/* Front Room: a warm 1970s front room at night. Plum walls, a lamp glowing
   in the corner, cream cards, mustard and tangerine. The TV scales everything
   from one font size (em units), so it fills any screen; the phone is a plain
   one-handed layout. */

@font-face {
  font-family: 'Unbounded';
  src: url('fonts/unbounded-latin.woff2') format('woff2');
  font-weight: 500 900;
  font-display: swap;
}
@font-face {
  font-family: 'Fredoka';
  src: url('fonts/fredoka-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --plum: #1d0f24;
  --plum-2: #2a1433;
  --plum-3: #3a1c45;
  --ink: #2b1630;
  --cream: #fff4e2;
  --cream-2: #f6e3c6;
  --mustard: #ffbf3c;
  --tang: #ff7a3d;
  --teal: #2ec4b6;
  --pink: #ff4f8b;
  --red: #ff5a5f;
  --violet: #9b6bff;
  --muted: rgba(255, 244, 226, 0.66);
  --p0: #ff7a3d; --p1: #2ec4b6; --p2: #ffbf3c; --p3: #ff4f8b;
  --p4: #5cc8ff; --p5: #b8e04a; --p6: #9b6bff; --p7: #ff5a5f;
  --me: var(--mustard);
  --display: 'Unbounded', 'Arial Black', system-ui, sans-serif;
  --body: 'Fredoka', 'Trebuchet MS', system-ui, sans-serif;
  --shadow: 0 0.3em 0 rgba(10, 2, 14, 0.45), 0 0.9em 2em rgba(10, 2, 14, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--plum);
  color: var(--cream);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--mustard); }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- the room behind everything ---------- */
.room-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(120% 90% at 50% 0%, var(--plum-3) 0%, var(--plum-2) 45%, var(--plum) 100%); }
.room-bg .paper {
  position: absolute; inset: 0; opacity: 0.55;
  background-image:
    radial-gradient(circle at 50% 50%, transparent 0 34%, rgba(255, 191, 60, 0.07) 35% 41%, transparent 42% 100%),
    radial-gradient(circle at 0 0, transparent 0 34%, rgba(255, 122, 61, 0.06) 35% 41%, transparent 42% 100%),
    radial-gradient(circle at 100% 100%, transparent 0 34%, rgba(255, 122, 61, 0.06) 35% 41%, transparent 42% 100%);
  background-size: 9rem 9rem;
  mask-image: linear-gradient(to bottom, #000 0%, #000 60%, transparent 92%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 60%, transparent 92%);
}
.room-bg .lamp {
  position: absolute; width: 70vmax; height: 70vmax; left: -22vmax; top: -30vmax; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 191, 60, 0.32) 0%, rgba(255, 122, 61, 0.14) 32%, transparent 66%);
  animation: glow 7s ease-in-out infinite alternate;
}
.room-bg .floor { position: absolute; left: 0; right: 0; bottom: 0; height: 22vh; background: linear-gradient(to bottom, transparent, rgba(8, 2, 10, 0.55)); }
@keyframes glow { from { opacity: 0.8; transform: scale(1); } to { opacity: 1; transform: scale(1.06); } }

/* ---------- shared pieces ---------- */
.card { background: var(--cream); color: var(--ink); border-radius: 1.1em; box-shadow: var(--shadow); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4em;
  min-height: 48px; padding: 0.55em 1.2em; border: 0; border-radius: 999px;
  background: rgba(255, 244, 226, 0.12); color: var(--cream);
  font-family: var(--body); font-weight: 600; font-size: 1em; text-decoration: none;
  box-shadow: inset 0 0 0 2px rgba(255, 244, 226, 0.22);
  transition: transform 0.12s, filter 0.12s, background 0.2s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(2px); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn-primary { background: linear-gradient(180deg, #ffd06a, var(--mustard) 45%, #ffa634); color: var(--ink); box-shadow: 0 0.22em 0 #b8661c, 0 0.5em 1.2em rgba(0, 0, 0, 0.3); }
.btn-primary:active { box-shadow: 0 0.08em 0 #b8661c; transform: translateY(0.14em); }
.card .btn { background: rgba(43, 22, 48, 0.08); color: var(--ink); box-shadow: inset 0 0 0 2px rgba(43, 22, 48, 0.18); }
.card .btn-primary { background: linear-gradient(180deg, #ffd06a, var(--mustard) 45%, #ffa634); box-shadow: 0 0.22em 0 #b8661c; }
.btn-big { min-height: 56px; padding: 0.7em 1.6em; font-size: 1.12em; }
.btn-small { min-height: 40px; padding: 0.35em 0.9em; font-size: 0.92em; }
.btn-quiet { background: transparent; box-shadow: none; color: var(--muted); text-decoration: underline; text-underline-offset: 0.2em; }
.card .btn-quiet { background: transparent; box-shadow: none; color: rgba(43, 22, 48, 0.7); }
.btn-danger { color: #ffb3b5; box-shadow: inset 0 0 0 2px rgba(255, 90, 95, 0.5); }
.link { background: none; border: 0; padding: 0.4em; color: var(--muted); text-decoration: underline; text-underline-offset: 0.2em; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }

.field { display: grid; gap: 0.3em; margin: 0 0 0.9em; font-weight: 600; }
.field span { font-size: 0.9em; opacity: 0.75; }
.field input {
  width: 100%; min-height: 54px; padding: 0.5em 0.8em; border-radius: 0.7em; border: 2px solid rgba(43, 22, 48, 0.2);
  background: #fff; color: var(--ink); font-size: 1.25rem; font-weight: 600;
}
.field input:focus { outline: none; border-color: var(--tang); box-shadow: 0 0 0 4px rgba(255, 122, 61, 0.25); }
#j-code, #pj-code { font-family: var(--display); letter-spacing: 0.25em; text-transform: uppercase; font-size: 1.6rem; }
.notice { background: rgba(255, 191, 60, 0.16); border: 1px solid rgba(255, 191, 60, 0.4); color: var(--cream); padding: 0.6em 0.9em; border-radius: 0.7em; }
.card .notice { color: var(--ink); background: rgba(255, 191, 60, 0.3); }

.av {
  --c: var(--mustard);
  display: inline-grid; place-items: center; flex: none;
  width: 2.2em; height: 2.2em; border-radius: 50%;
  background: var(--c); color: var(--ink); border: 0.14em solid var(--cream);
  font-family: var(--display); font-weight: 800; font-size: 1em; line-height: 1;
  box-shadow: 0 0.12em 0 rgba(0, 0, 0, 0.35);
}
.av-xl { width: 4.4em; height: 4.4em; font-size: 1.3em; }
.av-aud { background: var(--plum-3); color: var(--cream); border-style: dashed; }
.av-empty { background: transparent; border: 0.12em dashed rgba(255, 244, 226, 0.3); box-shadow: none; }

/* ---------- logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 0.18em; margin: 0; font-family: var(--display); font-weight: 900; font-size: 2.2em; line-height: 1; letter-spacing: -0.02em; }
.logo-lamp { width: 1.1em; height: 1.1em; transform: rotate(-8deg); filter: drop-shadow(0 0 0.35em rgba(255, 191, 60, 0.65)); }
.logo-front { color: var(--cream); text-shadow: 0.06em 0.06em 0 var(--tang); }
.logo-room { color: var(--mustard); text-shadow: 0.06em 0.06em 0 #a33c1a; transform: rotate(-3deg) translateY(0.04em); display: inline-block; }
.logo-big { font-size: 3.6em; }
.logo-small { font-size: 1.6em; }

/* ---------- home ---------- */
.home { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.6em; padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); }
.home-head { text-align: center; }
.home-head .logo { font-size: clamp(2.6rem, 9vw, 5rem); }
.tagline { margin: 0.6em 0 0; font-size: 1.2em; color: var(--muted); }
.home-cards { display: grid; gap: 1.2em; width: min(100%, 860px); }
.home-tv .home-cards { grid-template-columns: 1fr 1fr; }
.home-tv .host-card { order: -1; }
.home-cards .card { padding: 1.4em 1.4em 1.5em; display: flex; flex-direction: column; }
.home-cards h2 { margin: 0 0 0.6em; font-family: var(--display); font-size: 1.35em; }
.home-cards .card p { margin: 0 0 1.2em; flex: 1; }
.home-cards .btn-big { width: 100%; }
.home-phone .host-card { background: rgba(255, 244, 226, 0.08); color: var(--cream); box-shadow: inset 0 0 0 2px rgba(255, 244, 226, 0.14); }
.home-phone .host-card .btn { color: var(--cream); background: rgba(255, 244, 226, 0.1); }
.home-foot { color: var(--muted); }

/* ---------- toast and sheets ---------- */
#toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 60; transform: translate(-50%, 140%);
  max-width: min(92vw, 560px); padding: 0.8em 1.2em; border-radius: 1em; background: var(--cream); color: var(--ink); font-weight: 600;
  box-shadow: var(--shadow); transition: transform 0.3s cubic-bezier(.2, 1.4, .4, 1); pointer-events: none; text-align: center;
}
#toast.on { transform: translate(-50%, 0); }
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: grid; place-items: end center; background: rgba(10, 2, 14, 0.6); opacity: 0; transition: opacity 0.2s; }
.sheet-wrap.on { opacity: 1; }
.sheet {
  width: min(100%, 560px); max-height: 92vh; max-height: 92dvh; overflow: auto; padding: 1.4em 1.3em max(1.3em, env(safe-area-inset-bottom));
  background: var(--plum-2); border-radius: 1.3em 1.3em 0 0; box-shadow: 0 -1em 3em rgba(0, 0, 0, 0.4); transform: translateY(30px); transition: transform 0.25s;
}
.sheet-wrap.on .sheet { transform: none; }
@media (min-width: 700px) { .sheet-wrap { place-items: center; } .sheet { border-radius: 1.3em; } }
.sheet-title { font-family: var(--display); margin: 0 0 0.6em; font-size: 1.4em; }
.sheet h3 { margin: 1.2em 0 0.5em; font-size: 1em; text-transform: uppercase; letter-spacing: 0.08em; color: var(--mustard); }
.sheet-actions { display: flex; justify-content: flex-end; gap: 0.6em; margin-top: 1.2em; }
.about-ver { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6em 1em; padding: 0.8em 1em; border-radius: 0.8em; background: rgba(255, 244, 226, 0.07); }
.changelog { padding-left: 1.1em; margin: 0; }
.changelog > li { margin-bottom: 0.6em; }
.changelog ul { padding-left: 1.1em; margin: 0.2em 0 0; }
.about-links { margin-top: 1.2em; }
.menu-list { display: grid; gap: 0.6em; }
.menu-list .btn { width: 100%; }
.set-group { margin-bottom: 0.4em; }
.switch { display: flex; align-items: center; gap: 0.7em; min-height: 48px; cursor: pointer; }
.switch input { width: 1.4em; height: 1.4em; accent-color: var(--tang); flex: none; }
.range { display: grid; grid-template-columns: 8em 1fr; align-items: center; gap: 0.8em; min-height: 44px; }
.range input { accent-color: var(--tang); width: 100%; }
.set-label { margin: 0.8em 0 0.4em; color: var(--muted); }
.pills { display: flex; flex-wrap: wrap; gap: 0.5em; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span { display: inline-flex; align-items: center; min-height: 44px; padding: 0.3em 1em; border-radius: 999px; box-shadow: inset 0 0 0 2px rgba(255, 244, 226, 0.25); cursor: pointer; }
.pill input:checked + span { background: var(--mustard); color: var(--ink); box-shadow: none; font-weight: 600; }
.pill input:focus-visible + span { outline: 3px solid var(--teal); outline-offset: 2px; }

/* ===================================================================== */
/* The TV                                                                 */
/* ===================================================================== */

body[data-mode='screen'] { overflow: hidden; }
.tv { position: relative; height: 100vh; height: 100dvh; font-size: min(1.55vw, 2.75vh); padding: 1.4em 2em 1.2em; display: flex; flex-direction: column; }
.tv-wait { align-items: center; justify-content: center; gap: 1em; text-align: center; }
.tv-wait .row { display: flex; gap: 0.8em; }
body.idle { cursor: none; }

.tv-head { display: flex; align-items: baseline; gap: 1em; }
.tv-head .logo { font-size: 2.4em; }
.tv-tag { margin: 0; color: var(--muted); font-size: 1.05em; }

.lobby-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 1.05fr 1fr; gap: 1.6em; margin-top: 0.9em; }
.join-panel { padding: 1.1em 1.5em; display: flex; flex-direction: column; justify-content: center; min-height: 0; }
.join-how { margin: 0; font-size: 0.9em; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; color: rgba(43, 22, 48, 0.6); }
.join-addr { margin: 0.1em 0 0.7em; font-family: var(--display); font-weight: 700; font-size: 1.1em; overflow-wrap: anywhere; color: var(--ink); }
.join-code-row { display: flex; align-items: center; justify-content: space-between; gap: 1em; }
.room-code { display: flex; gap: 0.12em; margin: 0.15em 0 0; }
.room-code span {
  display: grid; place-items: center; width: 1.25em; height: 1.4em; border-radius: 0.18em;
  font-family: var(--display); font-weight: 900; font-size: 3.6em; line-height: 1;
  background: var(--ink); color: var(--mustard); box-shadow: 0 0.08em 0 #0d050f;
  animation: tile-in 0.6s cubic-bezier(.2, 1.5, .4, 1) both;
}
.room-code span:nth-child(1) { transform: rotate(-3deg); animation-delay: 0.05s; }
.room-code span:nth-child(2) { transform: rotate(2deg); animation-delay: 0.12s; color: var(--tang); }
.room-code span:nth-child(3) { transform: rotate(-1.5deg); animation-delay: 0.19s; color: var(--teal); }
.room-code span:nth-child(4) { transform: rotate(3deg); animation-delay: 0.26s; color: var(--pink); }
@keyframes tile-in { from { opacity: 0; translate: 0 -0.6em; } }
.qr-box { width: 8.4em; flex: none; }
.qr { display: block; width: 100%; height: auto; border-radius: 0.5em; }
.join-note { margin: 0.6em 0 0; color: rgba(43, 22, 48, 0.65); font-size: 0.9em; }
.lobby-side { display: flex; flex-direction: column; gap: 1em; min-height: 0; }
.seats-panel { display: flex; flex-direction: column; min-height: 0; }
.panel-title { margin: 0 0 0.5em; font-family: var(--display); font-size: 1.3em; display: flex; justify-content: space-between; }
.panel-title span { color: var(--mustard); }
.seats { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(4, minmax(0, 1fr)); gap: 0.5em; flex: 1; min-height: 0; }
.seat { position: relative; display: flex; align-items: center; gap: 0.6em; padding: 0.3em 0.7em; border-radius: 1em; min-height: 0; }
.seat .av { width: 2.5em; height: 2.5em; } /* big enough to make out a pixel-art face across the room */
.seat.on { background: rgba(255, 244, 226, 0.09); box-shadow: inset 0 0 0 0.12em color-mix(in srgb, var(--c) 60%, transparent); animation: pop-in 0.5s cubic-bezier(.2, 1.6, .4, 1); }
.seat.empty { box-shadow: inset 0 0 0 0.1em rgba(255, 244, 226, 0.12); }
.seat.away { opacity: 0.45; }
.seat-name { font-weight: 600; font-size: 1.15em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat.empty .seat-name { color: var(--muted); font-weight: 400; font-size: 1em; }
.vip { margin-left: auto; padding: 0.15em 0.55em; border-radius: 999px; background: var(--mustard); color: var(--ink); font-family: var(--display); font-weight: 800; font-size: 0.7em; letter-spacing: 0.06em; }
.kick { position: absolute; right: 0.3em; top: 0.2em; width: 1.6em; height: 1.6em; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.35); opacity: 0; transition: opacity 0.2s; }
.seat:hover .kick, .kick:focus-visible { opacity: 1; }
.audience-line { margin: 0.5em 0 0; color: var(--muted); font-size: 0.95em; }
@keyframes pop-in { from { transform: scale(0.6); opacity: 0; } }

.games-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.6em; margin-top: 0.9em; }
.game-tile {
  --g: var(--pink);
  display: grid; grid-template-columns: 2.6em 1fr; grid-template-rows: auto auto; column-gap: 0.6em; align-items: center; text-align: left;
  min-height: 3.6em; padding: 0.45em 0.7em; border: 0; border-radius: 0.9em; color: var(--cream);
  background: linear-gradient(135deg, color-mix(in srgb, var(--g) 34%, var(--plum-2)), var(--plum-2));
  box-shadow: inset 0 0 0 0.1em color-mix(in srgb, var(--g) 70%, transparent), 0 0.2em 0 rgba(10, 2, 14, 0.45);
  font: inherit; transition: transform 0.15s, filter 0.15s;
}
.game-tile:hover:not(:disabled), .game-tile:focus-visible { transform: translateY(-0.12em); filter: brightness(1.15); }
.game-tile:disabled { cursor: default; box-shadow: inset 0 0 0 0.1em color-mix(in srgb, var(--g) 35%, transparent); background: color-mix(in srgb, var(--plum-2) 70%, transparent); }
.game-tile:disabled > :not(.game-pop) { opacity: 0.5; }
.game-tile .game-art { grid-row: 1 / 3; width: 2.6em; }
.game-tile .game-art svg { display: block; width: 100%; height: auto; }
.game-name { font-family: var(--display); font-weight: 800; font-size: 0.95em; line-height: 1.1; }
.game-players { color: var(--muted); font-size: 0.8em; }
.game-art .pig, .game-art .pint { animation: none; }
/* what the game is, over its tile on hover or the remote's focus; the last two columns open leftwards */
.game-tile { position: relative; }
.game-pop {
  position: absolute; left: 0; bottom: calc(100% + 0.6em); z-index: 20; width: 25em; display: grid; gap: 0.45em;
  padding: 0.9em 1.1em; border-radius: 0.9em; background: var(--cream); color: var(--ink); box-shadow: var(--shadow), inset 0 0 0 0.15em var(--g);
  font-size: 0.82em; line-height: 1.35; text-align: left; pointer-events: none;
  opacity: 0; visibility: hidden; transform: translateY(0.4em); transition: opacity 0.18s, transform 0.18s, visibility 0s 0.18s;
}
.game-tile:nth-child(5n) .game-pop, .game-tile:nth-child(5n - 1) .game-pop { left: auto; right: 0; }
.game-tile:hover .game-pop, .game-tile:focus-visible .game-pop { opacity: 1; visibility: visible; transform: none; transition-delay: 0.25s, 0.25s, 0.25s; }
.pop-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1em; }
.pop-head b { font-family: var(--display); font-size: 1.35em; }
.pop-head small { color: color-mix(in srgb, var(--ink) 60%, transparent); white-space: nowrap; }
.pop-blurb { font-weight: 600; }
.pop-step { display: grid; grid-template-columns: 1.5em 1fr; gap: 0.5em; align-items: start; }
.pop-step i { display: grid; place-items: center; width: 1.5em; height: 1.5em; border-radius: 50%; background: var(--g); color: var(--ink); font-style: normal; font-weight: 800; font-size: 0.85em; }
.pop-apart { margin-top: 0.2em; padding-top: 0.5em; border-top: 1px solid color-mix(in srgb, var(--ink) 15%, transparent); color: color-mix(in srgb, var(--ink) 75%, transparent); }
@keyframes bob { 50% { transform: translateY(-0.25em) rotate(-3deg); } }
.lobby-foot { display: flex; justify-content: space-between; gap: 1em; margin-top: 0.9em; min-height: 1.4em; }
.lobby-hint, .last-game { margin: 0; color: var(--muted); }
.ver { margin: 0; color: var(--muted); font-size: 0.85em; opacity: 0.8; }
.lobby-foot .ver { margin-left: auto; }
.pad-lobby .ver { margin-top: auto; }
.lobby-hint b, .last-game b { color: var(--cream); }

.tv-tools { position: absolute; right: 1.2em; bottom: 0.9em; display: flex; gap: 0.4em; transition: opacity 0.4s; z-index: 5; }
.tool { min-height: 2em; padding: 0.25em 0.8em; border: 0; border-radius: 999px; background: rgba(10, 2, 14, 0.55); color: var(--cream); font-size: 0.75em; box-shadow: inset 0 0 0 1px rgba(255, 244, 226, 0.2); }
body.idle .tv-tools { opacity: 0; pointer-events: none; }
.tv-lobby .tv-tools { bottom: auto; top: 1.2em; }

.paused-layer:empty { display: none; }
.paused-layer, .pad-paused:not(:empty) { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; background: rgba(10, 2, 14, 0.66); backdrop-filter: blur(6px); }
.pad-paused:not(:empty) { position: fixed; }
.pad-remove { flex-direction: column; align-items: stretch; margin: 0.8em 0; }
.pad-remove li { display: flex; align-items: center; gap: 0.6em; }
.pad-remove li > span:not(.av) { flex: 1; }
.pad-remove .btn { min-height: 40px; padding: 0.3em 1em; }
.times-up .pad-body { pointer-events: none; }
.times-up .pad-body form, .times-up .pad-body .pad-opts, .times-up .pad-body canvas { opacity: 0.45; filter: grayscale(0.6); }
.times-up::after { content: "Time's up!"; position: fixed; left: 50%; bottom: max(1.2em, env(safe-area-inset-bottom)); z-index: 7; transform: translateX(-50%); padding: 0.5em 1.2em; border-radius: 999px; background: var(--red); color: #fff; font-family: var(--display); font-weight: 800; font-size: 1.2em; box-shadow: var(--shadow); animation: pop-in 0.25s both; }
.paused-card { display: grid; gap: 0.3em; text-align: center; padding: 1.2em 2em; border-radius: 1em; background: var(--cream); color: var(--ink); box-shadow: var(--shadow); }
.paused-card b { font-family: var(--display); font-size: 2em; }
.paused-card .btn-primary { margin-top: 0.6em; }
body.trouble::after { content: 'Reconnecting…'; position: fixed; top: max(8px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 70; padding: 0.4em 1em; border-radius: 999px; background: var(--red); color: #fff; font-weight: 600; }

/* game frame */
.tv-game { padding-bottom: 0.6em; }
.game-bar { display: flex; align-items: center; gap: 1.2em; font-size: 0.95em; color: var(--muted); }
.bar-logo { padding: 0.2em 0.8em; border-radius: 999px; background: var(--pink); color: var(--ink); font-family: var(--display); font-weight: 800; }
.tv-game[data-game='porkies'] .bar-logo { background: var(--pink); }
.bar-mid { flex: 1; text-align: center; font-weight: 600; color: var(--cream); }
.bar-code b { color: var(--cream); }
#bar-code { font-family: var(--display); color: var(--mustard); letter-spacing: 0.1em; }
.stage { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.crowd { display: flex; align-items: center; justify-content: center; gap: 1em; min-height: 3.6em; }
.crowd-list { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5em 1.1em; margin: 0; padding: 0; }
.crowd-p { position: relative; display: flex; align-items: center; gap: 0.4em; opacity: 0.55; transition: opacity 0.3s; }
.crowd-p.done { opacity: 1; animation: hop 0.5s cubic-bezier(.2, 1.8, .4, 1); }
.crowd-p.done::after { content: '✓'; position: absolute; left: 1.45em; top: -0.35em; width: 1.15em; height: 1.15em; display: grid; place-items: center; border-radius: 50%; background: var(--teal); color: var(--ink); font-weight: 800; font-size: 0.8em; }
.crowd-p.away { filter: grayscale(1); }
.crowd-name { font-weight: 600; }
.crowd-score { color: var(--mustard); font-family: var(--display); font-size: 0.85em; }
.crowd-aud { color: var(--muted); }
.tv-game .crowd-p:not(.done) { opacity: 0.9; }
.pk-write-scene ~ * .crowd-p:not(.done) { opacity: 0.5; }
@keyframes hop { 40% { transform: translateY(-0.5em); } }

/* timer ring */
.timer { position: relative; width: 4.2em; height: 4.2em; flex: none; --p: 1; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.t-bg { fill: rgba(10, 2, 14, 0.45); stroke: rgba(255, 244, 226, 0.15); stroke-width: 4; }
.t-fg { fill: none; stroke: var(--mustard); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--p)); transition: stroke 0.3s; }
.timer-n { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 1.35em; }
.timer.low .t-fg { stroke: var(--red); }
.timer.low { animation: throb 1s ease-in-out infinite; }
@keyframes throb { 50% { transform: scale(1.08); } }

/* ===================================================================== */
/* Porkies on the TV                                                      */
/* ===================================================================== */

.pig { display: block; overflow: visible; }
.pk-card-scene { text-align: center; display: flex; flex-direction: column; align-items: center; animation: rise 0.6s cubic-bezier(.2, 1.3, .4, 1) both; }
.pk-pig-big { width: 8.5em; margin-bottom: 0.4em; animation: spin-in 0.9s cubic-bezier(.2, 1.5, .4, 1) both; }
.pk-kicker { margin: 0; font-family: var(--display); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--mustard); font-size: 1.2em; }
.pk-title { margin: 0.15em 0 0.5em; font-family: var(--display); font-weight: 900; font-size: 3.6em; line-height: 1.05; color: var(--cream); text-shadow: 0.06em 0.06em 0 var(--pink); }
.pk-title-sm { margin: 0 0 0.5em; font-family: var(--display); font-size: 2.2em; color: var(--cream); text-shadow: 0.06em 0.06em 0 var(--pink); }
.pk-rules { list-style: none; counter-reset: r; display: flex; gap: 1em; margin: 0 0 1.2em; padding: 0; }
.pk-rules li { counter-increment: r; width: 13em; padding: 1em 1em 1.1em; border-radius: 1em; background: var(--cream); color: var(--ink); box-shadow: var(--shadow); text-align: left; font-size: 1.05em; animation: rise 0.6s cubic-bezier(.2, 1.3, .4, 1) both; }
.pk-rules li:nth-child(2) { animation-delay: 0.25s; transform: rotate(1deg); }
.pk-rules li:nth-child(3) { animation-delay: 0.5s; transform: rotate(-1deg); }
.pk-rules li::before { content: counter(r); display: grid; place-items: center; width: 1.8em; height: 1.8em; margin-bottom: 0.4em; border-radius: 50%; background: var(--pink); color: #fff; font-family: var(--display); font-weight: 800; }
.pk-points { display: flex; gap: 1em; margin: 0; }
.pk-points span { padding: 0.45em 1.1em; border-radius: 999px; background: rgba(255, 244, 226, 0.1); font-size: 1.1em; }
.pk-points b { font-family: var(--display); color: var(--mustard); margin-left: 0.3em; }
@keyframes rise { from { opacity: 0; transform: translateY(1.2em); } }
@keyframes spin-in { from { opacity: 0; transform: scale(0.3) rotate(-30deg); } }

.pk-write-scene, .pk-choose-scene, .pk-reveal-scene { width: 100%; max-width: 54em; display: flex; flex-direction: column; align-items: center; }
.pk-cat { margin: 0 0 0.7em; padding: 0.3em 1em; border-radius: 999px; background: var(--teal); color: var(--ink); font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.95em; animation: rise 0.5s both; }
.pk-q { padding: 1.1em 1.4em; font-size: 2.35em; font-weight: 600; line-height: 1.28; text-align: center; animation: rise 0.6s cubic-bezier(.2, 1.3, .4, 1) both; text-wrap: balance; }
.pk-q-small { font-size: 1.45em; padding: 0.7em 1.1em; animation: none; }
.blank { display: inline-block; min-width: 3.6em; margin: 0 0.1em; padding: 0 0.25em; border-bottom: 0.12em solid var(--pink); line-height: 1.05; }
.blank i { display: inline-block; width: 100%; }
.blank.filled { border-bottom: 0; border-radius: 0.2em; background: var(--pink); color: #fff; animation: fill-pop 0.6s cubic-bezier(.2, 1.8, .4, 1); }
@keyframes fill-pop { from { transform: scale(1.5); } }
.pk-instruct-row { display: flex; align-items: center; gap: 1.2em; margin-top: 1.2em; }
.pk-instruct { margin: 0; font-size: 1.5em; }
.pk-instruct b { color: var(--mustard); }
.pk-aud { color: var(--muted); font-size: 0.7em; }

.pk-opts { list-style: none; width: 100%; margin: 1.2em 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.8em 1em; }
.pk-opts.n5, .pk-opts.n6, .pk-opts.n7, .pk-opts.n8, .pk-opts.n9 { grid-template-columns: repeat(3, 1fr); }
.pk-opt {
  display: grid; place-items: center; min-height: 2.6em; padding: 0.5em 0.8em; border-radius: 0.8em; background: var(--cream); color: var(--ink);
  font-family: var(--display); font-weight: 700; font-size: 1.45em; text-transform: uppercase; text-align: center; line-height: 1.15; box-shadow: var(--shadow);
  animation: drop 0.5s cubic-bezier(.2, 1.5, .4, 1) both; animation-delay: calc(var(--i) * 0.11s + 0.1s); overflow-wrap: anywhere;
}
.pk-opt:nth-child(odd) { rotate: -0.6deg; }
.pk-opt:nth-child(even) { rotate: 0.7deg; }
.pk-opts.n7 .pk-opt, .pk-opts.n8 .pk-opt, .pk-opts.n9 .pk-opt { font-size: 1.2em; }
@keyframes drop { from { opacity: 0; transform: translateY(-1em) scale(0.85); } }

.pk-spot { width: 100%; flex: 1; display: grid; place-items: center; }
.pk-step { display: flex; flex-direction: column; align-items: center; gap: 0.7em; text-align: center; }
.pk-big-answer { padding: 0.45em 1em; border-radius: 0.6em; background: var(--cream); color: var(--ink); font-family: var(--display); font-weight: 900; font-size: 3em; text-transform: uppercase; box-shadow: var(--shadow); animation: slam 0.55s cubic-bezier(.2, 1.4, .4, 1) both; max-width: 16em; overflow-wrap: anywhere; }
.is-truth .pk-big-answer { animation-delay: 1.25s; background: var(--teal); }
@keyframes slam { from { opacity: 0; transform: scale(1.6) rotate(-4deg); } }
.pk-pickers { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5em 1.1em; margin: 0.3em 0 0; padding: 0; min-height: 2.4em; }
.pk-picker { display: flex; align-items: center; gap: 0.4em; font-size: 1.2em; font-weight: 600; animation: pop-in 0.45s cubic-bezier(.2, 1.6, .4, 1) both; }
.pk-picker:nth-child(1) { animation-delay: 0.45s; } .pk-picker:nth-child(2) { animation-delay: 0.6s; } .pk-picker:nth-child(3) { animation-delay: 0.75s; }
.pk-picker:nth-child(4) { animation-delay: 0.9s; } .pk-picker:nth-child(5) { animation-delay: 1.05s; } .pk-picker:nth-child(n+6) { animation-delay: 1.2s; }
.is-truth .pk-picker { animation-delay: 1.9s !important; }
.pk-picker .av-aud { width: auto; min-width: 2.2em; padding: 0 0.4em; border-radius: 999px; font-size: 0.9em; }
.pts { color: var(--mustard); font-family: var(--display); font-size: 0.85em; }
.pk-stamp-row { height: 4.6em; display: grid; place-items: center; }
.stamp { display: inline-block; padding: 0.1em 0.5em; border: 0.12em solid currentColor; border-radius: 0.2em; font-family: var(--display); font-weight: 900; font-size: 2.3em; text-transform: uppercase; rotate: -6deg; animation: stamp 0.35s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: 1.7s; background: rgba(10, 2, 14, 0.35); }
.stamp-lie { color: var(--red); }
.stamp-house { color: var(--violet); }
.stamp-truth { color: var(--teal); animation-delay: 1.3s; rotate: 3deg; }
@keyframes stamp { from { opacity: 0; transform: scale(3); } 70% { opacity: 1; transform: scale(0.92); } }
.pk-who { margin: 0; font-size: 1.35em; animation: rise 0.4s both; animation-delay: 2.3s; }
.pk-author { font-weight: 700; color: var(--c); }
.pk-audtop, .pk-likes { display: inline-block; margin-left: 0.6em; padding: 0.1em 0.6em; border-radius: 999px; background: rgba(255, 244, 226, 0.12); font-size: 0.8em; }
.is-truth .pk-who { animation-delay: 1.9s; }
.pk-note { max-width: 36em; margin: 0.4em 0 0; padding: 0.8em 1.2em; font-size: 1.2em; animation: rise 0.6s both; animation-delay: 2.6s; }

/* scores */
.pk-scores-scene { width: min(100%, 46em); height: 100%; display: flex; flex-direction: column; align-items: stretch; padding-top: 0.5em; }
.pk-scores-scene .pk-title-sm { text-align: center; }
.board { position: relative; list-style: none; margin: 0; padding: 0; flex: 1; }
.pk-scores-scene .b-row { position: absolute; left: 0; right: 0; top: calc(var(--row) * var(--h)); height: calc(var(--h) - 0.6em); transition: top 0.9s cubic-bezier(.5, 0, .2, 1); }
.b-row { display: flex; align-items: center; gap: 0.8em; padding: 0 1em; border-radius: 0.9em; background: rgba(255, 244, 226, 0.08); box-shadow: inset 0.35em 0 0 var(--c); }
.b-place { width: 1.6em; font-family: var(--display); font-weight: 800; color: var(--muted); }
.b-name { font-weight: 700; font-size: 1.3em; min-width: 6em; }
.b-bar { flex: 1; height: 0.7em; border-radius: 999px; background: rgba(255, 244, 226, 0.08); overflow: hidden; }
.b-bar i { display: block; height: 100%; width: var(--w); background: var(--c); border-radius: 999px; transition: width 1.2s cubic-bezier(.3, 0, .2, 1); }
.b-gain { color: var(--mustard); font-family: var(--display); opacity: 0; }
.b-row.moved .b-gain { animation: pop-in 0.5s both; opacity: 1; }
.b-score { min-width: 4.5em; text-align: right; font-family: var(--display); font-weight: 800; font-size: 1.4em; }

/* end */
.pk-end-scene { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 0.8em; position: relative; z-index: 0; padding-top: 1.6em; }
.pk-winner { text-align: center; animation: rise 0.7s both; }
.pk-crown { position: relative; display: inline-block; }
.pk-crown::before { content: ''; position: absolute; left: 50%; top: -1.6em; width: 3.2em; height: 1.9em; translate: -50% 0; background: var(--mustard); clip-path: polygon(0 100%, 0 20%, 25% 60%, 50% 0, 75% 60%, 100% 20%, 100% 100%); animation: bob 2s ease-in-out infinite; }
.pk-end-scene .pk-title { font-size: 2.6em; margin: 0.2em 0 0; }
.pk-crown .av-xl { font-size: 1.05em; }
.pk-sub { margin: 0; font-family: var(--display); color: var(--mustard); font-size: 1.3em; }
.pk-end-cols { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1.6em; width: min(100%, 60em); flex: 1; min-height: 0; }
.board-final { display: grid; align-content: start; gap: 0.45em; }
.board-final .b-row { height: 2.7em; animation: rise 0.5s both; }
.board-final .b-name { flex: 1; }
.awards { list-style: none; margin: 0; padding: 0; display: grid; align-content: start; gap: 0.6em; }
.award { display: grid; grid-template-columns: 1fr auto; padding: 0.45em 0.9em; border-radius: 0.9em; background: var(--cream); color: var(--ink); box-shadow: var(--shadow); animation: rise 0.5s both; }
.award:nth-child(2) { animation-delay: 0.2s; } .award:nth-child(3) { animation-delay: 0.4s; } .award:nth-child(4) { animation-delay: 0.6s; }
.award-t { font-family: var(--display); font-weight: 800; color: var(--pink); }
.award-who { font-weight: 700; text-align: right; }
.award-n { grid-column: 1 / -1; color: rgba(43, 22, 48, 0.65); font-size: 0.9em; }
.pk-end-btns { display: flex; gap: 1em; }
.confetti { position: absolute; inset: -2em 0 0; pointer-events: none; overflow: hidden; z-index: -1; }
.confetti i { position: absolute; top: -1em; left: calc(var(--x) * 1%); width: 0.55em; height: 0.9em; background: var(--c); border-radius: 0.1em; animation: fall 3.4s linear infinite; animation-delay: calc(var(--d) * 1s); }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ===================================================================== */
/* A phone                                                                */
/* ===================================================================== */

body[data-mode='pad'] { min-height: 100dvh; }
.pad { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.pad-wait { align-items: center; justify-content: center; }
.pad-join { align-items: center; padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)); gap: 1.2em; }
.pad-join-head { margin-top: 2vh; }
.join-form { width: min(100%, 440px); padding: 1.3em 1.2em 1.1em; display: grid; }
.join-form h2 { margin: 0 0 0.7em; font-family: var(--display); font-size: 1.3em; }
.pad-err { min-height: 1.3em; margin: -0.3em 0 0.6em; color: #c0262c; font-weight: 600; }
.pad .pad-scene .pad-err { color: #ffb3b5; }
.pad-foot { color: var(--muted); }

.pad-room { position: relative; }
.pad-head {
  position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: 0.7em;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px; background: rgba(29, 15, 36, 0.92); backdrop-filter: blur(10px);
  box-shadow: inset 0 -3px 0 var(--me);
}
.pad-me { flex: 1; min-width: 0; display: grid; }
.pad-me b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1.1em; }
.pad-me small { color: var(--muted); }
.pad-menu { min-height: 44px; padding: 0 1em; border-radius: 999px; border: 0; background: rgba(255, 244, 226, 0.1); }
.pad-body { flex: 1; display: flex; flex-direction: column; position: relative; }
.pad-game { flex: 1; display: flex; flex-direction: column; position: relative; min-height: 0; }
.pad-scene { flex: 1; display: flex; flex-direction: column; gap: 0.9em; padding: 18px 16px max(24px, env(safe-area-inset-bottom)); }
.pad-center { align-items: center; justify-content: center; text-align: center; }
.pad-title { margin: 0; font-family: var(--display); font-size: 1.5em; }
.pad-hello { display: grid; justify-items: center; gap: 0.6em; text-align: center; margin: 3vh 0 1vh; }
.pad-lobby { align-items: center; text-align: center; }
.vip-box { width: 100%; display: grid; gap: 0.7em; padding: 1em; border-radius: 1em; background: rgba(255, 191, 60, 0.12); box-shadow: inset 0 0 0 2px rgba(255, 191, 60, 0.4); }
.vip-box p { margin: 0; }
.game-btn { width: 100%; }
.pad-others { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5em 1em; margin: 0.5em 0; padding: 0; }
.pad-others li { display: flex; align-items: center; gap: 0.35em; font-weight: 600; }
.pad-others .av { font-size: 0.8em; }

.pad-timer { position: sticky; top: 0; height: 6px; background: rgba(255, 244, 226, 0.1); }
.pad-timer i { display: block; height: 100%; width: calc(var(--p, 1) * 100%); background: var(--me); transition: background 0.3s; }
.pad-timer.low i { background: var(--red); }
.pad-cat { margin: 0; color: var(--teal); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.85em; }
.pad-q { margin: 0; padding: 0.9em 1em; border-radius: 1em; background: var(--cream); color: var(--ink); font-size: 1.2em; font-weight: 600; line-height: 1.3; }
.pad-q-small { font-size: 1em; padding: 0.7em 0.9em; }
.pad-q .blank { min-width: 2em; }
.pad-form { display: grid; gap: 0.2em; }
.pad-form .field span { color: var(--muted); opacity: 1; }
.pad-form .btn-quiet { justify-self: center; }
.sugg-list { display: grid; gap: 0.5em; }
.sugg-list p { margin: 0.4em 0 0; text-align: center; }
.sugg { width: 100%; }
.pad-sent { text-align: center; padding: 1em; border-radius: 1em; background: rgba(46, 196, 182, 0.12); box-shadow: inset 0 0 0 2px rgba(46, 196, 182, 0.4); }
.pad-ok { margin: 0; font-family: var(--display); font-size: 1.35em; color: var(--teal); }
.pad-bad { margin: 0; font-family: var(--display); font-size: 1.35em; color: var(--red); }
.pad-mylie { margin: 0.3em 0; font-size: 1.25em; font-weight: 700; }
.pad-ask { margin: 0.2em 0 0; text-align: center; font-weight: 700; font-size: 1.15em; }
.pad-opts, .pad-likes { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55em; }
.opt {
  width: 100%; min-height: 58px; align-content: center; padding: 0.6em 1em; border: 0; border-radius: 0.9em; background: var(--cream); color: var(--ink);
  font-family: var(--display); font-weight: 700; font-size: 1.02em; text-transform: uppercase; box-shadow: 0 0.2em 0 rgba(0, 0, 0, 0.4);
  display: grid; justify-items: center; gap: 0.1em; overflow-wrap: anywhere;
}
.opt:active { transform: translateY(2px); box-shadow: 0 0.06em 0 rgba(0, 0, 0, 0.4); }
.opt.own { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 2px rgba(255, 244, 226, 0.2); }
.opt small { font-family: var(--body); text-transform: none; font-weight: 500; font-size: 0.8em; }
.pad-like-head { margin: 0.6em 0 0; text-align: center; color: var(--muted); }
.like { width: 100%; min-height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 0.8em; padding: 0.4em 1em; border: 0; border-radius: 0.9em; background: rgba(255, 244, 226, 0.08); text-align: left; font-weight: 600; }
.like b { font-size: 1.4em; color: rgba(255, 244, 226, 0.3); transition: color 0.2s, transform 0.2s; }
.like.on b { color: var(--pink); transform: scale(1.25); }
.pk-pig-pad { width: 7em; }
.pk-pig-pad.wobble .pig { animation: bob 1.6s ease-in-out infinite; }
.pad-place { margin: 0; font-family: var(--display); font-weight: 900; font-size: 3em; color: var(--me); }
.pad-score { margin: 0; font-size: 1.3em; font-weight: 700; }
.pad-gain { margin: 0; font-family: var(--display); font-size: 1.8em; color: var(--mustard); animation: pop-in 0.5s both; }
.pad-fooled { margin: 0; font-weight: 700; color: var(--pink); }
.pad-award { margin: 0; padding: 0.4em 1em; border-radius: 999px; background: var(--cream); color: var(--pink); font-family: var(--display); font-weight: 800; }
.pad-btns { width: 100%; display: grid; gap: 0.6em; margin-top: 1em; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* scores and the end have their own board: no need for the strip */
.tv-game.no-crowd .crowd { display: none; }

/* ===================================================================== */
/* Last Orders on the TV                                                  */
/* ===================================================================== */

.pint { display: block; overflow: visible; }
.game-art .pint { width: 78%; margin: 0 auto; animation: bob 2.8s ease-in-out infinite; }
.qz-pint-big { width: 6em; margin-bottom: 0.4em; animation: spin-in 0.9s cubic-bezier(.2, 1.5, .4, 1) both; }
.qz-title { text-shadow: 0.06em 0.06em 0 var(--tang); }
.qz-rules li { width: 11.5em; }
.qz-rules li::before { background: var(--tang); }
.tv-game[data-game='quiz'] .bar-logo { background: var(--mustard); }
.qz-round .pk-kicker { color: var(--k); }
.qz-round-title { color: var(--k); text-shadow: 0.06em 0.06em 0 rgba(10, 2, 14, 0.6); font-size: 4em; }
.qz-jokers { margin: 1em 0 0; font-size: 1.3em; min-height: 1.4em; }
.qz-jokers b { color: var(--mustard); }

.qz-vote-scene { width: 100%; max-width: 60em; display: flex; flex-direction: column; align-items: center; }
.qz-cats { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2em; width: 100%; margin: 0.6em 0 0; padding: 0; }
.qz-cat {
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 0.8em; min-height: 9em; padding: 1.2em 1em;
  border-radius: 1.1em; background: var(--cream); color: var(--ink); box-shadow: inset 0 -0.45em 0 var(--k), var(--shadow);
  animation: drop 0.5s cubic-bezier(.2, 1.5, .4, 1) both; animation-delay: calc(var(--i) * 0.15s);
}
.qz-cat-name { font-family: var(--display); font-weight: 800; font-size: 1.7em; text-align: center; line-height: 1.1; }
.qz-voters { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.3em; min-height: 2.4em; }
.qz-voters .av { animation: pop-in 0.4s cubic-bezier(.2, 1.6, .4, 1); }

.qz-ask-scene { width: 100%; max-width: 62em; display: flex; flex-direction: column; align-items: center; }
.qz-q { font-size: 2.1em; }
.qz-q-small { font-size: 1.4em; padding: 0.6em 1.1em; animation: none; }
.is-emoji .qz-q { font-size: 2.4em; }
.qz-opts { list-style: none; width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 0.8em 1em; margin: 1.1em 0 0; padding: 0; }
.qz-opt {
  position: relative; display: flex; align-items: center; gap: 0.7em; min-height: 3.6em; padding: 0.55em 1em 0.55em 0.6em; border-radius: 0.9em;
  background: var(--cream); color: var(--ink); box-shadow: inset 0.5em 0 0 var(--o), var(--shadow);
  animation: drop 0.45s cubic-bezier(.2, 1.5, .4, 1) both; animation-delay: calc(var(--i) * 0.1s + 0.1s); transition: opacity 0.4s, transform 0.4s;
}
.qz-letter { flex: none; display: grid; place-items: center; width: 1.9em; height: 1.9em; margin-left: 0.4em; border-radius: 50%; background: var(--o); color: var(--ink); font-family: var(--display); font-weight: 900; font-size: 1.1em; }
.qz-opt-text { flex: 1; font-weight: 700; font-size: 1.45em; line-height: 1.15; overflow-wrap: anywhere; }
.qz-who { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.3em; }
.qz-picker { display: inline-flex; align-items: center; gap: 0.15em; animation: pop-in 0.4s both; animation-delay: 0.6s; }
.qz-picker .av { width: 1.8em; height: 1.8em; font-size: 0.85em; }
.qz-picker .pts { font-size: 0.75em; }
.qz-audpct { font-size: 0.85em; color: rgba(43, 22, 48, 0.6); }
.qz-answered .qz-opt { animation: none; }
.qz-answered .qz-opt.wrong { opacity: 0.4; transform: scale(0.97); }
.qz-answered .qz-opt.right { background: var(--teal); box-shadow: inset 0.5em 0 0 var(--o), 0 0 0 0.18em var(--cream), var(--shadow); animation: fill-pop 0.6s cubic-bezier(.2, 1.8, .4, 1); }
.qz-num-ask { margin: 1.2em 0 0; font-size: 1.5em; color: var(--muted); }
.qz-number { margin-top: 0.6em; animation-delay: 1.25s; background: var(--teal); }
.qz-number small { font-size: 0.45em; }
.qz-guesses { list-style: none; display: grid; gap: 0.4em; width: min(100%, 34em); margin: 1em 0 0; padding: 0; }
.qz-guesses li { display: flex; align-items: center; gap: 0.7em; padding: 0.35em 0.9em; border-radius: 0.8em; background: rgba(255, 244, 226, 0.08); animation: rise 0.4s both; animation-delay: calc(1.8s + var(--i) * 0.2s); }
.qz-guesses li.win { background: rgba(46, 196, 182, 0.25); box-shadow: inset 0 0 0 0.12em var(--teal); }
.qz-guesses .b-name { flex: 1; min-width: 0; font-size: 1.1em; }
.qz-guess { font-family: var(--display); font-weight: 800; }

/* Last Orders on a phone */
.qz-pint-pad { width: 5em; }
.qz-pad-cat { color: var(--k); font-size: 2em; }
.qz-joker-box { display: grid; gap: 0.5em; width: 100%; margin-top: 1em; }
.qz-joker { width: 100%; }
.qz-jk { color: var(--mustard); }
.pad-emoji { font-size: 1.6em; text-align: center; }
.qz-pad-opts { gap: 0.7em; }
.qz-optbtn { grid-template-columns: auto 1fr; justify-items: start; align-items: center; text-align: left; min-height: 64px; box-shadow: inset 0.45em 0 0 var(--o), 0 0.2em 0 rgba(0, 0, 0, 0.4); text-transform: none; font-size: 1.08em; }
.qz-optbtn .qz-letter { width: 1.9em; height: 1.9em; margin: 0 0.3em 0 0.2em; font-size: 0.95em; }
.qz-catbtn { box-shadow: inset 0 -0.35em 0 var(--k), 0 0.2em 0 rgba(0, 0, 0, 0.4); text-transform: none; min-height: 64px; }
.qz-catbtn.picked { outline: 3px solid var(--k); outline-offset: 3px; }
#qz-n { font-family: var(--display); font-size: 2rem; text-align: center; letter-spacing: 0.05em; }
.qz-typed-answer { font-size: 2.4em; }
.qz-typed { flex: 1.4; font-weight: 600; overflow-wrap: anywhere; }
.qz-tick { color: var(--teal); font-size: 1.3em; }
.qz-cross { color: var(--red); font-size: 1.3em; }
.qz-guesses li.miss { opacity: 0.85; }
.qz-accept { min-height: 1.9em; padding: 0.2em 0.8em; font-size: 0.8em; }
body.idle .qz-accept { opacity: 0.35; }
.qz-accept-hint { margin: 0.6em 0 0; color: var(--muted); font-size: 0.9em; }
.qz-guesses.settled li { animation: none; }
#qz-vipmark { width: 100%; margin-top: 1.2em; }

/* The end screen: four awards in two columns, and a long board scrolls rather than hitting the buttons. */
.pk-end-cols { min-height: 0; overflow: hidden; }
.awards { grid-template-columns: 1fr 1fr; align-content: start; }
.board-final { overflow: hidden; min-height: 0; }
.board-final .b-row { height: 2.3em; }
.board-final.many { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 0.6em; }
.pk-end-cols:has(.board-final.many) { grid-template-columns: 1.6fr 1fr; } /* two columns of names need the room more than the awards do */
.board-final.many .b-row { height: 2.2em; padding: 0 0.7em; }
.board-final.many .b-name { font-size: 1.1em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* a long name gives way, never the score */
.board-final.many .b-row { gap: 0.5em; }
.board-final.many .b-score { flex: none; }
.board-final.many .b-score { font-size: 1.15em; min-width: 3.6em; }

/* The host's quip: a speech bubble under the scoreboard and the winner. */
.quip { position: relative; align-self: center; max-width: 40em; margin: 0.8em auto 0; padding: 0.55em 1.1em; border-radius: 1em; background: var(--cream); color: var(--ink); font-weight: 600; font-size: 1.15em; text-align: center; box-shadow: var(--shadow); opacity: 0; transform: translateY(0.6em) scale(0.96); transition: opacity 0.4s, transform 0.4s cubic-bezier(.2, 1.4, .4, 1); }
.quip::before { content: '🎙'; margin-right: 0.4em; }
.quip.on { opacity: 1; transform: none; }
.quip:empty { display: none; }
.pk-scores-scene .board { flex: 1 1 auto; }
.quip-end { margin: 0; font-size: 1.05em; }

/* Quick double taps (Send, votes) must never zoom the page. */
button, .btn, .opt, input, label { touch-action: manipulation; }
.award { column-gap: 0.6em; }
.set-hint { margin: 0.4em 0 0.2em; font-size: 0.9em; }

.quip { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0.4em 0.8em; }
.quip::before { display: none; }
.quip-whos { display: inline-flex; gap: 0.5em; }
.quip-who { display: inline-flex; align-items: center; gap: 0.3em; padding: 0.1em 0.5em 0.1em 0.1em; border-radius: 999px; background: color-mix(in srgb, var(--c) 30%, transparent); box-shadow: inset 0 0 0 0.12em var(--c); animation: pop-in 0.5s cubic-bezier(.2, 1.6, .4, 1) both; }
.quip-who .av { width: 1.7em; height: 1.7em; font-size: 0.8em; }
.quip-float { position: absolute; left: 50%; bottom: 0.4em; z-index: 4; width: max-content; max-width: 90%; translate: -50% 0; }

/* Extra screens in other households */
.extra-link { margin-top: 0.6em; font-size: 0.95em; text-align: left; padding-left: 0; }
.extra-form { margin-top: 0.8em; }
.home-cards .card .extra-form p { flex: none; margin: 0 0 0.8em; }
.mirror-tag { margin: 0 0 0 auto; padding: 0.3em 0.9em; border-radius: 999px; background: rgba(255, 244, 226, 0.1); color: var(--muted); font-size: 0.85em; }
.mirror-tag:empty { display: none; }
.mirror-tag b { color: var(--cream); }
.screens-line { margin: 0.3em 0 0; color: var(--muted); font-size: 0.9em; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4em; }
.screens-line:empty { display: none; }
.screen-chip { position: relative; padding: 0.15em 0.7em; border-radius: 999px; background: rgba(255, 244, 226, 0.1); color: var(--cream); }
.screen-chip.away { opacity: 0.45; }
.screen-chip .kick { position: static; width: 1.4em; height: 1.4em; margin-left: 0.3em; opacity: 0.6; }
body.mirror .tv-tools [data-tool="pause"], body.mirror .tv-tools [data-tool="skip"] { display: none; }
body.mirror [data-act] { display: none; }

/* Coming back: the phone's join form offers the seats of players whose phones dropped out */
.pj-back { margin: -0.2em 0 0.9em; padding: 0.6em 0.7em 0.7em; border-radius: 0.8em; background: rgba(255, 191, 60, 0.22); }
.pj-back[hidden] { display: none; }
.pj-back-t { margin: 0 0 0.5em; font-weight: 700; }
.pj-chips { display: flex; flex-wrap: wrap; gap: 0.45em; }
.pj-chip { display: inline-flex; align-items: center; gap: 0.4em; min-height: 44px; max-width: 100%; padding: 0.25em 0.8em 0.25em 0.3em; border: 0; border-radius: 999px; background: var(--cream); color: var(--ink); font: inherit; font-weight: 700; box-shadow: inset 0 0 0 2px rgba(43, 22, 48, 0.2); cursor: pointer; }
.pj-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-chip .av { flex: none; width: 2em; height: 2em; font-size: 0.85em; }
.pj-offer { display: flex; width: 100%; margin-top: 0.5em; }

/* What next at the end of a game: play again, another game straight away, or the lobby */
.next-t { color: var(--muted); font-size: 0.9em; }
.next-games { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.45em; }
.next-game { min-height: 44px; padding: 0.35em 0.9em; font-size: 0.95em; box-shadow: inset 0 0 0 2px var(--g); }
.pad-btns.next-btns .next-games { display: grid; grid-template-columns: 1fr 1fr; margin-top: 0.3em; }
.pad-btns.next-btns .next-t { grid-column: 1 / -1; text-align: center; }
.pad-btns.next-btns .next-game { padding: 0.35em 0.4em; }
/* the TV's end buttons stay one slim row, so eight players' scores keep their room */
.pk-end-btns.next-btns { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.35em 0.7em; max-width: 100%; font-size: 0.82em; }
.pk-end-btns.next-btns > .btn-primary { min-height: 0; padding: 0.35em 1.2em; font-size: 1.05em; }
.pk-end-btns .next-games { gap: 0.35em; flex-wrap: wrap; }
.pk-end-btns .next-t { margin-right: 0.2em; }
.pk-end-btns .next-game { min-height: 0; padding: 0.25em 0.7em; font-size: 0.9em; }
.pk-end-btns .next-lobby { min-height: 0; padding: 0.25em 0.4em; font-size: 0.9em; }

/* Pixel-art faces: a player's drawing in place of their letter, inside the same round badge */
.av-art { overflow: hidden; }
.av-art img { display: block; width: 100%; height: 100%; image-rendering: pixelated; }

/* The phone's lobby: drawing yourself, then "I'm ready" */
.pad-lobby-me, .pad-lobby-rest { display: contents; }
.px-card { width: 100%; display: grid; gap: 0.6em; justify-items: center; }
.px-how { margin: 0; font-size: 0.92em; max-width: 22em; }
.px { width: min(100%, 320px); display: grid; gap: 0.7em; justify-items: center; }
.px-stage { width: 100%; aspect-ratio: 1; border-radius: 0.8em; overflow: hidden; background: var(--c); box-shadow: 0 0 0 3px rgba(255, 244, 226, 0.85), var(--shadow); }
.px-grid { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.px-tools { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4em; }
.px-tool { display: grid; justify-items: center; gap: 0.1em; min-height: 52px; padding: 0.35em 0.2em; border: 0; border-radius: 0.8em; background: rgba(255, 244, 226, 0.1); color: var(--cream); font: inherit; font-size: 0.82em; font-weight: 600; box-shadow: inset 0 0 0 2px rgba(255, 244, 226, 0.18); }
.px-tool svg { width: 1.5em; height: 1.5em; }
.px-tool[aria-pressed='true'] { background: var(--cream); color: var(--ink); box-shadow: 0 0.15em 0 rgba(10, 2, 14, 0.45); }
.px-tool:disabled { opacity: 0.4; }
.px-pal { width: 100%; display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.45em; }
.px-sw { aspect-ratio: 1; min-height: 36px; padding: 0; border: 0; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.28); transition: transform 0.12s; }
.px-sw[aria-pressed='true'] { transform: scale(1.1); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.28), 0 0 0 3px var(--plum), 0 0 0 5.5px var(--cream); }
.px-more { width: 100%; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.45em; }
.px-label { width: 100%; color: var(--muted); font-size: 0.85em; }
.px-start { width: 50px; height: 50px; padding: 0; border: 0; border-radius: 50%; overflow: hidden; background: var(--c); box-shadow: 0 0 0 2px rgba(255, 244, 226, 0.7); }
.px-start img { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.px-clear { min-height: 44px; padding: 0 1em; border: 0; border-radius: 999px; background: transparent; color: var(--cream); font: inherit; font-weight: 600; box-shadow: inset 0 0 0 2px rgba(255, 244, 226, 0.3); }
.px-ready { width: min(100%, 320px); margin-top: 0.3em; }
.pad-ready-n { display: block; margin-top: 0.2em; color: var(--teal); font-weight: 700; }
.pad-tick { font-style: normal; font-weight: 800; color: var(--teal); }

/* The TV's lobby seats: a pencil while they draw, a tick once they're ready */
.seat-av { position: relative; display: inline-grid; flex: none; }
.seat-state { position: absolute; right: -0.3em; bottom: -0.2em; width: 1.05em; height: 1.05em; display: grid; place-items: center; border-radius: 50%; background: var(--teal); color: var(--ink); box-shadow: 0 0 0 0.12em var(--plum-2); font-style: normal; }
.seat-state svg { width: 78%; height: 78%; }
.seat-state.drawing { background: var(--cream); color: var(--tang); }
.seat.ready .seat-state { animation: pop-in 0.4s cubic-bezier(.2, 1.6, .4, 1); }
@media (prefers-reduced-motion: no-preference) {
  .seat-state.drawing svg { animation: px-scribble 1.4s ease-in-out infinite; }
}
@keyframes px-scribble { 50% { transform: rotate(-14deg) translate(-0.06em, 0.04em); } }

/* ---------- reactions: the phone's tray, and the emoji floating up on the TV ---------- */
.pad-react { min-height: 44px; min-width: 44px; padding: 0 0.55em; border-radius: 999px; border: 0; background: rgba(255, 244, 226, 0.1); font-size: 1.2em; line-height: 1; }
.rx-open .pad-react { background: color-mix(in srgb, var(--me) 45%, transparent); box-shadow: inset 0 0 0 2px var(--me); }
.rx-tray { position: sticky; z-index: 3; display: none; grid-template-columns: repeat(10, 1fr); gap: 2px; padding: 4px 10px 9px; background: rgba(29, 15, 36, 0.94); backdrop-filter: blur(10px); box-shadow: inset 0 -1px 0 rgba(255, 244, 226, 0.12); }
.rx-tray.on { display: grid; }
.rx-btn { min-width: 0; min-height: 44px; padding: 0; border: 0; border-radius: 0.6em; background: transparent; font-size: 1.45em; line-height: 1; transition: transform 0.12s, opacity 0.2s; }
.rx-btn:active { transform: scale(1.3); }
.rx-tray.cool .rx-btn { opacity: 0.4; }
.rx-tray::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 3px; height: 3px; border-radius: 3px; background: var(--me); transform: scaleX(0); transform-origin: left; }
.rx-tray.cool::after { animation: rx-cool 1.3s linear both; }
@keyframes rx-cool { from { transform: scaleX(1); } }
.rx-layer { position: fixed; inset: 0; z-index: 30; pointer-events: none; overflow: hidden; font-size: min(1.55vw, 2.75vh); }
.rx { position: absolute; left: var(--x); bottom: 0; display: grid; justify-items: center; translate: -50% 100%; animation: rx-rise 3.8s cubic-bezier(.3, .55, .4, 1) forwards; }
.rx-e { font-size: calc(3.4em * var(--s, 1)); line-height: 1.05; rotate: var(--tilt); filter: drop-shadow(0 0.06em 0.1em rgba(10, 2, 14, 0.55)); }
.rx .av-rx { width: 1.9em; height: 1.9em; margin-top: -0.45em; font-size: 0.95em; }
.rx-n { position: absolute; top: 0; right: -0.9em; padding: 0.05em 0.45em; border-radius: 999px; background: var(--mustard); color: var(--ink); font-family: var(--display); font-weight: 800; font-size: 0.9em; box-shadow: 0 0.1em 0 rgba(10, 2, 14, 0.4); animation: pop-in 0.3s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes rx-rise {
  0% { transform: translate(0, 0) scale(0.4); opacity: 0; }
  10% { transform: translate(calc(var(--sway) * -0.4), -16vh) scale(1.12); opacity: 1; }
  22% { transform: translate(calc(var(--sway) * 0.3), -24vh) scale(1); }
  70% { opacity: 1; }
  100% { transform: translate(var(--sway), -64vh) scale(0.92); opacity: 0; }
}
@keyframes rx-fade { 0%, 100% { opacity: 0; } 12%, 75% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .rx { bottom: 8vh; translate: -50% 0; animation: rx-fade 2.6s both; } }

/* the fun stats on the end screen: a row of small tiles under the game's own awards */
.awards:has(> .award-fun) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.awards:has(> .award-fun) > .award { grid-column: span 3; }
.awards:has(> .award-fun) > .award-fun { grid-column: span 2; grid-template-columns: minmax(0, 1fr); align-content: start; padding: 0.3em 0.65em; background: var(--cream-2); font-size: 0.74em; line-height: 1.3; }
.awards:has(> .award-fun) > .award-fun.fun-2 { grid-column: span 3; }
.awards:has(> .award-fun) > .award-fun.fun-1 { grid-column: 1 / -1; }
.awards:has(> .award-fun) > .award:not(.award-fun) + .award-fun { grid-column: 1 / span 2; }
.awards:has(> .award-fun) > .award:not(.award-fun) + .award-fun.fun-2 { grid-column: 1 / span 3; }
.awards:has(> .award-fun) > .award:not(.award-fun) + .award-fun.fun-1 { grid-column: 1 / -1; }
.awards:has(> .award-fun) > .award:not(.award-fun):nth-child(odd):has(+ .award-fun) { grid-column: 1 / -1; }
.award-fun .award-t { color: var(--violet); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.award-fun .award-who { text-align: left; overflow-wrap: anywhere; }
.award-fun .award-n { font-size: 0.82em; }
.award-icon { margin-right: 0.3em; font-style: normal; }
