/* ═══ VLESS Tools — CP2077 / CyberDeck HUD ═══ */
:root {
  --bg: #050505;
  --bg-2: #0a0a0a;
  --bg-panel: #0c0c0c;
  --bg-inset: #070707;
  --fg: #f5f5f5;
  --fg-dim: #6e6e6e;
  --fg-muted: #3a3a3a;
  --yellow: #fcee09;
  --yellow-dim: rgba(252, 238, 9, 0.12);
  --yellow-glow: rgba(252, 238, 9, 0.45);
  --cyan: #00f0ff;
  --cyan-dim: rgba(0, 240, 255, 0.1);
  --cyan-glow: rgba(0, 240, 255, 0.35);
  --magenta: #ff006e;
  --magenta-dim: rgba(255, 0, 110, 0.12);
  --red: #ff2d2d;
  --orange: #ff8c00;
  --purple: #b026ff;
  --success: #00f0ff;
  --error: #ff2d2d;
  --border-y: rgba(252, 238, 9, 0.45);
  --border-y-soft: rgba(252, 238, 9, 0.18);
  --border-c: rgba(0, 240, 255, 0.35);
  --font-sans: "Rubik", system-ui, sans-serif;
  --font-sans-fa: "Estedad", "Rubik", system-ui, sans-serif;
  --font-display: "Orbitron", "Rubik", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --hazard: repeating-linear-gradient(-45deg, var(--yellow) 0 6px, #000 6px 12px);
}

html[lang="fa"] {
  --font-sans: var(--font-sans-fa);
}

html[lang="fa"] .brand h1,
html[lang="fa"] .card-title {
  font-family: var(--font-sans-fa);
  letter-spacing: 0.02em;
  text-transform: none;
}

*, *::before, *::after { box-sizing: border-box; outline: none; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  overflow-x: hidden;
}

/* ── System chrome ── */
.sys-top {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: stretch;
  border-bottom: 2px solid var(--yellow);
  background: #000;
}

.sys-top-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 4px 16px;
  overflow: hidden;
  min-height: 28px;
}

.sys-binary {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--yellow);
  opacity: 0.55;
  white-space: nowrap;
  animation: binaryScroll 40s linear infinite;
}

@keyframes binaryScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.sys-top-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--fg-dim);
  white-space: nowrap;
}

.sys-top-tag strong { color: var(--yellow); }

.sys-hazard {
  width: 120px;
  background: var(--hazard);
  border-left: 2px solid var(--yellow);
  flex-shrink: 0;
}

.sys-footer {
  border-top: 2px solid var(--yellow);
  background: #000;
  padding: 8px 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 20px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--fg-dim);
}

.sys-footer strong { color: var(--yellow); }

.sys-footer-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sys-footer-status::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan-glow);
  animation: blink 2s ease infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ── App shell + rail ── */
.app-shell {
  display: flex;
  min-height: calc(100vh - 28px - 36px);
  position: relative;
}

.sys-rail {
  width: 28px;
  flex-shrink: 0;
  background: #000;
  border-left: 1px solid var(--border-y-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.25em;
  color: var(--fg-muted);
  padding: 20px 0;
  user-select: none;
}

.sys-rail span { color: var(--yellow); opacity: 0.5; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(rgba(252, 238, 9, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(252, 238, 9, 0.015) 1px, transparent 1px);
  background-size: 40px 40px;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.035;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.5) 2px, rgba(0,0,0,0.5) 4px);
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--yellow);
  border: 1px solid #000;
}

.container {
  position: relative;
  z-index: 1;
  flex: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 32px;
  width: 100%;
}

/* ── Header ── */
header {
  margin-bottom: 24px;
  position: relative;
}

header::after {
  content: "";
  display: block;
  height: 6px;
  margin-top: 20px;
  background: var(--hazard);
  opacity: 0.85;
}

.brand {
  position: relative;
  padding: 16px 20px;
  border: 1px solid var(--border-y);
  background: var(--bg-panel);
}

.brand::before,
.brand::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  pointer-events: none;
}

.brand::before {
  top: -1px;
  right: -1px;
  border-top: 3px solid var(--yellow);
  border-right: 3px solid var(--yellow);
}

.brand::after {
  bottom: -1px;
  left: -1px;
  border-bottom: 3px solid var(--yellow);
  border-left: 3px solid var(--yellow);
}

.brand-kicker {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--yellow);
  margin-bottom: 0;
  opacity: 0.8;
}

.brand-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.lang-switch {
  display: flex;
  border: 1px solid var(--border-y-soft);
  background: var(--bg-inset);
}

.lang-btn {
  background: transparent;
  border: none;
  border-inline-start: 1px solid var(--border-y-soft);
  color: var(--fg-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.18s;
}

.lang-btn:first-child { border-inline-start: none; }

.lang-btn:hover { color: var(--yellow); background: var(--yellow-dim); }

.lang-btn.active {
  color: #000;
  background: var(--yellow);
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: wrap;
}

.theme-switch {
  display: flex;
  border: 1px solid var(--border-y-soft);
  background: var(--bg-inset);
}

.theme-btn {
  background: transparent;
  border: none;
  border-inline-start: 1px solid var(--border-y-soft);
  color: var(--fg-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s;
}

.theme-switch .theme-btn:first-child { border-inline-start: none; }

.theme-btn:hover { color: var(--yellow); background: var(--yellow-dim); }

.theme-btn.active {
  color: #000;
  background: var(--yellow);
  pointer-events: none;
}

.brand h1 {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3.5vw, 2.1rem);
  font-weight: 800;
  margin: 0;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg);
  line-height: 1.15;
}

.brand h1 em {
  font-style: normal;
  color: var(--yellow);
  text-shadow: 0 0 30px var(--yellow-glow);
}

.brand p {
  margin: 8px 0 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
}

.brand p code {
  color: var(--cyan);
  background: var(--cyan-dim);
  padding: 1px 6px;
  border: 1px solid var(--border-c);
}

/* ── Tabs ── */
.tabs-nav {
  display: flex;
  gap: 0;
  margin-top: 16px;
  border: 1px solid var(--border-y);
  background: var(--bg-inset);
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: transparent;
  border: none;
  border-left: 1px solid var(--border-y-soft);
  color: var(--fg-dim);
  padding: 14px 12px;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, box-shadow 0.2s;
  position: relative;
}

.tab-btn:first-child { border-left: none; }

.tab-id {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 3px 6px;
  border: 1px solid var(--fg-muted);
  color: var(--fg-muted);
  transition: all 0.2s;
}

.tab-label { letter-spacing: 0.02em; }

.tab-btn:hover {
  color: var(--yellow);
  background: var(--yellow-dim);
}

.tab-btn:hover .tab-id {
  border-color: var(--yellow);
  color: var(--yellow);
}

.tab-btn.active {
  color: #000;
  background: var(--yellow);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.2);
}

.tab-btn.active .tab-id {
  background: #000;
  border-color: #000;
  color: var(--yellow);
}

.tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 20%;
  right: 20%;
  height: 3px;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
}

.tab-content { display: none; animation: panelIn 0.3s ease; }
.tab-content.active { display: block; }

@keyframes panelIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Grid ── */
.grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .grid { grid-template-columns: 1.15fr 0.85fr; } }
.grid.generator-grid { align-items: stretch; }
.grid.generator-grid > .card { min-height: 420px; }

/* ── Cards / HUD panels ── */
.card {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--border-y-soft);
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 24px rgba(0,0,0,0.6);
  min-width: 0;
  overflow: hidden;
}

/* هدر تمام‌عرض داخل کارت — بدون overflow */
.card > .card-head {
  margin-inline: -16px;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--yellow);
  box-shadow: 0 0 12px var(--yellow-glow);
  pointer-events: none;
}

.card::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  bottom: 8px;
  inset-inline-start: 8px;
  border-bottom: 2px solid var(--yellow);
  border-inline-start: 2px solid var(--yellow);
  opacity: 0.6;
  pointer-events: none;
}

.panel-serial {
  position: absolute;
  top: 10px;
  inset-inline-start: 12px;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "zero" 0;
  color: var(--fg-muted);
  z-index: 2;
  pointer-events: none;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px 12px;
  margin: 0 !important;
  border-bottom: 1px solid var(--border-y-soft);
  background: linear-gradient(180deg, rgba(252,238,9,0.04) 0%, transparent 100%);
  position: relative;
}

.card-head::before {
  content: "";
  position: absolute;
  top: 8px;
  inset-inline-end: 52px;
  width: 10px;
  height: 10px;
  border-top: 2px solid var(--fg-muted);
  border-inline-end: 2px solid var(--fg-muted);
  opacity: 0.35;
  pointer-events: none;
}

.card > .card-head + *:not(.panel-serial) {
  margin-top: 14px;
}

.card-stack { margin-top: 20px; }

/* ── Textarea sizing ── */
textarea {
  display: block;
  max-width: 100%;
  box-sizing: border-box;
}

.area-xs { height: 90px; min-height: 90px; resize: vertical; margin-bottom: 12px; }
.area-sm { height: 140px; min-height: 140px; resize: vertical; }
.area-md { height: 180px; min-height: 180px; resize: vertical; }
.area-lg { height: 250px; min-height: 250px; resize: vertical; }
.area-xl { height: 280px; min-height: 280px; resize: vertical; }
.area-fill { flex: 1; min-height: 220px; height: 220px; resize: none; }

.card textarea,
.card select,
.card input:not([type="checkbox"]):not([type="range"]):not(.input-mini):not(.cdn-output-num) {
  width: 100%;
  max-width: 100%;
}


.card-title {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg);
}

.card-title::before {
  content: "▸";
  color: var(--yellow);
  font-size: 10px;
}

.tag {
  font-size: 8px;
  padding: 4px 10px;
  background: transparent;
  color: var(--yellow);
  border: 1px solid var(--border-y);
  font-family: var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tag::before { content: "["; margin-left: 2px; }
.tag::after { content: "]"; margin-right: 2px; }

.card-config .config-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-top: 12px;
}

.config-hint {
  font-size: 11px;
  color: var(--fg-dim);
  margin-bottom: 10px;
  line-height: 1.6;
  font-family: var(--font-mono);
}

.config-hint code {
  color: var(--cyan);
  background: var(--cyan-dim);
  padding: 1px 5px;
  border: 1px solid var(--border-c);
}

/* ── Inputs ── */
label { display: block; color: var(--fg-dim); font-size: 12px; margin-bottom: 8px; font-family: var(--font-mono); letter-spacing: 0.04em; }

textarea, input:not([type="checkbox"]):not([type="range"]), select {
  width: 100%;
  background: var(--bg-inset);
  border: 1px solid var(--border-y-soft);
  color: var(--fg);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

textarea {
  resize: vertical;
  line-height: 1.55;
  word-break: break-all;
}

textarea:focus, input:focus, select:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 1px var(--yellow-dim), inset 0 0 20px rgba(252,238,9,0.03);
}

/* مخفی کردن فلش بالا/پایین input number */
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#config {
  border-color: var(--border-c);
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.02);
}

#config:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan-dim), 0 0 20px rgba(0,240,255,0.08);
}

#out {
  border-color: var(--border-c);
  background: rgba(0, 240, 255, 0.03);
  color: var(--cyan);
}

#extOut {
  border-color: rgba(255, 0, 110, 0.35);
  background: var(--magenta-dim);
  color: #ffb3d9;
}

#extDiff {
  border-color: var(--border-y-soft);
  background: var(--yellow-dim);
  color: var(--yellow);
}

#morphOutput, #spoofOutput {
  border-color: rgba(176, 38, 255, 0.35);
  background: rgba(176, 38, 255, 0.04);
}

#ips, #ipRanges {
  flex: 1;
}

#ip-panel-list {
  gap: 12px;
}

#ip-panel-list .gen-host-filters {
  margin-top: 0;
  margin-bottom: 0;
}

#ip-panel-list .dropzone {
  margin-top: 0;
}

.card input.input-mini {
  width: 50px;
  flex-shrink: 0;
}

/* ── IP subtabs ── */
.ip-subtabs {
  display: flex;
  gap: 0;
  margin-top: 12px;
  border: 1px solid var(--border-y-soft);
  background: var(--bg-inset);
}

.ip-subtab {
  flex: 1;
  background: transparent;
  border: none;
  border-left: 1px solid var(--border-y-soft);
  color: var(--fg-dim);
  padding: 10px;
  font-weight: 600;
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.2s;
}

.ip-subtab:first-child { border-left: none; }

.ip-subtab:hover { color: var(--yellow); background: var(--yellow-dim); }

.ip-subtab.active {
  color: #000;
  background: var(--yellow);
}

.ip-panel { display: none; flex: 1; flex-direction: column; min-height: 0; margin-top: 12px; }
.ip-panel.active { display: flex; }

/* ── CDN toolbar ── */
.cdn-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.btn-cdn {
  flex: 1;
  min-width: 90px;
  height: 34px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid var(--border-y-soft);
  background: var(--bg-inset);
  color: var(--fg-dim);
  font-family: var(--font-display);
  transition: all 0.2s;
}

.btn-cdn:hover { color: var(--fg); border-color: var(--yellow); }
.btn-cdn.cf:hover { border-color: #f38020; color: #f38020; }
.btn-cdn.fastly:hover { border-color: #ff0200; color: #ff0200; }
.btn-cdn.gcore:hover { border-color: #ff5722; color: #ff5722; }

.btn-shuffle {
  border-color: var(--yellow) !important;
  color: var(--yellow) !important;
  background: var(--yellow-dim) !important;
}

.btn-shuffle:hover {
  background: var(--yellow) !important;
  color: #000 !important;
}

.range-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.range-actions .btn-shuffle { width: 100%; }

.cdn-output-row { margin-bottom: 10px; }

.cdn-output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.cdn-output-head label {
  margin: 0;
  font-size: 10px;
  color: var(--fg-dim);
  text-transform: uppercase;
}

.cdn-output-num {
  width: 90px;
  padding: 8px;
  font-size: 13px;
  text-align: center;
  border-color: var(--border-y);
  color: var(--yellow);
}

.cdn-output-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-inset);
  border: 1px solid var(--border-y-soft);
  padding: 0;
  cursor: pointer;
}

.cdn-output-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--yellow);
  border: 2px solid #000;
  cursor: pointer;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

.cdn-output-row input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--yellow);
  border: 2px solid #000;
  cursor: pointer;
}

.range-hint {
  font-size: 10px;
  color: var(--fg-dim);
  margin-bottom: 8px;
  line-height: 1.55;
  font-family: var(--font-mono);
}

/* ── Metrics (diamond HUD style) ── */
.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.metric {
  background: var(--bg-inset);
  border: 1px solid var(--border-y-soft);
  padding: 14px 8px 10px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--cyan) 0 3px, transparent 3px 5px);
  opacity: 0.5;
}

.metric::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 8px;
  right: 8px;
  height: 3px;
  background: var(--hazard);
  opacity: 0.35;
}

.metric-val {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--yellow);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "zero" 0;
  text-shadow: 0 0 12px var(--yellow-glow);
  line-height: 1.2;
}

.metric-lbl {
  font-size: 0.6rem;
  color: var(--fg-dim);
  margin-top: 6px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metrics-ext-input {
  grid-template-columns: repeat(2, 1fr);
}

.metrics-ext-input.show-ws-filter {
  grid-template-columns: repeat(3, 1fr);
}

#extFilterMetricWrap[hidden] {
  display: none !important;
}

/* ── Toolbar ── */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 14px;
  background: var(--bg-inset);
  padding: 10px;
  border: 1px solid var(--border-y-soft);
}

.control-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  background: var(--bg);
  border: 1px solid var(--border-y-soft);
  font-family: var(--font-mono);
}

.control-group label {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-dim);
  white-space: nowrap;
}

.input-mini {
  width: 50px;
  height: 26px;
  padding: 0 13px 0 11px;
  text-align: center;
  background: var(--bg-inset);
  border: 1px solid var(--border-y-soft);
  color: var(--yellow);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "zero" 0;
}

.input-mini:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 1px var(--yellow-dim);
}

.vertical-separator {
  width: 1px;
  height: 22px;
  background: var(--border-y-soft);
  margin: 0 4px;
}

.spacer-div { flex-grow: 1; }

/* ── Buttons ── */
.btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  height: 36px;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: all 0.18s;
  border: 1px solid transparent;
  font-family: var(--font-mono);
  gap: 6px;
  white-space: nowrap;
}

.btn-block { width: 100%; }
.btn-flex { flex: 1; }
.btn-morph { margin-bottom: 15px; }

.toolbar-block {
  margin-top: 10px;
  margin-bottom: 14px;
}

.ico {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.9;
}

.btn-secondary {
  background: var(--bg);
  color: var(--fg-dim);
  border-color: var(--border-y-soft);
}

.btn-secondary:hover {
  color: var(--yellow);
  border-color: var(--yellow);
  background: var(--yellow-dim);
}

.btn-blue {
  background: var(--yellow);
  color: #000;
  border-color: var(--yellow);
  box-shadow: 0 0 20px var(--yellow-glow);
}

.btn-blue:hover {
  background: #fff;
  border-color: #fff;
  box-shadow: 0 0 28px rgba(255,255,255,0.3);
}

.btn-purple {
  background: transparent;
  color: var(--magenta);
  border-color: var(--magenta);
}

.btn-purple:hover {
  background: var(--magenta);
  color: #fff;
  box-shadow: 0 0 20px rgba(255,0,110,0.4);
}

.btn-gold {
  background: transparent;
  color: var(--yellow);
  border-color: var(--border-y);
}

.btn-gold:hover {
  background: var(--yellow);
  color: #000;
}

.btn-danger {
  color: var(--red);
  background: transparent;
  border-color: rgba(255,45,45,0.4);
}

.btn-danger:hover {
  background: var(--red);
  color: #fff;
}

.btn-nav {
  min-width: 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 14px;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: var(--fg-muted);
  display: inline-block;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

.status-dot.ok {
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
  animation: pulseDot 2s ease infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.action-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }

/* ── Toast notification (bottom cyber bar) ── */
.toast-host {
  position: fixed;
  inset-inline: 0;
  bottom: 42px;
  z-index: 10001;
  display: flex;
  justify-content: center;
  padding: 0 16px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(540px, 100%);
  min-height: 48px;
  padding: 12px 16px 12px 14px;
  background: rgba(7, 7, 7, 0.96);
  border: 1px solid var(--border-y-soft);
  border-inline-start: 3px solid var(--yellow);
  box-shadow:
    0 -8px 40px rgba(0, 0, 0, 0.65),
    0 0 24px rgba(252, 238, 9, 0.08);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--fg);
  opacity: 0;
  transform: translateY(calc(100% + 24px));
  transition:
    transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.32s ease;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.toast-accent {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--hazard);
  opacity: 0.75;
  pointer-events: none;
}

.toast::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--yellow), transparent);
  opacity: 0.55;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-icon {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #000;
  background: var(--yellow);
  border: 1px solid var(--yellow);
  box-shadow: 0 0 12px var(--yellow-glow);
}

.toast-text {
  flex: 1;
  line-height: 1.45;
  min-width: 0;
  word-break: break-word;
}

.toast-tag {
  flex-shrink: 0;
  font-size: 8px;
  letter-spacing: 0.22em;
  color: var(--fg-muted);
  opacity: 0.7;
  padding-inline-start: 8px;
  border-inline-start: 1px solid var(--border-y-soft);
}

.toast--success {
  border-inline-start-color: var(--cyan);
  color: #d4fffb;
}

.toast--success .toast-icon {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #000;
  box-shadow: 0 0 14px var(--cyan-glow);
}

.toast--success::before {
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
}

.toast--warn {
  border-inline-start-color: var(--yellow);
  color: #fff9c4;
}

.toast--warn .toast-icon {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #000;
}

.toast--error {
  border-inline-start-color: var(--red);
  color: #ffd4d4;
}

.toast--error .toast-icon {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  box-shadow: 0 0 14px rgba(255, 45, 45, 0.45);
}

.toast--error::before {
  background: linear-gradient(90deg, transparent, var(--red), transparent);
}

.toast--error .toast-accent {
  background: repeating-linear-gradient(-45deg, var(--red) 0 6px, #000 6px 12px);
}

.toast--info {
  border-inline-start-color: var(--cyan);
}

.toast--info .toast-icon {
  background: transparent;
  color: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 10px var(--cyan-glow);
  animation: toastPulse 1.2s ease infinite;
}

@keyframes toastPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@media (max-width: 768px) {
  .toast-host { bottom: 56px; padding: 0 10px; }
  .toast { min-height: 44px; padding: 10px 12px; font-size: 11px; }
  .toast-tag { display: none; }
}

.part-info {
  font-size: 11px;
  color: var(--fg-dim);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}

/* ── Dropzone ── */
.dropzone {
  margin-top: 12px;
  border: 1px dashed var(--border-y-soft);
  padding: 14px;
  background: var(--bg-inset);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: 0.2s;
  user-select: none;
}

.dropzone strong { font-size: 12px; color: var(--fg); font-family: var(--font-mono); }
.dropzone small { color: var(--fg-dim); display: block; margin-top: 4px; font-size: 10px; line-height: 1.45; font-family: var(--font-mono); }
.dropzone.dragover { border-color: var(--yellow); background: var(--yellow-dim); }

.drop-actions {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.drop-actions .btn,
.drop-actions .toggle {
  height: 36px;
  flex-shrink: 0;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-dim);
  background: var(--bg);
  border: 1px solid var(--border-y-soft);
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font-mono);
  transition: border-color 0.18s, color 0.18s, background 0.18s;
}

.toggle:hover {
  border-color: var(--yellow);
  color: var(--yellow);
  background: var(--yellow-dim);
}

.toggle input {
  accent-color: var(--yellow);
  width: 14px;
  height: 14px;
  margin: 0;
  flex-shrink: 0;
}
#ipFile { display: none; }

/* ── Switches ── */
.extract-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0;
  margin-bottom: 14px;
  justify-content: center;
  clear: both;
}

.extract-filter {
  margin-bottom: 14px;
  display: block;
  clear: both;
}

.extract-filter + .extract-switches {
  margin-top: 0;
}

.switch-item {
  flex: 1;
  min-width: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-inset);
  border: 1px solid var(--border-y-soft);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.2s, background 0.2s;
}

.switch-item:hover { border-color: var(--border-y); }

.switch-item:has(input:checked) {
  border-color: var(--yellow);
  background: var(--yellow-dim);
}

.switch-item .switch-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--fg-dim);
  transition: color 0.2s;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.switch-item:has(input:checked) .switch-label { color: var(--yellow); }

.extract-filter .switch-item {
  flex-direction: row;
  justify-content: space-between;
  width: 100%;
}

.extract-filter .switch-item:has(input:checked) {
  border-color: var(--magenta);
  background: var(--magenta-dim);
}

.extract-filter .switch-item:has(input:checked) .switch-label { color: var(--magenta); }

.extract-filter .switch input:checked + .switch-slider {
  background: var(--magenta);
}

.ext-cidr-switch { margin-top: 12px; margin-bottom: 0; }

.ext-cidr-switch .switch-item:has(input:checked) {
  border-color: var(--yellow);
  background: var(--yellow-dim);
}

.ext-cidr-switch .switch-item:has(input:checked) .switch-label { color: var(--yellow); }

.ext-cidr-switch .switch input:checked + .switch-slider { background: var(--yellow); }

.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 22px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background: var(--bg);
  transition: background 0.25s;
  cursor: pointer;
  border: 1px solid var(--border-y-soft);
}

.switch-slider::before {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--fg-dim);
  transition: transform 0.25s, background 0.25s;
}

.switch input:checked + .switch-slider {
  background: rgba(252, 238, 9, 0.15);
  border-color: var(--yellow);
}

.switch input:checked + .switch-slider::before {
  transform: translate(18px, -50%);
  background: var(--yellow);
}

.info-box {
  background: var(--cyan-dim);
  border: 1px solid var(--border-c);
  border-right: 3px solid var(--cyan);
  padding: 12px 14px;
  font-size: 11px;
  color: var(--fg-dim);
  margin-bottom: 14px;
  line-height: 1.65;
  font-family: var(--font-mono);
}

.info-box strong { color: var(--cyan); }

#btnExtract {
  white-space: normal;
  line-height: 1.4;
  min-height: 38px;
  height: auto;
  padding: 10px 12px;
}

#morphAddrFields { margin-bottom: 14px; }

.spoof-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.dropzone-text { min-width: 0; flex: 1; }

.spoof-field label { font-size: 11px; font-weight: 600; }
.spoof-field input { font-family: var(--font-mono); }

.sni-host-switch { margin-bottom: 14px; }

.sni-host-switch .switch-item {
  flex-direction: row;
  justify-content: space-between;
  width: 100%;
  padding: 12px 14px;
}

.sni-host-switch .switch-label code {
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 10px;
}

.morph-spoof-bar { margin-bottom: 14px; }

.morph-spoof-bar .switch-item {
  flex-direction: row;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
}

.morph-spoof-bar .switch-item:has(input:checked) {
  border-color: var(--purple);
  background: rgba(176, 38, 255, 0.08);
}

.morph-spoof-bar .switch-item:has(input:checked) .switch-label { color: var(--purple); }

.morph-spoof-bar .switch-label small {
  display: block;
  font-size: 9px;
  font-weight: 400;
  color: var(--fg-dim);
  margin-top: 3px;
  text-transform: none;
}

.morph-spoof-bar .switch input:checked + .switch-slider { background: var(--purple); }

.morph-switch-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.morph-panel { display: none; }
.morph-panel.active { display: block; }

/* ── Output divider (hazard + HUD rail) ── */
.hud-divider {
  margin-top: 24px;
  position: relative;
}

.hud-divider::before {
  content: "";
  display: block;
  height: 6px;
  margin-bottom: 14px;
  background: var(--hazard);
}

.hud-rail {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.hud-rail-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-y) 20%, var(--border-y) 80%, transparent);
  position: relative;
}

.hud-rail-line:first-child::after {
  content: "";
  position: absolute;
  top: 50%;
  inset-inline-end: 0;
  width: 5px;
  height: 5px;
  background: var(--yellow);
  transform: translateY(-50%) rotate(45deg);
  box-shadow: 0 0 6px var(--yellow-glow);
}

.hud-rail-line:last-child::before {
  content: "";
  position: absolute;
  top: 50%;
  inset-inline-start: 0;
  width: 5px;
  height: 5px;
  background: var(--yellow);
  transform: translateY(-50%) rotate(45deg);
  box-shadow: 0 0 6px var(--yellow-glow);
}

.hud-rail-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border: 1px solid var(--border-y);
  background: var(--bg-inset);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--yellow);
  white-space: nowrap;
  box-shadow: inset 0 0 20px rgba(252, 238, 9, 0.04);
}

.hud-rail-chevron {
  color: var(--fg-muted);
  font-size: 9px;
  letter-spacing: -3px;
  opacity: 0.65;
}

.hud-rail-tag::before { content: "["; margin-inline-end: 2px; opacity: 0.6; }
.hud-rail-tag::after { content: "]"; margin-inline-start: 2px; opacity: 0.6; }

.hud-divider .card::before { background: var(--cyan); box-shadow: 0 0 12px var(--cyan-glow); }
.part-nav {
  display: flex;
  gap: 6px;
  align-items: stretch;
  margin-bottom: 10px;
}

.part-nav select {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  background: var(--bg-inset);
  border: 1px solid var(--border-y-soft);
  color: var(--fg);
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--yellow) 50%), linear-gradient(135deg, var(--yellow) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-inline-end: 28px;
}

.part-nav select:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 1px var(--yellow-dim);
}

.part-nav select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.part-nav .btn-nav {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  font-size: 14px;
  flex-shrink: 0;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .sys-rail { display: none; }
  .sys-hazard { width: 60px; }
  .tabs-nav { flex-direction: column; }
  .tab-btn { border-left: none; border-top: 1px solid var(--border-y-soft); }
  .tab-btn:first-child { border-top: none; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .control-group { width: 100%; justify-content: space-between; height: 42px; }
  .vertical-separator, .spacer-div { display: none; }
  .toolbar .btn { width: 100%; height: 42px; }
  .extract-switches { flex-direction: column; }
  .switch-item { flex-direction: row !important; justify-content: space-between; width: 100%; }
  .dropzone { flex-direction: column; align-items: stretch; }
  .drop-actions { justify-content: space-between; }
  .drop-actions .btn { width: 100%; }
  .morph-switch-grid { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr; }
}

.gen-host-filters {
  margin-top: 12px;
  margin-bottom: 0;
}
