/* games.css - the starter arcade's shared look: the hub page and the game overlays. */
:root {
  color-scheme: light;
  --paper: #fcfaf4;
  --surface: #ffffff;
  --ink: #1e2927;
  --muted: #546763;
  --forest: #1f5c51;
  --forest-hover: #17463d;
  --forest-soft: #e3f1ed;
  --gold: #b88943;
  --sky: #2f6fb3;
  --sky-soft: #e6f0fa;
  --line: #dbe2d9;
  --berry: #c2410c;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-print: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 16px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { min-height: 100dvh; display: flex; flex-direction: column; font-family: var(--font-sans); color: var(--ink); background: var(--paper); line-height: 1.45; }
body.game-page { display: block; }
a { color: var(--forest); }
button, select { font: inherit; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* shared header, sub-bar and footer live in ../assets/first-steps-shell.css */

/* ---------- hub ---------- */
.hub { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 22px 18px 48px; }
.hub h1 { font-family: var(--font-serif); font-size: clamp(1.7rem, 5vw, 2.5rem); margin: 6px 0 4px; color: var(--forest); }
.hub .lede { color: var(--muted); margin: 0 0 20px; max-width: 60ch; }
.game-card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: 0 6px 24px rgba(31, 92, 81, .08); }
@media (min-width: 760px) { .game-card { grid-template-columns: 300px minmax(0, 1fr); } }
.game-art { background: linear-gradient(180deg, #9fc8ef 0%, #dceefc 46%, #ffffff 47%, #eef6fd 100%); min-height: 170px; position: relative; }
.game-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.game-body { padding: 18px 20px 20px; }
.game-body h2 { margin: 0 0 4px; font-size: 1.35rem; }
.game-body p { margin: 0 0 14px; color: var(--muted); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px; border-radius: 999px; border: 2px solid var(--forest); background: var(--forest); color: #fff; font-weight: 700; text-decoration: none; cursor: pointer; font-size: 1rem; }
.btn:hover { background: var(--forest-hover); border-color: var(--forest-hover); }
.btn.secondary { background: #fff; color: var(--forest); }
.btn.secondary:hover { background: var(--forest-soft); }
.btn.big { min-height: 60px; font-size: 1.25rem; padding: 12px 30px; }
.btn:focus-visible, .seg button:focus-visible, select:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.deck-section h2 { font-size: 1.15rem; margin: 30px 0 10px; }
.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 12px; }
.deck { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; text-decoration: none; color: inherit; transition: transform .12s, box-shadow .12s; }
.deck:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(31, 92, 81, .12); }
.deck .title { font-weight: 700; }
.deck .sample { font-family: var(--font-print); font-size: 1.15rem; letter-spacing: .02em; color: var(--sky); overflow-wrap: anywhere; }
.stars { font-size: 1.2rem; letter-spacing: 2px; color: var(--gold); }
.stars .off { color: #d9d2c4; }
.meter { height: 8px; border-radius: 99px; background: #edf1ec; overflow: hidden; }
.meter > span { display: block; height: 100%; background: linear-gradient(90deg, var(--forest), #43a08c); border-radius: 99px; }
.deck .meta { font-size: .85rem; color: var(--muted); }
.hub-foot { margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: .9rem; }
.linkish { background: none; border: 0; color: var(--forest); text-decoration: underline; cursor: pointer; padding: 6px 0; }

/* ---------- the game page ---------- */
.game-page { overflow: hidden; background: #dbeaf7; height: 100dvh; }
.game-page canvas#stage { position: fixed; inset: 0; width: 100vw; height: 100dvh; display: block; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.overlay { position: fixed; inset: 0; display: flex; flex-direction: column; overflow-y: auto; background: rgba(230, 240, 250, .82); backdrop-filter: blur(3px); z-index: 10; }
.overlay[hidden] { display: none; }
.panel { width: min(640px, calc(100% - 24px)); margin: 16px auto 24px; background: var(--surface); border-radius: 22px; padding: 20px 20px 22px; box-shadow: 0 12px 40px rgba(20, 50, 80, .18); }
.panel h1 { font-family: var(--font-serif); color: var(--forest); font-size: clamp(1.5rem, 6vw, 2.1rem); margin: 0 0 4px; line-height: 1.15; }
.panel .sub { color: var(--muted); margin: 0 0 14px; }
.field { margin: 14px 0 0; }
.field > .label { display: block; font-weight: 700; margin-bottom: 6px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { flex: 1 1 auto; min-height: 46px; padding: 8px 14px; border-radius: 12px; border: 2px solid var(--line); background: #fff; color: var(--ink); font-weight: 600; cursor: pointer; }
.seg button[aria-pressed="true"] { border-color: var(--forest); background: var(--forest-soft); color: var(--forest); }
.seg .case-b { font-family: var(--font-print); font-size: 1.1rem; }
select { width: 100%; min-height: 48px; border-radius: 12px; border: 2px solid var(--line); padding: 8px 12px; background: #fff; color: var(--ink); font-size: 1.05rem; }
.players { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 560px) { .players.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.player-box { border: 2px solid var(--line); border-radius: 14px; padding: 12px; }
.player-box.p1 { border-color: #f4b183; }
.player-box.p2 { border-color: #9cc3ea; }
.player-box h3 { margin: 0 0 8px; font-size: 1rem; }
.hint { color: var(--muted); font-size: .88rem; margin: 12px 0 0; }
.start-row { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.loading { color: var(--muted); font-size: .95rem; }

/* finish */
.result-big { font-size: clamp(2rem, 9vw, 3rem); font-weight: 800; color: var(--forest); margin: 2px 0; font-variant-numeric: tabular-nums; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr)); gap: 10px; margin: 12px 0; }
.result-grid > div { background: var(--sky-soft); border-radius: 12px; padding: 10px 12px; }
.result-grid b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.result-grid span { font-size: .85rem; color: var(--muted); }
.mastered h2 { font-size: 1.15rem; margin: 16px 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-family: var(--font-print); font-size: 1.2rem; padding: 6px 14px; border-radius: 999px; background: #f1f4f0; color: #8a978f; border: 2px solid transparent; }
.chip.m { background: var(--forest-soft); color: var(--forest); border-color: #9fd0c2; }
.chip.a { background: #fff6e0; color: #8a5a12; border-color: var(--gold); }
.chip.new::after { content: " \2605"; color: var(--gold); }
.duel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 520px) { .duel { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.duel > div { border-radius: 14px; padding: 12px; border: 2px solid var(--line); }
.duel .win { border-color: var(--gold); background: #fffaf0; }

/* in-race buttons over the canvas */
.hud-btn { position: fixed; z-index: 5; width: 58px; height: 58px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .95); background: rgba(31, 92, 81, .88); color: #fff; font-size: 26px; line-height: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, .2); touch-action: manipulation; padding: 0; }
.hud-btn.small { width: 42px; height: 42px; font-size: 18px; background: rgba(255, 255, 255, .9); color: var(--forest); border-color: rgba(31, 92, 81, .35); }
.hud-btn[hidden] { display: none; }
.hud-btn.pulse { animation: pulse .9s ease-out 1; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(184, 137, 67, .8); } 100% { box-shadow: 0 0 0 18px rgba(184, 137, 67, 0); } }
.results-now { position: fixed; z-index: 6; left: 50%; transform: translateX(-50%); bottom: 18px; }
@media (prefers-reduced-motion: reduce) { .deck, .hud-btn.pulse { transition: none; animation: none; } }

/* ---------- hub: three games, one deck picker ---------- */
.games { display: grid; gap: 16px; }
@media (min-width: 1000px) {
  .games { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .games .game-card { grid-template-columns: minmax(0, 1fr); grid-template-rows: 170px auto; }
}
.game-art.space, .game-art.chomp { background: #141b47; }
.deck-now { margin: 0 0 14px; padding: 10px 14px; background: var(--forest-soft); border-radius: 12px; color: var(--forest); display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; }
button.deck { font: inherit; text-align: left; cursor: pointer; width: 100%; border: 2px solid var(--line); }
button.deck[aria-pressed="true"] { border-color: var(--forest); box-shadow: 0 0 0 3px var(--forest-soft); }
.deck:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.game-page.space-page, .game-page.chomp-page { background: #141b47; }

/* ---------- hub: what to practice (Sight Words first, above the games) ---------- */
.pick { margin: 4px 0 26px; }
.pick-title { font-size: 1.1rem; margin: 0 0 10px; color: var(--ink); }
.pick-tabs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-bottom: 14px; }
.pick-tab { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; min-height: 64px; padding: 12px 16px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.pick-tab .pick-big { font-size: clamp(1.05rem, 3.6vw, 1.35rem); font-weight: 800; line-height: 1.2; }
.pick-tab .pick-small { font-size: .86rem; color: var(--muted); }
.pick-tab.sight[aria-selected="true"] { border-color: var(--gold); background: #fff6e2; box-shadow: 0 4px 16px rgba(184, 137, 67, .22); }
.pick-tab.consonant[aria-selected="true"] { border-color: var(--forest); background: var(--forest-soft); box-shadow: 0 4px 16px rgba(31, 92, 81, .16); }
.pick-tab:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.deck-section:focus { outline: none; }
.deck-head { font-size: 1.05rem; margin: 0 0 10px; }
.deck-head span { font-weight: 400; color: var(--muted); font-size: .9rem; margin-left: 6px; }
@media (max-width: 560px) { .pick .deck-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .pick .deck { padding: 10px; } .pick .deck .sample { font-size: 1rem; } }
