/* DARKROUTE — ops-console theme. Monospace, neon on near-black, scanlines. */

:root {
  --bg: #0a0e14;
  --bg-2: #0d131c;
  --bg-3: #101826;
  --line: #1c2634;
  --line-2: #263449;
  --text: #c7d0dd;
  --text-dim: #5b6b80;
  --text-bright: #e8eef6;
  --teal: #4de3c2;
  --amber: #f0b429;
  --red: #ff5470;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --topbar-h: 54px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

::selection { background: rgba(77, 227, 194, .25); }

/* ---------------- atmosphere overlays ---------------- */

.fx-scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 90;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.018) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}
.fx-vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 89;
  background: radial-gradient(120% 90% at 50% 30%, transparent 55%, rgba(0,0,0,.45));
}

/* ---------------- topbar ---------------- */

#topbar {
  height: var(--topbar-h);
  flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 0 14px;
  background: linear-gradient(180deg, #0e1520, #0a0e14);
  border-bottom: 1px solid var(--line);
  z-index: 20;
}

#drawer-toggle {
  display: none;
  background: none; border: 1px solid var(--line-2); color: var(--text);
  border-radius: 6px; width: 36px; height: 34px; font-size: 16px; cursor: pointer;
}

.brand { display: flex; flex-direction: column; line-height: 1.1; }
.brand-mark { font-size: 17px; letter-spacing: 4px; color: var(--text-bright); }
.brand-mark b { color: var(--teal); text-shadow: 0 0 14px rgba(77,227,194,.5); }
.brand-sub { font-size: 9px; letter-spacing: 3px; color: var(--text-dim); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.chip {
  font-size: 10px; letter-spacing: 1.5px; padding: 4px 10px;
  border: 1px solid var(--line-2); border-radius: 99px; color: var(--text-dim);
  white-space: nowrap;
}
.chip.demo {
  color: var(--amber); border-color: rgba(240,180,41,.5);
  background: rgba(240,180,41,.08);
  animation: demoPulse 2.4s ease-in-out infinite;
}
@keyframes demoPulse { 50% { box-shadow: 0 0 12px rgba(240,180,41,.35); } }

.status-chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 10px; letter-spacing: 2px; padding: 5px 12px;
  border: 1px solid var(--line-2); border-radius: 99px; white-space: nowrap;
}
.status-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); }
.status-chip.idle { color: var(--text-dim); }
.status-chip.busy { color: var(--amber); border-color: rgba(240,180,41,.5); }
.status-chip.busy .dot { background: var(--amber); animation: blink 1s steps(2) infinite; }
.status-chip.open { color: var(--teal); border-color: rgba(77,227,194,.5); }
.status-chip.open .dot { background: var(--teal); box-shadow: 0 0 10px var(--teal); }
.status-chip.fail { color: var(--red); border-color: rgba(255,84,112,.5); }
.status-chip.fail .dot { background: var(--red); box-shadow: 0 0 10px var(--red); }
@keyframes blink { 50% { opacity: .25; } }

#btn-burn {
  font-family: var(--mono); font-size: 11px; letter-spacing: 2px; cursor: pointer;
  color: #ffb3c0; background: linear-gradient(180deg, #2a0f18, #1a0a10);
  border: 1px solid rgba(255,84,112,.55); border-radius: 8px; padding: 9px 14px;
  transition: box-shadow .2s, transform .1s;
}
#btn-burn:hover { box-shadow: 0 0 18px rgba(255,84,112,.4); }
#btn-burn:active { transform: scale(.97); }

/* ---------------- layout ---------------- */

#layout { flex: 1; display: flex; min-height: 0; }

#sidebar-scrim { display: none; }

#sidebar {
  width: 320px; flex: none;
  border-right: 1px solid var(--line);
  background: var(--bg-2);
  overflow-y: auto;
  display: flex; flex-direction: column;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}

#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ---------------- sidebar blocks ---------------- */

.side-block { border-bottom: 1px solid var(--line); }
.side-block.grow { flex: 1 0 220px; display: flex; flex-direction: column; }
.side-block.grow .side-c { flex: 1; min-height: 160px; display: flex; flex-direction: column; }

.side-h {
  margin: 0; padding: 10px 14px;
  font-size: 10px; letter-spacing: 2.5px; color: var(--text-dim);
  cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 8px;
}
.side-h:hover { color: var(--text); }
.side-h .chev { margin-left: auto; transition: transform .15s; }
.side-block.closed .side-h .chev { transform: rotate(-90deg); }
.side-block.closed .side-c { display: none; }
.tag-memory {
  font-size: 8px; letter-spacing: 1px; color: var(--amber);
  border: 1px solid rgba(240,180,41,.4); border-radius: 99px; padding: 1px 7px;
}

.side-c { padding: 4px 14px 14px; }

/* ---------------- form ---------------- */

.fld { display: block; margin-bottom: 10px; }
.fld > span { display: block; font-size: 9px; letter-spacing: 2px; color: var(--text-dim); margin-bottom: 4px; }
.fld input, .fld select {
  width: 100%; font-family: var(--mono); font-size: 12px;
  background: var(--bg); color: var(--text-bright);
  border: 1px solid var(--line-2); border-radius: 6px; padding: 8px 10px;
  outline: none;
  max-width: 100%; text-overflow: ellipsis;
}
.fld input:focus, .fld select:focus { border-color: var(--teal); box-shadow: 0 0 10px rgba(77,227,194,.18); }
.fld input.bad { border-color: var(--red); box-shadow: 0 0 10px rgba(255,84,112,.3); }
.fld input:disabled { opacity: .4; }
.fld-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fld.dim, #scenario-row.dim { opacity: .4; }

.hint { font-size: 10px; color: var(--text-dim); line-height: 1.5; margin: -2px 0 10px; }
.hint b { color: var(--amber); font-weight: 600; }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; margin: 12px 0; }
.switch input { display: none; }
.switch-track {
  width: 34px; height: 18px; border-radius: 99px; flex: none;
  background: var(--bg); border: 1px solid var(--line-2); position: relative;
  transition: background .15s, border-color .15s;
}
.switch-track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px; border-radius: 50%; background: var(--text-dim);
  transition: left .15s, background .15s;
}
.switch input:checked + .switch-track { background: rgba(240,180,41,.15); border-color: var(--amber); }
.switch input:checked + .switch-track::after { left: 18px; background: var(--amber); }
.switch-label { font-size: 10px; letter-spacing: 1.5px; color: var(--text); }
.switch-label em { display: block; font-style: normal; font-size: 9px; color: var(--text-dim); letter-spacing: .5px; }

.form-error {
  font-size: 11px; color: var(--red); line-height: 1.5;
  border: 1px solid rgba(255,84,112,.4); border-left-width: 3px;
  border-radius: 6px; padding: 8px 10px; margin-bottom: 10px;
  background: rgba(255,84,112,.06);
  overflow-wrap: anywhere;
}

button.primary {
  width: 100%; font-family: var(--mono); font-size: 12px; letter-spacing: 3px;
  padding: 11px; cursor: pointer; border-radius: 8px;
  color: #06281f; background: linear-gradient(180deg, #5cf0cf, #2fbf9f);
  border: none; font-weight: 700;
  transition: box-shadow .2s, transform .1s, filter .15s;
}
button.primary:hover { box-shadow: 0 0 22px rgba(77,227,194,.45); }
button.primary:active { transform: scale(.98); }
button.primary:disabled { filter: grayscale(.6) brightness(.7); cursor: wait; }

button.ghost {
  width: 100%; font-family: var(--mono); font-size: 10px; letter-spacing: 2px;
  padding: 9px; cursor: pointer; border-radius: 7px; margin-top: 10px;
  color: var(--teal); background: transparent; border: 1px solid rgba(77,227,194,.4);
  transition: background .15s;
}
button.ghost:hover:not(:disabled) { background: rgba(77,227,194,.08); }
button.ghost:disabled { opacity: .5; cursor: wait; }

/* ---------------- identity panel ---------------- */

.id-empty { font-size: 11px; color: var(--text-dim); padding: 8px 0; }
.id-exit { margin-bottom: 10px; }
.id-ip { font-size: 20px; color: var(--teal); letter-spacing: 1px; text-shadow: 0 0 16px rgba(77,227,194,.35); }
.id-geo { font-size: 11px; color: var(--text-bright); margin-top: 2px; }
.id-org, .id-sim { font-size: 10px; color: var(--text-dim); margin-top: 3px; }
.id-sim { color: var(--amber); border: 1px dashed rgba(240,180,41,.5); border-radius: 6px; padding: 4px 8px; display: inline-block; }
.id-row { display: flex; gap: 10px; font-size: 10px; padding: 5px 0; border-top: 1px solid var(--line); }
.id-k { flex: none; width: 64px; color: var(--text-dim); letter-spacing: 1px; }
.id-v { color: var(--text); line-height: 1.45; overflow-wrap: anywhere; }

.leak-result { font-size: 10px; line-height: 1.6; margin-top: 10px; white-space: pre-wrap; }
.leak-result.pending { color: var(--amber); }
.leak-result.ok .lk-row { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); padding: 4px 0; }
.leak-result .lk-row span { color: var(--text-dim); }
.leak-result .lk-row b { color: var(--text-bright); font-weight: 600; text-align: right; }
.leak-result .lk-sim { margin-top: 8px; color: var(--amber); border: 1px dashed rgba(240,180,41,.5); border-radius: 6px; padding: 4px 8px; }
.leak-result.fail { color: var(--red); }

/* ---------------- log stream ---------------- */

#log-stream {
  flex: 1; overflow-y: auto; font-size: 10px; line-height: 1.7;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; min-height: 150px; max-height: 320px;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.log-line { display: flex; gap: 8px; }
.log-t { color: #33415a; flex: none; }
.log-k { flex: none; width: 52px; color: var(--text-dim); }
.log-m { color: var(--text); overflow-wrap: anywhere; }
.log-socks .log-k, .log-socks .log-m { color: var(--teal); }
.log-http .log-k { color: #7aa2ff; }
.log-error .log-k, .log-error .log-m { color: var(--red); }
.log-state .log-m { color: var(--amber); }
.log-leak .log-k { color: #c792ea; }

/* ---------------- history / bookmarks ---------------- */

.side-empty { font-size: 10px; color: var(--text-dim); padding: 6px 0; }
.side-item {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: none; border: none; border-bottom: 1px solid var(--line);
  padding: 6px 2px; font-family: var(--mono);
}
.side-item:hover .side-item-title { color: var(--teal); }
.side-item-title { display: block; font-size: 11px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-item-sub { display: block; font-size: 9px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- tab strip ---------------- */

#tabstrip {
  flex: none; display: flex; align-items: stretch;
  background: var(--bg-2); border-bottom: 1px solid var(--line);
  min-height: 40px;
}
#tabs { display: flex; overflow-x: auto; flex: 1; scrollbar-width: none; }
#tabs::-webkit-scrollbar { display: none; }

.tab {
  --hue: 172;
  display: flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 11px; color: var(--text-dim);
  background: none; border: none; border-right: 1px solid var(--line);
  padding: 0 10px 0 12px; cursor: pointer; max-width: 220px; min-width: 0; flex: none;
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--text-bright); background: var(--bg);
  border-bottom-color: hsl(var(--hue), 85%, 60%);
}
.tab .fav { font-size: 13px; color: hsl(var(--hue), 85%, 65%); width: 16px; text-align: center; }
.tab.loading .fav { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tab-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab .incog {
  font-size: 7px; letter-spacing: 1px; flex: none;
  color: hsl(var(--hue), 70%, 62%);
  border: 1px solid hsla(var(--hue), 70%, 62%, .45);
  border-radius: 99px; padding: 1px 5px;
}
.tab .tab-x { flex: none; color: var(--text-dim); border-radius: 4px; padding: 0 4px; font-size: 13px; }
.tab .tab-x:hover { color: var(--red); background: rgba(255,84,112,.12); }

#btn-newtab {
  flex: none; width: 40px; background: none; border: none; cursor: pointer;
  color: var(--text-dim); font-size: 16px;
}
#btn-newtab:hover { color: var(--teal); }

/* ---------------- nav bar ---------------- */

#navbar {
  flex: none; display: flex; align-items: center; gap: 4px;
  padding: 7px 10px; background: var(--bg-2); border-bottom: 1px solid var(--line);
}
#navbar > button {
  width: 32px; height: 30px; flex: none;
  background: none; border: 1px solid transparent; border-radius: 6px;
  color: var(--text-dim); font-size: 14px; cursor: pointer; font-family: var(--mono);
}
#navbar > button:hover:not(:disabled) { color: var(--text-bright); border-color: var(--line-2); }
#navbar > button:disabled { opacity: .3; cursor: default; }
#btn-bkmk.on { color: var(--amber); text-shadow: 0 0 10px rgba(240,180,41,.6); }

#address-form {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 99px;
  padding: 0 14px; height: 32px; margin-left: 6px;
}
#address-form:focus-within { border-color: var(--teal); box-shadow: 0 0 14px rgba(77,227,194,.15); }
.addr-lock { color: var(--teal); font-size: 11px; }
#address {
  flex: 1; min-width: 0; background: none; border: none; outline: none;
  color: var(--text-bright); font-family: var(--mono); font-size: 12px;
}
#address::placeholder { color: #3b4a5e; }

/* ---------------- viz + viewport ---------------- */

#vizwrap { flex: none; height: 76px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
#viz { width: 100%; height: 76px; display: block; }

#viewport { flex: 1; min-height: 0; position: relative; background: var(--bg); }
#viewport .view {
  position: absolute; inset: 0; width: 100%; height: 100%; border: none;
  background: #0a0e14;
  transition: opacity .25s;
}

/* ---------------- boot overlay ---------------- */

#boot-overlay {
  position: fixed; inset: 0; z-index: 200; display: none;
  background: rgba(4, 7, 11, .88); backdrop-filter: blur(3px);
  align-items: center; justify-content: center; padding: 20px;
}
#boot-overlay.show { display: flex; }
.boot-frame {
  width: min(680px, 100%); max-height: 80vh; overflow: hidden;
  border: 1px solid var(--line-2); border-radius: 12px;
  background: #070b11; box-shadow: 0 0 60px rgba(77,227,194,.12);
}
.boot-head {
  padding: 10px 16px; font-size: 10px; letter-spacing: 2px; color: var(--text-dim);
  border-bottom: 1px solid var(--line); display: flex; justify-content: space-between;
}
.boot-skip { color: #33415a; }
#boot-term { padding: 16px; font-size: 12px; line-height: 1.9; overflow-y: auto; max-height: 60vh; }
.boot-line { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.boot-line.dim { color: var(--text-dim); }
.boot-line.ok { color: var(--teal); }
.boot-line.warn { color: var(--amber); }
.boot-line.bad { color: var(--red); }

/* ---------------- burn overlay ---------------- */

#burn-overlay {
  position: fixed; inset: 0; z-index: 210; display: none;
  background:
    repeating-linear-gradient(0deg, rgba(255,84,112,.03) 0 2px, transparent 2px 5px),
    rgba(6, 2, 4, .965);
  align-items: center; justify-content: center; padding: 20px;
}
#burn-overlay.show { display: flex; }
#burn-flash {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 45%, rgba(255,84,112,.55), rgba(255,84,112,.08) 55%, transparent 75%);
}
#burn-flash.go { animation: burnFlash .42s ease-out; }
@keyframes burnFlash { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } }
.burn-frame { width: min(520px, 100%); position: relative; text-align: left; }
#burn-term { min-height: 13em; }
.burn-head {
  font-size: 15px; letter-spacing: 5px; color: var(--red);
  text-shadow: 0 0 22px rgba(255,84,112,.6); margin-bottom: 18px; text-align: center;
}
#burn-term { font-size: 12px; line-height: 2.1; }
.burn-line { color: var(--text-dim); opacity: .4; transition: opacity .1s, color .1s; }
.burn-line.done { opacity: 1; color: #ffb3c0; }

/* ---------------- responsive ---------------- */

@media (max-width: 1080px) {
  #sidebar { width: 280px; }
}

@media (max-width: 860px) {
  #drawer-toggle { display: block; }
  .brand-sub { display: none; }
  .brand-mark { font-size: 15px; letter-spacing: 2px; }
  #sidebar {
    position: fixed; top: var(--topbar-h); bottom: 0; left: 0; z-index: 120;
    width: min(330px, 88vw);
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 0 0 50px rgba(0,0,0,.6);
  }
  body.sidebar-open #sidebar { transform: none; }
  #sidebar-scrim {
    display: block; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 110;
    background: rgba(4,7,11,.6); opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  body.sidebar-open #sidebar-scrim { opacity: 1; pointer-events: auto; }
  .topbar-right { gap: 6px; }
  #latency-chip { display: none; }
  .chip.demo { font-size: 8px; padding: 3px 7px; }
  .status-chip { padding: 4px 9px; font-size: 9px; }
  #btn-burn { font-size: 9px; padding: 8px 9px; letter-spacing: 1px; }
  .tab { max-width: 150px; padding: 0 8px; }
  .tab .incog { display: none; }
  #navbar > button { width: 28px; }
}

@media (max-width: 480px) {
  .brand { display: none; }
  #vizwrap, #viz { height: 60px; }
  .boot-frame { max-height: 88vh; }
}
