:root{
  --bg: #0F1416;
  --surface: #161D20;
  --surface-2: #1C2528;
  --line: #2A3538;
  --text: #E7EDEE;
  --text-muted: #7C8A8E;
  --accent-human: #3ECF8E;
  --accent-ai: #FF7A45;
  --accent-neutral: #E8C85C;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }

body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.grain{
  position: fixed; inset:0; pointer-events:none; z-index:0; opacity:.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Topbar */
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding: 22px 32px;
  border-bottom: 1px solid var(--line);
  position: relative; z-index:1;
}
.wordmark{ font-family: var(--font-display); font-weight:700; font-size:16px; letter-spacing: .01em; }
.wordmark-lab{ color: var(--text); }
.wordmark-div{ color: var(--text-muted); margin: 0 6px; font-weight:400; }
.wordmark-tool{ color: var(--accent-human); }

.status-chip{
  display:flex; align-items:center; gap:8px;
  font-family: var(--font-mono); font-size:11px; letter-spacing:.06em; text-transform: uppercase;
  color: var(--text-muted);
}
.dot{
  width:6px; height:6px; border-radius:50%; background: var(--accent-human);
  box-shadow: 0 0 8px var(--accent-human);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse{ 0%,100%{opacity:1} 50%{opacity:.35} }

/* Console layout */
.console{
  max-width: 720px; margin: 0 auto; padding: 56px 24px 40px;
  position: relative; z-index:1;
}

.intro h1{
  font-family: var(--font-display); font-weight:700;
  font-size: clamp(28px, 4.5vw, 42px);
  line-height: 1.15; margin: 0 0 14px;
  letter-spacing: -0.01em;
}
.intro p{
  color: var(--text-muted); font-size:15px; line-height:1.6; max-width: 52ch; margin:0 0 40px;
}

/* Specimen tray */
.specimen-frame{
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 4px;
  overflow: hidden;
}
.bracket{ position:absolute; width:16px; height:16px; border-color: var(--accent-human); z-index: 3; opacity:.7; }
.bracket.tl{ top:8px; left:8px; border-top:2px solid; border-left:2px solid; }
.bracket.tr{ top:8px; right:8px; border-top:2px solid; border-right:2px solid; }
.bracket.bl{ bottom:56px; left:8px; border-bottom:2px solid; border-left:2px solid; }
.bracket.br{ bottom:56px; right:8px; border-bottom:2px solid; border-right:2px solid; }

.scanline{
  position:absolute; left:0; right:0; height:2px;
  background: linear-gradient(90deg, transparent, var(--accent-human), transparent);
  top:0; opacity:0; z-index:2; pointer-events:none;
}
.scanline.active{ animation: sweep 1.4s cubic-bezier(.4,0,.2,1) infinite; opacity:1; }
@keyframes sweep{
  0%{ top:0; opacity:0; }
  10%{ opacity:1; }
  90%{ opacity:1; }
  100%{ top:100%; opacity:0; }
}

textarea{
  width:100%; min-height: 220px; resize: vertical;
  background: transparent; border:none; outline:none;
  color: var(--text); font-family: var(--font-body); font-size:15px; line-height:1.6;
  padding: 22px 20px 12px;
}
textarea::placeholder{ color: var(--text-muted); }

.tray-footer{
  display:flex; align-items:center; justify-content:space-between;
  padding: 10px 16px 10px 20px;
  border-top: 1px solid var(--line);
}
.meta{ font-family: var(--font-mono); font-size:12px; color: var(--text-muted); }

.scan-btn{
  display:flex; align-items:center; gap:8px;
  background: var(--accent-human); color: #06110C; border:none;
  font-family: var(--font-mono); font-weight:600; font-size:13px; letter-spacing:.03em; text-transform: uppercase;
  padding: 10px 18px; border-radius: 3px; cursor:pointer;
  transition: transform .15s ease, background .15s ease;
}
.scan-btn:hover{ transform: translateY(-1px); background:#4EE39F; }
.scan-btn:active{ transform: translateY(0); }
.scan-btn:disabled{ opacity:.5; cursor: progress; transform:none; }
.btn-arrow{ transition: transform .15s ease; }
.scan-btn:hover .btn-arrow{ transform: translateX(2px); }

.hint{ font-family: var(--font-mono); font-size:11.5px; color: var(--text-muted); margin: 10px 4px 0; }

/* Report */
.report{ margin-top: 32px; animation: rise .4s ease; }
@keyframes rise{ from{ opacity:0; transform: translateY(8px);} to{opacity:1; transform:none;} }

.report-slip{
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-top: 3px dashed var(--line);
  border-radius: 4px;
  padding: 22px 24px 16px;
}
.slip-head{
  display:flex; justify-content:space-between;
  font-family: var(--font-mono); font-size:11px; letter-spacing:.08em; color: var(--text-muted);
  margin-bottom: 20px;
}

.verdict-row{ display:flex; align-items:center; gap:24px; }
.gauge-wrap{ position:relative; width:96px; height:96px; flex-shrink:0; }
.gauge{ width:100%; height:100%; transform: rotate(-90deg); }
.gauge-track{ fill:none; stroke: var(--line); stroke-width:8; }
.gauge-fill{
  fill:none; stroke: var(--accent-human); stroke-width:8; stroke-linecap: round;
  stroke-dasharray: 327; stroke-dashoffset: 327;
  transition: stroke-dashoffset 1s cubic-bezier(.4,0,.2,1), stroke 1s ease;
}
.gauge-number{
  position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  font-family: var(--font-display); font-weight:700; font-size:22px;
}
.pct-sign{ font-size:13px; margin-left:1px; color: var(--text-muted); }

.verdict-text{ flex:1; }
.verdict-label{
  display:block; font-family: var(--font-display); font-weight:700; font-size:19px; margin-bottom:6px;
}
.verdict-desc{ color: var(--text-muted); font-size:13.5px; line-height:1.55; margin:0; }

.readout{ margin-top:20px; border-top:1px solid var(--line); padding-top:14px; }
.readout-row{ display:flex; gap:12px; font-family: var(--font-mono); font-size:12.5px; line-height:1.6; }
.readout-row span:first-child{ color: var(--text-muted); text-transform: uppercase; letter-spacing:.06em; flex-shrink:0; }
.readout-row span:last-child{ color: var(--text); }

.slip-foot{
  margin-top:16px; padding-top:10px; border-top:1px dashed var(--line);
  font-family: var(--font-mono); font-size:10.5px; color: var(--text-muted); letter-spacing:.04em;
}

/* Error */
.error-box{
  margin-top: 24px; display:flex; align-items:center; gap:12px;
  background: rgba(255,122,69,.08); border:1px solid rgba(255,122,69,.3); border-radius:4px;
  padding: 14px 16px;
}
.error-box[hidden]{
  display: none;
}
.error-icon{
  width:20px; height:20px; border-radius:50%; background: var(--accent-ai); color:#1a0d05;
  display:flex; align-items:center; justify-content:center; font-weight:700; font-size:12px; flex-shrink:0;
}
.error-box p{ margin:0; font-size:13.5px; color: var(--text); }

.foot{
  text-align:center; padding: 30px 24px 50px; color: var(--text-muted);
  font-family: var(--font-mono); font-size:11px; letter-spacing:.02em;
}

@media (max-width: 520px){
  .topbar{ padding: 18px 18px; }
  .console{ padding: 40px 16px 30px; }
  .verdict-row{ flex-direction:column; align-items:flex-start; gap:16px; }
}