:root {
  color-scheme: dark;
  --night: oklch(.21 .04 200); --stone: oklch(.29 .045 200); --ink: oklch(.13 .03 200);
  --cream: oklch(.96 .03 90); --muted: oklch(.80 .04 190);
  --gold: oklch(.84 .15 88); --torch: oklch(.72 .18 48); --jade: oklch(.76 .12 172); --danger: oklch(.66 .21 27);
  --shadow: 0 4px 0 var(--ink); --ease: cubic-bezier(.22,1,.36,1);
  --z-top: 10; --z-settings: 20; --z-toast: 30; --z-reaction: 40;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; font: 400 16px/1.5 Kanit, sans-serif; color: var(--cream); background-color: var(--night); background-image: radial-gradient(ellipse at 50% 0, oklch(.72 .18 48 / .16), transparent 55%), radial-gradient(circle, oklch(.96 .03 90 / .06) 1px, transparent 1px); background-size: 100% 100%, 22px 22px; background-attachment: fixed; }
h1, h2, p { margin: 0; overflow-wrap: anywhere; }
h1, h2 { text-wrap: balance; line-height: 1.3; }
h1 { font-size: 32px; font-weight: 900; } h2 { font-size: 24px; }
button, input { font: inherit; color: var(--ink); }
button { min-width: 44px; min-height: 44px; padding: 9px 16px; background: var(--cream); border: 3px solid var(--ink); box-shadow: var(--shadow); border-radius: 999px; cursor: pointer; font-weight: 600; transition: transform 160ms var(--ease), box-shadow 160ms var(--ease); overflow-wrap: anywhere; }
button:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
button:hover:not(:disabled) { background: var(--gold); }
button:disabled { cursor: default; background: var(--stone); color: var(--muted); box-shadow: none; border-style: dashed; border-color: var(--muted); }
button.primary { background: var(--torch); font-weight: 700; }
button.primary:disabled { background: var(--stone); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
input { min-width: 0; width: 100%; min-height: 52px; padding: 10px 14px; font-size: 18px; background: var(--cream); border: 3px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow); }
input::placeholder { color: oklch(.45 .04 200); opacity: 1; }
img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.setup { width: 100%; max-width: 560px; margin: auto; padding: 24px 18px; }
.home { padding-top: max(20px, env(safe-area-inset-top)); padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.home-heading, .room-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sticker { background: var(--gold); color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 600; }
.hero { text-align: center; padding-top: 16px; }
.hero-art { display: block; width: 100%; aspect-ratio: 3/2; border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 6px 0 var(--ink); background: var(--stone); overflow: hidden; }
.hero h1 { margin-top: 18px; font-size: clamp(48px, 15vw, 72px); line-height: 1.05; letter-spacing: -.02em; color: var(--gold); text-shadow: 3px 3px 0 var(--ink); }
.hero h2 { margin-top: 8px; font-size: 26px; }
.hero p { margin-top: 4px; color: var(--muted); }
.home form { display: grid; gap: 14px; margin-top: 20px; text-align: center; }
.join { display: flex; gap: 10px; align-items: center; } .join button { flex-shrink: 0; }
.join input { text-transform: uppercase; letter-spacing: .15em; }
.start { width: 100%; min-height: 58px; font-size: 22px; }
.how { margin-top: 26px; border-top: 2px dashed var(--muted); border-bottom: 2px dashed var(--muted); }
summary { min-height: 48px; padding: 12px 0; cursor: pointer; font-weight: 600; }
.how ol { margin: 0 0 16px; padding-left: 26px; } .how li { margin: 8px 0; }
.game { max-width: 720px; min-height: 100dvh; margin: auto; padding-bottom: calc(var(--action-height, 0px) + 24px); }
.topbar { position: sticky; top: 0; z-index: var(--z-top); padding: max(8px, env(safe-area-inset-top)) 14px 8px; background: var(--night); border-bottom: 2px solid var(--ink); box-shadow: 0 4px 0 oklch(.13 .03 200 / .4); }
.wordmark { font-size: 18px; font-weight: 900; line-height: 1; background: var(--gold); padding: 6px 14px; }
.room-pill { margin-left: auto; background: var(--jade); letter-spacing: .08em; }
.stats { font-size: 24px; padding: 8px 0 0; color: var(--gold); }
.instruction { font-size: 15px; color: var(--muted); }
.players { display: flex; gap: 8px; overflow-x: auto; padding: 8px 1px 6px; scrollbar-width: none; }
.player-chip { flex: 0 0 auto; display: grid; grid-template-columns: auto auto; align-items: center; gap: 0 6px; max-width: 170px; padding: 3px 10px 3px 3px; border: 2px solid var(--ink); border-radius: 999px; background: var(--stone); }
.avatar { grid-row: 1 / 3; display: grid; place-items: center; width: 36px; height: 36px; font-size: 22px; background: var(--cream); border: 2px solid var(--ink); border-radius: 50%; }
.player-name, .player-status { font-size: 12px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-status { color: var(--gold); font-weight: 600; } .player-status:empty { display: none; }
.player-chip:has(.player-status:empty) .player-name { grid-row: 1 / 3; }
.player-chip.active .avatar { box-shadow: 0 0 0 3px var(--torch); }
.player-chip.camp { background: var(--night); border-style: dashed; border-color: var(--muted); } .camp .player-status { color: var(--jade); }
.player-chip.caught { background: oklch(.35 .12 27); } .caught .player-status { color: var(--cream); }
.offline .avatar { border-style: dashed; opacity: .6; }
.ticket { display: flex; flex-direction: column; align-items: center; width: 100%; margin: 8px 0 24px; padding: 18px; border-radius: 22px; background: var(--gold); transform: rotate(-1.5deg); }
.ticket strong { font-size: 52px; font-weight: 900; letter-spacing: .12em; }
.ticket small { font-size: 16px; } .ticket span { font-size: 15px; }
.waiting { text-align: center; margin: 14px 0; }
.table { padding: 10px 14px 0; text-align: center; }
.news { min-height: 24px; font-weight: 600; color: var(--jade); }
.stage { display: grid; justify-items: center; gap: 2px; padding: 8px 0 10px; perspective: 800px; }
.stage-art { display: block; width: min(48vw, 200px); aspect-ratio: 1; }
.stage-tile, .path-tile { position: relative; display: block; width: 100%; aspect-ratio: 1; border: 3px solid var(--ink); border-radius: 20px; overflow: hidden; background: var(--stone); box-shadow: 0 6px 0 var(--ink); }
.stage-tile.hazard { border-color: var(--danger); box-shadow: 0 6px 0 var(--ink), 0 0 0 3px var(--ink); }
.stage-tile b, .path-tile b { position: absolute; right: 0; bottom: 0; min-width: 2ch; padding: 0 10px; border: 3px solid var(--ink); border-width: 3px 0 0 3px; border-radius: 16px 0 0 0; background: var(--gold); color: var(--ink); font-size: 36px; font-weight: 900; line-height: 1.25; text-align: center; }
.caption { font-size: 26px; font-weight: 900; margin-top: 10px; color: var(--gold); }
.detail { color: var(--muted); }
.stage.bust .caption { color: var(--danger); } .stage.bust .stage-tile { transform: rotate(-3deg); }
.stage.empty .stage-art { opacity: .35; filter: grayscale(.6); }
.path { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 4px 0 10px; }
.path-tile { width: 44px; border-width: 2px; border-radius: 10px; box-shadow: 0 2px 0 var(--ink); }
.path-tile b { font-size: 15px; padding: 0 4px; border-width: 2px 0 0 2px; border-radius: 8px 0 0 0; }
.path-tile.hazard { border-color: var(--danger); } .path-tile.twice { outline: 3px solid var(--danger); outline-offset: 1px; }
.info { font-size: 14px; color: var(--muted); }
.mine { width: fit-content; max-width: 100%; margin: 10px auto 0; padding: 6px 16px; border: 2px solid var(--ink); border-radius: 999px; background: var(--stone); font-weight: 600; }
.scores { list-style: none; margin: 0; padding: 14px; display: grid; gap: 10px; }
.scores li { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 0 10px; padding: 10px 14px; border: 3px solid var(--ink); border-radius: 16px; background: var(--stone); box-shadow: var(--shadow); }
.scores .rank { grid-row: 1 / 3; font-size: 22px; font-weight: 900; text-align: center; }
.scores .who { font-weight: 600; overflow-wrap: anywhere; } .scores .haul { grid-column: 2; font-size: 14px; color: var(--muted); }
.scores strong { grid-column: 3; grid-row: 1 / 3; font-size: 34px; font-weight: 900; line-height: 1; color: var(--gold); }
.scores .winner { background: var(--gold); color: var(--ink); transform: rotate(-1deg); } .winner .haul { color: var(--ink); } .winner strong { color: var(--ink); }
.actions { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 720px; z-index: var(--z-top); padding: 8px 12px max(8px, env(safe-area-inset-bottom)); text-align: center; background: var(--night); border-top: 2px solid var(--ink); }
.game[data-phase=lobby] .actions { display: none; }
.actions > button { margin: 2px; } .actions > .start { margin: 0; min-height: 52px; font-size: 20px; }
.action-status { min-height: 28px; padding: 2px; color: var(--muted); font-size: 15px; } .action-status:empty { display: none; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice { display: grid; align-content: center; min-height: 64px; padding: 6px 8px; border-radius: 18px; font-size: 19px; font-weight: 700; line-height: 1.25; }
.choice small { font-size: 13px; font-weight: 500; }
.choice.leave { background: var(--jade); }
.choice[aria-pressed=true] { outline: 4px solid var(--cream); outline-offset: 2px; transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.choices:has([aria-pressed=true]) .choice[aria-pressed=false] { opacity: .55; }
.action-social { display: flex; align-items: center; justify-content: center; gap: 6px; }
button.quiet { background: var(--cream); font-size: 14px; }
.reactions { display: flex; justify-content: center; gap: 4px; padding: 6px 0 0; min-width: 0; } .reactions button { padding: 4px; font-size: 22px; box-shadow: none; border-width: 2px; background: var(--stone); }
.host-menu { position: relative; flex-shrink: 0; font-size: 13px; }
.host-menu summary { min-height: 44px; padding: 12px 4px; list-style: none; }
.host-items { position: absolute; right: 0; bottom: 100%; width: 230px; display: grid; gap: 8px; }
.settings-wrap { position: relative; flex: 0 0 44px; } .sound { padding: 4px; width: 44px; }
.settings { position: absolute; z-index: var(--z-settings); top: calc(100% + 8px); right: 0; width: min(300px, calc(100vw - 36px)); display: grid; gap: 14px; padding: 14px; border: 3px solid var(--ink); border-radius: 16px; box-shadow: var(--shadow); background: var(--stone); }
.settings-row { display: flex; align-items: center; gap: 10px; } .settings-row input { min-width: 0; font-size: 16px; }
.settings-row input[type=range] { min-height: 44px; padding: 0; border: 0; box-shadow: none; background: transparent; accent-color: var(--gold); }
.settings-value { min-width: 4ch; } .settings-row button { padding: 8px; flex-shrink: 0; }
.connection { position: sticky; top: 0; z-index: var(--z-toast); background: var(--gold); color: var(--ink); text-align: center; padding: 8px; } .connection:empty { display: none; }
.toast { position: fixed; bottom: calc(var(--action-height, 0px) + 12px); left: 50%; transform: translateX(-50%); z-index: var(--z-toast); width: max-content; max-width: calc(100vw - 32px); border: 3px solid var(--ink); border-radius: 16px; padding: 12px 18px; background: var(--gold); color: var(--ink); box-shadow: var(--shadow); text-align: center; } .toast:empty { display: none; }
.floating-emoji { position: fixed; z-index: var(--z-reaction); pointer-events: none; font-size: 42px; }
.confetti { position: fixed; inset: 0; z-index: var(--z-reaction); pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; width: 10px; height: 16px; top: 15%; border: 1px solid var(--ink); }
/* In play the header gives its height to the table: the round takes the wordmark's place. */
.game:not([data-phase=lobby]) .topbar { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; }
.game:not([data-phase=lobby]) .room-controls { grid-column: 2; grid-row: 1; }
.game:not([data-phase=lobby]) .wordmark { display: none; }
.game:not([data-phase=lobby]) .stats { grid-column: 1; grid-row: 1; align-self: center; padding: 0; }
.game:not([data-phase=lobby]) :is(.players, .instruction) { grid-column: 1 / -1; }
@media (max-height: 700px) { .stage-art { width: min(40vw, 170px); } .caption { font-size: 22px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
