/* Family Box Party — "print shop" theme: paper, ink outlines, flat color, hard shadows. */

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

:root {
  --paper: #fff6e5;
  --paper-2: #f6e9cf;
  --ink: #17130f;
  --soft: #6b6256;
  --card: #ffffff;
  --red: #ff5a4f;
  --blue: #3b6cf6;
  --yellow: #ffc933;
  --green: #2fbf71;
  --pink: #ff8fc7;
  --violet: #8a63f7;
  --g: var(--yellow);
  --line: 3px solid var(--ink);
  --r: 16px;
  --drop: 4px 4px 0 var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: 'Fredoka', 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(rgba(23, 19, 15, 0.13) 1.3px, transparent 1.4px);
  background-size: 22px 22px;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

h1, h2, p { margin: 0; }
h2 { font-size: 1.55rem; line-height: 1.15; font-weight: 700; overflow-wrap: anywhere; }
a { color: var(--blue); font-weight: 600; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* ---- icons + characters ---- */

.ic {
  width: 1.2em; height: 1.2em; flex: none; vertical-align: -0.22em;
  fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
}
.ic .f { fill: currentColor; stroke: none; }

.av { display: block; width: 100%; height: 100%; overflow: visible; }
.av .body { fill: var(--c, var(--yellow)); stroke: var(--ink); stroke-width: 2.6; stroke-linejoin: round; }
.av .ink { fill: var(--ink); }
.av .white { fill: #fff; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.av .pink { fill: var(--pink); stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.av .line { fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.av .line.thin { stroke-width: 1.5; }

.face { position: relative; display: inline-block; flex: none; width: 44px; height: 44px; }
.face.sm { width: 30px; height: 30px; }
.face.lg { width: 66px; height: 66px; }
.face.xl { width: 128px; height: 128px; margin: 6px auto; }
.face.empty {
  display: inline-flex; align-items: center; justify-content: center;
  border: 3px dashed var(--soft); border-radius: 18px; color: var(--soft); font-size: 1.3rem;
}
.mark {
  position: absolute; right: -6px; bottom: -4px; width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 2px solid var(--ink); border-radius: 50%; font-size: 10px; font-style: normal;
}
.mark .ic { width: 11px; height: 11px; stroke-width: 3.4; }

/* ---- layout ---- */

#app { max-width: 600px; margin: 0 auto; }

.page {
  display: flex; flex-direction: column; gap: 16px;
  padding: 22px 16px calc(36px + env(safe-area-inset-bottom));
}
.page.center { min-height: 100dvh; justify-content: center; }
.center { text-align: center; }

.card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px; background: var(--card); border: var(--line); border-radius: var(--r); box-shadow: var(--drop);
}

.label {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--soft);
}
.hint { color: var(--soft); font-size: 0.95rem; }
.hint:empty { display: none; }
.muted { color: var(--soft); }
.footnote { text-align: center; color: var(--soft); font-size: 0.85rem; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1 1 0; min-width: 0; }

/* ---- hero ---- */

.hero { text-align: center; padding: 10px 0 4px; }
.logo {
  display: inline-flex; align-items: center; justify-content: center; width: 76px; height: 76px; margin-bottom: 12px;
  font-size: 42px; background: var(--yellow); border: var(--line); border-radius: 22px; box-shadow: var(--drop);
  transform: rotate(-6deg);
}
.hero h1 { font-size: 2.5rem; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
.hero h1 span {
  display: inline-block; padding: 0 12px; border: var(--line); border-radius: 12px; box-shadow: 3px 3px 0 var(--ink);
}
.hero h1 span:nth-child(1) { background: var(--red); transform: rotate(-3deg); }
.hero h1 span:nth-child(2) { background: var(--blue); color: #fff; transform: rotate(2deg); }
.hero h1 span:nth-child(3) { background: var(--green); transform: rotate(-1.5deg); }
.tagline { margin-top: 12px; color: var(--soft); font-size: 1.05rem; }
.hero.small .logo { width: 56px; height: 56px; font-size: 30px; border-radius: 16px; }
.hero.small h1 { font-size: 2rem; }

/* ---- form controls ---- */

.input {
  width: 100%; min-width: 0; padding: 12px 14px; font-size: 1.1rem; font-weight: 500;
  background: #fff; border: var(--line); border-radius: 12px; outline: none; resize: none;
}
.input::placeholder { color: #a79d8d; }
.input:focus { background: #fffbe9; box-shadow: var(--drop); }
.code-input { text-align: center; letter-spacing: 0.3em; font-weight: 700; text-transform: uppercase; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; font-size: 1.05rem; font-weight: 600; line-height: 1.2; text-align: center;
  color: var(--ink); background: #fff; border: var(--line); border-radius: 14px; box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.06s, box-shadow 0.06s;
  touch-action: manipulation; user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); }
.btn:disabled { color: var(--soft); background: var(--paper-2); border-color: var(--soft); box-shadow: none; }
.btn.primary { background: var(--yellow); }
.btn.primary:disabled { background: var(--paper-2); }
.btn.secondary { background: #fff; }
.btn.ghost { background: transparent; border-style: dashed; box-shadow: none; font-weight: 500; }
.btn.ghost:active:not(:disabled) { transform: none; background: var(--paper-2); }
.btn.wide { width: 100%; }
.btn.big { padding: 15px 18px; font-size: 1.25rem; font-weight: 700; }
.btn.mini { padding: 6px 10px; font-size: 0.9rem; border-width: 2px; border-radius: 10px; box-shadow: 0 3px 0 var(--ink); }
.btn.mini:active:not(:disabled) { transform: translateY(3px); }

.shake { animation: shake 0.35s; }

.avatar-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.avatar-opt {
  aspect-ratio: 1; padding: 2px; background: transparent; border: 2px solid transparent; border-radius: 12px;
  transition: transform 0.1s;
}
.avatar-opt.on { background: #fff; border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); transform: rotate(-4deg) scale(1.06); }
.avatar-grid .avatar-opt:nth-child(6n+1) { --c: var(--red); }
.avatar-grid .avatar-opt:nth-child(6n+2) { --c: var(--blue); }
.avatar-grid .avatar-opt:nth-child(6n+3) { --c: var(--yellow); }
.avatar-grid .avatar-opt:nth-child(6n+4) { --c: var(--green); }
.avatar-grid .avatar-opt:nth-child(6n+5) { --c: var(--pink); }
.avatar-grid .avatar-opt:nth-child(6n+6) { --c: var(--violet); }
.setup-row .avatar-opt { width: 52px; padding: 4px; flex: none; transform: none; }
.setup-row:nth-of-type(4n+2) .avatar-opt { --c: var(--red); }
.setup-row:nth-of-type(4n+3) .avatar-opt { --c: var(--blue); }
.setup-row:nth-of-type(4n) .avatar-opt { --c: var(--green); }

/* ---- home ---- */

.card.invite { align-items: center; text-align: center; background: var(--yellow); }
.card.invite .label, .card.invite .hint { color: var(--ink); }
.code-big { font-size: 3.2rem; line-height: 1; font-weight: 700; letter-spacing: 0.16em; margin-right: -0.16em; }
.card.invite .row { width: 100%; flex-wrap: wrap; }

.games-list { display: grid; grid-template-columns: 1fr; gap: 10px; }
.game-blurb {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: #fff; border: var(--line); border-radius: 14px;
}
.game-blurb b { font-size: 1.05rem; }
.game-blurb p { color: var(--soft); font-size: 0.9rem; line-height: 1.3; }
.game-icon {
  display: flex; align-items: center; justify-content: center; flex: none; width: 46px; height: 46px; font-size: 24px;
  background: var(--g); border: var(--line); border-radius: 12px;
}

.g-trivia, [data-game='trivia'] { --g: var(--yellow); }
.g-quip, [data-game='quip'] { --g: var(--pink); }
.g-bluff, [data-game='bluff'] { --g: #b79cff; }
.g-closest, [data-game='closest'] { --g: #6fd99c; }
.g-doodle, [data-game='doodle'] { --g: #8fb0ff; }
.g-meld, [data-game='meld'] { --g: #ff9a8f; }

/* ---- settings ---- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-toggle {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; font-size: 0.95rem; font-weight: 600;
  color: var(--soft); background: var(--paper-2); border: 2px dashed var(--soft); border-radius: 999px;
}
.chip-toggle.on { color: var(--ink); background: var(--g); border: 2px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.chip-toggle:disabled { opacity: 0.85; }
.chip-toggle:not(.on) span { text-decoration: line-through; }

.setting-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper b { min-width: 1.6em; text-align: center; font-size: 1.3rem; }

.segmented { display: inline-flex; border: 2px solid var(--ink); border-radius: 12px; overflow: hidden; background: #fff; }
.segmented button {
  padding: 7px 10px; font-size: 0.88rem; font-weight: 600; background: transparent; border: 0; border-left: 2px solid var(--ink);
  white-space: nowrap;
}
.segmented button:first-child { border-left: 0; }
.segmented button.on { background: var(--ink); color: var(--paper); }
.segmented button:disabled:not(.on) { color: var(--soft); }

/* ---- game shell ---- */

.shell { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: var(--paper); border-bottom: var(--line);
}
.room-chip {
  display: inline-flex; align-items: center; gap: 5px; flex: none; padding: 5px 10px; font-size: 0.85rem; font-weight: 500;
  background: var(--yellow); border: 2px solid var(--ink); border-radius: 10px; box-shadow: 2px 2px 0 var(--ink);
}
.room-chip b { letter-spacing: 0.08em; font-weight: 700; }
.room-chip:disabled { background: #fff; box-shadow: none; }
.top-title {
  display: flex; align-items: center; justify-content: center; gap: 6px; flex: 1 1 0; min-width: 0;
  font-weight: 600; font-size: 0.98rem; white-space: nowrap;
}
.title-game { overflow: hidden; text-overflow: ellipsis; }
.title-round, .title-step {
  flex: none; padding: 1px 7px; font-size: 0.8rem; font-weight: 700; border: 2px solid var(--ink); border-radius: 8px; background: #fff;
}
.title-step { background: var(--ink); color: var(--paper); }
.icon-btn {
  display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; font-size: 1.1rem;
  background: #fff; border: 2px solid var(--ink); border-radius: 10px; box-shadow: 2px 2px 0 var(--ink);
}
.menu-wrap { position: relative; flex: none; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; display: flex; flex-direction: column; min-width: 230px;
  padding: 6px; background: #fff; border: var(--line); border-radius: 14px; box-shadow: var(--drop);
}
.menu button {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; font-weight: 500; text-align: left;
  background: transparent; border: 0; border-radius: 9px;
}
.menu button:hover, .menu button:focus-visible { background: var(--paper-2); }

.timer { display: flex; align-items: center; gap: 10px; padding: 8px 14px 0; }
.timer-track { flex: 1; height: 16px; background: #fff; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; }
.timer-fill {
  height: 100%; transform-origin: left center; transition: transform 0.2s linear;
  background-color: var(--green);
  background-image: repeating-linear-gradient(-45deg, rgba(23, 19, 15, 0.16) 0 6px, transparent 6px 12px);
}
.timer-text { min-width: 1.8em; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer.low .timer-fill { background-color: var(--red); }
.timer.low .timer-text { color: var(--red); animation: throb 0.5s infinite alternate; }

.stage { flex: 1 1 auto; padding: 16px 14px 20px; }
.panel { display: flex; flex-direction: column; gap: 14px; }
.panel.center { align-items: center; text-align: center; padding-top: 4vh; }
.panel.center > .btn.wide, .panel.center > .cat-grid { align-self: stretch; }

.strip {
  position: sticky; bottom: 0; z-index: 10; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: #fff; border-top: var(--line);
}
.strip::-webkit-scrollbar { display: none; }
.strip-player {
  display: flex; flex-direction: column; align-items: center; flex: 1 0 60px; max-width: 96px; min-width: 60px;
  padding: 4px 4px 2px; border-radius: 10px; font-size: 0.74rem; line-height: 1.25;
}
.strip-player.me { background: var(--paper-2); }
.strip-player.off .av { opacity: 0.35; }
.strip-player.pending .mark { background: var(--yellow); }
.strip-player.done .mark { background: var(--green); }
.strip-name { display: flex; align-items: center; justify-content: center; gap: 2px; max-width: 100%; margin-top: 3px; font-weight: 600; }
.strip-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip-name .ic { width: 12px; height: 12px; color: #c98a00; }
.strip-score { font-weight: 500; color: var(--soft); font-variant-numeric: tabular-nums; }

/* ---- lobby ---- */

.link-box {
  max-width: 100%; padding: 6px 12px; font-size: 0.9rem; font-weight: 500;
  background: rgba(255, 255, 255, 0.7); border: 2px dashed var(--ink); border-radius: 10px;
}
.link-text { overflow-wrap: anywhere; user-select: all; }
.lobby-players { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; }
.lobby-player {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0;
  padding: 10px 6px 8px; text-align: center; background: var(--paper); border: 2px solid var(--ink); border-radius: 14px;
}
.lobby-player.off { opacity: 0.5; }
.lobby-player.ghosted { background: transparent; border-style: dashed; border-color: var(--soft); color: var(--soft); }
.lobby-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lobby-tag { display: flex; align-items: center; gap: 4px; min-height: 1.2em; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--soft); }
.kick {
  position: absolute; top: -8px; right: -8px; display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0;
  font-size: 12px; color: #fff; background: var(--red); border: 2px solid var(--ink); border-radius: 50%;
}
.kick .ic { stroke-width: 3.4; }

/* ---- intro / category pick ---- */

.intro-icon {
  display: flex; align-items: center; justify-content: center; width: 132px; height: 132px; margin: 8px auto; font-size: 72px;
  background: var(--g); border: var(--line); border-radius: 34px; box-shadow: 6px 6px 0 var(--ink); transform: rotate(-5deg);
}
.intro-icon .ic { stroke-width: 2; }
.intro-icon.small { width: 72px; height: 72px; font-size: 38px; border-radius: 20px; box-shadow: var(--drop); }
.intro-name { font-size: 2.3rem; }
.intro-blurb { max-width: 30ch; font-size: 1.1rem; color: var(--soft); }

.cat-grid { display: grid; gap: 12px; }
.cat-btn {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; font-size: 1.2rem; font-weight: 700; text-align: left;
  background: var(--yellow); border: var(--line); border-radius: var(--r); box-shadow: 0 5px 0 var(--ink);
}
.cat-btn.c1 { background: var(--pink); }
.cat-btn.c2 { background: #8fb0ff; }
.cat-btn:active:not(:disabled) { transform: translateY(5px); box-shadow: none; }
.cat-btn:disabled { box-shadow: none; opacity: 0.75; }
.cat-icon {
  display: flex; align-items: center; justify-content: center; flex: none; width: 46px; height: 46px; font-size: 24px;
  background: #fff; border: 2px solid var(--ink); border-radius: 12px;
}
.cat-tag {
  display: inline-flex; align-items: center; gap: 6px; align-self: center; padding: 4px 12px; font-size: 0.85rem; font-weight: 700;
  background: #fff; border: 2px solid var(--ink); border-radius: 999px;
}

/* ---- prompts + answers ---- */

.prompt-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 18px 16px; text-align: center;
  background: #fff; border: var(--line); border-radius: var(--r); box-shadow: 5px 5px 0 var(--g);
}
.prompt-text { font-size: 1.35rem; line-height: 1.25; font-weight: 600; overflow-wrap: anywhere; }

.answers { display: grid; grid-template-columns: 1fr; gap: 10px; }
.answer-btn {
  display: flex; align-items: center; gap: 12px; min-height: 62px; padding: 10px 12px; font-size: 1.1rem; font-weight: 600; text-align: left;
  color: var(--ink); border: var(--line); border-radius: 14px; box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.06s, opacity 0.2s;
}
.answer-btn.a0 { background: var(--red); }
.answer-btn.a1 { background: #7c9cff; }
.answer-btn.a2 { background: var(--yellow); }
.answer-btn.a3 { background: #5fd394; }
button.answer-btn:active:not(:disabled) { transform: translateY(4px); box-shadow: none; }
.answer-btn.picked { transform: translateY(4px); box-shadow: none; outline: 3px solid var(--ink); outline-offset: 2px; }
.answer-btn.dim, button.answer-btn:disabled:not(.picked) { opacity: 0.45; box-shadow: none; }
.answer-btn.show:disabled { opacity: 1; box-shadow: 0 4px 0 var(--ink); }
.answer-btn.wrong { background: var(--paper-2); color: var(--soft); border-color: var(--soft); box-shadow: none; }
.answer-btn.wrong .shape { border-color: var(--soft); }
.answer-btn.correct { background: var(--green); box-shadow: 4px 4px 0 var(--ink); }
.shape {
  display: flex; align-items: center; justify-content: center; flex: none; width: 34px; height: 34px; font-size: 17px;
  background: #fff; border: 2px solid var(--ink); border-radius: 9px;
}
.answer-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.faces { display: inline-flex; flex: none; }
.faces .face { margin-left: -6px; }
.faces .face:first-child { margin-left: 0; }

.answer-form { display: flex; flex-direction: column; gap: 12px; }
.input.answer { font-size: 1.25rem; padding: 14px; }
.unit { flex: none; font-weight: 700; color: var(--soft); }
.sparks { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.spark { padding: 5px 12px; font-size: 0.9rem; font-weight: 500; background: #fff; border: 2px solid var(--ink); border-radius: 999px; }

.note {
  display: flex; flex-direction: column; gap: 4px; padding: 14px; text-align: center; font-weight: 500;
  background: var(--paper-2); border: 2px dashed var(--ink); border-radius: 14px;
}
.note.locked { background: #d9f5e4; border-style: solid; }
.note.fact { flex-direction: row; align-items: flex-start; gap: 10px; text-align: left; background: #fff3c4; border-style: solid; }
.note.fact .ic { margin-top: 2px; font-size: 1.2rem; }
.locked-title { display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; color: #14774a; }
.locked-value { font-size: 1.3rem; font-weight: 700; overflow-wrap: anywhere; }

/* ---- drawing ---- */

.pad-wrap { border: var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--drop); background: #fff; }
.pad { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; touch-action: none; cursor: crosshair; }
.tools { display: flex; flex-direction: column; gap: 10px; }
.tools .row { flex-wrap: wrap; gap: 8px; }
.tools .segmented button { padding: 7px 8px; }
.tools .btn.mini { padding: 6px 8px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 30px; height: 30px; padding: 0; border: 2px solid var(--ink); border-radius: 50%; }
.swatch.on { box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--ink); transform: scale(0.9); }
.drawing { display: block; width: 100%; max-width: 440px; margin: 0 auto; background: #fff; border: var(--line); border-radius: var(--r); box-shadow: var(--drop); }

/* ---- voting ---- */

.choices { display: flex; flex-direction: column; gap: 10px; }
.choice {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px; font-size: 1.1rem; font-weight: 600; text-align: left;
  background: #fff; border: var(--line); border-radius: 14px; box-shadow: 0 4px 0 var(--ink);
}
.choice:active:not(:disabled) { transform: translateY(4px); box-shadow: none; }
.choice:disabled { box-shadow: none; color: var(--soft); border-color: var(--soft); }
.choice.show:disabled { color: var(--ink); border-color: var(--ink); box-shadow: 0 4px 0 var(--ink); }
.choice.mine { background: var(--paper-2); border-style: dashed; }
.choice.picked { color: #fff; background: var(--blue); border-color: var(--ink); transform: translateY(4px); box-shadow: none; }
.choice-text { min-width: 0; overflow-wrap: anywhere; }
.tag {
  display: inline-block; flex: none; margin-left: 8px; padding: 1px 8px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  vertical-align: middle; color: var(--ink); background: #fff; border: 2px solid var(--ink); border-radius: 999px;
}
.tag.gold { background: var(--yellow); }

/* ---- reveal ---- */

.verdict {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 12px; padding: 12px; font-size: 1.4rem; font-weight: 700; text-align: center;
  border: var(--line); border-radius: var(--r); box-shadow: var(--drop);
}
.verdict.good { background: var(--green); }
.verdict.bad { background: var(--red); }
.streak { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; font-size: 0.9rem; background: #fff; border: 2px solid var(--ink); border-radius: 999px; }

.points-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.points-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 6px; font-size: 0.92rem; font-weight: 500;
  background: #fff; border: 2px solid var(--ink); border-radius: 999px;
}
.points-chip b { color: #14774a; }
.who { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

.truth-card { padding: 14px; text-align: center; background: var(--green); border: var(--line); border-radius: var(--r); box-shadow: var(--drop); }
.truth-card .label { color: var(--ink); }
.truth-text { font-size: 2rem; font-weight: 700; line-height: 1.1; overflow-wrap: anywhere; }

.rank-list { display: flex; flex-direction: column; gap: 8px; }
.rank-row {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; align-items: center; gap: 2px 10px; padding: 8px 12px;
  background: #fff; border: 2px solid var(--ink); border-radius: 12px;
}
.rank-row.top { background: #fff3c4; border-width: 3px; box-shadow: 3px 3px 0 var(--ink); }
.rank-n {
  display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; font-weight: 700; font-size: 0.9rem;
  background: var(--paper-2); border: 2px solid var(--ink); border-radius: 50%;
}
.rank-row.top .rank-n { background: var(--yellow); }
.rank-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.rank-diff { grid-column: 2 / 4; grid-row: 2; font-size: 0.82rem; color: var(--soft); }
.rank-pts { grid-column: 4; grid-row: 1 / 3; min-width: 3.2em; text-align: right; color: #14774a; }

.entries { display: flex; flex-direction: column; gap: 10px; }
.entry { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; background: #fff; border: 2px solid var(--ink); border-radius: 14px; }
.entry.top, .entry.match { border-width: 3px; }
.entry.top { background: #fff3c4; box-shadow: 3px 3px 0 var(--ink); }
.entry.truth { background: #d9f5e4; border-width: 3px; box-shadow: 3px 3px 0 var(--ink); }
.entry.solo { background: var(--paper); border-style: dashed; }
.entry-text { font-size: 1.15rem; font-weight: 600; overflow-wrap: anywhere; }
.entry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 0.88rem; color: var(--soft); }
.entry-meta b { margin-left: auto; color: #14774a; }
.entry-meta .end { margin-left: auto; }
.by { font-weight: 600; color: var(--ink); }

/* ---- scoreboard / final ---- */

.board { display: flex; flex-direction: column; gap: 8px; }
.board-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px;
  background: #fff; border: 2px solid var(--ink); border-radius: 14px;
}
.board-row.me { border-width: 3px; box-shadow: 3px 3px 0 var(--ink); }
.board-place {
  display: flex; align-items: center; justify-content: center; flex: none; width: 28px; height: 28px; font-size: 0.9rem; font-weight: 700;
  background: var(--paper-2); border: 2px solid var(--ink); border-radius: 50%;
}
.board-row:first-child .board-place { background: var(--yellow); }
.board-main { flex: 1 1 auto; min-width: 0; }
.board-name { display: flex; align-items: baseline; gap: 8px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gain { font-size: 0.82rem; font-weight: 700; color: #14774a; }
.bar { height: 10px; margin-top: 4px; background: var(--paper-2); border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-right: 2px solid var(--ink); transition: width 0.6s; }
.board-score { flex: none; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.up-next { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--soft); }
.up-next b, .up-next .ic { color: var(--ink); }

.trophy {
  display: flex; align-items: center; justify-content: center; align-self: center; width: 84px; height: 84px; font-size: 46px;
  background: var(--yellow); border: var(--line); border-radius: 50%; box-shadow: var(--drop);
}
.winner { font-size: 1.9rem; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 8px; margin-top: 6px; }
.podium-col { display: flex; flex-direction: column; align-items: center; flex: 1 1 0; min-width: 0; max-width: 150px; }
.podium-name { max-width: 100%; margin: 2px 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.podium-block {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px; width: 100%; padding-top: 8px;
  border: var(--line); border-bottom-width: 0; border-radius: 14px 14px 0 0; font-variant-numeric: tabular-nums;
}
.podium-n { font-size: 1.7rem; line-height: 1; font-weight: 700; }
.p1 .podium-block { height: 124px; background: var(--yellow); }
.p2 .podium-block { height: 96px; background: #8fb0ff; }
.p3 .podium-block { height: 76px; background: var(--pink); }

/* ---- pass & play curtain ---- */

.curtain { padding-top: 6vh; }
.curtain h2 { font-size: 2.2rem; }

/* ---- toasts + banner + confetti ---- */

#toasts {
  position: fixed; left: 0; right: 0; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 60;
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px; pointer-events: none;
}
.toast {
  max-width: 100%; padding: 10px 16px; font-weight: 600; text-align: center;
  color: var(--paper); background: var(--ink); border: 2px solid var(--ink); border-radius: 12px; box-shadow: 3px 3px 0 rgba(23, 19, 15, 0.25);
  animation: pop 0.25s both; transition: opacity 0.3s, transform 0.3s;
}
.toast.ok { color: var(--ink); background: var(--green); }
.toast.bad { color: var(--ink); background: var(--red); }
.toast.out { opacity: 0; transform: translateY(8px); }

#banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 70; padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  font-weight: 700; text-align: center; background: var(--red); border-bottom: var(--line);
}
#confetti { position: fixed; inset: 0; z-index: 50; width: 100%; height: 100%; pointer-events: none; }

/* ---- motion ---- */

.pop { animation: pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.float { animation: float 2.6s ease-in-out infinite; }
.intro-icon.float { animation-name: float-tilt; }
.wiggle { animation: wiggle 0.9s ease-in-out infinite; }

@keyframes pop { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes float-tilt { 0%, 100% { transform: rotate(-5deg) translateY(0); } 50% { transform: rotate(-2deg) translateY(-8px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(-9deg); } 50% { transform: rotate(7deg); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes throb { from { transform: scale(1); } to { transform: scale(1.25); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- larger screens ---- */

@media (min-width: 520px) {
  .games-list { grid-template-columns: 1fr 1fr; }
  .answers { grid-template-columns: 1fr 1fr; }
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .cat-btn { flex-direction: column; text-align: center; padding: 20px 10px; }
}

@media (min-width: 900px) {
  body { font-size: 19px; }
  #app { max-width: 780px; }
  .shell { border-left: var(--line); border-right: var(--line); background: rgba(255, 246, 229, 0.6); }
  .stage { padding: 26px 28px; }
  .prompt-text { font-size: 1.6rem; }
  .strip { justify-content: center; }
}

@media (min-width: 900px) {
  body.big { font-size: 23px; }
  body.big #app { max-width: 1040px; }
  body.big .face.sm { width: 40px; height: 40px; }
  body.big .strip-player { max-width: 130px; }
}

@media (max-width: 430px) {
  .room-word { display: none; }
}

@media (max-width: 380px) {
  body { font-size: 16px; }
  .hero h1 { font-size: 2.1rem; }
  .code-big { font-size: 2.6rem; }
  .segmented button { padding: 7px 7px; font-size: 0.8rem; }
  .top-title { font-size: 0.9rem; }
}
