/* Shared look for every game (loaded on /games/ pages only). Colours, type and spacing come from the site's tokens
   (static/tokens.css), so light and dark mode work without anything extra here. Each game adds its own game.css for
   anything only it needs; keep those rules under .game too. */

/* The game's box on its page */
.game { margin: var(--space-6) 0 var(--space-7); min-height: 320px; position: relative; }
.game:focus { outline: none; }
.game-loading { color: var(--text-muted); font-family: var(--font-mono); font-size: var(--step--1); padding: var(--space-6) 0; }
.game-error { border-left: 4px solid var(--danger); background: var(--danger-tint); color: var(--text); padding: var(--space-4) var(--space-5); }
.game-error p { margin: 0 0 var(--space-3); }

/* Score bar: streak, score, puzzle number */
.game-bar { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); align-items: baseline; border-bottom: 2px solid var(--rule-strong); padding-bottom: var(--space-2); margin-bottom: var(--space-5); font-family: var(--font-mono); font-size: var(--step--1); color: var(--text-secondary); }
.game-bar strong { font-family: var(--font-serif); font-weight: var(--weight-display); font-size: var(--step-2); color: var(--text); margin-left: var(--space-1); }

/* The site gives every button a fixed 48px height; inside a game, buttons grow to fit their text instead. */
.game button { height: auto; }
/* Card-style buttons (choices, rule cards, days) read left to right, not centred like the site's buttons */
.game :is(.pb-opt, .pb-type, .as-rule, .as-mode, .kl-day, .nhs-card) { align-items: stretch; justify-content: flex-start; text-align: left; }

/* Buttons: at least 44px tall, never colour alone for meaning */
.game-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 2.75rem; min-width: 2.75rem; padding: 0 var(--space-5);
  background: var(--surface-raised); color: var(--text); border: 1px solid var(--rule-strong); border-radius: 0;
  font: inherit; font-size: var(--step-0); font-weight: var(--weight-semibold); line-height: 1.2; cursor: pointer; padding-top: 0.5rem; padding-bottom: 0.5rem;
}
.game-btn:hover { background: var(--surface-sunken); }
.game-btn:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.game-btn:disabled { cursor: not-allowed; color: var(--text-muted); border-color: var(--rule); background: var(--surface-sunken); }
.game-btn--primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.game-btn--primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.game-btns { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-4) 0; }

/* Right and wrong: a word and a symbol as well as a colour */
.game-right { border-left: 4px solid var(--success); background: var(--success-tint); padding: var(--space-3) var(--space-4); }
.game-wrong { border-left: 4px solid var(--danger); background: var(--danger-tint); padding: var(--space-3) var(--space-4); }

/* The end-of-game panel */
.game-result { border: 1px solid var(--rule-strong); background: var(--surface-raised); padding: var(--space-5); margin: var(--space-5) 0; }
.game-result h2 { font-size: var(--step-3); margin: 0 0 var(--space-3); }
.game-share { font-family: var(--font-mono); font-size: var(--step--1); white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-sunken); padding: var(--space-3) var(--space-4); margin: var(--space-3) 0; }

/* Text below the game */
.game-about h2 { font-size: var(--step-3); }
.game-list { padding-left: 1.2em; font-size: var(--step-0); max-width: 66ch; }
.game-list li { margin: var(--space-2) 0; }

/* ---------- The games page (/games/) ---------- */
/* Build a Budget, featured: a wide card with the red despatch box (drawn in static/style.css, .bab-promo-box) */
.gm-feature { display: flex; align-items: center; gap: var(--space-6); margin: var(--space-6) 0 var(--space-4); padding: clamp(20px, 4vw, 40px);
  text-decoration: none; color: var(--text); background: var(--surface-raised); border: 1px solid var(--rule-strong); box-shadow: 6px 6px 0 var(--accent); }
.gm-feature:hover { background: var(--surface-page); }
.gm-feature:focus-visible { outline: var(--focus-ring); outline-offset: 4px; }
.gm-feature-text { display: flex; flex-direction: column; gap: var(--space-2); }
.gm-feature-name { font-family: var(--font-serif); font-weight: var(--weight-display); font-size: clamp(28px, 4.5vw, 44px); line-height: 1.05; letter-spacing: -0.015em; }
.gm-feature .gm-pitch { font-size: var(--step-1); max-width: 54ch; }
.gm-feature .go { font-weight: var(--weight-semibold); color: var(--link); margin-top: var(--space-2); }
.gm-feature:hover .go { text-decoration: underline; }

/* Shelves of game cards: each game has its own icon and accent colour (--gm, set on the card) */
.gm-shelf h2 { margin-bottom: 0; }
.gm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: var(--space-4); margin-top: var(--space-4); }
.gm-card { display: flex; gap: var(--space-4); align-items: flex-start; padding: var(--space-4); text-decoration: none; color: var(--text);
  background: var(--surface-raised); border: 1px solid var(--rule); border-left: 6px solid var(--gm, var(--rule-strong)); transition: transform var(--dur-1, 120ms) ease-out, box-shadow var(--dur-1, 120ms) ease-out; }
.gm-card:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--gm, var(--rule-strong)); }
.gm-card:focus-visible { outline: var(--focus-ring); outline-offset: 3px; }
.gm-mark { flex: none; display: grid; place-items: center; width: 64px; height: 64px; background: color-mix(in srgb, var(--gm, var(--text)) 14%, transparent); color: var(--gm, var(--text)); }
.gm-icon { width: 40px; height: 40px; }
.gm-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.gm-name { font-family: var(--font-serif); font-weight: var(--weight-display); font-size: var(--step-2); line-height: 1.15; }
.gm-pitch { color: var(--text-secondary); font-size: var(--step--1); line-height: 1.45; }
.gm-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.gm-tags > span { font-family: var(--font-mono); font-size: var(--step--2); letter-spacing: .03em; padding: 2px 8px; border: 1px solid var(--rule); color: var(--text-muted); }
.gm-tags .game-mine { border-color: var(--gm, var(--rule)); color: var(--text); }
.gm-notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: var(--space-6); border-top: 2px solid var(--rule-strong); padding-top: var(--space-4); }
.gm-notes h2 { font-size: var(--step-2); margin: 0 0 var(--space-2); }
.gm-notes p { color: var(--text-secondary); margin: 0; max-width: 60ch; }
@media (max-width: 720px) {
  .gm-feature { flex-direction: column-reverse; align-items: flex-start; gap: var(--space-3); box-shadow: 4px 4px 0 var(--accent); }
  .gm-mark { width: 52px; height: 52px; }
  .gm-icon { width: 32px; height: 32px; }
}
@media (prefers-reduced-motion: reduce) { .gm-card { transition: none; } .gm-card:hover { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .game *, .game *::before, .game *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
@media (max-width: 720px) {
  .game { margin-top: var(--space-5); }
  .game-btns .game-btn { flex: 1 1 auto; }
}
.game-shared { min-height: 1.5em; color: var(--text-secondary); margin: var(--space-2) 0 0; }
.game-h { font-size: var(--step-3); margin: 0 0 var(--space-3); }
.game-h:focus { outline: none; }
.game-note { color: var(--text-secondary); max-width: 62ch; }
.game-label { font-family: var(--font-mono); font-size: var(--step--2); letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 var(--space-2); }
.game-panel { border: 1px solid var(--rule-strong); background: var(--surface-raised); padding: var(--space-5); }
.game-input { font: inherit; font-size: var(--step-0); min-height: 2.75rem; padding: 0 var(--space-3); border: 1px solid var(--border-control); background: var(--surface-raised); color: var(--text); border-radius: 0; width: 100%; max-width: 30rem; }
.game-input:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.game-draft { border-left: 4px solid var(--warning); background: var(--warning-tint); color: var(--text); padding: var(--space-3) var(--space-4); margin: 0 0 var(--space-5); }
@media (max-width: 720px) { .game-panel { padding: var(--space-4); } }

/* The games row at the top of the More page: Build a Budget across two thirds, one other game (picked at random) in the last third */
.gm-row { display: grid; grid-template-columns: 2fr 1fr; gap: var(--space-4); margin-top: var(--space-4); align-items: stretch; }
.gm-row .gm-feature { margin: 0; }
.gm-one { display: flex; }
.gm-one .gm-card { flex: 1; flex-direction: column; }
.gm-one .gm-card[hidden] { display: none; }
@media (max-width: 860px) { .gm-row { grid-template-columns: 1fr; } }
