:root {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --ink: #1b1d26;
  --muted: #6a6e7c;
  --line: #ddd8cc;
  --accent: #d98a1f;
  --human: #d98a1f;
  --ai: #1aa7c9;
  --good: #2e8b57;
  --bad: #c2453b;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(24, 22, 40, 0.12);
  --stage-top: #1a1c2b;
  --stage-bottom: #0b0c14;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1016;
    --surface: #181b25;
    --ink: #eceef5;
    --muted: #9aa0b4;
    --line: #2a2e3d;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; width: 100%; }

a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 18px clamp(16px, 4vw, 40px);
}
.brand { font-weight: 800; letter-spacing: 0.01em; text-decoration: none; font-size: 1.05rem; }
.brand span { color: var(--accent); }
.topbar nav a { color: var(--muted); text-decoration: none; font-weight: 600; margin-left: 20px; }
.topbar nav a:hover { color: var(--ink); }

/* ---------- vote page ---------- */

.layout {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(20px, 3vw, 44px);
  padding: 0 clamp(16px, 4vw, 40px) 40px; align-items: start; max-width: 1500px; margin: 0 auto;
}

.stage {
  position: sticky; top: 16px; height: min(calc(100vh - 92px), 860px); aspect-ratio: 9 / 16;
  border-radius: 22px; overflow: hidden; background: #07080d; box-shadow: var(--shadow);
}
.frame { position: absolute; inset: 0; transform-origin: 50% 55%; animation: breathe 16s ease-in-out infinite alternate; }
.stage.revealing .frame { animation-play-state: paused; }
.layer { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; display: block; }
video.layer { opacity: 0; transition: opacity 0.35s ease; }
video.layer.on { opacity: 1; }
.scrim { position: absolute; left: 0; right: 0; bottom: 0; height: 46%; pointer-events: none; opacity: 0;
  background: linear-gradient(to top, rgba(4, 5, 10, 0.82), transparent); transition: opacity 0.8s ease; }
.scrim.show { opacity: 1; }
.stage .caption {
  position: absolute; left: 0; right: 0; bottom: 5%; text-align: center; color: #fff; padding: 0 18px;
  font-size: clamp(1.5rem, 2.6vw, 2.2rem); font-weight: 800; letter-spacing: 0.01em;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.8); opacity: 0; transform: translateY(8px);
  transition: opacity 0.6s ease, transform 0.6s ease; pointer-events: none;
}
.stage .caption.show { opacity: 1; transform: none; }
.stage .caption.human em { color: #ffc46b; }
.stage .caption.ai em { color: #6fe7ff; }
.stage .caption em { font-style: normal; }
.stage .caption .credit-line { font-size: clamp(0.8rem, 1.1vw, 0.98rem); font-weight: 500; line-height: 1.35; opacity: 0.92; text-shadow: 0 1px 10px rgba(0, 0, 0, 0.9); }
.stage .caption .credit-line.who { font-size: clamp(0.95rem, 1.4vw, 1.15rem); font-weight: 700; margin-top: 8px; opacity: 1; }
@keyframes breathe { from { transform: scale(1); } to { transform: scale(1.035); } }

.side { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.side h1 { margin: 4px 0 0; font-size: clamp(1.7rem, 3.4vw, 2.5rem); line-height: 1.1; letter-spacing: -0.01em; }
.lede { margin: 0; color: var(--muted); }

.player {
  display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow);
}
.play {
  flex: none; width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--ink); color: var(--bg);
  display: grid; place-items: center; transition: transform 0.15s ease;
}
.play:hover { transform: scale(1.06); }
.play svg { width: 22px; height: 22px; fill: currentColor; }
.play .pause { display: none; }
.play.on .pause { display: block; }
.play.on .tri { display: none; }
.progress { flex: 1; min-width: 0; }
.progress input { width: 100%; accent-color: var(--accent); }
.time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.9rem; min-width: 5.5em; text-align: right; }

.score { background: #fff; border-radius: var(--radius); padding: clamp(8px, 2vw, 22px); box-shadow: var(--shadow); min-height: 200px; }
.score img { display: block; width: 100%; height: auto; }
.score img + img { margin-top: 16px; }

.votebar {
  position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 14px; margin: 0 -14px -14px; background: linear-gradient(to top, var(--bg) 72%, transparent);
}
.like {
  display: inline-flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 999px;
  background: var(--surface); border: 2px solid var(--line); font-weight: 600; user-select: none; cursor: pointer;
}
.like input { position: absolute; opacity: 0; pointer-events: none; }
.like svg { width: 22px; height: 22px; fill: none; stroke: var(--muted); stroke-width: 2; transition: all 0.15s ease; }
.like:has(input:checked) { border-color: #e0477b; }
.like:has(input:checked) svg { fill: #e0477b; stroke: #e0477b; transform: scale(1.12); }
.like:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.spacer { flex: 1; }

.btn {
  border: 0; border-radius: 14px; padding: 14px 26px; font-weight: 800; font-size: 1.05rem;
  background: var(--ink); color: var(--bg); transition: transform 0.12s ease, opacity 0.2s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.human { background: var(--human); color: #1b1200; }
.btn.ai { background: var(--ai); color: #00232c; }
.btn.ghost { background: transparent; color: var(--ink); border: 2px solid var(--line); }
.btn.big { padding: 16px 34px; font-size: 1.1rem; }

.after { display: none; gap: 12px; flex-wrap: wrap; }
.votebar.revealed .choose { display: none; }
.votebar.revealed .after { display: flex; }
.choose { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; flex: 1; }

.notice { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .frame { animation: none; }
  video.layer, .scrim, .stage .caption { transition: none; }
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .stage { position: relative; top: 0; width: 100%; height: 56vh; aspect-ratio: auto; }
}
@media (max-width: 560px) {
  /* Keep the player above the sticky vote bar on a phone: a shorter stage, a smaller title. */
  .stage { height: 40vh; min-height: 250px; }
  .layer { object-position: 50% 36%; }  /* the still and every clip share a frame, so they stay aligned */
  .side h1 { font-size: 1.55rem; }
  .side { gap: 12px; }
  .like { width: 100%; justify-content: center; }
  .spacer { display: none; }
  .choose .btn, .after .btn { flex: 1; text-align: center; }
}

/* ---------- stats page ---------- */

.page { max-width: 880px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 60px; }
.page h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 8px 0 6px; line-height: 1.1; }
.page h2 { margin: 40px 0 4px; font-size: 1.35rem; }
.page .sub { color: var(--muted); margin: 0 0 18px; }
.headline { display: flex; flex-wrap: wrap; gap: 12px; margin: 22px 0 8px; }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 20px; }
.chip b { display: block; font-size: 1.8rem; line-height: 1.1; }
.chip span { color: var(--muted); font-size: 0.9rem; }

.rows { display: grid; gap: 10px; }
.row { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; }
.row .top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.row .name { font-weight: 700; }
.row .n { color: var(--muted); font-size: 0.85rem; }
.row .pct { font-weight: 800; font-variant-numeric: tabular-nums; }
.bar { height: 12px; border-radius: 999px; background: var(--line); margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--ai); width: 0; transition: width 0.7s ease; }
.row.human .bar i { background: var(--human); }
.row.empty { opacity: 0.6; }
.chance { color: var(--muted); font-size: 0.85rem; margin: 6px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.credit { margin-top: 48px; color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--line); padding-top: 16px; }

/* ---------- review page ---------- */

.review { max-width: 1000px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 60px; display: grid; gap: 16px; }
.review audio { width: 100%; }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; word-break: break-word; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-weight: 700; color: #111; }
.tag.human { background: var(--human); }
.tag.ai { background: var(--ai); }
.btn.danger { background: var(--bad); color: #fff; }

/* ---------- footer and legal pages ---------- */

.site-footer { margin-top: auto; padding: 22px clamp(16px, 4vw, 40px); border-top: 1px solid var(--line); color: var(--muted); font-size: 0.88rem; }
.footer-content { max-width: 1500px; margin: 0 auto; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 24px; }
.footer-attribution { flex: 1 1 320px; }
.footer-legal { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }
.footer-sep { margin: 0 12px; color: var(--muted); opacity: 0.5; }
@media (max-width: 640px) { .footer-content, .footer-legal { justify-content: center; text-align: center; } }

.legal h2 { margin-top: 28px; }
.legal h3 { margin: 22px 0 4px; font-size: 1.05rem; }
.legal p, .legal li { color: var(--ink); }
.legal ul { padding-left: 1.2em; }
.legal article { padding-top: 8px; }
.legal article + article { margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--line); }
.back-link { margin-top: 32px; }
