/* Filmster: name the movie from its score. Projection booth, light and dark. */

:root {
  --paper: #EDECE8;
  --surface: #FFFFFF;
  --ink: #16181C;
  --muted: #5F646E;
  --line: #D8D6D0;
  --accent: #B25E0C;          /* tungsten, dark enough to read on bone */
  --accent-ink: #FFFFFF;
  --accent-soft: #F7E9D8;
  --good: #1F7A4D;
  --good-soft: #E2F1E8;
  --bad: #B23A2F;
  --bad-soft: #F7E5E2;
  --film: #16181C;            /* the celluloid itself, both themes */
  --film-text: #F1EFE9;
  --sprocket: #0A0B0D;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0E1013;
    --surface: #191C22;
    --ink: #ECEDEF;
    --muted: #939AA6;
    --line: #2A2E35;
    --accent: #F2A73B;
    --accent-ink: #16181C;
    --accent-soft: #33260F;
    --good: #57C98A;
    --good-soft: #16301F;
    --bad: #E8776A;
    --bad-soft: #331D19;
    --film: #05070A;
    --film-text: #F1EFE9;
    --sprocket: #000000;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Archivo", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

.screen {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: calc(16px + env(safe-area-inset-top))
    calc(18px + env(safe-area-inset-right))
    calc(24px + env(safe-area-inset-bottom))
    calc(18px + env(safe-area-inset-left));
}
.hidden { display: none !important; }

h1, h2 { margin: 0; text-wrap: balance; }
h2 {
  font-family: "Big Shoulders Display", "Archivo", sans-serif;
  font-size: 1.5rem; font-weight: 700;
  letter-spacing: 0.01em; line-height: 1.1;
}
h3 {
  margin: 0 0 10px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--muted);
}
p { margin: 0; }
.muted { color: var(--muted); font-size: 0.92rem; }
.center { text-align: center; }
.prompt { font-size: 0.95rem; color: var(--muted); }
code {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.82em;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  word-break: break-all;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 18px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.small { font-size: 0.88rem; padding: 8px 14px; }
.btn.big {
  font-family: "Big Shoulders Display", "Archivo", sans-serif;
  font-size: 1.35rem; font-weight: 700;
  letter-spacing: 0.03em;
  padding: 14px 18px;
}
.btn:disabled { opacity: 0.4; cursor: default; }
.btn:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.cost {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78em;
  color: var(--accent);
  margin-left: 4px;
}

/* ── Panels & forms ──────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
input[type="text"], input[type="search"] {
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  width: 100%;
}
select {
  font-family: inherit;
  font-size: 1rem; /* under 16px iOS Safari zooms the page on focus */
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}
details summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
details p { margin: 12px 0 10px; }
details input { margin-bottom: 4px; }
details ol { margin: 10px 0 0; padding-left: 20px; font-size: 0.9rem; color: var(--muted); }
details li { margin-bottom: 8px; }

.error {
  background: var(--bad-soft);
  color: var(--bad);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.92rem;
}
.warn { color: var(--accent); font-size: 0.92rem; }
.health { color: var(--good); font-weight: 600; }

/* ── Home ────────────────────────────────────────────── */
.home-hero { text-align: center; padding: 22px 0 6px; }
.wordmark {
  font-family: "Big Shoulders Display", sans-serif;
  font-size: 3.4rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 16px;
  line-height: 0.95;
}
.tagline { color: var(--muted); margin-top: 10px; font-size: 0.95rem; }
.demo-link { margin-top: auto; align-self: center; color: var(--muted); }

/* ── Academy countdown leader ────────────────────────── */
.leader {
  position: relative;
  width: 168px; height: 168px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--film);
  overflow: hidden;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.3);
}
.leader.mark { width: 118px; height: 118px; }
.leader-sweep {
  position: absolute; inset: 0;
  background: conic-gradient(var(--accent) 0deg 42deg, transparent 42deg 360deg);
  opacity: 0.85;
}
.leader-cross {
  position: absolute; inset: 0;
  background:
    linear-gradient(to right, transparent calc(50% - 1px), rgba(241,239,233,0.5) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(to bottom, transparent calc(50% - 1px), rgba(241,239,233,0.5) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px));
}
.leader-cross::after {
  content: "";
  position: absolute;
  inset: 18%;
  border: 1px solid rgba(241, 239, 233, 0.35);
  border-radius: 50%;
}
.leader-num {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: "Big Shoulders Display", sans-serif;
  font-size: 4.4rem;
  font-weight: 800;
  color: var(--film-text);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}
.leader.mark .leader-num { font-size: 3.1rem; }
.leader.rolling .leader-sweep { animation: sweep 1s linear infinite; }
@keyframes sweep { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .leader.rolling .leader-sweep { animation: none; }
}

/* ── Header bars ─────────────────────────────────────── */
.bar { display: flex; align-items: center; gap: 12px; }
.bar h2 { flex: 1; }
.center-head { justify-content: center; text-align: center; }

/* ── Playlist picker ─────────────────────────────────── */
.deck-list { display: flex; flex-direction: column; gap: 8px; }
.deck-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px 10px 10px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  cursor: pointer;
}
.deck-art {
  width: 52px; height: 52px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--accent-soft);
}
.deck-art.liked {
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 1.3rem;
}
.deck-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deck-count {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ── Deck build ──────────────────────────────────────── */
.deck-name { text-align: center; font-weight: 600; font-size: 1.05rem; }
.progress {
  height: 8px;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.25s ease;
}

/* ── Table setup ─────────────────────────────────────── */
.player-row {
  display: grid;
  grid-template-columns: 40px 1fr 44px;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.color-dot {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 3px solid var(--line);
  cursor: pointer;
  padding: 0;
}
.player-x {
  font-size: 1.2rem;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  padding: 0;
}
.rule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-size: 0.98rem;
}
.rule-row.toggle input { width: 22px; height: 22px; accent-color: var(--accent); }

/* ── Pass screen ─────────────────────────────────────── */
.screen.pass { justify-content: center; text-align: center; }
.pass-inner { display: flex; flex-direction: column; gap: 18px; align-items: center; }
.pass-label {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.pass-name {
  font-family: "Big Shoulders Display", sans-serif;
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--pcolor, var(--accent));
  color: color-mix(in srgb, var(--pcolor, var(--accent)) 68%, var(--ink) 32%);
}
.scoreboard { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: 100%; }
.score-chip {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 5px 12px;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.score-chip.active { border-color: var(--pcolor, var(--accent)); }
.score-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pcolor, var(--accent)); }
.score-chip b { font-family: "IBM Plex Mono", ui-monospace, monospace; font-weight: 600; }
.score-chip .toks { color: var(--accent); }
.endgame { margin-top: 26px; color: var(--muted); }
#pass-start { width: 100%; }

/* ── Turn screen ─────────────────────────────────────── */
.turn-head { display: flex; align-items: baseline; justify-content: space-between; }
.turn-who {
  font-family: "Big Shoulders Display", sans-serif;
  font-size: 1.6rem; font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--pcolor, var(--accent));
  color: color-mix(in srgb, var(--pcolor, var(--accent)) 68%, var(--ink) 32%);
}
.toks {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  color: var(--accent);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}
.listen { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 4px 0; }
.listen .btn { min-width: 160px; }

.hint-strip { display: flex; flex-direction: column; gap: 6px; }
.hint-chip {
  display: flex; align-items: baseline; gap: 10px;
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.95rem;
}
.hint-chip .k {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
}
.hint-chip .v { font-weight: 600; }
.hint-chip .v.shape {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.1em;
}
.hint-buttons { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.turn-actions { margin-top: auto; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.turn-actions .btn.big { width: 100%; }

/* ── Challenge window ────────────────────────────────── */
.challenge-list { display: flex; flex-direction: column; gap: 8px; }
.challenge-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  cursor: pointer;
}
.challenge-row .name { flex: 1; text-align: left; font-weight: 600; }
.challenge-row .state { font-size: 0.85rem; color: var(--muted); }
.challenge-row.committed { border-color: var(--accent); }
.challenge-row.committed .state { color: var(--accent); font-weight: 600; }

/* ── Reveal: the title card ──────────────────────────── */
.title-card-wrap { perspective: 1000px; padding: 4px 0 2px; }
.title-card {
  position: relative;
  width: 100%;
  max-width: 340px;
  aspect-ratio: 16 / 10;
  margin: 0 auto;
  transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.4, 0, 0.2, 1);
}
.title-card.flipped { transform: rotateY(180deg); }
@media (prefers-reduced-motion: reduce) { .title-card { transition: none; } }
.tc-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 8px;
  background: var(--film);
  color: var(--film-text);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* sprocket holes down both edges: this is a strip of film */
  border-left: 13px solid var(--sprocket);
  border-right: 13px solid var(--sprocket);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.tc-face::before, .tc-face::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 13px;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0 7px,
    rgba(241, 239, 233, 0.82) 7px 15px,
    transparent 15px 22px);
  background-size: 7px 22px;
  background-repeat: repeat-y;
  background-position: center;
}
.tc-face::before { left: -13px; }
.tc-face::after { right: -13px; }
.tc-back-mark {
  font-family: "Big Shoulders Display", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: rgba(241, 239, 233, 0.35);
}
.tc-front {
  transform: rotateY(180deg);
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  text-align: center;
}
.reveal-art {
  width: 64px; height: 64px;
  border-radius: 4px;
  object-fit: cover;
  background: rgba(241, 239, 233, 0.1);
}
.reveal-movie {
  font-family: "Big Shoulders Display", sans-serif;
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-wrap: balance;
}
.reveal-meta {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.reveal-cue { font-size: 0.76rem; opacity: 0.62; font-style: italic; }

/* ── Judging ─────────────────────────────────────────── */
.judge-list { display: flex; flex-direction: column; gap: 8px; }
.judge-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.judge-row .who { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.95rem; }
.judge-row .who .tag {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.jbtn {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
}
.jbtn.yes.on { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.jbtn.no.on { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }

/* ── Game over: the reels ────────────────────────────── */
.over-hero { text-align: center; padding: 20px 0 2px; }
.superla { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.superla-chip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 0.85rem;
  color: var(--muted);
}
.superla-chip b { color: var(--ink); font-weight: 600; }
.final-reels { display: flex; flex-direction: column; gap: 16px; }
.reel-head {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; margin-bottom: 6px;
}
.reel-head .count {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.85rem;
}
.reel {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 10px;
  background: var(--film);
  border-radius: 6px;
  border-top: 8px solid var(--sprocket);
  border-bottom: 8px solid var(--sprocket);
  -webkit-overflow-scrolling: touch;
}
.reel:empty::after {
  content: "no films";
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: rgba(241, 239, 233, 0.4);
  padding: 12px 4px;
}
.frame {
  flex: 0 0 auto;
  width: 104px;
  background: rgba(241, 239, 233, 0.07);
  border-radius: 3px;
  padding: 7px;
  color: var(--film-text);
  text-align: center;
}
.frame img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 2px;
  display: block;
  margin-bottom: 6px;
  background: rgba(241, 239, 233, 0.12);
}
.frame .m { font-size: 0.68rem; line-height: 1.25; }
.frame .y {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.66rem;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}

/* ── Toast ───────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  border-radius: 99px;
  padding: 10px 20px;
  font-size: 0.9rem;
  max-width: 90vw;
  text-align: center;
  z-index: 50;
}
