/* Tabooboo
   Look: a picture-book page. Sunflower field, indigo ink outlines, flat colour, hard drop shadows.
   One hero per screen (the card, or the squeaker), everything else kept quiet.
   Team colours are the blue and pink of the growth charts. */

@font-face { font-family: "Grandstander"; src: url("/fonts/grandstander.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("/fonts/figtree.woff2") format("woff2"); font-weight: 300 900; font-display: swap; }

:root {
  --field: #ffd23f;
  --field-2: #ffc41f;
  --ink: #1e2352;
  --line: #1e2352;
  --paper: #ffffff;
  --tint: #fff4cc;
  --muted: #565b8c;
  --primary: #1e2352;
  --on-primary: #ffffff;
  --blue: #2e7cf6;
  --pink: #f0508f;
  --go: #12a46b;
  --stop: #eb4b3a;
  --pass: #8087b5;
  --star: #ffc41f;
  --danger-text: #b3261a;
  --band-s: 92%;
  --band-l: 86%;
  --display: "Grandstander", "Trebuchet MS", "Comic Sans MS", system-ui, sans-serif;
  --body: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  --edge: 2.5px solid var(--line);
  --drop: 0 4px 0 var(--line);
  --drop-lg: 0 7px 0 var(--line);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="day"]) {
    --field: #171a45; --field-2: #1d2152; --ink: #f6f3e4; --line: #070920; --paper: #2a2f73; --tint: #21266a;
    --muted: #b1b6e2; --primary: #ffd23f; --on-primary: #1e2352; --band-s: 48%; --band-l: 34%;
    --blue: #5c9bff; --pink: #ff6fa6; --go: #2cc587; --stop: #ff6a59; --pass: #9aa1d0; --danger-text: #ff9c8f;
    color-scheme: dark;
  }
}
:root[data-theme="night"] {
  --field: #171a45; --field-2: #1d2152; --ink: #f6f3e4; --line: #070920; --paper: #2a2f73; --tint: #21266a;
  --muted: #b1b6e2; --primary: #ffd23f; --on-primary: #1e2352; --band-s: 48%; --band-l: 34%;
  --blue: #5c9bff; --pink: #ff6fa6; --go: #2cc587; --stop: #ff6a59; --pass: #9aa1d0; --danger-text: #ff9c8f;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--field) radial-gradient(var(--field-2) 1.6px, transparent 1.8px) 0 0 / 22px 22px;
  color: var(--ink);
  font: 400 17px/1.45 var(--body);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1.08; text-wrap: balance; }
h1, h2, h3, .btn, .seg button, .squeaker { font-variant-ligatures: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- frame ---------- */
.app { min-height: 100%; display: flex; flex-direction: column; }
.bar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; flex-wrap: wrap; }
.wordmark { font: 800 22px/1 var(--display); letter-spacing: -0.01em; margin-right: auto; display: flex; align-items: center; gap: 8px; }
.wordmark svg { width: 26px; height: 26px; flex: none; }
.bar-home .wordmark { visibility: hidden; }
.icon-btn svg { width: 22px; height: 22px; }
.bar .code-btn { padding: 4px 6px; min-height: 42px; border-color: transparent; background: transparent; }
@media (max-width: 520px) {
  .bar { gap: 6px; padding-inline: 12px; }
  .bar-room .wordmark { display: none; }
  .bar-room .code-btn { margin-right: auto; padding-left: 0; }
  .bar .icon-btn { width: 40px; min-height: 40px; }
}
.main { flex: 1; width: min(100% - 32px, 1000px); margin: 0 auto; padding: 8px 0 48px; }
.narrow { width: 100%; max-width: 540px; margin-inline: auto; }
.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; }
.grow { flex: 1 1 0; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.center { text-align: center; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 9px 18px 7px;
  font: 700 17px/1.1 var(--display);
  color: var(--ink); background: var(--paper);
  border: var(--edge); border-radius: 14px; box-shadow: var(--drop);
  transition: transform 0.06s, box-shadow 0.06s;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; text-decoration: none;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-go { background: var(--go); color: #fff; }
.btn-stop { background: var(--stop); color: #fff; }
.btn-lg { min-height: 60px; font-size: 21px; padding-inline: 26px; border-radius: 18px; }
.btn-sm { min-height: 36px; font-size: 15px; padding: 5px 12px 4px; border-radius: 11px; box-shadow: 0 3px 0 var(--line); }
.btn-wide { width: 100%; }
.btn-flat { box-shadow: none; }
.btn-flat:active:not(:disabled) { transform: none; box-shadow: none; background: var(--tint); }
.icon-btn { width: 42px; min-height: 42px; padding: 0; border-radius: 50%; box-shadow: 0 3px 0 var(--line); }
.link { background: none; border: 0; padding: 0; color: inherit; font: 700 15px var(--body); text-decoration: underline; text-underline-offset: 3px; }

.field { display: grid; gap: 6px; }
.field > span { font: 700 15px var(--body); }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 10px 14px;
  background: var(--paper); color: var(--ink);
  border: var(--edge); border-radius: 12px;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.4; }
.select { appearance: none; padding-right: 38px; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%; background-size: 6px 6px; background-repeat: no-repeat; }
.select-sm { min-height: 36px; padding: 4px 34px 4px 10px; font-size: 15px; border-radius: 10px; width: auto; max-width: 100%; }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: 0.75; }
.code-input::placeholder { opacity: 0.3; }
.code-input { font: 800 30px/1 var(--display); letter-spacing: 0.28em; text-transform: uppercase; text-align: center; padding-left: calc(14px + 0.28em); }
.error { color: var(--danger-text); font-weight: 700; }

.seg { display: inline-flex; flex-wrap: wrap; border: var(--edge); border-radius: 12px; overflow: hidden; background: var(--paper); }
.seg button { border: 0; background: transparent; padding: 9px 14px 7px; font: 700 15px var(--display); min-height: 40px; }
.seg button + button { border-left: var(--edge); }
.seg button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  --h: 220;
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 12px;
  border: 2px solid var(--line); border-radius: 999px; background: var(--paper);
  font: 700 14px var(--body); color: var(--muted);
}
.chip i { font-style: normal; font-weight: 500; opacity: 0.85; }
.chip[aria-pressed="true"] { background: hsl(var(--h) var(--band-s) var(--band-l)); color: var(--ink); }
.chip[aria-pressed="true"]::before { content: "✓"; font-weight: 800; }

.panel { background: var(--paper); border: var(--edge); border-radius: 22px; box-shadow: var(--drop-lg); padding: 20px; }
.panel h2 { font-size: 24px; }
.panel-flat { box-shadow: none; }
.note { background: var(--tint); border: 2px dashed var(--line); border-radius: 14px; padding: 12px 14px; }

/* ---------- home ---------- */
.hero { padding: 26px 0 8px; }
.hero h1 { font-size: clamp(46px, 11vw, 88px); font-weight: 900; letter-spacing: -0.025em; line-height: 0.92; }
.hero p { margin-top: 12px; font-size: clamp(18px, 2.6vw, 22px); max-width: 30ch; font-weight: 500; }
.home-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); align-items: start; }
.steps { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; max-width: 62ch; }

/* ---------- room code as alphabet blocks ---------- */
.blocks { display: inline-flex; gap: 8px; }
.block { width: 54px; height: 60px; display: grid; place-items: center; padding-top: 4px; font: 900 34px/1 var(--display); color: #fff; border: var(--edge); border-radius: 12px; box-shadow: var(--drop); }
.block:nth-child(1) { background: var(--blue); transform: rotate(-3deg); }
.block:nth-child(2) { background: var(--pink); transform: rotate(2deg); }
.block:nth-child(3) { background: var(--go); transform: rotate(-1.5deg); }
.block:nth-child(4) { background: var(--stop); transform: rotate(3deg); }
.blocks-sm .block { width: 30px; height: 34px; font-size: 19px; border-radius: 8px; border-width: 2px; box-shadow: 0 2px 0 var(--line); padding-top: 2px; }
.blocks-sm { gap: 4px; }

/* ---------- lobby ---------- */
.lobby-top { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; }
.teams { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); align-items: start; }
.teambox { background: var(--paper); border: var(--edge); border-radius: 20px; box-shadow: var(--drop-lg); overflow: hidden; }
.teambox-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 10px; border-bottom: var(--edge); color: #fff; }
.teambox-head h3 { font-size: 21px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.teambox-head .input { min-height: 38px; padding: 4px 10px; font: 800 19px var(--display); }
.team-A .teambox-head { background: var(--blue); }
.team-B .teambox-head { background: var(--pink); }
.team-S .teambox-head { background: var(--tint); color: var(--ink); }
.players { list-style: none; margin: 0; padding: 6px 14px 12px; }
.player { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1.5px dashed color-mix(in srgb, var(--line) 30%, transparent); min-height: 50px; }
.player:last-child { border-bottom: 0; }
.player .name { font-weight: 700; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.player.off .name { opacity: 0.5; }
.player .select { width: 104px; flex: none; }
.tag { font: 700 12px var(--body); padding: 2px 8px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--tint); white-space: nowrap; }
.tag-you { background: var(--star); color: #1e2352; }
.empty { padding: 14px; color: var(--muted); }
.teambox-foot { padding: 0 14px 14px; }

/* ---------- scores ---------- */
.scores { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.score { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 12px 6px; background: var(--paper); border: var(--edge); border-radius: 16px; }
.score.up { box-shadow: var(--drop); }
.score .dot { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2px solid var(--line); }
.score.team-A .dot { background: var(--blue); }
.score.team-B .dot { background: var(--pink); }
.score .who { flex: 1; min-width: 0; display: grid; font: 700 15px/1.15 var(--body); }
.score .who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score .who small { font: 600 12.5px/1.2 var(--body); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score .pts { font: 800 30px/1 var(--display); font-variant-numeric: tabular-nums; }
.score .delta { font: 800 13px/1 var(--body); padding: 4px 7px 3px; border-radius: 999px; background: var(--tint); border: 1.5px solid var(--line); white-space: nowrap; }
.statusline { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; justify-content: space-between; font: 600 15px var(--body); }

/* ---------- the turn ---------- */
.turn { display: grid; gap: 16px; justify-items: center; }
.turn > * { width: 100%; }
.game { width: 100%; max-width: 540px; margin-inline: auto; }
.game .teams { grid-template-columns: 1fr; }
.callout { text-align: center; display: grid; gap: 8px; justify-items: center; padding: 26px 20px; }
.callout h2 { font-size: clamp(28px, 6vw, 38px); }
.callout .who { font: 800 clamp(22px, 4.6vw, 28px)/1.1 var(--display); }

.clock { display: grid; gap: 6px; }
.clock-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.clock-num { font: 900 46px/0.9 var(--display); letter-spacing: 0.01em; }
.clock-num.low { color: var(--stop); }
.tape { height: 16px; background: var(--paper); border: var(--edge); border-radius: 999px; overflow: hidden; }
.tape i { display: block; height: 100%; background: var(--primary); border-right: var(--edge); transition: width 0.25s linear; }
.tape.low i { background: var(--stop); }

.tcard { --h: 220; background: var(--paper); border: 3px solid var(--line); border-radius: 26px; box-shadow: 0 9px 0 var(--line); overflow: hidden; }
.tcard-head { background: hsl(var(--h) var(--band-s) var(--band-l)); border-bottom: 3px solid var(--line); padding: 14px 20px 14px; }
.tcard-sys { font: 700 14px/1.2 var(--body); opacity: 0.85; }
.tcard-term { font: 800 clamp(28px, 7.2vw, 40px)/1.04 var(--display); margin-top: 6px; overflow-wrap: anywhere; text-wrap: balance; }
.tcard-body { padding: 14px 20px 18px; }
.tcard-dont { font: 800 14px var(--body); color: var(--danger-text); margin-bottom: 6px; }
.tcard-words { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.tcard-words li { font: 700 22px/1.25 var(--body); display: flex; gap: 10px; align-items: baseline; overflow-wrap: anywhere; }
.tcard-words li::before { content: "×"; color: var(--stop); font: 900 22px/1 var(--display); flex: none; }
.tcard-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 14px 12px; }
.tcard.pop { animation: deal 0.18s ease-out; }
@keyframes deal { from { transform: translateY(10px) rotate(-1.5deg); opacity: 0.4; } to { transform: none; opacity: 1; } }

.marks { display: grid; grid-template-columns: 1fr 1fr 1.35fr; gap: 10px; }
.marks .btn { min-height: 66px; flex-direction: column; gap: 2px; font-size: 20px; padding-inline: 6px; }
.marks small { font: 600 12px var(--body); opacity: 0.9; }

.squeak-wrap { display: grid; justify-items: center; gap: 10px; }
.squeaker {
  width: 164px; height: 164px; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #ff9cc4 0 18%, var(--pink) 58%, #c2356f 100%);
  border: 3px solid var(--line); box-shadow: 0 10px 0 var(--line);
  color: #fff; font: 900 28px/1 var(--display); letter-spacing: 0.01em; text-shadow: 0 2px 0 rgb(0 0 0 / 0.25);
  transition: transform 0.07s, box-shadow 0.07s; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.squeaker:active:not(:disabled) { transform: translateY(8px) scale(1.06, 0.88); box-shadow: 0 2px 0 var(--line); }
.squeaker:disabled { filter: grayscale(0.6); opacity: 0.6; }
.squeaker-sm { width: 92px; height: 92px; font-size: 17px; box-shadow: 0 6px 0 var(--line); }
.squeaker-sm:active:not(:disabled) { transform: translateY(5px) scale(1.06, 0.88); }

.stickers { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 30px; }
.sticker { width: 30px; height: 30px; flex: none; }
.sticker.pop { animation: pop 0.28s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes pop { from { transform: scale(0.2) rotate(-30deg); } to { transform: none; } }

.reveal { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: start; }
.reveal .sticker { margin-top: 2px; }
.reveal-term { font: 800 21px/1.15 var(--display); overflow-wrap: anywhere; }
.reveal-meta { font: 600 13px var(--body); color: var(--muted); }
.pearl { grid-column: 1 / -1; display: flex; gap: 10px; align-items: flex-start; background: var(--tint); border-radius: 12px; padding: 10px 12px; font-size: 16px; line-height: 1.4; }
.pearl::before { content: ""; flex: none; width: 14px; height: 14px; margin-top: 4px; border-radius: 50%; border: 1.5px solid var(--line); background: radial-gradient(circle at 35% 30%, #fff 0 22%, #e9e4f5 45%, #b9b3d6 100%); }
.banned { grid-column: 1 / -1; font-size: 14px; color: var(--muted); }

.rows { display: grid; gap: 12px; }
.rowcard { background: var(--paper); border: var(--edge); border-radius: 18px; padding: 14px; display: grid; gap: 8px; }
.rowcard-top { display: flex; gap: 12px; align-items: flex-start; }
.rowcard-top .grow { display: grid; gap: 2px; }

.paused { text-align: center; padding: 36px 20px; display: grid; gap: 12px; justify-items: center; border-style: dashed; }
.flash { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; overflow: hidden; z-index: 50; pointer-events: none; display: grid; place-items: center; text-align: center; background: color-mix(in srgb, var(--pink) 94%, transparent); animation: flash 1.1s ease-out forwards; }
.flash b { display: block; font: 900 clamp(48px, 15vw, 120px)/0.9 var(--display); color: #fff; text-shadow: 0 5px 0 #1e2352; transform: rotate(-7deg); }
.flash span { display: block; margin-top: 18px; font: 800 clamp(18px, 4vw, 26px) var(--display); color: #fff; text-shadow: 0 2px 0 #1e2352; }
@keyframes flash { 0% { opacity: 0; } 8% { opacity: 1; } 78% { opacity: 1; } 100% { opacity: 0; } }

.banner { position: sticky; top: 0; z-index: 30; background: var(--stop); color: #fff; text-align: center; font: 700 15px var(--body); padding: 7px 12px; border-bottom: var(--edge); }
.winner { text-align: center; padding: 26px 18px; display: grid; gap: 6px; }
.winner h2 { font-size: clamp(32px, 7vw, 48px); }
.hostbox { border-top: 2px dashed color-mix(in srgb, var(--line) 35%, transparent); padding-top: 14px; }

/* ---------- dialogs ---------- */
dialog.sheet { border: 3px solid var(--line); border-radius: 22px; padding: 0; width: min(560px, calc(100% - 20px)); max-height: calc(100dvh - 20px); background: var(--paper); color: var(--ink); box-shadow: 0 9px 0 var(--line); overflow: hidden; }
dialog.sheet[open] { display: flex; flex-direction: column; }
dialog.sheet-wide { width: min(900px, calc(100% - 20px)); height: calc(100dvh - 20px); }
dialog::backdrop { background: rgb(14 16 48 / 0.6); }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 12px; border-bottom: var(--edge); background: var(--tint); }
.sheet-head h2 { font-size: 22px; flex: 1; }
.sheet-body { padding: 16px; overflow-y: auto; flex: 1; display: grid; gap: 14px; align-content: start; }
.sheet-foot { padding: 12px 16px; border-top: var(--edge); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.words { display: grid; gap: 8px; }
.word { display: flex; gap: 8px; }
.deck-tools { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .deck-tools { grid-template-columns: 1.4fr 1fr auto; align-items: end; } }
.deck-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 0; border-bottom: 1.5px dashed color-mix(in srgb, var(--line) 30%, transparent); }
.deck-item h3 { font-size: 19px; overflow-wrap: anywhere; }
.deck-item .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.deck-item p { grid-column: 1 / -1; font-size: 15px; color: var(--muted); overflow-wrap: anywhere; }
.pill { --h: 220; display: inline-block; font: 700 12.5px var(--body); padding: 2px 9px; border-radius: 999px; border: 1.5px solid var(--line); background: hsl(var(--h) var(--band-s) var(--band-l)); }

.toast { position: fixed; inset: auto auto 18px 50%; margin: 0; transform: translateX(-50%); z-index: 60; max-width: min(92vw, 480px); background: var(--primary); color: var(--on-primary); border: var(--edge); border-radius: 14px; box-shadow: var(--drop); padding: 10px 16px; font: 700 15px var(--body); text-align: center; }
.toast.bad { background: var(--stop); color: #fff; }

@media (max-width: 480px) {
  body { font-size: 16px; }
  .main { width: min(100% - 24px, 1000px); }
  .panel { padding: 16px; border-radius: 18px; }
  .tcard-words li { font-size: 20px; }
  .block { width: 46px; height: 52px; font-size: 29px; }
  .squeaker:not(.squeaker-sm) { width: 148px; height: 148px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
