/* Learn & Play (ADR 0108): the /play hub, the game tiles and the stage every
   game page plays in. Colors come from site.css and dark.css variables only,
   so the light, dark and night themes need no companion file. Game pages link
   this file and add their own. */

/* ---- The hub ------------------------------------------------------------ */
.play-hub { --play-tint: var(--nav-tint-learning); }
.play-intro { margin-bottom: 8px; }
.play-kicker { margin: 0 0 4px; font-size: 0.8rem; font-weight: 650; letter-spacing: 0.12em; text-transform: uppercase; }
.play-kicker a { color: var(--play-tint); text-decoration: none; }
.play-lede { max-width: 62ch; color: var(--muted); }
.play-hub h2 { margin: 28px 0 10px; font-size: 1.15rem; }
.play-today {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--accent-sun-soft), var(--surface));
}
.play-today h2 { margin-top: 0; margin-bottom: 2px; }
.play-today-note { margin: 0 0 12px; color: var(--muted); font-size: 0.9rem; }
.play-today-strip,
.play-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.play-learn { margin-top: 28px; }
.play-learn a { color: var(--accent-moon); font-weight: 600; text-decoration: none; }

/* ---- A game's tile ------------------------------------------------------ */
.game-tile {
  display: grid;
  grid-template-columns: 44px 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 12px;
  row-gap: 2px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, transform 0.15s;
}
.game-tile:hover, .game-tile:focus-visible { border-color: var(--play-tint, var(--accent-moon)); transform: translateY(-1px); }
.game-tile .game-icon { grid-row: 1 / span 3; width: 44px; height: 44px; }
.game-tile strong { font-size: 1.02rem; }
.game-tile-blurb { color: var(--muted); font-size: 0.9rem; line-height: 1.35; }
.game-tile-stat { color: var(--play-tint, var(--accent-sun)); font-size: 0.85rem; font-weight: 650; }
.game-tile.is-done { border-color: var(--play-tint, var(--accent-sun)); }
@media (prefers-reduced-motion: reduce) { .game-tile { transition: none; } .game-tile:hover { transform: none; } }

/* ---- The stage a game plays in (web/src/play/stage.ts) ------------------ */
.game-stage { position: relative; }
.game-stage-bar { display: none; }
.game-stage-start { display: none; }
@media (max-width: 799px) {
  /* With script, a phone shows the Play button and keeps the game for the full screen. */
  .game-stage.is-ready:not(.is-full) > .game-stage-start {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 16px;
    padding: 12px 26px;
    border: 0;
    border-radius: 999px;
    background: var(--accent-sun);
    color: #1d1f24;
    font: inherit;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
  }
  .game-stage-start svg { width: 18px; height: 18px; fill: currentColor; }
  .game-stage.is-ready:not(.is-full) > .game-stage-body { display: none; }
}
.game-stage.is-full {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.game-stage.is-full > .game-stage-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-height: 48px;
  padding: 4px 6px 4px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--masthead);
}
.game-stage-title { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-stage-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.game-stage-close:hover, .game-stage-close:focus-visible { background: var(--accent-moon-soft); }
.game-stage-close svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.game-stage.is-full > .game-stage-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 12px; }
/* While a game is open full screen, the page under it does not scroll and its bars are hidden. */
html.game-open, html.game-open body { overflow: hidden; }
html.game-open .site-header,
html.game-open .circumstances,
html.game-open .site-footer { visibility: hidden; }

/* ---- Results and sharing ------------------------------------------------ */
.game-share-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.game-share-button:hover, .game-share-button:focus-visible { border-color: var(--accent-moon); }
.game-stars { color: var(--accent-sun); letter-spacing: 0.08em; }
