/* ============================================================
   GAMESTACK.FUN — /play/ game page chrome
   Shared frame, HUD, controls and modal styling for playable
   games. Built on the design tokens from style.css so any new
   game page can reuse these classes.
   ============================================================ */

/* ---- Breadcrumb ---- */
.game-crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.game-crumb a { color: var(--muted); }
.game-crumb a:hover { color: var(--purple); }
.game-crumb span.sep { opacity: 0.5; }
.game-crumb span.current { color: var(--ink-soft); }

/* ---- Header row above the game frame ---- */
.game-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.game-page-head h1 { font-size: clamp(24px, 3vw, 32px); }
.game-tags { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.game-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--lavender);
  color: var(--purple);
  font-size: 11.5px;
  font-weight: 800;
  padding: 5px 11px;
  border-radius: 999px;
}
.game-tag.tone-mint { background: var(--mint); color: #0e5636; }
.game-tag.tone-butter { background: var(--butter); color: #6b4e05; }

/* ---- The game frame itself ---- */
.game-frame {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px;
  margin-bottom: 30px;
}

.game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.game-hud-group { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.game-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink-soft);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
}
.game-stat .val { color: var(--purple); font-weight: 800; }
.game-stat.lives .val { color: var(--pink); }
.game-stat.words .val { color: var(--mint-deep); }

.game-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 440px;
  aspect-ratio: 3 / 4.2;
  margin: 0 auto;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #232338;
  touch-action: none;
  box-shadow: inset 0 0 0 1px rgba(20,21,43,0.06);
}
#wr-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---- Overlays (start / paused-for-word / game over) ---- */
.game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: linear-gradient(180deg, rgba(20,21,43,0.72), rgba(20,21,43,0.85));
  backdrop-filter: blur(2px);
  text-align: center;
}
.game-overlay[hidden] { display: none; }

.overlay-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 26px 22px;
  max-width: 320px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0,0,0,0.35);
}
.overlay-card .oc-icon { font-size: 38px; line-height: 1; margin-bottom: 6px; }
.overlay-card h2 { font-size: 21px; margin-bottom: 8px; }
.overlay-card p { color: var(--muted); font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.overlay-card .btn { margin-top: 16px; width: 100%; }

/* ---- Word-learned card (the "every 100 points" moment) ---- */
.word-card .wc-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-gradient);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.word-card .wc-word {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  color: var(--ink);
}
.word-card .wc-phonetic {
  font-size: 13px;
  color: var(--purple);
  font-weight: 700;
  margin-bottom: 2px;
}
.word-card .wc-pos {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 9px;
  border-radius: 999px;
  margin: 8px 0 12px;
}
.word-card .wc-def { font-size: 14.5px; color: var(--ink-soft); font-weight: 600; margin-bottom: 10px; }
.word-card .wc-example {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border-left: 3px solid var(--purple);
  text-align: left;
}

/* ---- Game over specifics ---- */
.overlay-card .oc-score { font-family: var(--font-display); font-size: 40px; font-weight: 800; color: var(--purple); margin: 4px 0; }
.oc-best { font-size: 12.5px; font-weight: 800; color: var(--muted); margin-bottom: 10px; }
.oc-best .star { color: var(--yellow); }
.oc-words-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 10px 0 4px;
}
.oc-words-list .chip {
  font-size: 11.5px;
  font-weight: 800;
  background: var(--lavender);
  color: var(--purple);
  padding: 4px 10px;
  border-radius: 999px;
}
.overlay-card .btn-row { display: flex; gap: 10px; }
.overlay-card .btn-row .btn { flex: 1; margin-top: 0; }

/* ---- Touch / on-screen controls ---- */
.game-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin-top: 16px;
}
.wr-ctrl-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease, background 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.wr-ctrl-btn:active { transform: scale(0.92); background: var(--lavender); border-color: var(--purple); color: var(--purple); }
.game-controls-hint {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  margin-top: 10px;
}

/* ---- Static crawlable content below the game ---- */
.game-info-block { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-bottom: 10px; }
.game-info-block h2 { font-size: 22px; margin-bottom: 12px; }
.game-info-block p { color: var(--ink-soft); margin-bottom: 12px; }

.word-sample-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 6px;
}
.word-sample {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.word-sample .ws-word { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--ink); }
.word-sample .ws-def { font-size: 12px; color: var(--muted); font-weight: 600; }

.faq-list { display: flex; flex-direction: column; gap: 14px; }
.faq-item h4 { font-size: 15px; margin-bottom: 4px; }
.faq-item p { font-size: 13.5px; color: var(--muted); }

@media (max-width: 840px) {
  .game-info-block { grid-template-columns: 1fr; gap: 24px; }
  .word-sample-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .word-sample-grid { grid-template-columns: 1fr 1fr; }
  .wr-ctrl-btn { width: 52px; height: 52px; }
}