:root {
  --bg: #0b0d10;
  --panel: #14171c;
  --panel-2: #1b1f26;
  --line: #272c34;
  --text: #e8ebef;
  --muted: #9aa3ad;
  --muted-2: #6b7280;

  --green: #34d399;
  --green-d: #065f46;
  --blue: #60a5fa;
  --blue-d: #1e3a8a;
  --gray: #9ca3af;
  --gray-d: #374151;
  --amber: #fbbf24;
  --amber-d: #78350f;
  --neutral: #5b6675;

  --radius: 16px;
  --shadow: 0 10px 40px rgba(0,0,0,.45);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 50% -200px, #161b22 0%, var(--bg) 60%);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 20px 80px;
}

/* ---- Masthead ---- */
.masthead { text-align: center; margin-bottom: 36px; }
.masthead .mark { display: block; margin: 0 auto 10px; width: 56px; height: auto; }
.wordmark {
  font-size: 38px; font-weight: 800; letter-spacing: -0.03em;
}
.wordmark .dot { color: var(--green); }
.tagline { color: var(--muted); margin: 8px 0 0; font-size: 15px; }

/* ---- Uploader ---- */
.uploader {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.drop {
  position: relative;
  border: 1.5px dashed #38414d;
  border-radius: 12px;
  padding: 30px 18px;
  text-align: center;
  transition: border-color .15s, background .15s;
  cursor: pointer;
}
.drop.dragover { border-color: var(--green); background: rgba(52,211,153,.06); }
.drop input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}
.drop-icon { font-size: 30px; color: var(--muted); }
.drop-text { margin-top: 6px; color: var(--muted); }
.drop-text strong { color: var(--text); }
.drop-name { margin-top: 8px; color: var(--green); font-size: 13px; min-height: 16px; }

.or {
  text-align: center; color: var(--muted-2); font-size: 12px;
  text-transform: uppercase; letter-spacing: .15em; margin: 16px 0;
}

.entry-row { display: flex; gap: 10px; }
.entry-row input {
  flex: 1; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 10px; padding: 12px 14px; font-size: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.entry-row input:focus { outline: none; border-color: var(--blue); }
.entry-row button {
  background: var(--green); color: #06241a; border: 0; font-weight: 700;
  border-radius: 10px; padding: 0 22px; cursor: pointer; font-size: 14px;
  transition: filter .15s;
}
.entry-row button:hover { filter: brightness(1.06); }
.entry-row button:disabled { cursor: default; filter: none; opacity: .7; }
.hint { color: var(--muted-2); font-size: 12px; margin: 14px 0 0; text-align: center; }

/* Checking state: the animated brand loader (SMIL, runs inside <img>) plus the
   current pipeline stage. The sweep bar is the reduced-motion fallback — SMIL
   can't be paused from CSS, so we swap the element instead. */
.checking { margin: 16px 0 0; text-align: center; }
.checking-loader { width: 84px; height: auto; }
.checking-bar {
  display: none;
  height: 3px; border-radius: 3px; background: var(--panel-2);
  overflow: hidden; position: relative;
}
.checking-bar span {
  position: absolute; inset: 0 auto 0 0; width: 35%; border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--green), transparent);
  animation: sweep 1.15s ease-in-out infinite;
}
@keyframes sweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(340%); }
}
.checking-stage {
  color: var(--muted); font-size: 12px; margin-top: 10px; text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.uploader.is-checking .drop { opacity: .55; pointer-events: none; }
.uploader.is-checking .hint { opacity: .55; }

@media (prefers-reduced-motion: reduce) {
  .checking-loader { display: none; }
  .checking-bar { display: block; }
  .checking-bar span { animation: none; width: 100%; background: var(--green-d); }
}

.banner.error {
  margin-top: 18px; background: rgba(251,191,36,.08);
  border: 1px solid var(--amber-d); color: var(--amber);
  border-radius: 12px; padding: 14px 16px; font-size: 14px;
}

.placeholder {
  margin-top: 26px; color: var(--muted); font-size: 14px; line-height: 1.6;
  text-align: center;
}
.placeholder strong { color: var(--text); }

/* ---- Verdict card ---- */
.verdict {
  margin-top: 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 26px;
  align-items: start;
}
.verdict .txlog, .verdict .tech, .verdict .alert-banner { grid-column: 1 / -1; }
.alert-banner { background:#7f1d1d; color:#fff; padding:10px 14px; border-radius:6px; font-weight:600; margin-bottom:12px; }

/* state accent strip on the left edge */
.verdict { position: relative; overflow: hidden; }
.verdict::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
}
.state-live::before    { background: var(--green); }
.state-attested::before{ background: var(--blue); }
.state-registered::before{ background: var(--gray); }
.state-tampered::before{ background: var(--amber); }
.state-no_match::before{ background: var(--neutral); }

/* ---- Ring ---- */
.ring {
  width: 132px; height: 132px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--panel-2);
}
.ring-inner {
  width: 104px; height: 104px; border-radius: 50%;
  background: var(--bg);
  display: grid; place-items: center; text-align: center;
}
.ring.green  { box-shadow: 0 0 0 6px var(--green-d), 0 0 26px rgba(52,211,153,.4) inset; border: 3px solid var(--green); }
.ring.blue   { box-shadow: 0 0 0 6px var(--blue-d),  0 0 26px rgba(96,165,250,.35) inset; border: 3px solid var(--blue); }
.ring.gray   { border: 3px solid var(--gray); }
.ring.amber  { box-shadow: 0 0 0 6px var(--amber-d), 0 0 26px rgba(251,191,36,.35) inset; border: 3px solid var(--amber); }
.ring.neutral{ border: 3px dashed var(--neutral); }

.tier-num { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.tier-word { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.glyph { font-size: 44px; color: var(--neutral); font-weight: 700; }

.ring.green .tier-num { color: var(--green); }
.ring.blue .tier-num  { color: var(--blue); }
.ring.amber .tier-num { color: var(--amber); }
.ring.gray .tier-num  { color: var(--gray); }

/* ---- Body ---- */
.verdict-body { min-width: 0; }
.headline { margin: 2px 0 6px; font-size: 21px; letter-spacing: -.01em; }
.subhead { margin: 0 0 8px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.subhead.emphasis { color: var(--text); }
.muted { color: var(--muted-2); font-size: 13px; line-height: 1.55; }
.state-no_match .headline { color: var(--text); }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 22px; margin: 16px 0 0; }
.facts > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.facts dt { color: var(--muted-2); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.facts dd { margin: 0; font-size: 14px; word-break: break-word; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
.badge-green { background: rgba(52,211,153,.14); color: var(--green); }
.badge-blue  { background: rgba(96,165,250,.14); color: var(--blue); }
.badge-gray  { background: rgba(156,163,175,.14); color: var(--gray); }
.badge-amber { background: rgba(251,191,36,.14); color: var(--amber); }

/* ---- Enrolled-device trust line ----
   Same visual weight as .txlog (a meta line about provenance, not a verdict):
   panel-2 plate, hairline border, muted text. .warn is the caution accent —
   it must never render as plain body text. */
.trust-row {
  margin-top: 16px; padding: 10px 12px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--muted); font-size: 13px; line-height: 1.6;
}
.trust-row code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text); font-size: 12.5px; word-break: break-all;
}
.trust-row .subhead { display: inline; margin: 0; font-size: 12.5px; }
.trust-row .warn {
  display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 999px;
  background: rgba(251,191,36,.12); border: 1px solid var(--amber-d);
  color: var(--amber); font-weight: 600; font-size: 12px;
}

/* ---- Timeline ---- */
.timeline-wrap { margin-top: 18px; }
.timeline-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.diverge-note { color: var(--amber); font-weight: 600; }
.ok-note { color: var(--green); }
.timeline {
  position: relative; height: 16px; border-radius: 6px;
  background: var(--panel-2); overflow: hidden; border: 1px solid var(--line);
}
.seg { position: absolute; top: 0; bottom: 0; }
.seg.matched  { background: linear-gradient(var(--green), #2bb589); }
.seg.present  { background: linear-gradient(var(--gray), #7e8994); }  /* neutral: tile present ≠ tile verified */
.seg.diverged { background: repeating-linear-gradient(45deg, var(--amber), var(--amber) 4px, #d99a12 4px, #d99a12 8px); }
.timeline-axis {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--muted-2); margin-top: 5px;
}
.legend { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.sw.matched { background: var(--green); }
.sw.diverged { background: var(--amber); }

/* ---- Transparency log line ---- */
.txlog {
  margin-top: 22px; padding: 12px 14px; border-radius: 10px;
  font-size: 13.5px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border: 1px solid var(--line);
}
.txlog.verified { background: rgba(52,211,153,.08); border-color: var(--green-d); color: var(--green); }
.txlog.failed   { background: rgba(251,191,36,.08); border-color: var(--amber-d); color: var(--amber); }
.txlog.absent   { background: var(--panel-2); color: var(--muted); }
.tx-mark { font-weight: 800; font-size: 15px; }
.tx-text { font-weight: 600; }
.tx-meta { color: var(--muted-2); font-size: 12px; margin-left: auto; }

/* ---- Technical detail ---- */
.tech { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.tech summary {
  cursor: pointer; color: var(--muted); font-size: 13px; user-select: none;
  list-style: none;
}
.tech summary::-webkit-details-marker { display: none; }
.tech summary::before { content: "▸ "; color: var(--muted-2); }
.tech[open] summary::before { content: "▾ "; }
.tech-body { margin-top: 12px; }
.kv { display: flex; gap: 12px; font-size: 12.5px; margin: 6px 0; color: var(--muted); }
.kv > span:first-child { color: var(--muted-2); min-width: 90px; }
.kv code, .raw {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text); word-break: break-all;
}
.raw {
  margin-top: 10px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 12px; font-size: 11.5px; max-height: 280px;
  overflow: auto; white-space: pre-wrap;
}

.foot { margin-top: 28px; text-align: center; color: var(--muted-2); font-size: 12px; }

@media (max-width: 560px) {
  .verdict { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .facts { grid-template-columns: 1fr; text-align: left; }
  .tx-meta { margin-left: 0; }
}

/* Full-reference comparison: boxes on the uploader's own image */
.fr-preview { position: relative; display: inline-block; max-width: 100%; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--panel-2); }
.fr-preview img { display: block; max-width: 100%; max-height: 520px; height: auto; }
.fr-preview svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fr-box { fill: rgba(248,113,113,.10); stroke: #f87171; stroke-width: 0.6; vector-effect: non-scaling-stroke; stroke-width: 2px; }
.fr-box.residual { fill: rgba(251,191,36,.10); stroke: #fbbf24; }
.fr-key { display: inline-block; width: 12px; height: 12px; border: 2px solid #f87171; border-radius: 2px; vertical-align: -2px; }
.fr-key.residual { border-color: #fbbf24; }
