:root {
  color-scheme: light;
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); }
button, input, select { font: inherit; }
button { min-height: var(--tap-height); padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius-button); background: var(--surface); color: var(--plum); font-weight: 750; cursor: pointer; touch-action: manipulation; transition: transform .12s, background .12s; }
button:hover:enabled { background: #F2EBF7; }
button:active:enabled { transform: scale(.97); }
button:disabled { color: var(--muted); background: #EAE4EC; border-color: transparent; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--plum); outline-offset: 4px; }
input:not([type=checkbox]), select { width: 100%; min-height: var(--tap-height); border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface); color: var(--ink); font-size: 16px; }
input[readonly] { background: #F6F2F8; }
label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 14px; font-weight: 650; }
form { display: grid; gap: 12px; margin-top: 28px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(32px, 5vw, 48px); letter-spacing: -.045em; margin-bottom: 10px; line-height: 1.1; font-weight: 850; }
h1 span { display: block; font-size: 15px; letter-spacing: 0; font-weight: 500; color: var(--muted); margin-top: 10px; }
h2 { font-size: clamp(23px, 3vw, 32px); letter-spacing: -.025em; }
p { line-height: 1.6; }
a { color: var(--plum); text-underline-offset: 4px; }
.eyebrow { font-size: 12px; letter-spacing: .13em; font-weight: 800; color: var(--plum); margin-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.brand-mark { width: 44px; height: 44px; flex: 0 0 44px; color: var(--coral); }
.brand-name { font-size: clamp(27px, 4vw, 34px); font-weight: 900; letter-spacing: -.045em; }
.brand-tagline { color: var(--plum); font-size: 21px; font-weight: 750; }
.muted { color: var(--muted); font-size: 14px; margin-top: 16px; }
.entry { max-width: 580px; margin: 8vh auto; padding: 28px; }
.entry form { padding: 24px; background: var(--surface); border-radius: var(--radius-card); }
.host { max-width: 1440px; margin: auto; padding: 30px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 26px; margin-bottom: 22px; }
.primary { background: var(--coral); color: var(--ink); border-color: transparent; }
.primary:hover:enabled { background: #FF756C; }
.wide { width: 100%; margin: 12px 0; }
.error { color: var(--danger); min-height: 24px; margin-bottom: 12px; }
header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 26px; }
header .brand { margin-bottom: 8px; }
.tools { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.sound { display: flex; align-items: center; gap: 8px; margin: 0; }
.sound input { accent-color: var(--plum); width: 22px; height: 22px; }
#connection { font-size: 13px; color: var(--muted); }
#connection.online { color: var(--mint); }
.invite { display: flex; gap: 16px; align-items: end; }
.invite > div { flex: 1; min-width: 0; }
.invite button { flex-shrink: 0; }
.scores { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0; }
.score { min-width: 0; flex: 1 1 180px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.score-name { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); overflow-wrap: anywhere; }
.score-value { font-size: clamp(36px, 5vw, 48px); font-weight: 850; margin-top: 8px; color: var(--plum); font-variant-numeric: tabular-nums; }
.dot { width: 7px; height: 7px; flex-shrink: 0; border-radius: 100%; background: var(--muted); }
.dot.online { background: var(--mint); }
.board-header { display: flex; justify-content: space-between; align-items: baseline; gap: 15px; }
.board-header p { color: var(--muted); font-size: 14px; }
.board { display: grid; grid-template-columns: repeat(var(--board-columns, 5), minmax(0, 1fr)); gap: 12px; }
.board-col { display: grid; grid-template-rows: minmax(84px, auto) repeat(5, 72px); gap: 10px; padding: 12px; border-radius: var(--radius-card); background: var(--surface); border: 1px solid var(--line); }
.board-category { padding: 10px 2px; text-align: center; display: grid; place-items: center; font-size: 15px; font-weight: 800; overflow-wrap: anywhere; }
.tile { background: var(--plum); color: var(--surface); font-size: clamp(21px, 3vw, 30px); border: 0; border-radius: var(--radius-tile); padding: 10px 4px; min-height: 58px; }
.tile:hover:enabled { background: #754799; }
.tile.used { color: var(--muted); background: #F0EBF3; }
.row { display: flex; gap: 10px; }
.row select { flex: 1; min-width: 0; }
.question-top { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.question-top h2 { color: var(--plum); font-size: 38px; margin-bottom: 0; }
.question-top button { min-width: 100px; }
dialog { width: min(840px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--paper); color: var(--ink); padding: 30px; }
dialog::backdrop { background: #2E1A4599; backdrop-filter: blur(6px); }
.question-text { font-size: clamp(24px, 4vw, 34px); font-weight: 750; line-height: 1.4; margin: 28px 0; }
.turn { min-height: 34px; font-size: 19px; font-weight: 700; color: var(--plum); }
.judgement { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.good { background: #E8F3EE; color: var(--mint); border-color: #C2E0D5; }
.good:hover:enabled { background: #D9EBE3; }
.bad { background: #FBECEF; color: var(--danger); border-color: #ECC8D0; }
.bad:hover:enabled { background: #F6DAE0; }
.answer-controls { display: flex; gap: 12px; margin-top: 20px; }
.answer-controls button { flex: 1; }
.answer { padding: 18px; background: #E8F3EE; border-radius: 18px; color: var(--mint); font-size: 20px; margin-top: 16px; white-space: pre-wrap; }
.intro { position: fixed; inset: 0; z-index: 10; background: var(--ink); color: var(--surface); padding: 8vw; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; cursor: pointer; }
.intro .eyebrow { color: #FFB3AC; }
.intro .brand-mark { width: 64px; height: 64px; margin-bottom: 20px; }
.intro h2 { font-size: clamp(36px, 8vw, 90px); margin: 20px 0; line-height: 1.1; }
.intro p { font-size: clamp(20px, 3vw, 30px); max-width: 850px; }
.intro span { color: #DED5E4; margin-top: 20px; }
.intro button { margin-top: 35px; background: transparent; color: var(--surface); border-color: #70677B; font-size: 14px; }
.intro button:hover:enabled { background: #ffffff15; }
.player { max-width: 680px; margin: auto; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); }
.player header h1 { font-size: 28px; }
.player .panel { padding: 24px; }
.player-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; font-size: 22px; font-weight: 700; }
.player-meta strong { color: var(--plum); font-size: clamp(32px, 8vw, 42px); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.player-meta #me { min-width: 0; overflow-wrap: anywhere; }
.player-question { font-size: clamp(21px, 5vw, 27px); font-weight: 700; line-height: 1.45; margin-bottom: 0; }
.buzz-status { min-height: 55px; text-align: center; font-weight: 700; font-size: 18px; line-height: 1.4; }
.buzzer { width: 100%; min-height: 190px; border-radius: var(--radius-buzzer); background: var(--coral); border: 0; color: var(--ink); font-size: clamp(30px, 8vw, 44px); font-weight: 900; letter-spacing: -.025em; }
.buzzer::before { content: "ϟ"; display: block; font-size: 48px; line-height: 1; margin-bottom: 12px; }
.buzzer:hover:enabled { background: #FF756C; }
.buzzer:disabled { background: #E1DAE0; color: var(--muted); opacity: 1; }
.buzzer.winner { background: var(--mint); color: var(--surface); }
.buzzer.winner::before { content: "✓"; }
.centered { text-align: center; }
.small-title { font-size: 19px; color: var(--ink); margin-top: 28px; }
.player .score { min-width: 0; flex-basis: 160px; }
.player .score-value { font-size: clamp(34px, 7vw, 42px); }
.game-settings { display: grid; gap: 14px; margin: 20px 0; }
.game-settings p { margin: 0; color: var(--muted); font-size: 14px; }
.game-settings summary { cursor: pointer; min-height: var(--tap-height); padding: 16px 0; font-weight: 750; }
.category-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; }
.category-choices label { display: flex; align-items: center; gap: 10px; min-height: var(--tap-height); padding: 12px; border: 1px solid var(--line); border-radius: 12px; margin: 0; color: var(--ink); }
.category-choices input, .game-settings input[type=checkbox] { width: 22px; height: 22px; flex-shrink: 0; accent-color: var(--plum); }
.pack-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.pack-card { display: grid; gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: #FAF7FC; }
.pack-card strong { color: var(--plum); font-size: 18px; }
.pack-card button { min-height: var(--tap-height); }
.category-choices label:has(input:disabled) { color: var(--muted); background: #F6F2F8; }
[hidden] { display: none !important; }
@media (max-width: 900px) {
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board-col { grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-rows: auto 58px; padding: 18px; }
  .board-category { grid-column: 1 / -1; display: block; text-align: left; padding: 0 0 4px; font-size: 17px; }
}
@media (max-width: 600px) {
  .entry { margin: 4vh auto; padding: 24px; }
  .host { padding: 20px 16px; }
  header { align-items: start; flex-direction: column; }
  .tools { gap: 12px; width: 100%; }
  .invite { flex-wrap: wrap; }
  .invite > div { flex-basis: 100%; }
  .invite button { flex: 1; }
  .panel { padding: 22px; }
  .board-header { display: block; }
  .board { grid-template-columns: 1fr; }
  dialog { padding: 22px; }
  .question-top button { padding: 10px; font-size: 13px; }
  .question-text { font-size: 25px; }
  .judgement { gap: 8px; }
  .judgement button { padding: 13px 9px; font-size: 15px; }
  .answer-controls { flex-direction: column; }
  .score { min-width: 110px; }
  .player header { gap: 10px; }
  .intro .eyebrow { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* The mobile board is an overview: one compact row per category. */
@media (max-width: 600px) {
  .board { gap: 8px; }
  .board-col { grid-template-rows: auto 44px; gap: 6px; padding: 10px 12px; border-radius: 16px; }
  .board-category { font-size: 14px; line-height: 1.25; padding: 0; }
  .tile { min-height: 44px; font-size: 18px; border-radius: 9px; padding: 4px 0; }
  .board-header h2 { font-size: 21px; margin-bottom: 6px; }
  .board-header p { margin-bottom: 10px; }
}

/* Setup: bold game cards and a browsable, scalable topic library. */
.game-library { margin-bottom: 28px; }
.saved-game { background: var(--paper); border: 1px solid var(--line); border-left: 5px solid var(--plum); border-radius: 18px; padding: 18px; margin: 12px 0; }
.saved-game p { font-size: .9rem; }
.saved-game .row { flex-wrap: wrap; }
.saved-game button { min-height: 44px; }
.game-settings > label { color: var(--plum); font-weight: 800; }
.pack-choices { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,260px),1fr)); gap: 14px; }
.pack-card { border-top: 5px solid var(--coral); background: var(--paper); border-radius: 20px; padding: 20px; }
.pack-card strong { font-size: 1.35rem; color: var(--ink); }
.pack-card p { font-size: .9rem; line-height: 1.5; }
.pack-topics { color: var(--plum); font-weight: 700; }
.category-controls { padding: 16px 0; }
.category-controls .row { flex-wrap: wrap; }
.selected-chips { display: flex; gap: 6px; flex-wrap: wrap; max-height: 160px; overflow: auto; }
.category-chip { font-size: .8rem; background: var(--paper); color: var(--plum); min-height: 44px; padding: 8px 12px; border-radius: 30px; }
.category-choices > label { min-height: 56px; padding: 12px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); }
.category-choices > label:has(input:checked) { background: #eee4f5; border-color: var(--plum); color: var(--ink); }
.category-choices > label[hidden] { display: none; }

.tile{font-size:clamp(24px,3.5vw,42px);font-weight:900}#inviteQR{display:block;background:white;padding:10px;margin-top:12px}#inviteCode{font-size:28px;letter-spacing:2px}#undo{margin-block:10px}#startHosting{margin-bottom:10px}

/* Deadline-driven progress fills the complete chosen duration, including custom times. */
.answer-timer { margin: 18px 0; color: var(--plum); }
.answer-timer-heading { display: flex; justify-content: space-between; gap: 12px; font-size: 22px; font-weight: 800; }
.answer-timer-heading strong { font-variant-numeric: tabular-nums; }
.answer-timer-track { height: 12px; border-radius: 99px; background: #e5d8ed; overflow: hidden; margin-top: 10px; }
.answer-timer-fill { height: 100%; background: var(--plum); transform-origin: left; }
.answer-timer.expired { color: var(--danger); }
.score-value { overflow-wrap: anywhere; }
