/* ============================================================================
   quevidkit — Video Forensics Lab
   Design: an instrument, not a dashboard. Graphite bench + calibrated cyan
   signal trace. Space Grotesk for readouts, Inter for prose, JetBrains Mono
   for data. Light + dark, mobile-first.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── Tokens: light (default / paper bench) ──────────────────────────────── */
:root {
  --bg:            #eef1f5;
  --bg-grid:       rgba(15, 34, 54, 0.045);
  --surface:       #ffffff;
  --surface-2:     #f4f6fa;
  --surface-3:     #eaeef4;
  --surface-inset: #f7f9fc;
  --border:        #d6dde7;
  --border-soft:   #e3e8ef;
  --border-strong: #c2ccd9;

  --ink:           #101a26;
  --ink-2:         #38475a;
  --muted:         #647689;
  --faint:         #8b9aab;

  --accent:        #0c7c8c;   /* calibrated signal teal */
  --accent-bright: #13a4b8;
  --accent-ink:    #e6fbff;
  --accent-wash:   rgba(19, 164, 184, 0.10);
  --accent-line:   rgba(12, 124, 140, 0.30);

  --safe:    #0f9d6b;
  --safe-wk: rgba(15, 157, 107, 0.12);
  --warn:    #c8871a;
  --warn-wk: rgba(200, 135, 26, 0.13);
  --danger:  #d63a4b;
  --danger-wk: rgba(214, 58, 75, 0.11);
  --neutral: #5f7185;

  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --display: 'Space Grotesk', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, sans-serif;

  --shadow-sm: 0 1px 2px rgba(16, 26, 38, 0.06), 0 2px 8px rgba(16, 26, 38, 0.05);
  --shadow-md: 0 4px 14px rgba(16, 26, 38, 0.08), 0 12px 32px rgba(16, 26, 38, 0.07);
  --shadow-lg: 0 10px 30px rgba(16, 26, 38, 0.12), 0 24px 60px rgba(16, 26, 38, 0.10);

  --radius:    18px;
  --radius-sm: 12px;
  --radius-xs: 9px;
  --tap: 48px;
}

/* ── Tokens: dark (graphite bench, phosphor trace) ──────────────────────── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #0a0f16;
    --bg-grid:       rgba(120, 200, 220, 0.05);
    --surface:       #121a24;
    --surface-2:     #0f1620;
    --surface-3:     #16202c;
    --surface-inset: #0b1119;
    --border:        #26323f;
    --border-soft:   #1d2732;
    --border-strong: #33414f;

    --ink:           #eaf1f7;
    --ink-2:         #b8c7d6;
    --muted:         #8496a8;
    --faint:         #5f7183;

    --accent:        #2bc4d8;
    --accent-bright: #45e0f2;
    --accent-ink:    #06222a;
    --accent-wash:   rgba(43, 196, 216, 0.11);
    --accent-line:   rgba(43, 196, 216, 0.34);

    --safe:    #34d69a;
    --safe-wk: rgba(52, 214, 154, 0.13);
    --warn:    #f5b445;
    --warn-wk: rgba(245, 180, 69, 0.14);
    --danger:  #ff5d6e;
    --danger-wk: rgba(255, 93, 110, 0.13);
    --neutral: #7d8ea1;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.42);
    --shadow-lg: 0 16px 44px rgba(0, 0, 0, 0.5);
  }
}
/* explicit dark override so a toggle (if added) wins both directions */
:root[data-theme="dark"] {
  --bg:            #0a0f16;
  --bg-grid:       rgba(120, 200, 220, 0.05);
  --surface:       #121a24;
  --surface-2:     #0f1620;
  --surface-3:     #16202c;
  --surface-inset: #0b1119;
  --border:        #26323f;
  --border-soft:   #1d2732;
  --border-strong: #33414f;
  --ink:           #eaf1f7;
  --ink-2:         #b8c7d6;
  --muted:         #8496a8;
  --faint:         #5f7183;
  --accent:        #2bc4d8;
  --accent-bright: #45e0f2;
  --accent-ink:    #06222a;
  --accent-wash:   rgba(43, 196, 216, 0.11);
  --accent-line:   rgba(43, 196, 216, 0.34);
  --safe:    #34d69a;
  --safe-wk: rgba(52, 214, 154, 0.13);
  --warn:    #f5b445;
  --warn-wk: rgba(245, 180, 69, 0.14);
  --danger:  #ff5d6e;
  --danger-wk: rgba(255, 93, 110, 0.13);
  --neutral: #7d8ea1;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 16px 44px rgba(0, 0, 0, 0.5);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* faint engineering grid — the bench surface */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(ellipse 120% 80% at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 120% 80% at 50% 0%, #000 20%, transparent 78%);
}

/* ── Layout ─────────────────────────────────────────────────────────────── */

.container {
  position: relative;
  z-index: 1;
  max-width: 820px;
  margin: 0 auto;
  padding: 18px 14px calc(28px + env(safe-area-inset-bottom, 0px));
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

/* ── Typography ─────────────────────────────────────────────────────────── */

h1, h2, h3, h4 {
  margin-top: 0;
  color: var(--ink);
  font-family: var(--display);
  letter-spacing: -0.015em;
  line-height: 1.15;
}
h1 { font-size: clamp(1.7rem, 7vw, 2.3rem); font-weight: 600; }
h2 { font-size: 1.28rem; margin-bottom: 14px; font-weight: 600; }
h3 { font-size: 1.02rem; margin: 22px 0 11px; font-weight: 600; }
h4 { font-size: 0.96rem; font-weight: 600; }

.section-eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 26px 0 12px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-strong), transparent);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-family: var(--mono);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.7rem;
  font-weight: 600;
}
.eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
  animation: livepulse 2.4s ease-in-out infinite;
}
.eyebrow.small { margin-bottom: 6px; font-size: 0.64rem; }

.lead { max-width: 62ch; font-size: 1rem; color: var(--ink-2); }
.muted { color: var(--muted); }

/* ── Hero ───────────────────────────────────────────────────────────────── */

.hero-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(140% 120% at 100% 0%, var(--accent-wash) 0%, transparent 46%),
    var(--surface);
  border-color: var(--border-soft);
  box-shadow: var(--shadow-md);
}
.hero-card h1 { margin-bottom: 12px; }
.hero-card h1 .accent { color: var(--accent); }

.hero-trace {
  position: absolute;
  right: -8%;
  top: 8px;
  width: 62%;
  max-width: 320px;
  height: 74px;
  opacity: 0.5;
  pointer-events: none;
  color: var(--accent);
}
.hero-trace path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-dasharray: 620;
  stroke-dashoffset: 620;
  animation: trace-draw 2.6s ease-out 0.2s forwards;
}

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.trust-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-2);
}
.trust-chip svg { width: 14px; height: 14px; color: var(--accent); flex-shrink: 0; }

/* ── Mode cards ─────────────────────────────────────────────────────────── */

.mode-cards { display: grid; gap: 10px; margin: 20px 0 0; }

.mode-card {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  transition: border-color 0.18s, transform 0.18s;
}
.mode-card:hover { border-color: var(--accent-line); transform: translateY(-1px); }

.mode-icon {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-wash);
  border: 1px solid var(--accent-line);
}
.mode-icon svg { width: 17px; height: 17px; }

.mode-card strong { display: block; margin-bottom: 3px; font-size: 0.92rem; font-family: var(--display); }
.mode-card span { color: var(--muted); font-size: 0.83rem; line-height: 1.5; }

/* ── Form ───────────────────────────────────────────────────────────────── */

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; margin-bottom: 7px; font-weight: 600; font-size: 0.9rem; color: var(--ink); }

input[type="file"],
input[type="number"],
input[type="url"],
input[type="text"],
select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  background: var(--surface-inset);
  color: var(--ink);
  font-size: 16px; /* iOS zoom guard */
  font-family: var(--body);
  transition: border-color 0.16s, box-shadow 0.16s;
}
input[type="number"] { font-family: var(--mono); }

/* File dropzone */
.dropzone {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px;
  border: 1.5px dashed var(--accent-line);
  border-radius: var(--radius-sm);
  background: var(--accent-wash);
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
  min-height: var(--tap);
}
.dropzone:hover, .dropzone:focus-within {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent-wash) 60%, var(--surface));
}
.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%; height: 100%;
  cursor: pointer;
}
.dropzone-icon {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 11px;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--accent-line);
  color: var(--accent);
}
.dropzone-icon svg { width: 20px; height: 20px; }
.dropzone-text { min-width: 0; }
.dropzone-title { font-weight: 600; font-size: 0.92rem; color: var(--ink); }
.dropzone-file {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--accent);
  word-break: break-all;
  margin-top: 2px;
}
.dropzone-hint { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.dropzone.has-file { border-style: solid; border-color: var(--accent); }

.demo-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  background: none;
  border: none;
  padding: 6px 2px;
  width: auto;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.84rem;
  font-family: var(--body);
  cursor: pointer;
  box-shadow: none;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--accent-line);
}
.demo-link:hover:not(:disabled) { transform: none; box-shadow: none; text-decoration-color: var(--accent); }
.demo-link svg { width: 15px; height: 15px; }

select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23647689'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 34px;
}

input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible,
.dropzone:focus-within, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
  outline: none;
}

.field small.muted { display: block; margin-top: 6px; font-size: 0.79rem; line-height: 1.45; }

/* ── Buttons ────────────────────────────────────────────────────────────── */

button {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  padding: 14px 20px;
  font-weight: 600;
  font-size: 1rem;
  font-family: var(--display);
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button:hover:not(:disabled) { transform: translateY(-1px); background: var(--accent-bright); box-shadow: var(--shadow-md); }
button:active:not(:disabled) { transform: translateY(0) scale(0.99); }

button:disabled {
  background: var(--surface-3);
  color: var(--faint);
  cursor: progress;
  box-shadow: none;
}

.btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 9px; }
.btn-primary svg { width: 18px; height: 18px; }

button.secondary {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--border-strong);
  box-shadow: none;
  width: auto;
  padding: 11px 16px;
  font-size: 0.9rem;
}
button.secondary:hover:not(:disabled) { background: var(--surface-3); border-color: var(--accent-line); }

/* ── Inline row ─────────────────────────────────────────────────────────── */

.inline-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 12px 0; }

/* ── Error ──────────────────────────────────────────────────────────────── */

.error {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 12px;
  padding: 12px 14px;
  color: var(--danger);
  background: var(--danger-wk);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9rem;
}
.error::before {
  content: "!";
  flex-shrink: 0;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.8rem;
  display: grid; place-items: center;
  margin-top: 1px;
}

/* ── Status pill ────────────────────────────────────────────────────────── */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--muted);
}
.status-pill::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--neutral);
}
.status-pill.online { border-color: color-mix(in srgb, var(--safe) 40%, transparent); background: var(--safe-wk); color: var(--safe); }
.status-pill.online::before { background: var(--safe); box-shadow: 0 0 0 3px var(--safe-wk); }
.status-pill.attention { border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-wk); color: var(--warn); }
.status-pill.attention::before { background: var(--warn); }

/* ── Advanced panels ────────────────────────────────────────────────────── */

.advanced {
  margin: 14px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}
.advanced summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 16px;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 9px;
  -webkit-tap-highlight-color: transparent;
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::after {
  content: '';
  margin-left: auto;
  width: 8px; height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.2s;
}
details[open] > summary::after { transform: rotate(-135deg); }
.summary-icon { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; }

.adv-body { padding: 2px 16px 16px; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.settings-grid .full-width { grid-column: 1 / -1; }

/* ── Progress ───────────────────────────────────────────────────────────── */

.progress-head { display: flex; align-items: baseline; gap: 10px; justify-content: space-between; }
.progress-pct {
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  width: 100%;
  height: 10px;
  background: var(--surface-inset);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}
.progress-bar {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-bright) 100%);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.progress-bar::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.4) 45%, transparent 100%);
  animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(220%); }
}

/* ── Check status list ──────────────────────────────────────────────────── */

.check-list { display: grid; gap: 7px; margin-top: 18px; }

.check-status {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.check-icon {
  position: relative;
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--surface-3);
  color: var(--faint);
  border: 1px solid var(--border);
}

.check-status.running { color: var(--accent); border-color: var(--accent-line); background: var(--accent-wash); }
.check-status.running .check-icon {
  background: var(--accent); color: var(--accent-ink); border-color: transparent;
}
.check-status.running .check-icon::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--accent); border-top-color: transparent;
  animation: spin 0.8s linear infinite;
}
.check-status.done { color: var(--safe); border-color: color-mix(in srgb, var(--safe) 30%, transparent); }
.check-status.done .check-icon { background: var(--safe); color: #fff; border-color: transparent; }
.check-status.error { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.check-status.error .check-icon { background: var(--danger); color: #fff; border-color: transparent; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes livepulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* Skeleton shimmer for pending rows while nothing is running yet */
.check-status.pending .check-bar-skel {
  margin-left: auto;
  width: 46px; height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--border-soft) 50%, var(--surface-3) 75%);
  background-size: 200% 100%;
  animation: skel 1.4s ease-in-out infinite;
}
.check-status:not(.pending) .check-bar-skel { display: none; }
@keyframes skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Verdict gauge (results hero) ───────────────────────────────────────── */

.verdict-stage {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: center;
  padding: 6px 0 4px;
}

.gauge {
  position: relative;
  width: 132px; height: 132px;
  flex-shrink: 0;
}
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge-track { fill: none; stroke: var(--surface-inset); stroke-width: 11; }
.gauge-fill {
  fill: none;
  stroke-width: 11;
  stroke-linecap: round;
  stroke: var(--neutral);
  transition: stroke-dashoffset 1.1s cubic-bezier(0.34, 1.2, 0.4, 1), stroke 0.6s ease;
}
.gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.gauge-value {
  font-family: var(--display);
  font-size: 1.85rem;
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.gauge-label { font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }

.verdict-readout { min-width: 0; }
.verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  border-radius: 999px;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.9rem;
  color: #fff;
  background: var(--neutral);
}
.verdict-badge svg { width: 16px; height: 16px; }
.verdict-meaning { margin: 11px 0 0; font-size: 0.92rem; color: var(--ink-2); line-height: 1.5; }

/* ── Metrics ────────────────────────────────────────────────────────────── */

.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }

.metric-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 13px;
}
.metric-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.metric-card h3 { margin: 8px 0 0; font-size: 1.4rem; font-family: var(--display); font-variant-numeric: tabular-nums; }

.sha-line {
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--muted);
  word-break: break-all;
}
.sha-line code {
  font-family: var(--mono);
  background: var(--surface-inset);
  border: 1px solid var(--border-soft);
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 0.76rem;
  color: var(--ink-2);
}

.result-meta { margin: 0 0 18px; font-size: 0.86rem; color: var(--muted); }
.result-meta .mode-tag {
  font-family: var(--mono);
  color: var(--accent);
  background: var(--accent-wash);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
}

/* ── Explanation list ───────────────────────────────────────────────────── */

#result-explanation { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
#result-explanation li {
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-xs);
  font-size: 0.88rem;
  color: var(--ink-2);
  white-space: pre-wrap;
  line-height: 1.5;
}

/* ── Evidence cards: horizontal scroll-snap on mobile ───────────────────── */

.check-bars {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 86%;
  gap: 12px;
  margin: 4px -18px 6px;
  padding: 4px 18px 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.check-bars::-webkit-scrollbar { height: 6px; }
.check-bars::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }

.check-item {
  scroll-snap-align: start;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
}
.check-item h4 { margin: 0 0 5px; font-size: 0.98rem; }
.check-item > p.muted { font-size: 0.82rem; margin: 0 0 12px; line-height: 1.45; }
.check-summary {
  font-size: 0.84rem;
  margin: 12px 0 0;
  padding-top: 11px;
  border-top: 1px dashed var(--border);
  color: var(--ink-2);
}

.bar-row {
  display: grid;
  grid-template-columns: 74px 1fr 44px;
  gap: 9px;
  align-items: center;
  font-size: 0.78rem;
  margin-bottom: 9px;
  color: var(--muted);
}
.bar-row strong { text-align: right; font-family: var(--mono); font-weight: 600; color: var(--ink); font-size: 0.8rem; }
.bar-track {
  height: 8px;
  background: var(--surface-inset);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill-score { height: 100%; background: var(--danger); border-radius: 999px; transition: width 0.6s cubic-bezier(0.4,0,0.2,1); }
.bar-fill-confidence { height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.6s cubic-bezier(0.4,0,0.2,1); }

.swipe-hint {
  display: none;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--faint);
  margin: -2px 0 6px;
}
.swipe-hint svg { width: 13px; height: 13px; }

/* ── Timeline ───────────────────────────────────────────────────────────── */

.timeline-track {
  position: relative;
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background:
    repeating-linear-gradient(90deg, transparent 0, transparent 9.5%, var(--border-soft) 9.5%, var(--border-soft) calc(9.5% + 1px)),
    var(--surface-inset);
  margin-bottom: 12px;
  overflow: hidden;
}
.timeline-block {
  position: absolute;
  top: 6px;
  height: 28px;
  border-radius: 6px;
  background: linear-gradient(180deg, var(--warn), var(--danger));
  box-shadow: 0 0 12px color-mix(in srgb, var(--danger) 30%, transparent);
  opacity: 0.9;
  cursor: pointer;
  transition: transform 0.12s, opacity 0.12s;
}
.timeline-block:hover { transform: scaleY(1.12); opacity: 1; }

#result-segments { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
#result-segments li {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-2);
  padding: 8px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
}

/* ── Raw data ───────────────────────────────────────────────────────────── */

#result-raw {
  max-height: 280px;
  overflow: auto;
  background: var(--surface-inset);
  color: var(--ink-2);
  padding: 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.55;
  -webkit-overflow-scrolling: touch;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */

.footer { text-align: center; padding: 26px 0 8px; font-size: 0.82rem; color: var(--muted); }
.footer .disclaimer { max-width: 54ch; margin: 0 auto 14px; line-height: 1.55; }

.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 4px; font-size: 0.82rem; }
.footer-links a { color: var(--accent); text-decoration: none; transition: color 0.15s; padding: 4px 6px; }
.footer-links a:hover { text-decoration: underline; text-underline-offset: 3px; }
.footer-sep { color: var(--faint); }

.ts-brand-footer {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}
.ts-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--faint);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  transition: color 0.2s;
}
.ts-brand-link:hover { color: var(--accent); }
.ts-gh-icon { width: 15px; height: 15px; opacity: 0.75; transition: opacity 0.2s; }
.ts-brand-link:hover .ts-gh-icon { opacity: 1; }

/* ── Hidden ─────────────────────────────────────────────────────────────── */

.hidden { display: none !important; }

/* ── Reveal animation for result/progress cards ─────────────────────────── */
.reveal { animation: reveal-up 0.5s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
@keyframes reveal-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes trace-draw { to { stroke-dashoffset: 0; } }

/* ── Responsive: from 320px up ──────────────────────────────────────────── */

@media (min-width: 560px) {
  .check-bars {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: repeat(2, 1fr);
    overflow: visible;
    margin: 4px 0 6px;
    padding: 0;
  }
  .swipe-hint { display: none !important; }
}

@media (min-width: 600px) {
  .mode-cards { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 768px) {
  .container { padding: 32px 20px; }
  .card { padding: 26px 24px; }
  .gauge { width: 148px; height: 148px; }
}

@media (max-width: 559px) {
  .swipe-hint { display: flex; }
  .metric-grid { grid-template-columns: 1fr; gap: 8px; }
  .metric-card { display: flex; align-items: baseline; justify-content: space-between; }
  .metric-card h3 { margin: 0; }
  .settings-grid { grid-template-columns: 1fr; }
  .inline-row { flex-direction: column; align-items: stretch; }
  .inline-row button, .inline-row .status-pill { width: 100%; justify-content: center; }
}

@media (max-width: 400px) {
  .verdict-stage { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 14px; }
  .verdict-readout { text-align: center; }
  .bar-row { grid-template-columns: 66px 1fr 40px; }
}

/* ── Touch-friendly tap targets ─────────────────────────────────────────── */
@media (pointer: coarse) {
  input[type="file"], input[type="number"], input[type="url"], select, button, summary { min-height: var(--tap); }
  .dropzone, .check-status { min-height: var(--tap); }
  .demo-link { min-height: 40px; }
}

/* ── Safe-area insets (notch / island phones) ───────────────────────────── */
@supports (padding: env(safe-area-inset-left)) {
  .container {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
}

/* ── Reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .hero-trace path { stroke-dashoffset: 0; }
}

/* ── Debug log panel ────────────────────────────────────────────────────── */
.debug-panel {
  margin: 22px 0 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 12px;
}
.debug-panel > summary {
  cursor: pointer;
  padding: 12px 15px;
  color: var(--muted);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 9px;
}
.debug-panel > summary::-webkit-details-marker { display: none; }
.debug-panel > summary::before { content: "›"; color: var(--muted); font-size: 15px; transition: transform 0.2s; }
.debug-panel[open] > summary::before { transform: rotate(90deg); }
.debug-count {
  background: var(--surface-3);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 11px;
  color: var(--ink-2);
}
.debug-toolbar { display: flex; align-items: center; gap: 10px; padding: 0 15px 10px; flex-wrap: wrap; }
.debug-btn {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--ink-2);
  border-radius: 7px;
  padding: 5px 13px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
}
.debug-btn:hover { background: var(--surface-3); }
.debug-auto { color: var(--muted); font-size: 11px; display: flex; align-items: center; gap: 6px; }
.debug-log {
  margin: 0;
  padding: 11px 15px;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink-2);
  border-top: 1px solid var(--border-soft);
  line-height: 1.55;
}
.debug-log .lg-err { color: var(--danger); }
.debug-log .lg-ok { color: var(--safe); }
.debug-log .lg-warn { color: var(--warn); }
.debug-log .lg-t { color: var(--faint); }
