/* Play room. Shares the main site's palette: cream paper, plum ink, rose accent. */
:root {
  --paper: #fcf8f3;
  --card: #fffdfa;
  --ink: #35273a;
  --ink-soft: #5e5361;
  --ink-mute: #746a78;
  --plum: #62428a;
  --plum-deep: #4e3471;
  --plum-wash: #f1e7f7;
  --rose: #b45e7a;
  --line: #ebdfe5;
  --green: #2e8b78;
  --shadow: 0 8px 24px rgba(87, 56, 76, .07);
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid #ae9cd4; outline-offset: 2px; }

/* Header */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; min-height: 64px; padding: 10px max(4vw, 16px); background: rgba(255, 252, 248, .97); border-bottom: 1px solid #efe4df; }
.brand { white-space: nowrap; font-size: 23px; font-weight: 800; letter-spacing: -.04em; color: #38283f; text-decoration: none; }
.bar-links { display: flex; gap: 4px; margin: 0 auto; }
.bar-links a { padding: 8px 12px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--ink-soft); text-decoration: none; }
.bar-links a:hover, .bar-links a[aria-current] { background: var(--plum-wash); color: #593c83; }
.bar-room { display: flex; align-items: center; gap: 10px; }
.people { display: flex; }
.people .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--paper); }
.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--c, var(--plum)); color: #fff; font-size: 13px; font-weight: 800; flex: none; }
.avatar.me { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--c); }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid #e3d8e2; border-radius: 999px; background: var(--card); font-size: 13px; font-weight: 800; letter-spacing: .12em; }
.chip:hover { background: #f8eaf1; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.link { border: 0; background: none; padding: 6px 4px; font-size: 14px; font-weight: 700; color: var(--plum); text-decoration: underline; text-underline-offset: 3px; }

main { max-width: 1120px; margin: 0 auto; padding: 44px max(4vw, 16px) 96px; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .13em; color: var(--rose); }
.lede { color: var(--ink-soft); max-width: 52ch; }
.note, .hint { font-size: 14px; color: var(--ink-mute); }
.row { display: flex; flex-wrap: wrap; gap: 10px; }
.stack { display: grid; gap: 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; padding: 12px 20px; border: 1px solid #e3d8e2; border-radius: 14px; background: var(--card); font-weight: 700; color: #46344e; transition: background .15s, transform .1s; }
.btn:hover { background: #f8eaf1; border-color: #d2b8d3; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--plum); border-color: var(--plum); color: #fff; }
.btn.primary:hover { background: var(--plum-deep); }
.btn.wide { width: 100%; }
input { width: 100%; padding: 12px 14px; border: 1px solid #dccfdc; border-radius: 14px; background: #fff; }
input::placeholder { color: #a79bab; }

/* Hub, gate and lobby */
h1 { font-size: clamp(36px, 5.2vw, 58px); line-height: 1.05; letter-spacing: -.045em; font-weight: 800; margin: 12px 0 18px; text-wrap: balance; }
h1 span { color: var(--rose); }
h2 { font-size: clamp(26px, 3.4vw, 36px); letter-spacing: -.035em; line-height: 1.15; font-weight: 800; }
h3 { font-size: 22px; letter-spacing: -.02em; line-height: 1.25; font-weight: 800; }
.hub-top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px 48px; margin-bottom: 12px; }
.hub-join { display: grid; gap: 8px; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; min-width: min(100%, 320px); }
.hub-join label, .entry label, .label { font-size: 14px; font-weight: 700; }
.pair { display: flex; gap: 8px; }
#code, #hub-code { text-transform: uppercase; letter-spacing: .14em; font-weight: 700; }
#code::placeholder, #hub-code::placeholder { text-transform: none; letter-spacing: 0; font-weight: 400; }
.gate-body { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(28px, 5vw, 72px); align-items: start; margin-top: 22px; }
.gate-art { max-width: 420px; border-radius: 22px; overflow: hidden; margin-bottom: 22px; }
.gate-art svg { display: block; width: 100%; height: auto; }
.entry { display: grid; gap: 12px; padding: 24px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.choice { display: grid; gap: 10px; padding-top: 16px; margin-top: 4px; border-top: 1px solid var(--line); }
.choice-head { display: grid; }
.choice-head span { font-size: 14px; color: var(--ink-mute); }
/* Arrived by invite link: one job, join the room. */
.for-invite { display: none; }
.invited .for-invite { display: inline-flex; }
.invited .for-open { display: none; }
.big-code { padding: 14px; text-align: center; font-size: clamp(24px, 4vw, 32px); font-weight: 800; letter-spacing: .2em; background: var(--plum-wash); border-radius: 14px; color: var(--plum-deep); user-select: all; }
.seats { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 8px; }
.seats li { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.seats li.empty { color: var(--ink-mute); font-weight: 500; }
.avatar.ghost { background: none; border: 2px dashed #d5c7d6; color: #b3a4b5; }
.btn:disabled { opacity: .6; cursor: default; }
.stage-invite { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; margin-bottom: 22px; background: var(--plum-wash); border-radius: 16px; font-size: 14px; font-weight: 600; }
.stage-invite .btn { padding: 8px 14px; font-size: 14px; }
.solo-note { margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--green); }

/* Game cards */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; margin-top: 24px; }
.game-card { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 14px 14px 18px; background: var(--card); border: 1px solid #ede2e3; border-radius: 22px; box-shadow: 0 8px 24px rgba(87, 56, 76, .05); transition: transform .15s, box-shadow .15s, border-color .15s; }
.game-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(87, 56, 76, .11); border-color: #d9c4dc; }
.game-art { display: block; border-radius: 16px; overflow: hidden; margin-bottom: 8px; }
.game-art svg { display: block; width: 100%; height: auto; }
.game-meta { display: flex; justify-content: space-between; font-size: 10.5px; font-weight: 800; letter-spacing: .12em; }
.game-meta .tag { color: var(--rose); }
.game-meta .count { color: var(--ink-mute); text-transform: uppercase; }
.game-card strong { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.game-text { font-size: 14px; color: var(--ink-soft); }
.game-card.locked .game-art { opacity: .55; }
.lock-note { margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--rose); }

/* Room */
#shelf h2 { margin: 8px 0; }
.stage-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; margin-bottom: 20px; }
.stage-note { font-size: 13px; color: var(--ink-mute); }

.scores { display: flex; flex-wrap: wrap; gap: 8px; }
.score { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 14px; }
.score.active { border-color: var(--plum); box-shadow: 0 0 0 2px var(--plum-wash); }
.score-name { font-weight: 600; }
.score strong { font-variant-numeric: tabular-nums; }
.end-card { display: grid; gap: 10px; justify-items: start; margin-top: 22px; padding: 26px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.end-card h3 { font-size: 28px; }
.end-card p:not(.eyebrow) { color: var(--ink-soft); }
.end-card .row { margin-top: 8px; }

/* Drawing */
.board { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; max-height: 72vh; border: 1px solid #e6d9e2; border-radius: 18px; background: #fffdfa; box-shadow: var(--shadow); touch-action: none; cursor: crosshair; }
.board.locked { cursor: default; }
.draw-game { max-width: 920px; margin: 0 auto; }
.draw-game .board { max-width: calc(72vh * 4 / 3); margin: 0 auto; }
.idea { margin-bottom: 12px; font-weight: 600; color: var(--ink-soft); }
.idea.fresh { color: var(--plum); font-size: 18px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 12px; }
.tool-group { display: flex; align-items: center; gap: 6px; }
.tool-group.push { margin-left: auto; }
.swatch { width: 28px; height: 28px; padding: 0; border-radius: 50%; border: 2px solid #fff; background: var(--c); box-shadow: 0 0 0 1px #d9cbd8; }
.swatch.on { box-shadow: 0 0 0 3px var(--c); }
.size { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid #e3d8e2; border-radius: 10px; background: var(--card); }
.size i { display: block; border-radius: 50%; background: var(--ink); }
.tool { padding: 7px 12px; border: 1px solid #e3d8e2; border-radius: 10px; background: var(--card); font-size: 13px; font-weight: 700; }
.size.on, .tool.on { background: var(--plum-wash); border-color: var(--plum); color: #593c83; }
.tool:hover, .size:hover { background: #f8eaf1; }

/* Doodle Guess */
.guess-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 16px; }
.round { font-size: 11px; font-weight: 800; letter-spacing: .13em; color: var(--ink-mute); }
.clock { margin-left: auto; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.clock.low { color: #c0392b; }
.guess-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.guess-side { display: grid; gap: 12px; padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; }
.secret { color: var(--plum); font-size: 28px; text-transform: capitalize; }
.blanks { white-space: pre-wrap; letter-spacing: .08em; font-size: 24px; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; min-height: 96px; align-content: start; font-size: 14px; }
.feed .muted { color: var(--ink-mute); }
.guess-form { display: flex; gap: 8px; }

/* Four in a Row */
.four-game { max-width: 560px; margin: 0 auto; }
.turn { display: flex; align-items: center; gap: 10px; margin: 14px 0; font-size: 18px; font-weight: 700; }
.disc { width: 20px; height: 20px; border-radius: 50%; background: var(--c); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .14); }
.four-board { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0; padding: 10px; background: var(--plum); border-radius: 22px; box-shadow: var(--shadow); }
.four-col { display: grid; gap: 0; padding: 0; border: 0; border-radius: 12px; background: none; }
.four-col:disabled { cursor: default; }
.four-board.mine .four-col:not(:disabled):hover { background: rgba(255, 255, 255, .14); }
.cell { display: block; aspect-ratio: 1; margin: 9%; border-radius: 50%; background: #f7f1ea; box-shadow: inset 0 3px 0 rgba(0, 0, 0, .12); }
.cell.full { background: var(--c); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .14); }
.cell.new { animation: fall .32s cubic-bezier(.3, 1.3, .6, 1); }
.cell.win { box-shadow: 0 0 0 4px #fff, inset 0 -4px 0 rgba(0, 0, 0, .14); }
@keyframes fall { from { transform: translateY(calc(var(--fall) * -118%)); } }

/* Quick Tap */
.tap-game { max-width: 560px; margin: 0 auto; display: grid; gap: 18px; }
.tap-pad { width: 100%; min-height: min(46vh, 340px); border: 0; border-radius: 28px; background: var(--plum-wash); color: var(--plum-deep); font-size: clamp(24px, 5vw, 36px); font-weight: 800; letter-spacing: -.02em; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.tap-pad.wait { background: #e9a5b6; color: #5a2233; }
.tap-pad.green { background: #46b89d; color: #fff; }
.tap-pad.sent { background: #f1ece6; color: var(--ink-mute); }
.tap-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tap-results li { display: flex; justify-content: space-between; padding: 12px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); font-variant-numeric: tabular-nums; }
.tap-results li.best { border-color: var(--green); background: #eaf6f2; }

/* Little Match */
.match-game { max-width: 640px; margin: 0 auto; display: grid; gap: 14px; }
.dots { display: flex; gap: 6px; }
.dots i { flex: 1; height: 5px; border-radius: 99px; background: #eadfe6; }
.dots i.on { background: var(--plum); }
.match-game h3 { font-size: clamp(24px, 3.6vw, 32px); text-wrap: balance; }
.options { display: grid; gap: 10px; }
.option { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 12px 18px; text-align: left; border: 1px solid #e3d8e2; border-radius: 16px; background: var(--card); font-weight: 600; color: var(--ink); }
.option:not(:disabled):hover { background: #f8eaf1; border-color: #d2b8d3; }
.option:disabled { cursor: default; opacity: 1; }
.option.picked { border-color: var(--plum); background: var(--plum-wash); }
.who { display: flex; gap: 4px; }
.reveal { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; background: var(--plum-wash); border-radius: 16px; }

/* Pattern Duel and Odd One Out */
.race-game, .rps-game, .memory-game { max-width: 640px; margin: 0 auto; display: grid; gap: 16px; }
.race-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.tiles { display: flex; flex-wrap: wrap; gap: 10px; }
.tile { display: grid; place-items: center; min-width: 62px; height: 68px; padding: 0 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tile.ask { background: var(--plum); border-color: var(--plum); color: #fff; }
.answers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.answer { min-height: 64px; border: 1px solid #e3d8e2; border-radius: 16px; background: var(--card); font-size: 24px; font-weight: 800; }
.answer:not(:disabled):hover, .odd-cell:not(:disabled):hover { background: #f8eaf1; border-color: #d2b8d3; }
.answer:disabled, .odd-cell:disabled { cursor: default; color: var(--ink); }
.answer.right, .odd-cell.right { background: #dff3ec; border-color: var(--green); }
.answer.wrong, .odd-cell.wrong { background: #fbe4e4; border-color: #d98a8a; }
.odd-grid { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 8px; max-width: 480px; width: 100%; margin: 0 auto; }
.odd-cell { aspect-ratio: 1; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--card); font-size: clamp(20px, 5.4vw, 34px); font-weight: 700; line-height: 1; }
.race-status { min-height: 26px; font-weight: 600; color: var(--ink-soft); }
.race-status.reveal { color: var(--plum); font-size: 18px; font-weight: 800; }

/* Memory Pairs */
.memory-grid { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 10px; max-width: 520px; width: 100%; margin: 0 auto; }
.mcard { aspect-ratio: 3 / 4; padding: 0; border: 0; border-radius: 16px; background: var(--plum) radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .22) 0 12%, transparent 13%); font-size: clamp(26px, 7vw, 44px); line-height: 1; box-shadow: var(--shadow); transition: transform .15s; }
.mcard:not(:disabled):hover { transform: translateY(-3px); }
.mcard:disabled { cursor: default; }
.mcard.up { background: var(--card); box-shadow: inset 0 0 0 1px var(--line); animation: flip .25s ease-out; }
.mcard.kept { box-shadow: inset 0 0 0 3px var(--c); }
@keyframes flip { from { transform: rotateY(90deg); } }

/* Rock Paper Scissors */
.rps-hands { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.rps-hand { display: grid; justify-items: center; gap: 6px; padding: 22px 8px; border: 1px solid #e3d8e2; border-radius: 22px; background: var(--card); font-weight: 700; }
.rps-hand:not(:disabled):hover { background: #f8eaf1; transform: translateY(-3px); }
.rps-hand:disabled { cursor: default; color: var(--ink); opacity: .55; }
.rps-hand.picked { opacity: 1; border-color: var(--plum); background: var(--plum-wash); }
.rps-icon { font-size: clamp(40px, 10vw, 64px); line-height: 1; }
.rps-icon.big { font-size: clamp(64px, 16vw, 104px); }
.rps-duel { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rps-shown { display: grid; justify-items: center; gap: 8px; padding: 26px 8px; border-radius: 22px; background: var(--card); border: 1px solid var(--line); font-weight: 700; animation: pop .3s cubic-bezier(.3, 1.4, .6, 1); }
.rps-shown:first-child .rps-icon { transform: scaleX(-1); }
@keyframes pop { from { transform: scale(.8); opacity: 0; } }

.toast, .offline { position: fixed; left: 50%; transform: translateX(-50%); margin: 0; padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; z-index: 50; }
.toast { bottom: 24px; max-width: calc(100vw - 32px); background: #35273a; color: #fff; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; transform: translate(-50%, 8px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.offline { top: 76px; background: #fbe7c8; color: #6d4a12; }

@media (max-width: 820px) {
  .gate-body, .guess-body { grid-template-columns: 1fr; }
  .gate-art { max-width: 280px; }
  .bar-links { display: none; }
  .brand { font-size: 19px; }
  .bar { gap: 10px; }
  .bar-room { margin-left: auto; }
  main { padding-top: 28px; }
  .tool-group.push { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
