/* =============================================
   SPILLVERKSTED — Shared game chrome
   Loaded alongside styles.css on game pages, so every game
   inherits the portal's palette, fonts and light/dark theme.
   ============================================= */

:root {
  /* Canvas-facing colours, read from JS via game-ui.js */
  --board-bg: #FAF2E7;
  --board-bg-alt: #F0E4D4;
  --board-line: #DFD1BF;
  --board-ink: #3B3330;
  --board-ink-soft: #8C7F76;
}

[data-theme="dark"] {
  --board-bg: #141A24;
  --board-bg-alt: #1C2431;
  --board-line: #2A3342;
  --board-ink: #E4E2DE;
  --board-ink-soft: #8A8078;
}

body.game-page {
  align-items: stretch;
  overflow-x: hidden;
}

/* --- Top bar --- */

/* help.js and fullscreen.js pin their buttons to the top right, so keep that
   corner of the bar clear for them. */
.game-page .top-bar {
  justify-content: space-between;
  padding-right: 108px;
}

.game-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem 0.4rem 0.7rem;
  border-radius: 100px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  color: var(--text-body);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.game-back:hover {
  color: var(--terracotta);
  border-color: var(--terracotta-light);
  transform: translateX(-2px);
}

.game-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin: 0;
  text-align: center;
  flex: 1;
}

.game-page .top-bar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --- Page layout --- */

.game-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 1rem 2rem;
  width: 100%;
}

/* --- Stat pills --- */

.game-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}

.stat-pill {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.4rem 1rem;
  border-radius: 100px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.stat-pill .label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-pill .value {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.stat-pill.accent .value { color: var(--terracotta); }
.stat-pill.good .value { color: var(--sage); }
.stat-pill.gold .value { color: var(--warm-gold); }

/* --- The playing surface --- */

.game-stage {
  position: relative;
  display: inline-block;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1.5px solid var(--border-soft);
  box-shadow: var(--shadow-lg);
  max-width: 100%;
}

.game-stage canvas {
  display: block;
  border-radius: var(--radius-md);
  background: var(--board-bg);
  max-width: 100%;
  height: auto;
  touch-action: none;
}

/* --- Buttons --- */

.g-btn {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.7rem 1.6rem;
  border-radius: 100px;
  border: none;
  cursor: pointer;
  background: var(--terracotta);
  color: #fff;
  box-shadow: var(--shadow-md);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.g-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}

.g-btn:active { transform: translateY(0); }

.g-btn.ghost {
  background: var(--bg-card);
  color: var(--text-body);
  border: 1.5px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}

.g-btn.ghost:hover { color: var(--terracotta); border-color: var(--terracotta-light); }

.g-btn.sage { background: var(--sage); }

/* Small segmented choices — difficulty, table pickers, colours */

.g-choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
}

.g-choice {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border-radius: 100px;
  border: 1.5px solid var(--border-soft);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.g-choice:hover { color: var(--text-primary); border-color: var(--terracotta-light); }

.g-choice.active {
  background: var(--terracotta);
  border-color: var(--terracotta);
  color: #fff;
}

/* --- Overlays --- */

.game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 1.5rem;
  text-align: center;
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--bg-card) 78%, transparent);
  backdrop-filter: blur(3px);
  z-index: 10;
}

.game-overlay.hidden { display: none; }

.game-overlay h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
}

.game-overlay p {
  font-size: 1rem;
  color: var(--text-body);
  max-width: 34ch;
  line-height: 1.55;
}

.game-overlay .big-score {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--warm-gold);
  line-height: 1;
}

/* --- Footer hint --- */

.game-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 46ch;
  line-height: 1.5;
}

/* --- Cards & tiles used by the non-canvas games --- */

.tile {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1.5px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-primary);
}

@media (max-width: 600px) {
  .game-title { font-size: 1.2rem; }
  .game-main { padding: 0.8rem 0.6rem 1.5rem; }
  .game-stage { padding: 8px; border-radius: var(--radius-md); }
  .stat-pill { padding: 0.3rem 0.7rem; }
  .stat-pill .label { font-size: 0.7rem; }
  .stat-pill .value { font-size: 1rem; }
  .game-overlay h2 { font-size: 1.5rem; }
}
