/* MobileScan component styles (plain CSS, used alongside Tailwind utilities). */
:root {
  --ink-950: #070b12; --ink-900: #0b111c; --ink-850: #0f1724; --ink-800: #131d2d;
  --ink-700: #1c2a3f; --ink-600: #2a3b55;
  --scan-300: #7ef0c9; --scan-400: #3ee0a8; --scan-500: #14c58a; --scan-600: #0c9e6e;
}

.grid-bg {
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(20, 197, 138, .12), transparent 70%),
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
  background-size: 100% 100%, 32px 32px, 32px 32px;
}

/* Cards & stats */
.card {
  position: relative;
  border: 1px solid var(--ink-700);
  background: linear-gradient(180deg, rgba(19, 29, 45, .85), rgba(11, 17, 28, .85));
  border-radius: 1rem;
  padding: 1.25rem;
}
.card-title { font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #cbd5e1; }
.stat { border: 1px solid var(--ink-700); background: rgba(15, 23, 36, .8); border-radius: .9rem; padding: .9rem 1rem; }
.stat-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: #64748b; }
.stat-value { margin-top: .25rem; font-size: 1.5rem; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }

.step {
  position: absolute; right: 1.1rem; top: .9rem;
  font: 600 2rem/1 'JetBrains Mono', monospace; color: rgba(62, 224, 168, .18);
}
.dot { margin-top: .45rem; height: .4rem; width: .4rem; flex-shrink: 0; border-radius: 999px; }
.badge {
  font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--scan-300); background: rgba(20, 197, 138, .12); border: 1px solid rgba(20, 197, 138, .35);
  padding: .15rem .5rem; border-radius: 999px;
}

/* Forms */
.input {
  width: 100%; border-radius: .7rem; border: 1px solid var(--ink-600); background: var(--ink-950);
  padding: .6rem .8rem; color: #e2e8f0; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--scan-500); box-shadow: 0 0 0 3px rgba(20, 197, 138, .2); }
.consent { display: flex; gap: .75rem; align-items: flex-start; color: #cbd5e1; cursor: pointer; }
.consent input { margin-top: .2rem; width: 1.1rem; height: 1.1rem; accent-color: var(--scan-500); flex-shrink: 0; }

.mode-option { display: block; cursor: pointer; }
.mode-box {
  border: 1px solid var(--ink-600); border-radius: .9rem; padding: .9rem 1rem;
  transition: border-color .15s, background .15s;
}
.mode-option input:checked + .mode-box { border-color: var(--scan-500); background: rgba(20, 197, 138, .07); }
.mode-option input:focus-visible + .mode-box { box-shadow: 0 0 0 3px rgba(20, 197, 138, .3); }

/* Buttons */
.btn-primary, .btn-ghost, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border-radius: .75rem; padding: .75rem 1.1rem; font-weight: 600; font-size: .9rem;
  transition: background .15s, border-color .15s, transform .05s; cursor: pointer;
}
.btn-primary { background: var(--scan-500); color: #04150e; }
.btn-primary:hover { background: var(--scan-400); }
.btn-ghost { border: 1px solid var(--ink-600); color: #cbd5e1; background: transparent; padding: .55rem .9rem; }
.btn-ghost:hover { border-color: var(--scan-500); color: #fff; }
.btn-danger { background: rgba(225, 29, 72, .15); border: 1px solid rgba(225, 29, 72, .5); color: #fecdd3; }
.btn-danger:hover { background: rgba(225, 29, 72, .28); }
button:active, a.btn-primary:active { transform: translateY(1px); }

/* Key/value lists */
.kv { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem .8rem; }
.kv dt { color: #64748b; flex-shrink: 0; }
.kv dd { color: #e2e8f0; text-align: right; word-break: break-all; }
[data-copy] { cursor: copy; border-bottom: 1px dashed rgba(62, 224, 168, .35); }

/* Live indicator */
.live-pill {
  display: inline-flex; align-items: center; gap: .45rem; font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em; color: var(--scan-300);
  border: 1px solid rgba(20, 197, 138, .35); border-radius: 999px; padding: .3rem .7rem;
}
.live-pill.off { color: #fda4af; border-color: rgba(244, 63, 94, .4); }
.live-dot { width: .45rem; height: .45rem; border-radius: 999px; background: currentColor; animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .25 } }

/* Radar logo */
.radar {
  background:
    conic-gradient(from 0deg, rgba(62, 224, 168, .55), transparent 25%),
    radial-gradient(circle, transparent 38%, rgba(62, 224, 168, .25) 39%, transparent 41%),
    var(--ink-900);
  animation: sweep 3.5s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg) } }

/* Traffic kind chips */
.kind {
  display: inline-block; min-width: 3.2rem; text-align: center; font: 600 .66rem/1 'JetBrains Mono', monospace;
  text-transform: uppercase; padding: .3rem .4rem; border-radius: .4rem; border: 1px solid;
}
.kind-tls   { color: #7ef0c9; border-color: rgba(62, 224, 168, .4);  background: rgba(62, 224, 168, .08); }
.kind-https { color: #93c5fd; border-color: rgba(96, 165, 250, .4);  background: rgba(96, 165, 250, .08); }
.kind-http  { color: #fcd34d; border-color: rgba(251, 191, 36, .45); background: rgba(251, 191, 36, .08); }
.kind-dns   { color: #c4b5fd; border-color: rgba(167, 139, 250, .4); background: rgba(167, 139, 250, .08); }
.kind-flow  { color: #cbd5e1; border-color: rgba(148, 163, 184, .35); background: rgba(148, 163, 184, .06); }
.kind-quic  { color: #f9a8d4; border-color: rgba(244, 114, 182, .4); background: rgba(244, 114, 182, .08); }

/* Feed rows */
#feed tr { cursor: pointer; transition: background .2s; }
#feed tr:hover { background: rgba(28, 42, 63, .5); }
#feed tr.fresh { animation: flash 1.2s ease-out; }
#feed tr.err td { color: #fda4af; }
@keyframes flash { from { background: rgba(20, 197, 138, .18) } to { background: transparent } }
.state-open { color: var(--scan-400); }

.bar { height: .3rem; border-radius: 999px; background: linear-gradient(90deg, var(--scan-600), var(--scan-300)); }

.flash { animation: fadeout 6s forwards; }
@keyframes fadeout { 0%, 80% { opacity: 1 } 100% { opacity: 0; visibility: hidden } }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--ink-700); border-radius: 10px; border: 2px solid var(--ink-950); }

/* ---------------------------------------------------------------- console nav */
.tabs { display: inline-flex; gap: .25rem; padding: .2rem; border: 1px solid var(--ink-700); border-radius: .7rem; background: rgba(11, 17, 28, .6); }
.tabs a { font-size: .78rem; font-weight: 500; color: #94a3b8; padding: .35rem .75rem; border-radius: .5rem; transition: background .15s, color .15s; }
.tabs a:hover { color: #e2e8f0; }
.tabs a.active { background: rgba(20, 197, 138, .14); color: var(--scan-300); }

/* ---------------------------------------------------------------- network map */
.glass { background: rgba(9, 14, 23, .72) !important; backdrop-filter: blur(8px); border: 1px solid rgba(42, 59, 85, .8); }
.seg { display: inline-flex; padding: .2rem; border-radius: .7rem; background: rgba(9, 14, 23, .72); border: 1px solid rgba(42, 59, 85, .8); backdrop-filter: blur(8px); }
.seg button { font-size: .75rem; font-weight: 600; color: #94a3b8; padding: .35rem .8rem; border-radius: .5rem; }
.seg button.active { background: var(--scan-500); color: #04150e; }
.chip {
  font-size: .72rem; font-weight: 500; color: #94a3b8; padding: .38rem .7rem; border-radius: .6rem;
  background: rgba(9, 14, 23, .72); border: 1px solid rgba(42, 59, 85, .8); backdrop-filter: blur(8px);
  transition: color .15s, border-color .15s;
}
.chip:hover { color: #e2e8f0; }
.chip.on { color: var(--scan-300); border-color: rgba(20, 197, 138, .45); }
.hud { display: grid; grid-template-columns: repeat(3, auto); border-radius: .8rem; overflow: hidden;
  border: 1px solid rgba(42, 59, 85, .8); background: rgba(42, 59, 85, .8); gap: 1px; backdrop-filter: blur(8px); }
.hud > div { background: rgba(9, 14, 23, .82); padding: .5rem .9rem; min-width: 6.2rem; }
.hud p { font-size: .6rem; text-transform: uppercase; letter-spacing: .12em; color: #64748b; }
.hud b { display: block; font: 600 1.15rem/1.3 'JetBrains Mono', monospace; color: #fff; font-variant-numeric: tabular-nums; }
.legend { font-size: .7rem; color: #cbd5e1; padding: .6rem .8rem; border-radius: .8rem;
  background: rgba(9, 14, 23, .72); border: 1px solid rgba(42, 59, 85, .8); backdrop-filter: blur(8px); }
.legend i { display: inline-block; width: .55rem; height: .55rem; border-radius: 99px; margin-right: .35rem;
  background: var(--c); box-shadow: 0 0 8px var(--c); vertical-align: -1px; }
.legend i.ring { background: transparent; border: 1.5px solid var(--c); box-shadow: none; }
.tip { position: absolute; z-index: 20; pointer-events: none; min-width: 13rem; max-width: 20rem;
  padding: .65rem .8rem; border-radius: .7rem; font-size: .72rem; color: #cbd5e1;
  background: rgba(7, 11, 18, .94); border: 1px solid rgba(62, 224, 168, .35); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.tip h4 { font: 600 .8rem 'JetBrains Mono', monospace; color: #fff; word-break: break-all; }
.tip .row { display: flex; justify-content: space-between; gap: 1rem; margin-top: .2rem; }
.tip .row span:first-child { color: #64748b; }
#fg { cursor: grab; }
#fg:active { cursor: grabbing; }
#fg.pointer { cursor: pointer; }

/* ---------------------------------------------------------------- phone scan screen */
.ring-anim { transition: stroke-dashoffset .35s linear, stroke .6s; filter: drop-shadow(0 0 6px rgba(62, 224, 168, .45)); }
.scan-pulse { box-shadow: 0 0 0 0 rgba(62, 224, 168, .25); }
[data-state="scanning"] .scan-pulse { animation: ringpulse 2.4s ease-out infinite; }
[data-state="waiting"] #ring-big { color: #475569; }
@keyframes ringpulse { 0% { box-shadow: 0 0 0 0 rgba(62, 224, 168, .28) } 100% { box-shadow: 0 0 0 34px rgba(62, 224, 168, 0) } }
.steps li { position: relative; display: flex; flex-direction: column; align-items: center; gap: .4rem; color: #64748b;
  text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.steps li span { width: .7rem; height: .7rem; border-radius: 99px; border: 2px solid #2a3b55; background: var(--ink-950); }
.steps li.active { color: var(--scan-300); }
.steps li.active span { border-color: var(--scan-400); box-shadow: 0 0 0 4px rgba(62, 224, 168, .15); animation: pulse 1.6s infinite; }
.steps li.done { color: #94a3b8; }
.steps li.done span { background: var(--scan-500); border-color: var(--scan-500); }
.grade { --g: #3ee0a8; display: grid; place-items: center; width: 4rem; height: 4rem; border-radius: 1rem; flex-shrink: 0;
  font: 800 2rem/1 Inter, sans-serif; color: var(--g); border: 2px solid var(--g);
  background: color-mix(in srgb, var(--g) 12%, transparent); }

/* connection check */
.cc-icon { position: relative; width: 2.6rem; height: 2.6rem; flex-shrink: 0; border-radius: 99px; display: grid; place-items: center;
  border: 2px solid #475569; }
.cc-icon span { width: .8rem; height: .8rem; border-radius: 99px; background: #64748b; animation: pulse 1.4s infinite; }
#conncheck[data-ok="1"] { border-color: rgba(20, 197, 138, .45); }
#conncheck[data-ok="1"] .cc-icon { border-color: var(--scan-400); box-shadow: 0 0 0 5px rgba(62, 224, 168, .12); }
#conncheck[data-ok="1"] .cc-icon span { background: var(--scan-400); animation: none; }
