:root {
  --bg: #07070b;
  --fg: #f2f0ea;
  --muted: #8b8a99;
  --line: rgba(242, 240, 234, 0.14);
  --human: #ffb547;
  --ai: #3df2ff;
  --accent: #b46bff;
  --danger: #ff4d6d;
  --ok: #5dff9b;
  --display: 'Space Grotesk', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--display);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#stage { position: fixed; inset: 0; width: 100%; height: 100%; }
.grain {
  position: fixed; inset: -50%; pointer-events: none; opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.6s steps(4) infinite;
}
@keyframes grain { to { transform: translate(-3%, 2%); } }

.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 20px; font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em;
}
.logo { font-weight: 600; }
.logo span { color: var(--accent); margin: 0 2px; }
.score { display: flex; gap: 18px; color: var(--muted); }
.score b { color: var(--fg); }

main { position: relative; z-index: 1; height: 100%; }
.screen {
  position: absolute; inset: 0; display: none;
  flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 80px 16px 32px;
  text-shadow: 0 1px 16px rgba(7, 7, 11, 0.9), 0 0 2px rgba(7, 7, 11, 0.6);
}
.btn.primary, .choice.picked { text-shadow: none; }
body[data-screen="landing"] [data-for="landing"],
body[data-screen="searching"] [data-for="searching"],
body[data-screen="live"] [data-for="live"],
body[data-screen="vote"] [data-for="vote"],
body[data-screen="reveal"] [data-for="reveal"],
body[data-screen="summary"] [data-for="summary"] { display: flex; animation: enter 0.45s cubic-bezier(.2,.8,.2,1); }
@keyframes enter { from { opacity: 0; transform: translateY(12px) scale(0.98); } }

.kicker {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 16px;
}
.blink { animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.3; } }

h1 {
  font-size: clamp(40px, 8vw, 88px); line-height: 0.95; letter-spacing: -0.04em;
  margin: 0 0 28px; font-weight: 700;
}
h2 { font-size: clamp(28px, 5vw, 48px); letter-spacing: -0.03em; margin: 0 0 28px; font-weight: 500; }
em { font-style: normal; }
em.h { color: var(--human); text-shadow: 0 0 40px color-mix(in srgb, var(--human) 50%, transparent); }
em.a { color: var(--ai); text-shadow: 0 0 40px color-mix(in srgb, var(--ai) 50%, transparent); }


.consent {
  display: flex; gap: 10px; align-items: flex-start; max-width: 460px; text-align: left;
  font-size: 13px; color: var(--muted); margin-bottom: 20px; cursor: pointer;
}
.consent input { accent-color: var(--accent); margin-top: 2px; width: 16px; height: 16px; flex: none; }
.hint { font-size: 13px; color: var(--muted); margin: 16px 0 0; }
.error { color: var(--danger); font-size: 14px; margin-top: 12px; }

.btn {
  font: 600 16px var(--display); color: var(--fg); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: 14px 26px; cursor: pointer;
  transition: transform .15s, background .15s, border-color .15s, opacity .15s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--fg); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn.big { font-size: 20px; padding: 18px 40px; }
.btn.ghost { color: var(--muted); }
.btn.round { width: 54px; height: 54px; padding: 0; font-size: 20px; }

.live { justify-content: space-between; }
.timer { position: relative; width: 92px; height: 92px; display: grid; place-items: center; }
.timer svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 3; }
.timer .track { stroke: var(--line); }
.timer .bar { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 282.7; transition: stroke .3s; }
.timer.low .bar { stroke: var(--danger); }
.timer span { font: 600 20px var(--mono); }
.status { font-family: var(--mono); color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.live .controls { margin-top: auto; }
.controls { display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap; }
#mute .off { display: none; }
#mute[aria-pressed="true"] { border-color: var(--danger); }
#mute[aria-pressed="true"] .on { display: none; }
#mute[aria-pressed="true"] .off { display: inline; }

.vote-q { font-size: clamp(36px, 7vw, 72px); font-weight: 700; }
.vote { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.choice {
  font: 700 clamp(28px, 6vw, 44px) var(--display); letter-spacing: -0.02em;
  width: min(42vw, 260px); height: 150px; border-radius: 24px; border-width: 2px;
}
.choice.h { border-color: var(--human); color: var(--human); }
.choice.a { border-color: var(--ai); color: var(--ai); }
.choice.h:hover { background: color-mix(in srgb, var(--human) 14%, transparent); box-shadow: 0 0 60px color-mix(in srgb, var(--human) 35%, transparent); }
.choice.a:hover { background: color-mix(in srgb, var(--ai) 14%, transparent); box-shadow: 0 0 60px color-mix(in srgb, var(--ai) 35%, transparent); }
.choice.picked { color: var(--bg); }
.choice.h.picked { background: var(--human); }
.choice.a.picked { background: var(--ai); }
.votebar { width: min(560px, 90vw); height: 3px; background: var(--line); margin-top: 32px; border-radius: 3px; overflow: hidden; }
.votebar i { display: block; height: 100%; width: 100%; background: var(--fg); transform-origin: left; }

.verdict {
  font: 700 clamp(72px, 18vw, 200px) var(--display); letter-spacing: -0.06em; line-height: 0.9; margin: 0 0 12px;
}
.verdict.h { color: var(--human); text-shadow: 0 0 80px color-mix(in srgb, var(--human) 60%, transparent); }
.verdict.a { color: var(--ai); text-shadow: 0 0 80px color-mix(in srgb, var(--ai) 60%, transparent); }
.verdict.glitch { animation: glitch .35s steps(3) 3; }
@keyframes glitch {
  0% { transform: translate(0); clip-path: inset(0 0 0 0); }
  33% { transform: translate(-6px, 2px); clip-path: inset(20% 0 40% 0); }
  66% { transform: translate(5px, -3px); clip-path: inset(50% 0 10% 0); }
}
.who { font-size: 18px; color: var(--muted); margin: 0 0 22px; }
.who b { color: var(--fg); }
.result { font: 600 22px var(--mono); margin-bottom: 10px; }
.result .good { color: var(--ok); }
.result .bad { color: var(--danger); }
.partner { color: var(--muted); font-size: 15px; margin: 0 0 30px; min-height: 1.4em; }
.partner b { color: var(--fg); }

.summary .headline { font-size: clamp(30px, 6vw, 56px); font-weight: 700; max-width: 720px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; width: min(720px, 100%); margin-bottom: 20px; }
.tiles div {
  border: 1px solid var(--line); border-radius: 16px; padding: 16px 8px;
  background: rgba(7,7,11,.6); backdrop-filter: blur(6px); display: grid; gap: 4px;
}
.tiles b { font: 600 28px var(--mono); }
.tiles span { font-size: 12px; color: var(--muted); }
.history {
  list-style: none; padding: 0; margin: 0 0 24px; width: min(720px, 100%);
  max-height: 30vh; overflow-y: auto; text-align: left; font-size: 14px;
}
.history li { display: flex; gap: 12px; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.history .n { font-family: var(--mono); color: var(--muted); width: 2.2em; }
.history .k { font: 600 12px var(--mono); padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; }
.history .k.h { color: var(--human); }
.history .k.a { color: var(--ai); }
.history .d { flex: 1; color: var(--muted); }
.history .ok { color: var(--ok); }
.history .no { color: var(--danger); }

dialog {
  background: #12121a; color: var(--fg); border: 1px solid var(--line); border-radius: 20px;
  padding: 24px; width: min(380px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }
dialog h3 { margin: 0 0 4px; }
dialog p { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
.reasons { display: grid; gap: 8px; margin-bottom: 12px; }
.reasons button {
  font: 500 15px var(--display); color: var(--fg); background: rgba(255,255,255,.04);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; text-align: left;
}
.reasons button:hover { border-color: var(--danger); }

@media (max-width: 520px) {
  .choice { height: 120px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .score { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, .grain { animation: none !important; transition: none !important; }
}
[hidden] { display: none !important; }
