/* This Stays Here: "After Hours" look (see the design spec). Dark only, by design:
   midnight canvas, plum cards, lavender actions, coral/gold marks, lime for winners. */

@font-face {
  font-family: "Lilita One";
  src: url("fonts/LilitaOne-latin.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Nunito Sans";
  src: url("fonts/NunitoSans-latin.woff2") format("woff2");
  font-weight: 600 900; font-style: normal; font-display: swap;
}

:root {
  color-scheme: dark;
  /* colors (spec values; don't approximate) */
  --background: #171224;
  --surface: #292139;
  --surface-elevated: #372D4A;
  --primary: #A78BFA;
  --primary-hover: #BFA9FF;
  --secondary: #FF637B;
  --accent: #D4F76A;
  --warning: #FFCF56;
  --text-primary: #FAF7FF;
  --text-secondary: #A59DB5;
  --border: #433750;
  --success: #34D399;
  --error: #FF637B;
  --on-fill: #171224;            /* text on every bright fill */
  /* game modes */
  --mode-family: #34D399;
  --mode-adult: #FF637B;
  --mode-disclose: #FB923C;
  --mode-drawing: #38BDF8;
  --mode-meme: #FFCF56;
  --mode-bonus: #F0ABFC;
  --mode-trivia: var(--mode-meme);   /* trivia took gold over from the shelved meme rounds */
  --mode-classic: #A78BFA;
  --mode: var(--mode-classic);   /* this round's color: set from body[data-round] */
  --edition: var(--mode-family); /* Family or 18+: set from body[data-content] */
  /* type */
  --display: "Lilita One", ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Nunito Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* shape and spacing (4 8 12 16 24 32 48) */
  --radius: 20px;
  --radius-lg: 24px;
  --radius-field: 16px;
  --pill: 999px;
  --tap: 56px;
  --ease: 200ms ease-out;
  /* hand-drawn marks */
  --burst: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='%23FF637B' d='M50 2l10 27 25-15-11 27 28 4-25 13 21 20-29-2 4 29-23-18-11 27-7-28-25 16 9-28-29-1 23-17-21-20 29 3-3-29 22 19z'/%3E%3C/svg%3E");
  --sparks-l: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg stroke='%23FF637B' stroke-width='5' stroke-linecap='round'%3E%3Cpath d='M8 9l16 7'/%3E%3Cpath d='M5 21h20'/%3E%3Cpath d='M8 33l16-7'/%3E%3C/g%3E%3C/svg%3E");
  --sparks-r: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg stroke='%23FF637B' stroke-width='5' stroke-linecap='round'%3E%3Cpath d='M32 9l-16 7'/%3E%3Cpath d='M35 21H15'/%3E%3Cpath d='M32 33l-16-7'/%3E%3C/g%3E%3C/svg%3E");
  --sparks-gold: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg stroke='%23FFCF56' stroke-width='5' stroke-linecap='round'%3E%3Cpath d='M10 34l6-24'/%3E%3Cpath d='M22 34l12-18'/%3E%3C/g%3E%3C/svg%3E");
  --squiggle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 12'%3E%3Cpath d='M3 8q6-8 12 0t12 0 12 0 12 0' fill='none' stroke='%23FF637B' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E");
  --crown: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 36'%3E%3Cpath d='M7 30L4 9l12 10 8-15 8 15 12-10-3 21z' fill='none' stroke='%23FFCF56' stroke-width='4' stroke-linejoin='round'/%3E%3C/svg%3E");
  --swoosh: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 20'%3E%3Cpath d='M6 15C60 5 130 3 194 7' fill='none' stroke='%23FFCF56' stroke-width='7' stroke-linecap='round'/%3E%3C/svg%3E");
  --blob-lav: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 80'%3E%3Cpath fill='%23A78BFA' d='M0 80V34c10-14 30-16 40-4 6-18 32-20 40-2 10-8 28-4 32 10 6 2 8 8 8 14v28z'/%3E%3C/svg%3E");
  --blob-coral: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 80'%3E%3Cpath fill='%23FF637B' d='M0 80V34c10-14 30-16 40-4 6-18 32-20 40-2 10-8 28-4 32 10 6 2 8 8 8 14v28z'/%3E%3C/svg%3E");
  --spike: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cpath fill='%23FF637B' d='M80 80H8l22-18L4 52l30-6L22 22l26 12 6-30 10 28 16-8z'/%3E%3C/svg%3E");
  --wave-gold: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 50'%3E%3Cpath fill='%23FFCF56' d='M0 50V22c14-14 26 8 40-6s26 8 40-6 26 8 40-4v44z'/%3E%3C/svg%3E");
}
body[data-round="drawing"] { --mode: var(--mode-drawing); }
body[data-round="meme"] { --mode: var(--mode-meme); }
body[data-round="disclose"] { --mode: var(--mode-disclose); }
body[data-round="bonus"] { --mode: var(--mode-bonus); }
body[data-round="trivia"] { --mode: var(--mode-trivia); }
body[data-content="adult"] { --edition: var(--mode-adult); }

* { box-sizing: border-box; }
html { overflow-x: hidden; }
html, body { margin: 0; }
body {
  background: var(--background);
  color: var(--text-primary);
  font: 600 18px/1.4 var(--body);
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Edge decorations: flat shapes cropped at the bottom corners, behind everything. */
body::before, body::after {
  content: ""; position: fixed; bottom: 0; z-index: 0; pointer-events: none;
  background-repeat: no-repeat; background-size: contain;
}
body::before { left: 0; width: 120px; height: 80px; background-image: var(--blob-lav); background-position: left bottom; }
body::after { right: 0; width: 80px; height: 80px; background-image: var(--spike); background-position: right bottom; }
body[data-content="adult"]::before { background-image: var(--blob-coral); }
body[data-content="adult"]::after { background-image: var(--wave-gold); width: 110px; height: 46px; }
body.playing::before, body.playing::after { opacity: 0.35; }   /* quieter during a round */

main {
  position: relative; z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}

h1, h2, .title {
  font-family: var(--display); font-weight: 400; text-transform: uppercase;
  line-height: 1.05; letter-spacing: 0.3px;
}
h1 { font-size: 34px; margin: 8px 0 8px; }
h2 { font-size: 24px; margin: 0 0 12px; }
p { margin: 0 0 12px; }
strong { font-weight: 900; }
.muted { color: var(--text-secondary); }
.center { text-align: center; }

/* Screen titles with coral sparks either side */
.title {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: clamp(28px, 8.5vw, 34px); margin: 4px 0 16px; text-align: center;
}
.title::before, .title::after {
  content: ""; flex: none; width: 28px; height: 28px; background: var(--sparks-l) center / contain no-repeat;
}
.title::after { background-image: var(--sparks-r); }
.subtitle { font-family: var(--display); text-transform: uppercase; color: var(--warning); text-align: center; font-size: 17px; margin: -10px 0 16px; letter-spacing: 0.5px; }

/* ----- wordmark (home) ----- */
.wordmark {
  position: relative; text-align: center; margin: 32px auto 28px; padding: 30px 0 22px;
  font-family: var(--display); text-transform: uppercase; line-height: 0.9;
  font-size: clamp(56px, 19vw, 84px);
}
.wordmark span { display: block; }
.wordmark .stays {
  display: inline-block; background: var(--secondary); color: var(--on-fill);
  padding: 4px 14px 0; margin: 6px 0; transform: rotate(-6deg); border-radius: 6px;
}
.wordmark::before {   /* crown */
  content: ""; position: absolute; top: 0; left: 50%; width: 56px; height: 42px; transform: translateX(-90%) rotate(-10deg);
  background: var(--crown) center / contain no-repeat;
}
.wordmark::after {    /* gold underline */
  content: ""; position: absolute; left: 18%; right: 18%; bottom: 0; height: 18px;
  background: var(--swoosh) center / 100% 100% no-repeat;
}
.wordmark .spark-r, .wordmark .spark-l { position: absolute; width: 40px; height: 40px; background: var(--sparks-r) center / contain no-repeat; }
.wordmark .spark-r { right: 2%; top: 20%; transform: rotate(-30deg); }
.wordmark .spark-l { left: 2%; bottom: 18%; background-image: var(--sparks-l); transform: rotate(-20deg); }
.tagline { text-align: center; font-weight: 800; color: var(--text-secondary); margin: -8px 0 24px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--text-secondary); font-weight: 800; text-transform: uppercase; font-size: 14px; letter-spacing: 1px; margin: 20px 0 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 2px; background: var(--border); border-radius: 2px; }

/* ----- cards ----- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.card.raised { background: var(--surface-elevated); }

/* ----- fields ----- */
label, .label {
  display: block; font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--warning); margin-bottom: 8px;
}
input, textarea, select {
  width: 100%;
  font: 700 18px/1.35 var(--body);
  color: var(--on-fill);
  background: var(--text-primary);
  border: 3px solid transparent;
  border-radius: var(--radius-field);
  padding: 13px 16px;
  min-height: var(--tap);
  outline: none;
  transition: border-color var(--ease), box-shadow var(--ease);
}
input::placeholder, textarea::placeholder { color: #6b6480; opacity: 1; }
input:focus-visible, textarea:focus-visible, select:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 3px rgb(167 139 250 / 0.35); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 8l5 5 5-5' fill='none' stroke='%23171224' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 20px;
}
textarea { resize: none; min-height: 96px; display: block; }
.code-input { text-transform: uppercase; letter-spacing: 8px; text-align: center; font-family: var(--display); font-size: 28px; font-weight: 400; }
.counter { font-size: 14px; font-weight: 800; color: var(--text-secondary); text-align: right; margin-top: 6px; font-variant-numeric: tabular-nums; }
.counter.near { color: var(--warning); }
.hint { font-size: 15px; margin: 8px 0 0; color: var(--text-secondary); }

/* ----- buttons ----- */
button {
  position: relative;
  font: 400 19px/1.1 var(--display);
  text-transform: uppercase; letter-spacing: 0.5px;
  border: 0;
  border-radius: var(--pill);
  min-height: var(--tap);
  padding: 14px 24px;
  width: 100%;
  cursor: pointer;
  background: var(--primary);
  color: var(--on-fill);
  transition: transform 150ms ease-out, background-color var(--ease), border-color var(--ease);
  touch-action: manipulation;
}
button:hover:not(:disabled) { background: var(--primary-hover); }
button:active:not(:disabled) { transform: scale(0.97); }
button:focus-visible { outline: 3px solid var(--primary-hover); outline-offset: 3px; }
button:disabled { background: var(--surface-elevated); color: var(--text-secondary); cursor: default; }
button.gold { background: var(--warning); }
button.gold:hover:not(:disabled) { background: #ffdb80; }
button.secondary {
  background: var(--surface); color: var(--text-primary); border: 2px solid var(--border);
}
button.secondary:hover:not(:disabled) { background: var(--surface-elevated); border-color: var(--primary); }
button.ghost {
  background: none; color: var(--text-secondary); font: 800 16px/1.2 var(--body);
  text-transform: none; letter-spacing: 0; min-height: 48px;
}
button.ghost:hover:not(:disabled) { background: none; color: var(--text-primary); }
button.loading { color: transparent !important; pointer-events: none; }
button.loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--on-fill); border-right-color: transparent; animation: spin 0.7s linear infinite;
}
button.secondary.loading::after { border-color: var(--text-primary); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
/* The screen's main action stays reachable at the bottom while you scroll. */
.cta { position: sticky; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 3; box-shadow: 0 0 0 8px var(--background); margin-top: 8px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 12px; align-items: flex-end; }
.row > * { flex: 1; min-width: 0; }

/* ----- top bar: round progress, chips, timer ----- */
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.round-label {
  font-family: var(--display); text-transform: uppercase; color: var(--warning); font-size: 20px; line-height: 1.1;
  padding-bottom: 12px; background: var(--squiggle) left bottom / 48px 10px no-repeat;
}
.timer {
  flex: none; min-width: 64px; text-align: center; font: 400 20px/1 var(--display);
  background: var(--warning); color: var(--on-fill);
  border-radius: var(--pill); padding: 8px 14px; font-variant-numeric: tabular-nums;
}
.timer.low { background: var(--error); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 16px; }
.chips:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.6px;
  border-radius: var(--pill); padding: 4px 10px; background: var(--surface); color: var(--text-secondary);
  white-space: nowrap;
}
.chip.mode { background: var(--mode); color: var(--on-fill); }
.content-badge { background: var(--edition); color: var(--on-fill); }
.content-badge.aud { background: var(--surface-elevated); color: var(--text-primary); }
.settings-summary { margin: 12px 0 0; font-size: 15px; line-height: 1.5; }

/* ----- room code ----- */
.room-card { text-align: center; padding: 16px 16px 14px; }
.room-card .label { text-align: center; margin-bottom: 2px; }
.room-row { display: flex; align-items: center; justify-content: center; gap: 12px; }
.room-row::before { content: ""; width: 26px; height: 32px; background: var(--sparks-gold) center / contain no-repeat; transform: scaleX(-1); }
.room-code { font-family: var(--display); font-size: clamp(48px, 15vw, 60px); letter-spacing: 6px; line-height: 1.1; }
.copy {
  width: 48px; min-height: 48px; height: 48px; padding: 0; flex: none; border-radius: 14px;
  background: transparent; color: var(--warning); display: inline-flex; align-items: center; justify-content: center;
}
.copy:hover:not(:disabled) { background: var(--surface-elevated); }
.copy svg { width: 28px; height: 28px; }
.join-url { word-break: break-all; text-align: center; font-size: 15px; margin: 6px 0 0; }

/* ----- players ----- */
.players { list-style: none; margin: 0; padding: 0; }
.players li { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.players .who { flex: 1; min-width: 0; font-weight: 900; font-size: 18px; overflow-wrap: anywhere; }
.avatar {
  flex: none; width: 48px; height: 48px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font: 400 22px/1 var(--display); color: var(--on-fill); background: var(--av, var(--primary));
  box-shadow: 0 0 0 3px var(--surface);
}
.avatar.sm { width: 34px; height: 34px; font-size: 16px; }
.avatar.lg { width: 64px; height: 64px; font-size: 30px; box-shadow: 0 0 0 4px var(--primary); }
.tag { font-size: 14px; color: var(--text-secondary); font-weight: 800; }
.tag.host { color: var(--warning); text-transform: uppercase; letter-spacing: 0.6px; font-size: 13px; }
.tag.done { color: var(--success); }
.tag.off { color: var(--error); }

/* ----- prompt card ----- */
.prompt-card {
  position: relative; background: var(--surface); border-radius: var(--radius-lg); padding: 24px; margin: 12px 0 16px;
}
.prompt-card::before {   /* burst at the outer corner, in this round's color for special rounds */
  content: ""; position: absolute; top: -12px; left: -10px; width: 44px; height: 44px; z-index: -1;
  background: var(--burst) center / contain no-repeat;
}
body:not([data-round="classic"]) .prompt-card::before { background: var(--mode); -webkit-mask: var(--burst) center / contain no-repeat; mask: var(--burst) center / contain no-repeat; }
.prompt-card::after {
  content: ""; position: absolute; top: -18px; right: 14px; width: 34px; height: 34px;
  background: var(--sparks-gold) center / contain no-repeat;
}
body[data-content="adult"] .prompt-card { box-shadow: inset 0 0 0 2px var(--mode-adult); }
.prompt {
  font: 900 clamp(26px, 8vw, 34px)/1.12 var(--body); letter-spacing: -0.2px;
  overflow-wrap: anywhere; margin-bottom: 16px;
}
.prompt:last-child { margin-bottom: 0; }
.prompt.sm { font-size: clamp(22px, 6.5vw, 28px); }
.prompt.long { font-size: clamp(21px, 6vw, 27px); }   /* prompts over 80 characters */
.prompt.sm.long { font-size: clamp(18px, 5.2vw, 23px); }
.prompt-label { font-size: 14px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--warning); font-weight: 900; margin-bottom: 8px; }

/* ----- answers and voting ----- */
.answer {
  display: flex; align-items: center; gap: 12px;
  text-align: left; font: 800 19px/1.3 var(--body); text-transform: none; letter-spacing: 0;
  background: var(--surface); color: var(--text-primary);
  border: 3px solid transparent; border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 12px; min-height: var(--tap);
}
button.answer:hover:not(:disabled) { background: var(--surface-elevated); }
.answer .text { flex: 1; overflow-wrap: anywhere; }
.answer.mine { background: transparent; border: 2px dashed var(--border); }
button.answer.mine:disabled { color: var(--text-secondary); }
div.answer.mine { color: var(--text-primary); }
.answer.first { border-color: var(--warning); background: var(--surface-elevated); }
.answer.second { border-color: var(--primary); background: var(--surface-elevated); }
.vs { text-align: center; font: 400 18px/1 var(--display); color: var(--secondary); margin: -2px 0 10px; text-transform: uppercase; }
.badge {
  font-size: 13px; font-weight: 900; border-radius: var(--pill); padding: 4px 10px; text-transform: uppercase; letter-spacing: 0.4px;
  background: var(--surface-elevated); color: var(--text-primary); white-space: nowrap;
}
.badge:empty { display: none; }
.badge.gold { background: var(--warning); color: var(--on-fill); }
.badge.accent { background: var(--primary); color: var(--on-fill); }
.badge.lime { background: var(--accent); color: var(--on-fill); }
.badge.good { background: var(--success); color: var(--on-fill); }
.badge.bad { background: var(--error); color: var(--on-fill); }
.badge.aud { background: var(--text-primary); color: var(--on-fill); }
button.picked, button.secondary.picked { background: var(--mode); color: var(--on-fill); border-color: var(--mode); }
.answer.first .badge.gold::before, .answer.second .badge.accent::before { content: "✓ "; }

/* ----- reveal ----- */
.results { list-style: none; margin: 0; padding: 0; }
.result {
  background: var(--surface); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px;
  border: 3px solid transparent;
}
.result .row-top { display: flex; gap: 12px; align-items: flex-start; }
.result .text { flex: 1; font: 900 20px/1.25 var(--body); overflow-wrap: anywhere; }
.result .pts { flex: none; text-align: right; font: 400 28px/0.95 var(--display); color: var(--warning); }
.result .pts small { display: block; font-size: 14px; letter-spacing: 0.5px; }
.result .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; font-size: 15px; color: var(--text-secondary); font-weight: 800; }
.result.top { background: var(--accent); color: var(--on-fill); position: relative; }
.result.top .pts, .result.top .meta { color: var(--on-fill); }
.result.top .badge:not(.gold):not(.accent):not(.aud) { background: rgb(23 18 36 / 0.12); color: var(--on-fill); }
.result.top::before {
  content: ""; position: absolute; top: -18px; left: -8px; width: 40px; height: 30px; transform: rotate(-18deg);
  background: var(--crown) center / contain no-repeat;
}
.result.drawn .pic { max-width: 280px; }
.result.drawn .pic svg { border-radius: 14px; }
.result.drawn.top .pic svg { box-shadow: 0 0 0 3px var(--on-fill); }

.winner-banner {
  position: relative; display: flex; align-items: center; gap: 14px;
  background: var(--surface); border-radius: var(--radius); padding: 16px; margin: 20px 0 16px;
}
.winner-banner::before {
  content: ""; position: absolute; top: -14px; left: -6px; width: 30px; height: 30px;
  background: var(--sparks-gold) center / contain no-repeat; transform: scaleX(-1);
}
.winner-banner .wb-text { flex: 1; min-width: 0; }
.winner-banner .wb-label { font: 400 15px/1.1 var(--display); text-transform: uppercase; color: var(--warning); letter-spacing: 0.5px; }
.winner-banner .wb-name { font: 400 clamp(26px, 8vw, 32px)/1.05 var(--display); text-transform: uppercase; overflow-wrap: anywhere; }
.starburst {
  flex: none; width: 76px; height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--accent); color: var(--on-fill); font: 400 24px/0.9 var(--display); text-align: center;
  -webkit-mask: var(--burst) center / contain no-repeat; mask: var(--burst) center / contain no-repeat;
}
.starburst small { font-size: 13px; }

/* ----- scoreboard / final ----- */
table { width: 100%; border-collapse: collapse; }
td, th { padding: 10px 4px; border-bottom: 2px solid var(--border); text-align: left; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { font-size: 13px; color: var(--warning); font-weight: 900; text-transform: uppercase; letter-spacing: 0.8px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num { font: 400 24px/1 var(--display); color: var(--warning); }
td .name-cell { display: flex; align-items: center; gap: 10px; }
td .name-cell .nm { font-weight: 900; overflow-wrap: anywhere; }
td .rank { font: 400 18px/1 var(--display); color: var(--text-secondary); width: 22px; flex: none; }
tr.me td .nm { color: var(--primary-hover); }

.winner-card { position: relative; text-align: center; background: var(--accent); color: var(--on-fill); border-radius: var(--radius-lg); padding: 28px 16px 20px; margin: 28px 0 16px; }
.winner-card::before {
  content: ""; position: absolute; top: -26px; left: 50%; width: 60px; height: 46px; transform: translateX(-50%) rotate(-6deg);
  background: var(--crown) center / contain no-repeat;
}
.winner-card .wc-label { font: 400 17px/1 var(--display); text-transform: uppercase; letter-spacing: 0.6px; }
.winner { font: 400 clamp(34px, 11vw, 44px)/1.05 var(--display); text-transform: uppercase; margin: 8px 0 4px; overflow-wrap: anywhere; }
.winner-card .muted { color: var(--on-fill); font-weight: 900; margin: 0; }
.big-emoji { font-size: 56px; text-align: center; line-height: 1.2; }

/* waiting states */
.waiting { text-align: center; padding: 24px 16px; }
.waiting h2 { margin: 8px 0 8px; }
.waiting p:last-child { margin: 0; }

#toast {
  position: fixed; z-index: 30; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(140px);
  background: var(--text-primary); color: var(--on-fill);
  padding: 14px 20px; border-radius: 16px; font-weight: 800;
  width: max-content; max-width: calc(100% - 32px); transition: transform var(--ease);
}
#toast.show { transform: translateX(-50%) translateY(0); }
#net {
  position: fixed; z-index: 25; top: env(safe-area-inset-top); left: 50%; transform: translateX(-50%);
  margin-top: 8px; padding: 8px 16px; border-radius: var(--pill);
  background: var(--warning); color: var(--on-fill); font-weight: 900; font-size: 15px;
}
#net[hidden] { display: none; }

.sheet {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgb(10 7 18 / 0.75);
}
.sheet .card { width: 100%; max-width: 420px; margin: 0; background: var(--surface-elevated); max-height: 100%; overflow: auto; }
.sheet p { margin: 0; }

/* ----- special rounds ----- */
.banner {
  display: flex; gap: 12px; align-items: center;
  background: var(--mode); color: var(--on-fill);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px;
  font-size: 16px; font-weight: 800;
  animation: pop 0.22s ease-out;
}
.banner-icon { font-size: 34px; line-height: 1; flex: none; }
.banner-title { font: 400 24px/1.05 var(--display); text-transform: uppercase; margin-bottom: 2px; }
@keyframes pop { from { transform: scale(0.94); } to { transform: scale(1); } }

.canvas {
  display: block; width: 100%; aspect-ratio: 1; background: #fff;
  border: 3px solid var(--mode); border-radius: 16px;
  touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none;
}
.pad-tools { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.pad-tools button { width: auto; min-height: 48px; padding: 10px 16px; font-size: 16px; }
.ink { flex: 1; height: 10px; border-radius: var(--pill); background: var(--surface-elevated); overflow: hidden; }
.ink span { display: block; height: 100%; width: 100%; background: var(--mode); transition: width var(--ease); }

svg.drawing { display: block; width: 100%; height: auto; aspect-ratio: 1; background: #fff; border-radius: 12px; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.duel { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.duel > .answer { flex: 1; min-width: 0; }
.duel .vs { margin: 0; }
.answer.thumb { position: relative; display: block; padding: 6px; margin: 0; border-radius: 18px; }
.answer.thumb .badge { position: absolute; top: 12px; right: 12px; }
.sheet .card .drawing.big { max-height: 55vh; width: auto; max-width: 100%; margin: 0 auto; }

/* Meme rounds: the picture is the prompt, centered in a gold frame */
.meme {
  display: block; width: 100%; max-height: 52vh; object-fit: contain;
  border-radius: 16px; background: #000; border: 3px solid var(--mode); margin: 0 auto 4px;
}
.prompt-card .meme { margin-bottom: 0; }

/* Disclose & Expose: big question, two labeled choices, orange accent */
.choice button { padding: 16px 10px; min-height: 64px; font-size: 19px; }
.answer.who { width: 100%; }
.answer.who.first { border-color: var(--mode); }
.answer.who.first .badge.gold { background: var(--mode); }
.opt-letter { display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; margin-right: 10px; border-radius: 50%;
  background: var(--mode); color: var(--on-fill); font-family: var(--display); font-size: 16px; }
.result .text .opt-letter { margin-right: 6px; vertical-align: middle; }
.disclose-group { padding: 12px 0 0; margin-top: 12px; border-top: 2px solid var(--border); }
.disclose-names { font-size: 20px; font-weight: 900; overflow-wrap: anywhere; }
td .badge { display: inline-block; margin-top: 6px; }

/* Reactions (no points) */
.cell { margin-bottom: 12px; }
.cell > .answer { margin-bottom: 0; width: 100%; }
.grid .cell, .duel .cell { margin-bottom: 0; }
.duel > .cell { flex: 1; min-width: 0; }
.reacts { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.react-toggle {
  width: auto; min-width: 56px; min-height: 44px; padding: 6px 12px; flex: none;
  font: 800 19px/1 var(--body); text-transform: none; letter-spacing: 0;
  background: var(--surface); color: var(--text-primary); border: 2px solid var(--border);
}
.react-toggle span { font-size: 16px; font-weight: 900; margin-left: 2px; color: var(--text-secondary); }
.react-toggle:hover:not(:disabled) { background: var(--surface-elevated); }
.react-toggle[aria-expanded="true"] { border-color: var(--primary); background: var(--surface-elevated); }
.react-sum { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.react-sum:empty { display: none; }
.rs {
  display: inline-flex; align-items: center; gap: 3px; padding: 4px 9px; border-radius: var(--pill);
  background: var(--surface); font-size: 17px; line-height: 1.2; border: 2px solid transparent;
}
.rs.on { border-color: var(--primary); }
.rs .n { font-size: 14px; font-weight: 900; font-variant-numeric: tabular-nums; }
.react-pop {
  position: absolute; z-index: 6; left: 0; bottom: calc(100% + 6px);
  display: flex; gap: 4px; padding: 6px; border-radius: var(--pill);
  background: var(--surface-elevated); border: 2px solid var(--border);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.45); animation: pop 0.15s ease-out;
}
.react-pop[hidden] { display: none; }
.react {
  width: 48px; min-width: 48px; min-height: 48px; padding: 0; border-radius: 50%; flex: none;
  font: 700 24px/1 var(--body); text-transform: none; letter-spacing: 0;
  background: transparent; color: var(--text-primary); border: 2px solid transparent;
  display: inline-flex; align-items: center; justify-content: center;
}
.react:hover:not(:disabled) { background: var(--surface); }
.react .n { display: none; }
.react.on { border-color: var(--primary); background: var(--surface); }
.result .react-toggle, .card .react-toggle, .result .rs, .card .rs { background: var(--surface-elevated); }
.result.top .react-toggle, .result.top .rs { background: rgb(23 18 36 / 0.12); color: var(--on-fill); border-color: transparent; }
.result.top .react-toggle span { color: var(--on-fill); }
.result.top .rs.on { border-color: var(--on-fill); }
.react.bump { animation: bump 0.25s ease-out; }
@keyframes bump { 50% { transform: scale(1.2); } }
.burst {
  position: fixed; z-index: 20; pointer-events: none; font-size: 30px;
  animation: float-up 1.4s ease-out forwards;
}
@keyframes float-up {
  from { transform: translate(0, 0) scale(0.6); opacity: 0; }
  15% { opacity: 1; transform: translate(0, -20px) scale(1.2); }
  to { transform: translate(var(--drift, 0), -160px) scale(1); opacity: 0; }
}

/* End-of-game awards */
.awards { list-style: none; margin: 0; padding: 0; }
.awards li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 2px solid var(--border); }
.awards li:last-child { border-bottom: 0; }
.awards li.me .award-who { color: var(--accent); }
.award-emoji { font-size: 34px; width: 44px; text-align: center; flex: none; }
.award-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--warning); font-weight: 900; }
.award-who { font-size: 19px; font-weight: 900; overflow-wrap: anywhere; }

/* Audience */
.aud-chip:empty { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
  .burst { display: none; }
  button.loading::after { animation: none; border-right-color: var(--on-fill); opacity: 0.6; }
}
@media (min-width: 600px) {
  body::before { width: 200px; height: 134px; }
  body::after { width: 130px; height: 130px; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.result.top .badge.gold { background: var(--on-fill); color: var(--warning); }
.card .answer { background: var(--surface-elevated); }
.card button.answer:hover:not(:disabled) { background: var(--border); }

/* ----- staged reveals and the final-round title card ----- */
[data-seq] { opacity: 0; transform: translateY(14px); transition: opacity 250ms ease-out, transform 250ms ease-out; }
[data-seq].shown { opacity: 1; transform: none; }
tr[data-seq] { transform: none; }
.result.top[data-seq].shown, .winner-card[data-seq].shown, .winner-banner[data-seq].shown { animation: win-pop 320ms ease-out; }
@keyframes win-pop { 0% { transform: scale(0.94); } 60% { transform: scale(1.03); } 100% { transform: scale(1); } }
.drumroll {
  text-align: center; font: 400 24px/1.1 var(--display); text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--warning); margin: 8px 0 16px;
}
.title-card {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: var(--background); padding: 24px; cursor: pointer; text-align: center;
  transition: opacity 200ms ease-out;
}
.title-card.out { opacity: 0; }
.tc-inner { animation: tc-in 300ms ease-out; }
@keyframes tc-in { from { transform: scale(0.9); } to { transform: scale(1); } }
.tc-small { font: 400 20px/1 var(--display); text-transform: uppercase; color: var(--warning); letter-spacing: 0.5px; padding-bottom: 14px; background: var(--squiggle) center bottom / 48px 10px no-repeat; margin-bottom: 18px; }
.tc-big { font: 400 clamp(64px, 22vw, 96px)/0.9 var(--display); text-transform: uppercase; }
.tc-big span { display: block; }
.tc-banner { display: inline-block !important; background: var(--secondary); color: var(--on-fill); padding: 6px 16px 0; margin-top: 8px; border-radius: 6px; transform: rotate(-5deg); }
.tc-mode { margin-top: 22px; font-size: 15px; padding: 6px 14px; }
.tc-sub { margin: 22px auto 0; max-width: 300px; font-weight: 800; color: var(--text-secondary); }
.tc-tap { margin: 18px 0 0; font-size: 14px; font-weight: 900; text-transform: uppercase; letter-spacing: 1px; color: var(--primary); }
@media (prefers-reduced-motion: reduce) {
  [data-seq] { opacity: 1; transform: none; transition: none; }
}

/* ----- host: remove a player or audience member ----- */
.players .remove {
  flex: none; width: 44px; min-height: 44px; height: 44px; padding: 0; border-radius: 50%;
  background: transparent; color: var(--text-secondary); border: 2px solid var(--border);
  font: 800 18px/1 var(--body);
}
.players .remove:hover:not(:disabled) { background: var(--surface-elevated); color: var(--error); border-color: var(--error); }
.aud-list:not(:empty) { margin-top: 4px; }
.aud-list li { padding: 4px 0; }
.aud-list .who { font-size: 16px; }
.chip.tappable { cursor: pointer; border: 1px solid var(--border); }
.chip.tappable:focus-visible { outline: 3px solid var(--primary-hover); outline-offset: 2px; }

/* ----- "How to play" links and the rules page (public/rules.html) ----- */
.help-link {
  display: inline-block; color: var(--primary-hover); font-weight: 900; font-size: 16px;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px;
  padding: 12px 4px; min-height: 48px;
}
.help-link:hover { color: var(--text-primary); }
.help-link:focus-visible, .rules a:focus-visible { outline: 3px solid var(--primary-hover); outline-offset: 3px; border-radius: 6px; }
.help-row { text-align: center; margin: 8px 0 0; }
a.chip.help-chip { text-decoration: none; color: var(--text-primary); background: var(--surface-elevated); }
a.chip.help-chip:hover { background: var(--border); }

.rules { line-height: 1.5; font-size: 17px; }
.rules a { color: var(--primary-hover); text-underline-offset: 3px; }
.rules .tagline { margin: 0 0 20px; }
.rules-top { margin-bottom: 4px; }
.rules-back { display: inline-flex; align-items: center; min-height: 48px; font-weight: 900; text-decoration: none; }
.rules-back-bottom { display: flex; justify-content: center; margin-top: 8px; }
.rules section { margin: 28px 0; scroll-margin-top: 16px; }
.rules h2 { color: var(--text-primary); font-size: 26px; padding-bottom: 12px; background: var(--squiggle) left bottom / 48px 10px no-repeat; margin-bottom: 14px; }
.rules h3 { font: 900 19px/1.3 var(--body); color: var(--warning); margin: 20px 0 8px; }
.rules ul, .rules ol { padding-left: 22px; margin: 0 0 12px; }
.rules li + li { margin-top: 8px; }
.rules li::marker { color: var(--secondary); font-weight: 900; }
.rules [data-k] { font-variant-numeric: tabular-nums; }
.rules-quick ol { margin-bottom: 0; }
.rules-toc { display: flex; flex-wrap: wrap; gap: 8px; }
.rules-toc a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border-radius: var(--pill);
  background: var(--surface-elevated); color: var(--text-primary); text-decoration: none; font-weight: 800; font-size: 15px;
}
.rules-toc a:hover { background: var(--border); }
.rules-table-wrap { padding: 4px 14px; overflow-x: auto; }
.rules td, .rules th { padding: 10px 6px; vertical-align: top; overflow-wrap: anywhere; }
.rules td { font-size: 16px; }
.rules td.num { font-size: 22px; white-space: nowrap; }
.rules th.num { white-space: nowrap; overflow-wrap: normal; }
.rules details { background: var(--surface); border-radius: var(--radius); margin-bottom: 10px; }
.rules summary {
  cursor: pointer; list-style: none; padding: 14px 44px 14px 16px; font-weight: 900; position: relative; min-height: 48px;
}
.rules summary::-webkit-details-marker { display: none; }
.rules summary::after {
  content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  font: 400 26px/1 var(--display); color: var(--warning);
}
.rules details[open] summary::after { content: "–"; }
.rules summary:focus-visible { outline: 3px solid var(--primary-hover); outline-offset: -3px; border-radius: var(--radius); }
.rules details p { padding: 0 16px 16px; margin: 0; color: var(--text-secondary); }
.rules-foot { margin-top: 28px; }
