/* ChitPlay table games: the same warm room colours as the 3D game, paper chits for every secret */
:root { --bg: #140b07; --panel: #24140c; --tile: #2f1d12; --line: rgba(255, 230, 176, .16); --gold: #ffd27a; --cream: #f6ead2; --hot: linear-gradient(180deg, #c94c14, #a03a0c); --paper: #f3ead2; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--cream); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#party { max-width: 560px; margin: 0 auto; padding: 0 14px 40px; min-height: 100vh; }
.bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 12px 0; background: var(--bg); }
.bar strong { color: var(--gold); }
.back { color: var(--cream); text-decoration: none; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 14px; }
.panel { display: flex; flex-direction: column; gap: 12px; padding: 18px 16px; border-radius: 18px; background: var(--panel); border: 1.5px solid var(--line); }
.panel.pass { margin-top: 18vh; text-align: center; }
h1 { margin: 0; color: var(--gold); font-size: clamp(24px, 6vw, 32px); line-height: 1.15; overflow-wrap: anywhere; }
h2 { margin: 6px 0 0; font-size: 17px; }
.lead { margin: 0; color: #f4e3c0; }
.btn { min-height: 48px; padding: 10px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--tile); color: var(--cream); font-family: inherit; font-size: 16px; font-weight: 700; cursor: pointer; overflow-wrap: anywhere; }
.btn.primary { background: var(--hot); border-color: var(--gold); color: #fff8e6; box-shadow: 0 3px 0 #8a2f12; }
.btn:disabled { opacity: .5; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); gap: 8px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.names { display: flex; flex-direction: column; gap: 6px; margin: 0; padding-left: 22px; }
.names li { display: flex; gap: 6px; }
.names input, select, textarea { flex: 1; min-width: 0; min-height: 44px; padding: 8px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--tile); color: var(--cream); font: inherit; }
textarea { width: 100%; resize: vertical; }
.x { flex: none; width: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: transparent; color: var(--cream); font-size: 16px; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.opt select { flex: 0 1 200px; }
.err { margin: 0; min-height: 1em; color: #ff9a8a; }
.rules { align-self: center; color: var(--gold); font-size: 14px; }
/* the paper chit */
.chit { position: relative; padding: 22px 18px; border-radius: 6px; color: #3a2a18; text-align: center; background: repeating-linear-gradient(0deg, transparent 0 23px, rgba(70, 110, 190, .3) 23px 24px), var(--paper); box-shadow: 0 6px 0 #8a6a3a, 0 10px 24px rgba(0, 0, 0, .35); transform: rotate(-1deg); }
.chit .big { display: block; font-size: clamp(28px, 9vw, 40px); font-weight: 800; overflow-wrap: anywhere; }
.chit .prompt { display: block; font-size: clamp(18px, 5vw, 22px); font-weight: 700; line-height: 1.35; }
.chit.unfold { animation: unfold .45s ease-out; transform-origin: top; }
@keyframes unfold { from { transform: rotate(-1deg) scaleY(.15); opacity: .4; } }
.chit.story { text-align: left; transform: none; }
.chit .line { margin: 0 0 12px; animation: unfold .5s ease-out both; }
.chit .line small { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; opacity: .6; }
.hint { margin: 0; color: var(--gold); min-height: 1em; }
.timer { margin: 0; font: 700 18px ui-monospace, monospace; color: var(--gold); text-align: center; }
.scores { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; font-size: 13px; }
.scores span { padding: 3px 9px; border-radius: 999px; background: var(--tile); border: 1px solid var(--line); }
.board { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.board li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--tile); }
.board li.first { border: 1.5px solid var(--gold); }
.bars { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.bars li { position: relative; display: flex; justify-content: space-between; padding: 10px 14px; border-radius: 12px; background: var(--tile); overflow: hidden; }
.bars li i { position: absolute; inset: 0 auto 0 0; background: rgba(255, 210, 122, .18); }
.bars li span, .bars li strong { position: relative; }
.bars li.win { border: 1.5px solid var(--gold); }
.games { display: flex; flex-direction: column; gap: 10px; }
.game { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--tile); border: 1.5px solid var(--line); color: var(--cream); text-decoration: none; }
.game .icon { font-size: 30px; line-height: 1; }
.game strong { display: block; color: var(--gold); font-size: 17px; }
.game small { display: block; opacity: .8; }
.game em { display: block; font-style: normal; font-size: 14px; opacity: .9; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; animation: fall 2.6s ease-in forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }
@media (prefers-reduced-motion: reduce) { .chit.unfold, .chit .line { animation: none; } }

.bar { position: static; }
.panel.pass { margin-top: 12px; }

/* in the 3D room: the room fills the screen, the game sits in a sheet at the bottom */
body.room { background: transparent; }
body.room #party { position: relative; z-index: 5; display: flex; flex-direction: column; justify-content: flex-end; min-height: 100vh; min-height: 100dvh; padding-bottom: 12px; pointer-events: none; }
body.room #party > * { pointer-events: auto; }
body.room .bar { background: transparent; margin-bottom: auto; }
body.room .panel { max-height: 58vh; max-height: 58dvh; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; background: rgba(36, 20, 12, .9); backdrop-filter: blur(4px); }
body.room .panel.pass { margin-top: 0; }
/* the panel moves beside the board on wide screens and on a phone on its side */
@media (min-width: 900px), (orientation: landscape) and (max-height: 560px) {
  body.room #party { position: fixed; top: 0; bottom: 0; right: max(10px, env(safe-area-inset-right)); width: min(400px, 44vw); max-width: none; min-height: 0; margin: 0; padding: 8px 0; }
  body.room .panel, body.room .panel--tight { max-height: calc(100dvh - 64px); }
}
@media (orientation: landscape) and (max-height: 560px) {
  .bar { padding: 4px 0; gap: 6px; }
  .bar strong { display: none; }
  .bar .back { font-size: 13px; padding: 4px 9px; }
  body.room .panel, body.room .panel--tight { padding: 10px; gap: 6px; }
  body.room h1 { font-size: 18px; }
  .btn { min-height: 42px; padding: 6px 12px; font-size: 15px; }
  .dieface { font-size: 32px; }
  .head .chatbtn { width: 40px; height: 40px; }
}
@media (max-width: 359px) { .bar .rulesbtn { font-size: 12px; padding: 5px 7px; } .strip li { font-size: 12px; } }
body.room #party { padding-top: max(12px, env(safe-area-inset-top)); padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); padding-bottom: max(12px, env(safe-area-inset-bottom)); }

/* several phones */
a.btn { display: flex; align-items: center; justify-content: center; text-align: center; text-decoration: none; }
.code { margin: 0; text-align: center; font: 800 clamp(34px, 11vw, 48px)/1.1 ui-monospace, monospace; letter-spacing: .12em; color: var(--gold); }
.names.joined li { display: list-item; padding: 2px 0; }
.opt input { flex: 0 1 200px; min-width: 0; min-height: 44px; padding: 8px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--tile); color: var(--cream); font: inherit; }
.guest-only { display: none; }
body.is-guest .guest-only { display: block; }

/* table games */
.bar strong { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bar .back { flex: none; }
@media (max-width: 520px) { .wideonly { display: none; } .bar .rulesbtn { font-size: 16px; padding: 5px 10px; } }
.bar strong { flex: 1; }
.bar .rulesbtn { margin-left: auto; background: rgba(36, 20, 12, .8); font: inherit; font-size: 14px; cursor: pointer; }
.bar .back { background: rgba(36, 20, 12, .8); }
body.room .panel { pointer-events: auto; }
body.room .panel--tight { gap: 8px; padding: 12px; max-height: 50vh; max-height: 50dvh; }
.panel--tight h1 { font-size: clamp(18px, 4.6vw, 22px); }
.panel--tight .lead { font-size: 13px; }
.grid.compact { grid-template-columns: repeat(auto-fill, minmax(min(100%, 104px), 1fr)); gap: 6px; }
.grid.compact .btn { min-height: 42px; padding: 6px 8px; font-size: 14px; }
.grid.tiny { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 5px; }
.grid.tiny .btn { min-height: 44px; padding: 4px; }
.chips { display: flex; gap: 6px; }
.chip { min-width: 44px; min-height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--tile); color: var(--cream); font: 700 16px system-ui, sans-serif; cursor: pointer; }
.chip.on { background: var(--hot); border-color: var(--gold); color: #fff8e6; }
.said { display: flex; flex-direction: column; gap: 3px; margin: 0; padding: 0; list-style: none; font-size: 14px; }
.hand { display: flex; flex-wrap: wrap; gap: 5px; }
.card { min-width: 44px; min-height: 58px; padding: 4px 7px; border-radius: 8px; border: 1.5px solid #cfc4a6; background: #fbf8ef; color: #17140f; font: 800 16px system-ui, "Segoe UI Symbol", sans-serif; cursor: pointer; }
button.card:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.card--red { color: #c62828; }
.hand--idle .card, .card--idle { min-height: 36px; min-width: 32px; display: inline-grid; place-items: center; font-size: 13px; background: #cfc6b2; border-color: #a99f89; color: #1d1a14; cursor: default; }
.hand--idle .card--red { color: #8e1616; }
.typed { display: flex; flex-direction: column; gap: 8px; }
.aim { display: flex; flex-direction: column; gap: 6px; }
.slider { display: grid; grid-template-columns: 62px 1fr; align-items: center; gap: 8px; font-size: 14px; }
.slider input { width: 100%; min-height: 36px; accent-color: #ff9a3d; }
.emojis { display: flex; justify-content: space-between; gap: 4px; }
.emojis button { flex: 1; min-height: 40px; border: 1px solid var(--line); border-radius: 10px; background: transparent; font-size: 18px; cursor: pointer; }
.qr { align-self: center; width: min(44vw, 170px); padding: 8px; border-radius: 10px; background: #fff; }
.qr:empty { display: none; }
.qr svg { display: block; width: 100%; height: auto; }
.spinner { align-self: center; width: 40px; height: 40px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--gold); animation: turn 1s linear infinite; }
@keyframes turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 4s; } }
.sheet { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(10, 5, 2, .72); }
.sheet__box { display: flex; flex-direction: column; gap: 10px; width: min(100%, 560px); max-height: 88vh; overflow-y: auto; padding: 18px 16px; border-radius: 18px; background: var(--panel); border: 1.5px solid var(--line); }
.sheet__box ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; }
.sheet__box p { margin: 0; }
.sheet__box h1 { font-size: clamp(21px, 5.4vw, 27px); }
.steps li { line-height: 1.45; }
.sheet__go { position: sticky; bottom: -18px; display: flex; flex-direction: column; margin: 0 -16px -18px; padding: 10px 16px 14px; background: var(--panel); }
/* who's playing, with their colour; the player whose turn it is stands out */
.strip { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.strip li { flex: 1 1 40%; display: flex; justify-content: space-between; gap: 6px; min-width: 0; padding: 4px 8px; border-radius: 9px; border-left: 6px solid var(--who); background: var(--tile); font-size: 13px; }
.strip li.on { outline: 2px solid var(--who); background: #452a18; }
.strip strong { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 700; }
.strip span { flex: none; }
.head { display: flex; align-items: center; gap: 10px; }
.head h1 { min-width: 0; }
.head .chatbtn { flex: none; margin-left: auto; width: 46px; height: 46px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--tile); font-size: 21px; cursor: pointer; }
.dieface--spin { display: inline-block; font-size: 34px; animation: turn .7s linear infinite; }
@media (prefers-reduced-motion: reduce) { .dieface--spin { animation: none; } }
.record { margin: 0; text-align: center; font-size: 14px; color: var(--gold); }
.talklines { display: flex; flex-direction: column; gap: 6px; }
.talklines .btn { min-height: 44px; font-weight: 600; font-size: 15px; }
.emojis--big button { min-height: 44px; font-size: 22px; flex: 1 0 14%; }
.emojis--big { flex-wrap: wrap; }
.chip.wide { flex: 1; padding: 0 12px; }
.panel--tight { min-height: 170px; }
.dieface { flex: none; font: 44px/1 system-ui, "Segoe UI Symbol", sans-serif; color: var(--gold); }
.grid .btn.wide { grid-column: 1 / -1; min-height: 52px; font-size: 16px; }
/* emojis, always on screen in a game */
.troll { display: flex; gap: 4px; flex: none; margin: -2px 0 0; overflow-x: auto; scrollbar-width: none; }
.troll::-webkit-scrollbar { display: none; }
.troll button { flex: 1 0 36px; min-width: 36px; height: 38px; padding: 0; border-radius: 10px; border: 1px solid var(--line); background: var(--tile); font-size: 20px; line-height: 1; cursor: pointer; }
.troll button:active { transform: scale(1.2); }
.bar .scanlink { flex: none; margin-left: auto; }
.bar .scanlink + .rulesbtn { margin-left: 0; }

/* the TV games: the buttons and the bigger screen */
.tvbig { position: fixed; left: 0; right: 0; top: 54px; z-index: 4; display: flex; justify-content: center; padding: 0 8px; }
.tvbig[hidden] { display: none; }
.tvcanvas { display: block; width: 100%; max-width: 900px; height: auto; border-radius: 10px; border: 3px solid #14161b; background: #000; }
.tvpanel { gap: 8px; }
.keyhint { font-size: 12.5px; }
.pads { display: flex; gap: 10px; justify-content: center; }
.pads--two .pad { flex: 1 1 0; }
.pad { display: grid; gap: 6px; flex: 1; min-width: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
.pad__who { grid-column: 1 / -1; text-align: center; font: 700 13px system-ui, sans-serif; color: var(--gold); }
.pad--1 { grid-template-columns: 1fr; }
.pad--2 { grid-template-columns: 1fr 1fr; }
.pad--4, .pad--5 { grid-template-areas: ". u ." "l a r" ". d ."; grid-template-columns: 1fr 1.2fr 1fr; }
.padbtn { min-height: 60px; border-radius: 16px; border: 2px solid var(--line); background: #3b2413; color: var(--cream); font: 800 22px system-ui, sans-serif; touch-action: none; cursor: pointer; }
.padbtn:active { background: #6a3d1c; transform: scale(.97); }
.padbtn--a { background: var(--hot); border-color: var(--gold); color: #fff; font-size: 20px; }
.pad--1 .padbtn { min-height: 92px; font-size: 26px; }
.pad--4 .padbtn--u, .pad--5 .padbtn--u { grid-area: u; } .pad--4 .padbtn--d, .pad--5 .padbtn--d { grid-area: d; } .pad--4 .padbtn--l, .pad--5 .padbtn--l { grid-area: l; } .pad--4 .padbtn--r, .pad--5 .padbtn--r { grid-area: r; } .pad--5 .padbtn--a { grid-area: a; }
.pad--4 .padbtn, .pad--5 .padbtn { min-height: 50px; }
.bigbtn { min-height: 38px; padding: 4px 10px; font-size: 13.5px; }
@media (orientation: landscape) and (max-height: 560px) { .padbtn { min-height: 44px; font-size: 18px; } .pad--1 .padbtn { min-height: 76px; } .pad--4 .padbtn, .pad--5 .padbtn { min-height: 38px; } .keyhint, .bigbtn { display: none; } }
@media (hover: hover) and (pointer: fine) { .pads { display: flex; } }

/* the thumb stick */
.pad { display: flex; align-items: center; justify-content: center; gap: 16px; }
.pad--both { justify-content: space-between; }
.stick { position: relative; flex: none; width: 128px; height: 128px; border-radius: 50%; border: 2px solid var(--line); background: radial-gradient(circle at 50% 45%, #4a2d18, #24140c 70%); box-shadow: inset 0 4px 14px rgba(0, 0, 0, .55); touch-action: none; cursor: grab; }
.stick--x { width: 168px; height: 92px; border-radius: 46px; }
.stick--y { width: 92px; height: 140px; border-radius: 46px; }
.stick::before, .stick::after { content: ''; position: absolute; inset: 50% auto auto 50%; border: 7px solid transparent; transform: translate(-50%, -50%); opacity: .45; }
.stick__knob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; background: radial-gradient(circle at 38% 32%, #ffcf8a, #e0672a 60%, #8a2f12); border: 2px solid var(--gold); box-shadow: 0 6px 12px rgba(0, 0, 0, .5); transition: transform .08s ease-out; pointer-events: none; }
.stick--on .stick__knob { transition: none; }
.pad .padbtn--a { flex: 0 1 140px; min-height: 92px; border-radius: 50%; aspect-ratio: 1; font-size: 18px; }
.pad--swipe .padbtn--a { flex: 0 1 76px; min-height: 76px; border-radius: 18px; aspect-ratio: auto; font-size: 14px; }
.swipe-zone { display: flex; flex: 1 1 190px; min-width: 0; min-height: 82px; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 8px; border: 2px dashed var(--line); border-radius: 16px; background: linear-gradient(145deg, rgba(89, 60, 36, .92), rgba(31, 24, 21, .96)); color: var(--cream); text-align: center; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.swipe-zone strong { font: 800 15px system-ui, sans-serif; }
.swipe-zone small { color: var(--gold); font: 600 12px system-ui, sans-serif; }
.swipe-zone.swipe--on { border-color: var(--gold); background: linear-gradient(145deg, #805226, #342016); }
.tvcanvas--swipe { touch-action: none; cursor: crosshair; }
.pad__who { position: absolute; transform: translateY(-74px); }
.pads--two .pad { flex-direction: column; gap: 8px; }
.pads--two .pad__who { position: static; transform: none; }
.pads--two .stick { width: 104px; height: 104px; }
.pads--two .stick--x { width: 136px; height: 80px; }
.pads--two .pad .padbtn--a { min-height: 64px; flex-basis: 64px; }
/* a keypad for typed answers: the answer so far, then the keys */
.pad.pad--keypad { display: flex; flex-direction: column; align-items: stretch; gap: 6px; width: 100%; }
.pad--keypad .keypad { width: 100%; }
.keypad__show { display: block; align-self: stretch; box-sizing: border-box; width: 100%; min-height: 40px; padding: 6px 10px; border-radius: 12px; background: #0f1218; color: #fff; font: 900 26px ui-monospace, Consolas, monospace; letter-spacing: 4px; text-align: center; overflow-wrap: anywhere; }
.keypad__show--sent { color: #3ddc6a; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pad--keypad-letters .keypad { grid-template-columns: repeat(20, 1fr); gap: 4px; }
.pad--keypad-letters .keypad__key { grid-column: span 2; }
.pad--keypad-letters .keypad__key--indent { grid-column: 2 / span 2; }
.keypad__key { min-height: 46px; border-radius: 12px; border: 2px solid var(--line); background: #2b2f3a; color: #fff; font: 800 20px system-ui, sans-serif; touch-action: manipulation; cursor: pointer; }
.pad--keypad-letters .keypad__key { min-height: 40px; font-size: 15px; padding: 0; }
.keypad__key:active { transform: scale(.96); background: #3b4150; }
.keypad__key--soft { background: #3b2a2a; }
.keypad__key--ok { background: #1f9e4a; border-color: #3ddc6a; }
@media (orientation: landscape) and (max-height: 560px) { .keypad__key { min-height: 34px; font-size: 16px; } .keypad__show { min-height: 30px; font-size: 20px; } }
/* answer buttons: four big colour buttons in a 2 x 2 grid, easy to hit without looking */
.pad.pad--choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pad--choices .pad__who { grid-column: 1 / -1; }
.choicebtn { min-height: 64px; border-radius: 16px; border: 3px solid rgba(255,255,255,.35); background: var(--choice); color: #fff; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-shadow: 0 1px 3px rgba(0,0,0,.55); box-shadow: inset 0 -5px 0 rgba(0,0,0,.25); }
.choicebtn strong { font: 900 19px system-ui, sans-serif; letter-spacing: .5px; }
.choicebtn small { font: 700 11px system-ui, sans-serif; opacity: .85; }
.choicebtn:active { transform: translateY(2px) scale(.98); box-shadow: inset 0 -2px 0 rgba(0,0,0,.25); }
@media (orientation: landscape) and (max-height: 560px) { .choicebtn { min-height: 46px; } .choicebtn strong { font-size: 16px; } }
.pads--two .pad--swipe .swipe-zone { min-height: 58px; flex-basis: auto; }
@media (orientation: landscape) and (max-height: 560px) { .stick { width: 104px; height: 104px; } .stick--x { width: 140px; height: 76px; } .stick--y { width: 76px; height: 112px; } .pad .padbtn--a { min-height: 70px; } }
/* Rang Patti cards */
.card[class*="card--tint-"] { border-width: 2px; color: #fff; font-weight: 900; text-shadow: 0 1px 2px rgba(0,0,0,.45); }
.card--tint-r { background: #d32f2f; border-color: #8e1616; } .card--tint-g { background: #2e9e4f; border-color: #145c2a; }
.card--tint-b { background: #1e6fd0; border-color: #0d3f7a; } .card--tint-y { background: #f2b705; border-color: #9c7400; color: #2a1a00; text-shadow: none; }
.card--tint-w { background: conic-gradient(#d32f2f 0 25%, #2e9e4f 0 50%, #1e6fd0 0 75%, #f2b705 0); border-color: #222; }
.hand--idle .card[class*="card--tint-"] { opacity: .78; color: #fff; }
/* after a game */
.next { display: flex; flex-direction: column; gap: 6px; }
.next > strong { font-size: 14px; color: var(--gold); }
.next__list { display: flex; gap: 8px; }
.next__game { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px; border-radius: 12px; border: 1px solid var(--line); background: var(--tile); color: var(--cream); text-decoration: none; font-size: 12.5px; text-align: center; }
.next__game svg { width: 56px; height: 56px; }
.revive h1 { font-size: 26px; }
.revive__count { align-self: center; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--gold); color: var(--gold); font: 800 18px system-ui, sans-serif; }
/* on a computer the TV game fills the screen beside the controls */
@media (pointer: fine) and (min-width: 900px) {
  body.tv-full .tvbig { top: 56px; bottom: 12px; left: 12px; right: calc(min(400px, 44vw) + 22px); align-items: center; padding: 0; border-radius: 14px; background: radial-gradient(ellipse at center, rgba(20, 11, 7, .82), rgba(20, 11, 7, .96)); }
  body.tv-full .tvcanvas { box-sizing: border-box; width: min(100%, calc((100dvh - 68px) * 1.6)); max-width: none; height: auto; max-height: 100%; aspect-ratio: 16 / 10; }
}
body.tv-full .tvbig { z-index: 4; }
/* a phone held sideways: the TV fills the space to the left of the controls, whole and never cut off */
@media (orientation: landscape) and (max-height: 560px) {
  body.tv-full .tvbig { top: calc(env(safe-area-inset-top) + 50px); bottom: 6px; left: max(6px, env(safe-area-inset-left)); right: calc(46vw + 28px); align-items: center; padding: 0; border-radius: 12px; background: rgba(20, 11, 7, .96); }
  body.tv-full .tvcanvas { box-sizing: border-box; width: min(100%, calc((100dvh - 56px - env(safe-area-inset-top)) * 1.6)); max-width: none; height: auto; max-height: 100%; aspect-ratio: 16 / 10; }
}
/* who a troll emoji goes to */
.troll-wrap { display: flex; flex-direction: column; gap: 4px; flex: none; }
.troll__to { display: flex; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: none; font: 600 12px system-ui, sans-serif; color: #e8d6b0; }
.troll__to::-webkit-scrollbar { display: none; }
.troll__who { flex: none; min-height: 30px; padding: 2px 10px; border-radius: 999px; border: 1px solid rgba(255, 230, 176, .3); background: transparent; color: #fff3d6; font: 600 12.5px system-ui, sans-serif; cursor: pointer; max-width: 120px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.troll__who.on { background: #ffd27a; color: #2a160a; border-color: #ffd27a; }
.recent__game.carry { text-decoration: none; }

/* A hand showing a new player where to tap */
.hint-hand { position: fixed; z-index: 95; width: 0; height: 0; pointer-events: none; }
.hint-hand__ring { position: absolute; left: -22px; top: -22px; width: 44px; height: 44px; border-radius: 50%; border: 3px solid #ffd23f; box-shadow: 0 0 18px rgba(255, 210, 63, .8); animation: hint-ring 1.2s ease-out infinite; }
.hint-hand__finger { position: absolute; left: -6px; top: 4px; font-size: 40px; line-height: 1; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .55)); animation: hint-tap 1.2s ease-in-out infinite; }
.hint-hand--drag .hint-hand__finger { animation: hint-drag 1.6s ease-in-out infinite; }
.hint-hand__text { position: absolute; left: 50%; top: 56px; transform: translateX(-50%); padding: 6px 12px; border-radius: 999px; background: #ffd23f; color: #2a1606; font: 800 14px system-ui, sans-serif; white-space: nowrap; box-shadow: 0 4px 12px rgba(0, 0, 0, .35); }
.hint-hand__text--up { top: -78px; }
@keyframes hint-ring { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes hint-tap { 0%, 100% { transform: translate(6px, 10px); } 45% { transform: translate(0, 0); } 55% { transform: translate(0, 0) scale(.92); } }
@keyframes hint-drag { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-26px, 18px); } }
@media (prefers-reduced-motion: reduce) { .hint-hand__ring, .hint-hand__finger { animation: none; } }

/* the chat row: who it goes to, the emojis and the message button, in one line at the bottom */
.chatrow { display: flex; align-items: center; gap: 6px; flex: none; order: 99; margin-top: 2px; padding-top: 8px; border-top: 1px solid var(--line); }
.chatrow .troll { flex: 1; min-width: 0; margin: 0; -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent); mask-image: linear-gradient(90deg, #000 82%, transparent); }   /* the fade says: more emojis this way */
.chatrow .troll button { flex: 0 0 38px; }
.chatrow__to { flex: none; display: inline-flex; align-items: center; gap: 4px; max-width: 34%; min-height: 38px; padding: 0 10px; border-radius: 999px; border: 1.5px solid var(--gold); background: #3a2410; color: #fff3d6; font: 700 13px system-ui, sans-serif; cursor: pointer; }
.chatrow__to span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chatrow__to b { font-size: 11px; opacity: .8; }
.chatrow .chatbtn { flex: none; width: 40px; height: 40px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--tile); font-size: 19px; cursor: pointer; }
/* the chat row stays in view at the bottom even while the panel scrolls */
body.room .panel > .chatrow { position: sticky; bottom: 0; z-index: 2; padding-bottom: 2px; background: rgba(36, 20, 12, .97); }

/* the game menu: one ⏸ button in the top bar while playing; the menu itself looks like Raja Rani Chor Police's */
.pausebtn { font-size: 16px; min-width: 44px; min-height: 40px; }
.pausemenu .game__panel { max-height: calc(100dvh - 32px); }
.pausemenu .game__title { font-family: var(--font-display, Georgia, serif); }
.pausemenu { z-index: 400; }
.pausebtn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.pausebtn__ico { display: grid; place-items: center; } .pausebtn__ico .ico { width: 20px; height: 20px; }

/* the top bar while playing: pause, the game, what matters now (round and points), and the language */
.bar .bartitle { flex: none; white-space: nowrap; }
.barstatus { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 4px 8px; border-radius: 999px; background: rgba(20, 11, 7, .72); color: #ffe6b0; font: 700 12px system-ui, sans-serif; }
.barstatus:empty { display: none; }
.barstatus__summary { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barstatus__more { flex: none; min-height: 26px; padding: 2px 6px; border: 0; border-radius: 999px; background: rgba(var(--accent-rgb), .18); color: var(--acc-light); font: inherit; font-size: 11px; font-weight: 800; cursor: pointer; position: relative; }
.barstatus__more::after { content: ""; position: absolute; inset: -9px -4px; }   /* easy to hit with a thumb */
.rank-chip { flex: none; min-height: 36px; padding: 0 8px; font-size: 12px; white-space: nowrap; color: var(--acc-light); }
.bar .langpick { flex: none; margin-left: auto; font-size: 13px; min-height: 36px; padding: 0 10px; }
.langlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; margin: 8px 0 12px; }
/* on a phone the round and the points get a line of their own under the bar, whole */
@media (max-width: 620px) { .bar { flex-wrap: wrap; row-gap: 6px; } .barstatus { order: 9; flex: 1 0 100%; white-space: normal; text-align: center; font-size: 12px; padding: 4px 10px; } }
@media (max-width: 340px) {
  .bar { gap: 6px; }
  .bar .bartitle { flex: 1 1 40px; max-width: 108px; min-width: 0; }
  .rank-chip { padding: 0 6px; }
  .bar .langpick { padding: 0 6px; }
}
/* a sheet over the game (rules, menu, language): the pointing hand waits behind it */
html:has(.sheet) .hint-hand { display: none; }
/* a friends' room: which game is next, who's in, and the host's game picker */
.lobby__game { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--tile); border: 1.5px solid var(--line); }
.lobby__game > div { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.lobby__game small { color: #cdb894; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.lobby__game strong { color: var(--gold); font-size: 18px; overflow-wrap: anywhere; }
.lobby__icon { font-size: 30px; line-height: 1; }
.btn.lobby__change { flex: none; min-height: 44px; padding: 6px 12px; font-size: 15px; }
.names.lobby__names li { display: flex; align-items: center; gap: 8px; }
.names.lobby__names li > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.names.lobby__names .x { height: 36px; width: 36px; font-size: 14px; }
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 128px), 1fr)); gap: 8px; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 92px; padding: 10px 6px; border-radius: 14px; border: 1.5px solid var(--line); border-top: 4px solid var(--accent, var(--gold)); background: var(--tile); color: var(--cream); font: inherit; text-align: center; cursor: pointer; transition: transform .12s ease, border-color .12s ease; }
.pick strong { font-size: 14px; line-height: 1.2; overflow-wrap: anywhere; }
.pick small { font-size: 12px; color: #cdb894; }
.pick__icon { font-size: 26px; line-height: 1.1; }
.pick.on { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255, 210, 122, .35) inset; }
.pick:not([disabled]):hover { transform: translateY(-2px); }
.pick:not([disabled]):active { transform: scale(.97); }
.pick[disabled] { opacity: .4; cursor: not-allowed; }
.pick:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .pick { transition: none; } }
/* every button answers the finger at once: a quick press-in, no grey flash, no double-tap zoom wait */
.btn, .chip, .x, .pick { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.btn, .chip, .x { transition: transform .1s ease, filter .1s ease; }
.btn:not(:disabled):active, .chip:active, .x:active { transform: scale(.97); filter: brightness(1.12); }
@media (prefers-reduced-motion: reduce) { .btn, .chip, .x { transition: none; } .btn:not(:disabled):active, .chip:active, .x:active { transform: none; } }
/* a new screen slides up into place */
.panel--enter { animation: panelin .28s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes panelin { from { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: reduce) { .panel--enter { animation: none; } }
/* the record to beat, gold, at the start of the status line */
.barbest { color: var(--gold); font-weight: 800; white-space: nowrap; }
.barbest + span::before { content: ' · '; opacity: .6; }
.record--best { color: var(--gold); font-weight: 800; font-size: 17px; }
/* the menu: the two switches side by side, and leaving set apart in red */
.game__menu-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.game__choice--danger { border-color: rgba(229, 83, 61, .55) !important; color: #ffb4a6 !important; margin-top: 6px; }
.game__choice--danger .game__choice-ico { color: #ff7a63; }
/* on a phone the play page's top bar is two lines: the banners start below both */
.emoji-pop { --hud-h: 64px; }

/* ═══ every game in its own colours (set from the game's accent by applyTheme in table.js) ═══ */
:root { --accent: #c94c14; --accent-rgb: 201, 76, 20; --acc-hi: #d2602d; --acc-deep: #82320f; --acc-shadow: #4f1f0b; --acc-light: #ffd27a; --on-accent: #fffaf0; --panel-rgb: 36, 20, 12; --panel-rgb2: 26, 14, 8; }
body:not(.room) { background: radial-gradient(120% 70% at 50% -10%, rgba(var(--accent-rgb), .28), transparent 60%), var(--bg); background-attachment: fixed; }
h1 { color: var(--acc-light); letter-spacing: -.01em; text-shadow: 0 2px 12px rgba(var(--accent-rgb), .35); }
h2 { color: #fff1d6; }
.lead { color: #f1e2c6; }
/* the panel: dark glass tinted with the game's colour, a thin bar of that colour along the top */
.panel { position: relative; border-radius: 22px; border: 1px solid rgba(var(--accent-rgb), .35); background: linear-gradient(180deg, rgb(var(--panel-rgb)), rgb(var(--panel-rgb2))); box-shadow: 0 18px 40px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .06); }
.panel::before { content: ''; position: absolute; left: 22px; right: 22px; top: -1px; height: 3px; border-radius: 0 0 4px 4px; background: linear-gradient(90deg, transparent, var(--acc-hi), transparent); opacity: .9; pointer-events: none; }
body.room .panel { background: linear-gradient(180deg, rgba(var(--panel-rgb), .84), rgba(var(--panel-rgb2), .93)); backdrop-filter: blur(10px) saturate(1.2); -webkit-backdrop-filter: blur(10px) saturate(1.2); }
body.room .panel > .chatrow { background: rgba(var(--panel-rgb2), .97); }
/* buttons: quiet ones tinted, the main one in the game's colour with a soft glow */
.btn { background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .01)), var(--tile); border-color: rgba(var(--accent-rgb), .3); transition: transform .1s ease, filter .1s ease, border-color .15s ease, box-shadow .15s ease; }
@media (hover: hover) { .btn:not(:disabled):hover { border-color: rgba(var(--accent-rgb), .7); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .14); } }
.btn.primary { background: var(--hot); border-color: var(--acc-hi); color: var(--on-accent); box-shadow: 0 3px 0 var(--acc-shadow), 0 10px 22px rgba(var(--accent-rgb), .35); text-shadow: none; }
.btn.primary:not(:disabled):active { box-shadow: 0 1px 0 var(--acc-shadow), 0 4px 12px rgba(var(--accent-rgb), .3); transform: translateY(2px) scale(.98); }
.chip { background: var(--tile); border-color: rgba(var(--accent-rgb), .3); }
.chip.on { background: var(--hot); border-color: var(--acc-hi); color: var(--on-accent); box-shadow: 0 6px 14px rgba(var(--accent-rgb), .3); }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .chip:focus-visible, button.card:focus-visible { outline-color: var(--acc-light); }
/* the top bar: the game's name in its colour, the status pill tinted to match */
.bar strong.bartitle { color: var(--acc-light); text-shadow: 0 1px 8px rgba(0, 0, 0, .6); }
.barstatus { background: rgba(var(--panel-rgb2), .78); border: 1px solid rgba(var(--accent-rgb), .3); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.bar .back, .bar .rulesbtn { background: rgba(var(--panel-rgb2), .8); border-color: rgba(var(--accent-rgb), .35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
/* players, turns and results */
.strip li { background: var(--tile); }
.strip li.on { background: rgba(var(--accent-rgb), .22); box-shadow: 0 0 14px rgba(var(--accent-rgb), .25); }
.board li { background: var(--tile); border: 1px solid transparent; }
.board li.first { border: 1.5px solid var(--acc-light); background: linear-gradient(90deg, rgba(var(--accent-rgb), .3), var(--tile)); box-shadow: 0 0 18px rgba(var(--accent-rgb), .25); }
.bars li i { background: rgba(var(--accent-rgb), .3); }
.bars li.win { border-color: var(--acc-light); }
.dieface { color: var(--acc-light); }
.padbtn--a { background: var(--hot); border-color: var(--acc-hi); color: var(--on-accent); }
.rankbar i { background: var(--hot); }
.record { color: var(--acc-light); }
.lobby__game { background: linear-gradient(90deg, rgba(var(--accent-rgb), .22), var(--tile)); border-color: rgba(var(--accent-rgb), .4); }
.code { color: var(--acc-light); text-shadow: 0 0 22px rgba(var(--accent-rgb), .5); }
.slider input { accent-color: var(--acc-hi); }
.chatrow__to { border-color: var(--acc-light); background: rgba(var(--accent-rgb), .2); }
/* a slim scrollbar in the game's colour */
.panel { scrollbar-width: thin; scrollbar-color: rgba(var(--accent-rgb), .55) transparent; }
.panel::-webkit-scrollbar { width: 6px; } .panel::-webkit-scrollbar-thumb { border-radius: 6px; background: rgba(var(--accent-rgb), .55); }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }
/* the game menu, in the game's colours too */
.pausemenu .game__panel { border-color: rgba(var(--accent-rgb), .5); background: linear-gradient(180deg, rgb(var(--panel-rgb)), rgb(var(--panel-rgb2))); }
.pausemenu .game__title { color: var(--acc-light); }
.pausemenu .game__choice--primary { background: var(--hot); border-color: var(--acc-hi); color: var(--on-accent); box-shadow: 0 3px 0 var(--acc-shadow), 0 10px 22px rgba(var(--accent-rgb), .3); }
.pausemenu .game__choice--primary .game__choice-ico { color: var(--on-accent); }
.undobtn { flex: none; margin-left: auto; min-height: 38px; padding: 4px 12px; border-radius: 999px; border: 1.5px solid rgba(var(--accent-rgb), .55); background: rgba(var(--accent-rgb), .16); color: var(--acc-light); font: 800 14px system-ui, sans-serif; cursor: pointer; white-space: nowrap; -webkit-tap-highlight-color: transparent; touch-action: manipulation; transition: transform .1s ease; }
.undobtn:active { transform: scale(.94); }
.undobtn:focus-visible { outline: 3px solid var(--acc-light); outline-offset: 2px; }
.head .undobtn + .undobtn { margin-left: 0; }
.hintline { margin: 0; padding: 6px 10px; border-radius: 10px; background: rgba(var(--accent-rgb), .18); color: var(--acc-light); font-size: 13.5px; font-weight: 700; }
.record--series { font-size: 15px; }
.head { flex-wrap: wrap; row-gap: 6px; }
.head h1 { flex: 1 1 170px; min-width: 0; }
.panel--result { gap: 8px; padding: 14px; }
.panel--result h1 { font-size: clamp(20px, 5.3vw, 28px); }
.panel--result .lead { font-size: 14px; }
.panel--result .board { max-height: 24vh; overflow-y: auto; gap: 4px; }
.panel--result .board li { padding: 7px 10px; }
.panel--result .story { max-height: 22vh; overflow-y: auto; padding: 14px; }
.panel--result .record { font-size: 12px; }
.panel--result .record--best { font-size: 15px; }
.result-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr)); gap: 7px; }
.result-actions .btn { min-height: 42px; padding: 7px 10px; font-size: 14px; }
.result-feedback { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; color: var(--acc-light); font-size: 12px; font-weight: 700; }
.result-feedback[hidden] { display: none; }
.result-find { flex: none; min-height: 38px; padding: 5px 10px; border-radius: 999px; font-size: 12px; }
.panel--result > .result-share { align-self: flex-start; min-height: 42px; padding: 6px 12px; font-size: 13px; }
.result-more { border-top: 1px solid var(--line); padding-top: 4px; font-size: 13px; }
.result-more summary { display: flex; align-items: center; min-height: 36px; color: var(--acc-light); font-weight: 750; cursor: pointer; }
.result-more > * + * { margin-top: 8px; }
.score-sheet .sheet__box { max-height: calc(100dvh - 32px); overflow-y: auto; }
.score-sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.score-sheet__head h1 { margin: 0; }
.score-sheet__close { flex: none; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 12px; background: var(--tile); color: var(--cream); font-size: 24px; cursor: pointer; }
.score-sheet__rows { display: grid; gap: 6px; margin: 12px 0; padding: 0; list-style: none; }
.score-sheet__rows li { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--tile); }
.score-sheet__rows li.score-sheet__active { border-color: var(--acc-light); background: rgba(var(--accent-rgb), .18); }
.score-sheet__rank { display: grid; gap: 8px; margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--tile); }
.score-sheet__rank p, .score-sheet__rank small, .score-sheet__best { margin: 0; }
.score-sheet__room { color: var(--acc-light); }
.grid--board-alternative:not(:focus-within) { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.grid--board-alternative:focus-within { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; clip-path: none; white-space: normal; }

/* ─── while a game is played: one slim bar on top, a short tray at the bottom, the game in between ─── */
.bar .viewbtn { flex: none; min-width: 42px; font: 800 13px system-ui, sans-serif; letter-spacing: .02em; cursor: pointer; }
.bar .viewbtn[aria-pressed="true"] { border-color: var(--acc-light); background: rgba(var(--accent-rgb), .3); color: #fff; }
body.room.in-play #party { padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: max(6px, env(safe-area-inset-bottom)); }
body.room.in-play .bar { flex-wrap: nowrap; gap: 6px; padding: 0; }
body.room.in-play .bar .bartitle, body.room.in-play .bar .rank-chip { display: none; }
body.room.in-play .bar .back { height: 34px; min-height: 34px; padding: 0 10px; font-size: 13px; }
body.room.in-play .bar .langpick { margin-left: 0; }
body.room.in-play .barstatus { order: 0; flex: 1 1 auto; min-height: 34px; padding: 2px 4px 2px 9px; white-space: nowrap; text-align: left; font-size: 12px; }
body.room.in-play .barstatus__more { min-height: 26px; }
/* the tray: never more than a quarter of an upright phone */
body.room.in-play .panel--play, body.room.in-play .tvpanel { max-height: max(25dvh, 168px); padding: 8px 10px; gap: 5px; border-radius: 16px; box-shadow: 0 -6px 24px rgba(0, 0, 0, .35); }
body.room.in-play .panel--play .strip { flex-wrap: nowrap; }
body.room.in-play .panel--play .strip li { flex: 1 1 0; padding: 2px 7px; border-left-width: 4px; font-size: 12px; }
body.room.in-play .panel--play .head { flex-wrap: nowrap; gap: 6px; }
body.room.in-play .panel--play .head h1 { flex: 1 1 auto; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 15px; line-height: 1.25; }
body.room.in-play .panel--play .head .undobtn { min-height: 30px; padding: 2px 10px; font-size: 13px; }
body.room.in-play .panel--play .lead, body.room.in-play .panel--play .hintline { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; line-height: 1.3; }
body.room.in-play .panel--play .btn { min-height: 38px; padding: 5px 10px; font-size: 14px; }
body.room.in-play .chatrow { gap: 5px; margin-top: 0; padding-top: 5px; }
body.room.in-play .chatrow .troll button { flex-basis: 32px; min-width: 32px; height: 32px; font-size: 17px; }
body.room.in-play .chatrow__to { min-height: 32px; padding: 0 8px; font-size: 12px; }
body.room.in-play .chatrow .chatbtn { width: 34px; height: 34px; font-size: 16px; }
/* wide screens and phones on their side: the tray stands at the right, narrow, the board takes the rest */
@media (min-width: 900px), (orientation: landscape) and (max-height: 560px) {
  body.room.in-play #party { width: min(340px, 40vw); }
  body.room.in-play .panel--play, body.room.in-play .tvpanel { max-height: calc(100dvh - 52px); }
}
/* 2D: only the board is drawn, so the players' name tags and speech bubbles have nothing to sit on */
html[data-view="2d"] body.room .player-tags, html[data-view="2d"] body.room .player-bubbles { display: none; }   /* before, during and after the game */
/* a TV game played full screen: the picture sits centred in the space between the bar and the tray */
body.room.in-play.tv-full .tvbig { top: calc(max(6px, env(safe-area-inset-top)) + 42px); bottom: calc(max(25dvh, 168px) + 14px); align-items: center; }
body.room.in-play.tv-full .tvcanvas { width: 100%; height: auto; max-height: 100%; aspect-ratio: 16 / 10; object-fit: contain; }
@media (min-width: 900px), (orientation: landscape) and (max-height: 560px) {
  body.room.in-play.tv-full .tvbig { top: 8px; bottom: 8px; right: calc(min(340px, 40vw) + 22px); }
  body.room.in-play.tv-full .tvcanvas { width: min(100%, calc((100dvh - 16px) * 1.6)); }
}
html[data-view="2d"] .bigbtn { display: none; }

/* the chess clock: both times side by side, the running one lit, red in the last twenty seconds */
.clocks { display: flex; gap: 6px; }
.clock { flex: 1 1 0; display: flex; align-items: baseline; justify-content: space-between; gap: 6px; min-width: 0; padding: 4px 10px; border-radius: 10px; border: 1.5px solid var(--line); background: rgba(0, 0, 0, .28); color: #d9c9a8; }
.clock small { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; }
.clock b { font: 800 18px ui-monospace, monospace; letter-spacing: .02em; }
.clock--on { border-color: var(--acc-light); background: rgba(var(--accent-rgb), .28); color: #fff; box-shadow: 0 0 12px rgba(var(--accent-rgb), .35); }
.clock--low b { color: #ff6b5b; }
.clock--low.clock--on { animation: clockpulse 1s ease-in-out infinite; }
@keyframes clockpulse { 50% { box-shadow: 0 0 16px rgba(255, 90, 70, .6); } }
@media (prefers-reduced-motion: reduce) { .clock--low.clock--on { animation: none; } }
body.room.in-play .clock { padding: 2px 8px; }
body.room.in-play .clock b { font-size: 16px; }


/* small screens: the whole keypad fits without scrolling (Word Guess, Fast Typing, Number Memory, Bingo) */
@media (max-height: 820px) {
  .pad--keypad-letters .keypad { gap: 3px; }
  .pad--keypad-letters .keypad__key { min-height: 34px; font-size: 14px; border-radius: 9px; }
  .pad--keypad .keypad__show { min-height: 34px; padding: 3px 10px; font-size: 20px; }
  .pad--keypad:not(.pad--keypad-letters) .keypad__key { min-height: 40px; }
}
@media (max-height: 660px) {
  .pad--keypad-letters .keypad__key { min-height: 30px; font-size: 13px; }
  .pad--keypad:not(.pad--keypad-letters) .keypad__key { min-height: 34px; font-size: 18px; }
  .pad--keypad .keypad__show { min-height: 30px; font-size: 18px; }
}

/* keypad and answer-button games: the controls get the room they need under the TV, so no key is cut off */
body.room.in-play.tv-keys .tvpanel { max-height: min(64dvh, 480px); }

/* the 3D / 2D switch in a game bar: as wide as its two labels */
.back.viewbtn.vtoggle { width: auto; min-width: 0; padding: 3px; }

/* the ad on a result screen: last, below every button, with room around it */
.adbox--result { margin: 14px 0 4px; padding: 8px 0 0; border-top: 1px solid rgba(255,210,122,.15); text-align: center; }
.adbox--result small { display: block; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; opacity: .55; margin-bottom: 4px; }

/*
 * The game bar fits every screen: phones upright and on their side, tablets, computers. The buttons keep
 * their size; the score chip takes what is left, and where that is too little it gets a line of its own
 * under the buttons (full width, so the score and the best are never cut). Measured on the game's own
 * column (#party), which is narrow beside the board on a phone on its side.
 */
body.room.in-play #party { container: party / inline-size; }
body.room.in-play .bar { flex-wrap: wrap; row-gap: 6px; }
body.room.in-play .bar > * { min-width: 0; }
body.room.in-play .barstatus { flex: 1 1 150px; min-width: 0; }
/* one line at the top while playing: Menu on the left, the score right beside it taking the rest */
body.room.in-play .bar { flex-wrap: nowrap; }
body.room.in-play .barstatus { order: 0; flex: 1 1 0; min-width: 0; }
@container party (max-width: 300px) {
  body.room.in-play .bar .back { padding: 0 7px; font-size: 12px; }
}

/* the turn timer with people online or with friends: a live count of the 30 seconds */
.turnclock { position: fixed; z-index: 40; left: 50%; transform: translateX(-50%); top: calc(max(8px, env(safe-area-inset-top)) + 54px); display: flex; align-items: center; gap: 8px; max-width: min(92vw, 360px); padding: 6px 12px 8px; border-radius: 999px; background: rgba(28, 16, 10, .92); border: 1.5px solid rgba(255, 210, 122, .45); color: #f6ead2; font: 700 13px/1.2 system-ui, sans-serif; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); pointer-events: none; overflow: hidden; }
.turnclock__who { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.turnclock b { flex: none; color: #ffd27a; font-variant-numeric: tabular-nums; }
.turnclock i { position: absolute; left: 0; bottom: 0; height: 3px; width: calc(var(--left, 1) * 100%); background: #ffd27a; transition: width .25s linear; }
.turnclock--mine { border-color: #3ddc6a; }
.turnclock--mine b, .turnclock--mine .turnclock__who { color: #b8f5c8; }
.turnclock--hurry { border-color: #ff6b57; animation: turnclock-pulse .8s ease-in-out infinite; }
.turnclock--hurry b { color: #ff9b8a; }
.turnclock--hurry i { background: #ff6b57; }
@keyframes turnclock-pulse { 50% { box-shadow: 0 0 0 4px rgba(255, 107, 87, .35); } }
@media (prefers-reduced-motion: reduce) { .turnclock--hurry { animation: none; } }
@media (min-width: 900px) { body.room .turnclock { left: calc(50% - min(200px, 22vw)); } }

/* the players' strip in a narrow tray: name over score, so four names still read in full */
@container party (max-width: 520px) {
  body.room.in-play .panel--play .strip li { flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; padding: 2px 6px; line-height: 1.15; }
  body.room.in-play .panel--play .strip strong { max-width: 100%; font-size: 11.5px; }
  body.room.in-play .panel--play .strip span { font-size: 11.5px; opacity: .9; }
}

/* a long hint on a small screen wraps onto two lines instead of running off the edge */
.hint-hand__text { width: max-content; max-width: min(340px, calc(100vw - 16px)); white-space: normal; text-align: center; line-height: 1.25; border-radius: 16px; }

/*
 * While playing, the emoji row never sits on top of a control: it is the last thing in the tray, in the
 * flow (not stuck over the bottom), and an upright phone gives the tray the room its controls need
 * (a stick and a big button, a hand of cards, a row of bids) before anything has to scroll.
 */
body.room.in-play .panel > .chatrow { position: static; }
@media (orientation: portrait) {
  body.room.in-play .panel--play, body.room.in-play .tvpanel { max-height: min(50dvh, 430px); }
}

/* the Menu button says Menu on every screen, phones too */
.bar .pausebtn { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; }

/* the game clock (Ludo Score mode): time left at the top; the turn timer moves under it */
.gameclock { position: fixed; z-index: 41; left: 50%; transform: translateX(-50%); top: calc(max(8px, env(safe-area-inset-top)) + 50px); padding: 5px 14px; border-radius: 999px; background: rgba(20, 12, 8, .94); border: 1.5px solid #ffd27a; color: #ffd27a; font: 900 15px/1.2 system-ui, sans-serif; font-variant-numeric: tabular-nums; pointer-events: none; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
.gameclock--hurry { border-color: #ff6b57; color: #ff9b8a; animation: turnclock-pulse .8s ease-in-out infinite; }
body.has-gameclock .turnclock { top: calc(max(8px, env(safe-area-inset-top)) + 88px); }
@media (min-width: 900px) { body.room .gameclock { left: calc(50% - min(200px, 22vw)); } }
@media (prefers-reduced-motion: reduce) { .gameclock--hurry { animation: none; } }

/* the house and hall games: their own screen, not a picture on the TV in the room */
body.tv-roomgame.tv-full .tvbig { background: #140b07; align-items: center; }
body.tv-roomgame .tvcanvas { border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
/* Ludo: your three lifelines, green until the computer has to play a turn for you, then red */
.lives { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 2px 0 4px; font-size: 11px; font-weight: 700; color: var(--cream-2, #f3e4c8); opacity: .95; }
.lives span { margin-right: 2px; letter-spacing: .02em; }
.lives i { width: 13px; height: 13px; border-radius: 50%; background: #2ecc71; box-shadow: 0 0 7px rgba(46, 204, 113, .65), inset 0 -2px 0 rgba(0, 0, 0, .18); }
.lives i.lost { background: #e5484d; box-shadow: 0 0 7px rgba(229, 72, 77, .6), inset 0 -2px 0 rgba(0, 0, 0, .2); }
/* joining a friend's game: the camera reading the host's QR code */
.scanvideo { display: block; width: 100%; max-width: 360px; aspect-ratio: 1; margin: 8px auto; border-radius: 16px; object-fit: cover; background: #000; border: 2px solid rgba(255, 210, 122, .6); }
.scanvideo[hidden] { display: none; }
/* stars for how far a tunnel run went */
.tvstars { margin: 2px 0 8px; text-align: center; font-size: 30px; line-height: 1.1; color: #ffd23f; text-shadow: 0 2px 10px rgba(255, 210, 63, .45); }
.tvstars .tvstars__off { color: rgba(255, 255, 255, .22); text-shadow: none; }
.tvstars small { display: block; margin-top: 4px; font-size: 12px; color: var(--cream-2, #f3e4c8); text-shadow: none; }
