/* Silent Scenes Digital – prototype v0.1
   Layout: one column, phone first; play controls live in the bottom half (thumb reach).
   Monochrome like the print cards; one restrained accent per category, never alone. */
@font-face { font-family: "SS Title"; src: url("fonts/Caladea-Bold.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "SS Body"; src: url("fonts/Carlito-Regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "SS Body"; src: url("fonts/Carlito-Bold.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "SS Body"; src: url("fonts/Carlito-Italic.woff") format("woff"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --paper: #fcfcfb;
  --ink: #141414;
  --ink-2: #4d4c49;
  --line: #d6d5d0;
  --surface: #f1f1ee;
  --ok: #1f6b3a;
  --focus: #1d5fd1;
  --f-title: "SS Title", Cambria, Georgia, "Times New Roman", serif;
  --f-body: "SS Body", Calibri, "Segoe UI", system-ui, -apple-system, sans-serif;
  --fs: 1;              /* text size multiplier (setting) */
  --radius: 16px;
  --tap: 52px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f0f10; --ink: #f2f0ea; --ink-2: #b9b6ae; --line: #3a3a3f; --surface: #1b1b1e; --ok: #6fcf8f; --focus: #8ab4ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"], :root[data-stage="on"] {
  --paper: #0f0f10; --ink: #f2f0ea; --ink-2: #b9b6ae; --line: #3a3a3f; --surface: #1b1b1e; --ok: #6fcf8f; --focus: #8ab4ff;
  color-scheme: dark;
}
:root[data-textsize="large"] { --fs: 1.18; }

/* category accent: light value by default, dark value whenever the dark palette applies */
.catx { --catc: var(--cat-l, var(--ink)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .catx { --catc: var(--cat-d, var(--ink)); } }
:root[data-theme="dark"] .catx, :root[data-stage="on"] .catx { --catc: var(--cat-d, var(--ink)); }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--f-body); font-size: calc(17px * var(--fs)); line-height: 1.4;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}
.app {
  min-height: 100%; display: flex; flex-direction: column;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: max(12px, env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-bottom, 0px));
  max-width: 560px; margin-inline: auto;
}
.screen { flex: 1; display: flex; flex-direction: column; gap: 18px; min-height: 0; }
h1, h2, h3 { font-family: var(--f-title); font-weight: 700; margin: 0; text-wrap: balance; line-height: 1.12; }
h1 { font-size: calc(34px * var(--fs)); }
h2 { font-size: calc(26px * var(--fs)); }
h3 { font-size: calc(19px * var(--fs)); }
p { margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: calc(14px * var(--fs)); }
.label {
  font-family: var(--f-body); font-weight: 700; font-size: calc(12px * var(--fs));
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2);
}
.spacer { flex: 1; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* top bar */
.bar { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.bar .title { flex: 1; min-width: 0; font-weight: 700; }
.iconbtn {
  min-width: 44px; min-height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: transparent; color: var(--ink); font: inherit; font-size: calc(15px * var(--fs));
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; cursor: pointer;
}

/* buttons */
.btn {
  min-height: var(--tap); border-radius: var(--radius); border: 2px solid var(--ink);
  background: var(--ink); color: var(--paper); font: inherit; font-weight: 700;
  font-size: calc(19px * var(--fs)); padding: 10px 20px; cursor: pointer; width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-align: center;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.btn.secondary { background: transparent; color: var(--ink); }
.btn.quiet { background: var(--surface); border-color: var(--surface); color: var(--ink); }
.btn.big { min-height: 76px; font-size: calc(24px * var(--fs)); }
.btn:disabled { opacity: .38; cursor: default; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btnrow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btnrow.wide-right { grid-template-columns: 1fr 1.6fr; }

/* home */
.home-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding-top: 6vh; }
.home-hero h1 { font-size: calc(46px * var(--fs)); letter-spacing: .01em; }
.wordmark-kicker { font-weight: 700; letter-spacing: .32em; font-size: 12px; text-transform: uppercase; color: var(--ink-2); }
.iconstrip { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 10px; color: var(--ink); }
.iconstrip svg { width: 30px; height: 30px; }
.foot { text-align: center; font-size: calc(13px * var(--fs)); color: var(--ink-2); padding-top: 6px; }

/* choice tiles */
.tile {
  display: grid; grid-template-columns: 48px 1fr; gap: 4px 14px; align-items: start; text-align: left;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: transparent;
  color: var(--ink); font: inherit; cursor: pointer; width: 100%;
}
.tile svg { grid-row: span 2; width: 44px; height: 44px; }
.tile strong { font-family: var(--f-title); font-size: calc(21px * var(--fs)); }
.tile span { color: var(--ink-2); font-size: calc(15px * var(--fs)); }
.tile[aria-pressed="true"] { border: 2px solid var(--ink); padding: 15px; background: var(--surface); }

/* form bits */
fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button {
  min-height: 44px; min-width: 56px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--ink); font: inherit; font-size: calc(16px * var(--fs)); cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); font-weight: 700; }
input[type="text"] {
  min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  font: inherit; padding: 0 14px; width: 100%; min-width: 0;
}
.catpick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.catbtn {
  display: flex; align-items: center; gap: 10px; min-height: 56px; border-radius: 14px; border: 1px solid var(--line);
  background: transparent; color: var(--ink); font: inherit; font-size: calc(15px * var(--fs)); text-align: left;
  padding: 8px 10px; cursor: pointer; line-height: 1.15;
}
.catbtn svg { width: 28px; height: 28px; flex: none; color: var(--catc); }
.catbtn .n { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: calc(13px * var(--fs)); }
.catbtn[aria-pressed="true"] { border: 2px solid var(--catc); padding: 7px 9px; background: var(--surface); }
.catbtn[aria-pressed="false"] { opacity: .55; }
.catbtn[aria-pressed="false"] .lbl { text-decoration: line-through; }
.switchrow { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 52px; border-bottom: 1px solid var(--line); }
.switchrow label { flex: 1; min-width: 0; }
.toggle {
  appearance: none; -webkit-appearance: none; width: 54px; height: 32px; border-radius: 999px; background: var(--line);
  position: relative; flex: none; cursor: pointer; border: 0; margin: 0;
}
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: var(--paper); transition: left .15s; }
.toggle:checked { background: var(--ink); }
.toggle:checked::after { left: 25px; }
.count { font-variant-numeric: tabular-nums; font-weight: 700; }
.warn { color: var(--ink); background: var(--surface); border-radius: 12px; padding: 12px 14px; }
.sticky-foot {
  position: sticky; bottom: 0; padding-top: 10px; padding-bottom: max(4px, env(safe-area-inset-bottom, 0px));
  background: var(--paper); box-shadow: 0 -10px 12px -6px var(--paper); z-index: 2;
}
[tabindex="-1"]:focus { outline: none; }
.lede { font-size: calc(18px * var(--fs)); color: var(--ink-2); max-width: 22em; }

/* the card (mirrors the printed front) */
.card {
  border: 1px solid var(--line); border-radius: 20px; padding: 16px 18px 14px; background: var(--paper);
  display: flex; flex-direction: column; gap: 12px; min-width: 0;
}
.card-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1.5px solid var(--ink); }
.card-head svg { width: 24px; height: 24px; flex: none; color: var(--ink); }
.card-head .lbl { flex: 1; min-width: 0; font-weight: 700; font-size: calc(12.5px * var(--fs)); letter-spacing: .1em; text-transform: uppercase; }
.card-title { font-family: var(--f-title); font-size: calc(33px * var(--fs)); line-height: 1.08; text-wrap: balance; overflow-wrap: anywhere; }
.card-context { font-style: italic; color: var(--ink-2); font-size: calc(17px * var(--fs)); margin-top: -4px; }
.card ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.card li { position: relative; padding-left: 20px; font-size: calc(19px * var(--fs)); line-height: 1.3; }
.card li::before { content: "•"; position: absolute; left: 2px; }
.card-foot { border-top: 1px dotted var(--ink-2); padding-top: 8px; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: calc(14px * var(--fs)); }
.card-foot .ref { grid-column: 1 / -1; font-size: calc(16px * var(--fs)); }
.card-foot .id, .card-foot .copy { color: var(--ink-2); font-size: calc(12px * var(--fs)); }
.card .accent-rule { height: 3px; border-radius: 3px; background: var(--catc); width: 56px; }

.dots { display: inline-flex; gap: 5px; flex: none; }
.dots i { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--ink); display: block; }
.dots i.on { background: var(--ink); }

/* hand-over */
.handover { text-align: center; align-items: center; justify-content: center; }
.cardback {
  width: min(52vw, 210px); aspect-ratio: 63 / 88; max-width: 100%; border: 1.5px solid var(--ink); border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 12px;
}
.cardback svg { width: 46%; height: auto; }
.cardback .k { font-weight: 700; letter-spacing: .26em; font-size: 10px; text-transform: uppercase; }
.team-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-weight: 700; }

/* stage view (what the team sees) */
.stage-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 700; }
.stage-top .tally { font-variant-numeric: tabular-nums; }
.clue { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; min-height: 0; }
.ring { position: relative; width: min(68vw, 40vh, 300px); aspect-ratio: 1; max-width: 100%; }
.ring > svg.track { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track circle { fill: none; stroke-width: 5; }
.ring .track .bg { stroke: var(--line); }
.ring .track .fg { stroke: var(--catc); stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.ring .inner { position: absolute; inset: 14%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.ring .inner svg { width: 54%; height: auto; color: var(--ink); }
.clock { font-variant-numeric: tabular-nums; font-weight: 700; font-size: calc(40px * var(--fs)); line-height: 1; }
.clock.low { color: var(--catc); }
.clue h2 { font-size: calc(30px * var(--fs)); }
.clue .catno { font-weight: 700; letter-spacing: .16em; text-transform: uppercase; font-size: calc(13px * var(--fs)); color: var(--catc); }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--paper); border-radius: 12px; padding: 10px 16px; font-weight: 700; z-index: 50;
  max-width: calc(100% - 32px); text-align: center;
}
.overlay {
  position: fixed; inset: 0; z-index: 30; background: var(--paper); overflow: auto;
  padding: max(12px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(14px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.overlay > .inner { max-width: 560px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; gap: 14px; }
.flash { position: fixed; inset: 0; pointer-events: none; z-index: 40; background: var(--catc); opacity: 0; }
.flash.go { animation: flash .5s ease-out; }
@keyframes flash { 0% { opacity: .35 } 100% { opacity: 0 } }

/* category die */
.die-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; justify-content: center; flex: 1; text-align: center; }
.die { width: 120px; height: 120px; border: 3px solid var(--ink); border-radius: 22px; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 14px; }
.die i { width: 20px; height: 20px; border-radius: 50%; background: var(--ink); place-self: center; visibility: hidden; }
.die i.on { visibility: visible; }
.die.rolling { animation: roll .7s cubic-bezier(.3,.7,.4,1); }
@keyframes roll { 0% { transform: rotate(-200deg) scale(.6); } 70% { transform: rotate(12deg) scale(1.05); } 100% { transform: rotate(0) scale(1); } }

/* summary / end */
.list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.list .item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); min-height: 56px; }
.list .item svg { width: 26px; height: 26px; flex: none; color: var(--catc); }
.list .item .t { flex: 1; min-width: 0; }
.list .item .t b { font-family: var(--f-title); font-size: calc(18px * var(--fs)); display: block; }
.list .item .pts { font-variant-numeric: tabular-nums; font-weight: 700; }
.bible { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: calc(15px * var(--fs)); color: var(--ink-2); }
.bible input { width: 24px; height: 24px; accent-color: var(--ink); }
.scoreboard { display: flex; flex-direction: column; gap: 8px; }
.scoreboard .s { display: flex; align-items: baseline; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface); }
.scoreboard .s .rank { font-variant-numeric: tabular-nums; color: var(--ink-2); width: 1.4em; }
.scoreboard .s .nm { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.scoreboard .s .pts { font-variant-numeric: tabular-nums; font-family: var(--f-title); font-size: calc(26px * var(--fs)); }
.scoreboard .s.lead { background: var(--ink); color: var(--paper); }
.scoreboard .s.lead .rank { color: var(--paper); }
.reveal { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.reveal .card-title { font-size: calc(36px * var(--fs)); }

/* forehead (landscape-first) */
.fh { position: fixed; inset: 0; z-index: 20; background: var(--paper); display: grid; grid-template-columns: minmax(64px, 16%) 1fr minmax(64px, 16%); }
.fh .zone {
  border: 0; background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; font-size: calc(18px * var(--fs));
  display: flex; align-items: center; justify-content: center; writing-mode: vertical-rl; cursor: pointer;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
.fh .zone.left { padding-left: env(safe-area-inset-left, 0px); transform: rotate(180deg); }
.fh .zone.right { padding-right: env(safe-area-inset-right, 0px); background: var(--ink); color: var(--paper); }
.fh .mid { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 10px; padding: max(10px, env(safe-area-inset-top, 0px)) 14px max(10px, env(safe-area-inset-bottom, 0px)); min-width: 0; overflow: hidden; }
.fh .fh-title { font-family: var(--f-title); font-size: clamp(30px, 9vmin, 64px); line-height: 1.05; text-wrap: balance; overflow-wrap: anywhere; }
.fh .fh-hints { font-size: calc(15px * var(--fs)); color: var(--ink-2); max-width: 46em; }
.fh .fh-top { display: flex; gap: 14px; align-items: center; font-weight: 700; justify-content: center; flex-wrap: wrap; }
.fh .fh-top svg { width: 26px; height: 26px; }
.fh .big-count { font-family: var(--f-title); font-size: clamp(60px, 30vmin, 180px); line-height: 1; }
.fh .state { font-family: var(--f-title); font-size: clamp(40px, 16vmin, 110px); }
.rotate-hint { display: none; }
@media (orientation: portrait) { .fh .rotate-hint { display: block; } }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (orientation: landscape) and (max-height: 520px) {
  .app { max-width: 920px; }
  .sticky-foot { position: static; box-shadow: none; }
  [data-screen="stage"] { display: grid; grid-template-columns: 1.2fr 1fr; grid-template-rows: auto 1fr auto auto; gap: 10px 20px; }
  [data-screen="stage"] .stage-top { grid-column: 1 / -1; }
  [data-screen="stage"] .clue { grid-column: 1; grid-row: 2 / 5; }
  [data-screen="stage"] #peek { grid-column: 2; grid-row: 3; }
  [data-screen="stage"] .btnrow { grid-column: 2; grid-row: 4; }
  [data-screen="stage"] #nextactor { grid-column: 2; grid-row: 2; align-self: end; justify-self: start; }
  [data-screen="stage"] .btn.big { min-height: 64px; }
  .ring { width: min(56vh, 220px); }
  .clue { flex-direction: row; gap: 24px; }
  .clue .txt { text-align: left; }
  .home-hero { padding-top: 0; }
  .card-title { font-size: calc(28px * var(--fs)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
