#game-picker { width:min(360px,calc(100vw - 24px)); padding:8px; color:var(--ink); border:0; }
#game-picker:popover-open { display:flex; flex-direction:column; gap:4px; }
#game-picker button { display:flex; align-items:center; gap:12px; width:100%; min-height:76px; border:0; border-radius:12px; padding:12px; background:transparent; color:var(--ink); font:inherit; text-align:left; cursor:pointer; touch-action:manipulation; }
#game-picker button:hover, #game-picker button:focus-visible { background:var(--accent-soft); }
#game-picker button:focus-visible { outline-offset:-3px; }
.game-picker-icon { display:grid; place-items:center; flex:none; width:40px; height:44px; color:var(--control-ink); }
.game-picker-icon svg { width:30px; height:30px; }
#game-picker button > span:nth-child(2) { min-width:0; flex:1; }
#game-picker strong { display:block; font-size:16px; line-height:1.5; font-weight:750; }
#game-picker small { display:block; margin-top:3px; color:var(--control-ink); font-size:13px; line-height:1.5; }
.game-picker-arrow { width:16px; height:16px; color:var(--control-ink); }
#game-settings { width:min(560px,calc(100% - 32px)); max-height:calc(100dvh - 32px); padding:32px; text-align:left; border-radius:24px; }
#game-settings h2 { padding-right:36px; margin:0; font-size:24px; }
#game-settings .close-button { width:44px; height:44px; top:16px; right:16px; }
#game-settings::backdrop { background:#30204e66; }
html:has(#game-settings[open]) { overflow:hidden; }
.game-button { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:44px; border:1px solid var(--line); border-radius:12px; padding:10px 16px; background:var(--accent-soft); color:var(--control-ink); font:inherit; font-size:14px; font-weight:650; cursor:pointer; touch-action:manipulation; }
.game-button:hover:not(:disabled) { background:var(--surface-soft); }
.game-button:disabled { opacity:.55; cursor:default; }
.game-primary { background:var(--control-ink); color:var(--surface); border-color:transparent; }
.game-primary:hover:not(:disabled) { background:var(--ink); }
.game-panel { max-width:680px; width:100%; margin:0 auto; color:var(--ink); }
.game-panel[hidden], .game-panel [hidden], #game-exit[hidden] { display:none !important; }
.game-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.game-heading h2 { margin:0; font-size:24px; line-height:1.4; }
.game-stats { display:flex; flex-wrap:wrap; gap:8px 20px; font-size:16px; font-weight:650; font-variant-numeric:tabular-nums; }
.game-time-low { color:var(--control-ink); text-decoration:underline; text-underline-offset:4px; }
.game-setup { padding:24px 0 36px; }
#game-intro, #game-result-summary { font-size:22px; line-height:1.6; margin:0 0 20px; text-wrap:balance; }
#game-settings .game-setup { padding-bottom:0; }
#game-rules { margin:0; line-height:1.8; font-size:15px; }
.game-start-controls { display:flex; align-items:center; flex-wrap:wrap; gap:12px; margin-top:28px; }
.game-setting { display:flex; align-items:center; flex-wrap:wrap; gap:12px; }
.game-setting[hidden] { display:none; }
#game-duration { min-height:44px; border:1px solid var(--line); border-radius:12px; padding:8px 32px 8px 12px; background:var(--surface); color:var(--ink); font:inherit; }
.game-result-actions { display:flex; flex-wrap:wrap; gap:12px; }
.game-round { text-align:center; margin:24px 0 16px; }
#game-progress { display:block; width:100%; height:6px; margin:18px 0 22px; border:0; border-radius:4px; background:var(--accent-soft); accent-color:var(--purple); overflow:hidden; }
#game-progress::-webkit-progress-bar { background:var(--accent-soft); }
#game-progress::-webkit-progress-value { background:var(--purple); }
#game-progress::-moz-progress-bar { background:var(--purple); }
.game-question-line { display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:12px 24px; }
#game-question { margin:0; font-size:clamp(36px,6vw,56px); font-weight:800; line-height:1.4; }
.game-factor-input { width:1.8ch; min-width:44px; min-height:44px; padding:0 .1em; border:2px solid var(--purple); border-radius:9px; background:var(--surface); color:var(--ink); font:inherit; text-align:center; vertical-align:baseline; caret-color:var(--purple); }
.game-factor-input:focus-visible, #game-build-grid:focus-visible { outline:3px solid var(--purple); outline-offset:4px; }
.game-factor-input[aria-invalid="true"] { border-style:dashed; }
#game-formula { margin:8px 0 0; font-size:20px; font-variant-numeric:tabular-nums; }
#game-feedback { min-height:24px; margin:16px 0 0; font-size:15px; line-height:1.6; font-weight:600; }
.game-voice-note { margin:16px 0; font-size:13px; line-height:1.6; color:var(--control-ink); }
.game-digits { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; max-width:320px; margin:28px auto 0; }
.game-digits .game-button { min-height:58px; font-size:24px; }
.game-digits .game-button:disabled { text-decoration:line-through; }
.game-build { margin-top:20px; }
.game-build-stage { display:grid; place-items:center; }
#game-build-grid { --unit:calc(100cqw / 9); position:relative; display:grid; grid-template-columns:repeat(9,minmax(0,1fr)); grid-template-rows:repeat(9,minmax(0,1fr)); width:min(100%,360px); aspect-ratio:1; container-type:inline-size; outline:1px solid var(--line); background:var(--surface-soft); touch-action:none; user-select:none; cursor:crosshair; }
.game-build-cell { border-right:1px solid var(--line); border-bottom:1px solid var(--line); pointer-events:none; }
.game-build-cell:nth-of-type(9n) { border-right:0; }
.game-build-cell:nth-last-of-type(-n+9) { border-bottom:0; }
#game-build-empty { position:absolute; inset:0; display:grid; place-items:center; margin:0; color:var(--control-ink); font-size:16px; line-height:1.7; pointer-events:none; }
#game-build-blocks { position:absolute; left:calc(var(--column-start,0)*var(--unit)); top:calc(var(--row-start,0)*var(--unit)); width:calc(var(--columns)*var(--unit)); height:calc(var(--rows)*var(--unit)); pointer-events:none; transform-style:preserve-3d; z-index:1; }
#game-build-count { margin:16px 0; color:var(--control-ink); font-size:15px; line-height:1.7; font-variant-numeric:tabular-nums; }
.game-build-actions { display:flex; justify-content:center; gap:12px; }
@media screen {
  :root[data-game] :is(#playground-tools, #discovery-progress, .discovery, .onboarding-hint, .achievement-replay-note, .board-discovery-tools, #table-view, #reset-all, .board-status .icon-select, #keyboard-hint) { display:none !important; }
  :root[data-game="finished"] #board-scroll, :root[data-game]:not([data-game-kind="chant"]) #board-scroll { display:none; }
  :root[data-game][data-game-kind="chant"] #board-scroll { width:100%; overflow:visible; flex:none; padding:0; }
  :root[data-game][data-game-kind="chant"] #board { min-width:0; width:100%; zoom:1; }
  :root[data-game][data-game-kind="chant"] #table-columns { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); max-width:680px; gap:16px; margin:0 auto; padding:0; }
  :root[data-game][data-game-kind="chant"] .number-column { display:contents; }
  :root[data-game][data-game-kind="chant"] :is(.column-heading, .block-cell:not(.game-choice)) { display:none; }
  :root[data-game][data-game-kind="chant"] .block-cell.game-choice { height:190px; margin:0; border:2px solid var(--line); border-radius:16px; background:var(--surface-soft); box-shadow:none; }
  :root[data-game][data-game-kind="chant"] .block-cell.game-choice::after { display:none; }
  :root[data-game][data-game-kind="chant"] .block-cell.game-choice:hover { border-color:var(--purple); }
  :root[data-game][data-game-kind="chant"] .block-cell.game-correct { border-color:var(--control-ink); background:var(--accent-soft); }
  :root[data-game][data-game-kind="chant"] .block-cell.game-wrong { opacity:.4; }
  :root[data-game][data-game-kind="chant"] .creature-button { touch-action:manipulation; cursor:pointer; }
  :root[data-game][data-game-kind="chant"] .creature { --rx:-13deg !important; --ry:-19deg !important; }
  :root[data-game] .board-bottom { display:flex; flex-wrap:nowrap; justify-content:space-between; width:100%; flex-shrink:0; gap:12px; }
  :root[data-game] .board-bottom .board-status { flex:0 0 auto; margin-left:auto; }
  :root[data-game] .board-bottom .utility-button { min-width:44px; min-height:44px; }
  :root[data-game] .playground.is-fullscreen { overflow:auto; justify-content:flex-start; }
  :root[data-game] .playground.is-fullscreen .game-panel { flex-shrink:0; }
  :root[data-game] .playground.is-fullscreen #board-scroll { flex-shrink:0; }
}
@media (max-width:1090px) {
  #table-view button { width:44px; min-width:44px; min-height:44px; padding:0; gap:0; }
  #table-view button > span { display:none; }
}
@media (max-width:740px) {
  .game-heading h2 { font-size:21px; }
  .game-stats { font-size:14px; }
  #game-settings { padding:28px 20px 24px; }
  :root[data-game][data-game-kind="chant"] .block-cell.game-choice { height:160px; }
  :root[data-game][data-game-kind="chant"] #table-columns { gap:12px; }
}
@media (max-width:480px) {
  #game-settings .game-primary { width:100%; }
}
@media print { #game-toggle, #game-picker, #game-settings, #game-exit, .game-panel { display:none !important; } }
