:root {
  color-scheme: light;
  --table: oklch(.91 .15 95); --ink: oklch(.24 .04 280); --white: oklch(.99 .005 95);
  --blue: oklch(.48 .18 260); --red: oklch(.49 .19 25); --green: oklch(.43 .12 150); --pink: oklch(.75 .16 0);
  --shadow: 0 4px 0 var(--ink); --ease: cubic-bezier(.22,1,.36,1);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; background: var(--table); background-image: radial-gradient(ellipse, #24203920 1px, transparent 1.5px); background-size: 22px 22px; color: var(--ink); font: 400 17px/1.5 Kanit, sans-serif; }
h1, h2, p { margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(26px, 6vw, 36px); line-height: 1.25; text-wrap: balance; }
h2 { font-size: 23px; line-height: 1.4; }
button, input { font: inherit; color: inherit; }
button { min-height: 48px; min-width: 44px; border: 3px solid var(--ink); border-radius: 999px; padding: 9px 18px; background: var(--white); box-shadow: var(--shadow); cursor: pointer; font-weight: 500; transition: transform 160ms var(--ease), box-shadow 160ms var(--ease); }
button:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
button:disabled { cursor: default; }
button:disabled:not(.clue-tap) { background: #e6e2d4; color: #5b5665; box-shadow: 0 2px 0 var(--ink); }
button.primary { background: var(--blue); color: white; font-weight: 600; }
button.positive { background: var(--green); color: white; }
button.negative { background: var(--red); color: white; }
button.quiet { box-shadow: none; background: transparent; border-width: 2px; }
button.start { width: 100%; min-height: 56px; font-size: 22px; }
:focus-visible { outline: 4px solid var(--blue); outline-offset: 4px; }
input { width: 100%; min-width: 0; min-height: 56px; padding: 12px 16px; border: 3px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow); background: var(--white); font-size: 20px; }
input::placeholder { color: #65616c; opacity: 1; }
.setup, .room { margin: auto; width: 100%; min-width: 0; padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); }
.setup { max-width: 560px; min-height: 100dvh; }
.room { max-width: 720px; min-height: 100dvh; }
header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
header strong { font-size: 25px; transform: rotate(-3deg); }
.eyebrow { font-size: 15px; font-weight: 600; }
.hero { text-align: center; }
.hero h1 { font-size: clamp(58px, 15vw, 86px); letter-spacing: -.07em; transform: rotate(-4deg); }
.hero p { max-width: 320px; margin: 12px auto; font-size: 21px; }
.art { overflow: hidden; background: #fff5bf; border-radius: 22px; }
.art img { width: 100%; height: 100%; object-fit: contain; display: block; }
.hero-art { aspect-ratio: 3 / 2; margin: 20px auto; border: 3px solid var(--ink); box-shadow: var(--shadow); }
.home form { display: grid; gap: 16px; margin: 24px 0; }
.join { display: flex; gap: 10px; }
.join button { flex-shrink: 0; }
.muted { color: #524752; font-size: 16px; }
.how { padding: 0 16px; border: 3px solid var(--ink); border-radius: 16px; background: #fff8d8; margin: 22px 0; text-align: left; box-shadow: var(--shadow); }
summary { cursor: pointer; padding: 12px 0; min-height: 48px; }
.how ol { padding-left: 24px; margin: 0 0 16px; }
.how li { padding: 5px 0; }
.settings-wrap { position: relative; flex: 0 0 48px; }
.sound { width: 48px; padding: 4px; }
.settings { position: absolute; z-index: 20; right: 0; top: calc(100% + 10px); width: min(290px, calc(100vw - 40px)); padding: 16px; display: grid; gap: 14px; background: var(--white); border: 3px solid var(--ink); border-radius: 18px; box-shadow: var(--shadow); }
.settings-row { display: flex; gap: 8px; align-items: center; }
.settings-row input { min-height: 48px; font-size: 16px; padding: 6px; }
.settings-row input[type=range] { border: 0; box-shadow: none; padding: 0; accent-color: var(--blue); }
.settings-row button { flex-shrink: 0; padding: 6px 10px; }
.settings-value { min-width: 4ch; }
.ticket { display: flex; flex-direction: column; align-items: center; background: var(--pink); border-radius: 18px; width: 100%; transform: rotate(-2deg); padding: 18px; margin: 24px 0; }
.ticket strong { letter-spacing: .12em; font-size: 52px; }
.ticket small { font-size: 17px; }
.lobby { max-width: 520px; margin: auto; text-align: center; }
.waiting-copy { margin-top: 16px; }
/* Everyone stays visible: 5 per row, two rows for a full room of 10. */
.players { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 10px 4px; padding: 8px 0 14px; }
.player { text-align: center; min-width: 0; }
.avatar { display: grid; place-items: center; margin: auto; width: 38px; height: 38px; border: 3px solid var(--ink); border-radius: 50%; background: var(--white); font-weight: 600; box-shadow: var(--shadow); }
.player.submitted .avatar { background: #ccefcf; }
.player-name { display: block; font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; margin-top: 5px; }
.player-state { display: block; font-size: 12px; }
.offline .avatar { background: #dfdbce; }
.game { display: flex; flex-direction: column; align-items: stretch; gap: 18px; }
.score { text-align: center; font-size: 16px; }
.deck { display: grid; grid-template-columns: repeat(13,minmax(0,1fr)); gap: 4px; width: 100%; max-width: 520px; margin: -8px auto 0; }
.pip { display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 5px; min-height: 32px; font-size: 15px; font-weight: 700; background: var(--white); box-shadow: 0 2px 0 var(--ink); }
.pip.scored { background: var(--green); color: white; }
.pip.lost { background: var(--red); color: white; }
/* The card in play: the first one still in the deck. */
.pip.left:not(.pip.left ~ .pip.left) { animation: current 1.2s ease-in-out infinite; outline: 3px solid var(--blue); outline-offset: 1px; }
.instruction { text-align: center; font-size: clamp(24px, 5.5vw, 30px); }
.word-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; background: var(--white); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 5px 5px 0 var(--ink); min-height: 138px; padding: 20px; transform: rotate(-1deg); }
.word-card small { font-size: 16px; }
.word-card strong { font-size: clamp(28px, 7vw, 40px); overflow-wrap: anywhere; line-height: 1.3; }
.rules { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.rules span { border: 2px solid var(--ink); border-radius: 999px; padding: 3px 10px; background: #fff8d8; font-size: 14px; }
.waiting { text-align: center; }
.guesser-art { aspect-ratio: 1; max-width: 260px; margin: 0 auto 18px; animation: breathe 3s ease-in-out infinite; }
.waiting h2 { margin: 8px 0; }
.clue-form { display: grid; gap: 22px; }
.easel { position: relative; background: var(--white); border: 3px solid var(--ink); border-radius: 12px 12px 4px 4px; box-shadow: 3px 7px 0 #242039; transform: rotate(var(--tilt, -1deg)); min-width: 0; }
.easel::after { content: ''; position: absolute; bottom: -11px; left: -5px; right: -5px; height: 9px; background: #d9d6cc; border: 2px solid var(--ink); border-radius: 3px; }
.writing { padding: 14px; }
.writing input { font: 600 27px/1.4 Mali, cursive; text-align: center; border: 0; border-bottom: 2px dashed #888; border-radius: 0; box-shadow: none; color: var(--blue); padding: 18px 0; }
.author { display: block; font: 400 15px/1.5 Kanit, sans-serif; color: var(--ink); margin-top: 10px; overflow-wrap: anywhere; }
.writing .author { text-align: center; }
.written { display: flex; align-items: center; flex-direction: column; gap: 12px; background: var(--white); border: 3px solid var(--ink); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); }
.marker { position: relative; display: block; font: 600 clamp(23px, 5vw, 32px)/1.5 Mali, cursive; color: var(--marker, var(--blue)); overflow-wrap: anywhere; }
.board { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px 15px; padding: 6px 3px 14px; }
.clue-tap { display: flex; flex-direction: column; justify-content: center; width: 100%; height: 100%; min-height: 152px; padding: 18px 8px 12px; border: 0; border-radius: 9px; box-shadow: none; background: transparent; }
.clue-tap .marker, .clue-tap .author, .clue-status { width: 100%; }
.clue-status { display: block; font-size: 14px; color: var(--ink); margin-top: 4px; }
.cancelled .marker::after { content: ''; position: absolute; left: 0; right: 0; top: 46%; height: 8px; border-top: 4px solid var(--red); border-bottom: 3px solid var(--red); transform: rotate(-8deg); }
.cancelled .clue-status { color: var(--red); font-weight: 600; }
.cancelled { background: #fff0e9; }
.auto .marker::after { animation: strike 600ms var(--ease) both; }
.guess-form { display: grid; gap: 22px; }
/* The one thing to press stays in thumb reach even when the clues run past the fold. */
.game > button.start, .clue-form > button.primary, .guess-form > button.primary { position: sticky; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 5; }
.result-clues { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 20px 10px; } .result-clues .clue-tap { min-height: 104px; padding: 10px 4px 8px; } .result-clues .marker { font-size: 20px; }
.judgment { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.judgment p { grid-column: 1/-1; padding: 16px; border: 3px solid var(--ink); border-radius: 16px; background: var(--white); font-size: 23px; text-align: center; }
.judgment button { min-height: 64px; font-size: 21px; }
.result { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; padding: 12px 0; }
.reveal-word { display: block; font-size: clamp(32px,8vw,48px); line-height: 1.4; overflow-wrap: anywhere; }
.reveal-guess { font-size: 22px; }
.stamp { border: 5px double currentColor; border-radius: 10px; padding: 8px 18px; transform: rotate(-6deg); color: var(--ink); }
.stamp.correct { color: var(--green); }
.stamp.wrong { color: var(--red); }
.revealing .reveal-guess { animation: pop-in 300ms both; }
.revealing .reveal-word { animation: pop-in 450ms 500ms both; }
.revealing .stamp { animation: slam 400ms 1050ms both; }
.result-clues { animation: pop-in 400ms 1500ms both; }
.over { display: flex; flex-direction: column; align-items: stretch; text-align: center; gap: 20px; }
.final-score { font-size: clamp(68px,19vw,110px); line-height: 1.1; color: var(--blue); }
.over > p { font-size: 23px; }
.over .best { font-size: 18px; }
.history { list-style: none; margin: 0; padding: 0; text-align: left; }
.history li { display: flex; flex-direction: column; gap: 4px; background: var(--white); border: 2px solid var(--ink); border-radius: 12px; padding: 14px; margin-bottom: 12px; overflow-wrap: anywhere; }
.history small { font-size: 15px; }
.host-controls { padding: 0 14px 12px; border-top: 2px dashed #77704d; }
.host-controls button { margin: 8px 4px; }
.host-controls summary { font-size: 15px; }
.reactions { display: flex; justify-content: center; gap: 8px; margin-top: 26px; }
.reactions button { padding: 6px; flex: 0 0 48px; font-size: 24px; }
.connection { position: sticky; z-index: 25; top: 0; text-align: center; background: var(--ink); color: white; padding: 8px 16px; }
.connection:empty, .toast:empty { display: none; }
.toast { position: fixed; z-index: 40; bottom: calc(84px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); background: var(--ink); color: white; border-radius: 18px; padding: 12px 20px; text-align: center; box-shadow: 0 5px 20px #0003; }
.floating-emoji { position: fixed; z-index: 50; pointer-events: none; font-size: 44px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@keyframes current { 50% { transform: translateY(-3px); } }
@keyframes breathe { 50% { transform: translateY(-5px) rotate(2deg); } }
@keyframes strike { from { scale: 0 1; } to { scale: 1 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(14px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes slam { from { opacity: 0; transform: scale(1.65) rotate(-12deg); } to { opacity: 1; transform: scale(1) rotate(-6deg); } }
@media (min-width: 600px) { .board { grid-template-columns: repeat(3,minmax(0,1fr)); } .clue-form, .guess-form { width: 100%; max-width: 520px; align-self: center; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
