/* ════════════════════════════════════════════════════════════════
   GAME SHELL · shared immersive chrome for all Schulcast games
   ════════════════════════════════════════════════════════════════
   One viewport-locked "app shell" (NYT-style) shared by Schubladen,
   Sinnsuche and Quiz: a slim header bar with every control, a centred
   stage that never makes the *page* scroll, and the how-to / archive
   modals. Generic .game-* classes; each game keeps its own board CSS.

   Loaded as a normal (render-blocking) <link> in each game page head
   so the lock applies before first paint — no scroll flash, no FOUC.
   Network-first in the service worker (see sw.js), so edits ship
   without a CACHE_VERSION bump.
   ════════════════════════════════════════════════════════════════ */

/* ── Viewport-locked shell — the page itself never scrolls ──────── */
html, body { height: 100%; }
body.is-game { margin: 0; overflow: hidden; overscroll-behavior: none; }
.game-shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* ── Slim header bar — every control lives here ─────────────────── */
.game-bar {
  flex: 0 0 auto;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 8px; padding: 9px clamp(12px, 3vw, 28px); min-height: 54px;
  border-bottom: 1px solid var(--color-border, rgba(127,127,127,0.18));
  background: var(--color-bg-main);
}
.game-bar__home {
  justify-self: start; display: inline-flex; align-items: center; gap: 6px;
  color: var(--color-text-secondary); text-decoration: none;
  font-family: 'Syne', sans-serif; font-weight: 700; font-size: 12px; letter-spacing: 0.04em;
}
.game-bar__home:hover { color: var(--color-accent); }
.game-bar__center { justify-self: center; display: flex; flex-direction: column; align-items: center; line-height: 1.05; min-width: 0; }
.game-bar__name { font-family: 'Syne', sans-serif; font-weight: 800; font-size: clamp(15px, 2.4vw, 19px); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-primary); white-space: nowrap; }
.game-bar__day { font-family: 'Fraunces', Georgia, serif; font-style: italic; font-size: 11px; color: var(--color-text-secondary); }
.game-bar__day:empty { display: none; }
.game-bar__tools { justify-self: end; display: inline-flex; align-items: center; gap: 4px; }
.game-bar__icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border: none; background: transparent;
  color: var(--color-text-primary); border-radius: 10px; cursor: pointer; text-decoration: none;
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 12px; letter-spacing: 0.06em;
}
.game-bar__icon:hover { background: var(--color-bg-card); color: var(--color-accent); }
@media (max-width: 480px) {
  .game-bar { gap: 4px; padding: 8px 10px; }
  .game-bar__home-text { display: none; }
  .game-bar__icon { width: 34px; height: 34px; }
  .game-bar__name { font-size: 15px; letter-spacing: 0.02em; }
}

/* ── Stage — centres the content; `safe center` falls back to top
   alignment (instead of clipping) when content is taller than the
   stage, and overflow-y lets that rare tall content scroll *inside*
   the stage while the page stays locked. ──────────────────────── */
.game-stage {
  flex: 1 1 auto; display: flex; flex-direction: column;
  align-items: center; justify-content: center; justify-content: safe center;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: clamp(8px, 2vh, 22px) clamp(12px, 3vw, 24px);
}

/* ── Modals (how-to + archive) ──────────────────────────────────── */
.game-modal { position: fixed; inset: 0; z-index: 1200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.game-modal[hidden] { display: none; }
.game-modal__backdrop { position: absolute; inset: 0; background: rgba(15, 16, 11, 0.62); backdrop-filter: blur(3px); animation: game-modal-fade 0.18s ease; }
.game-modal__panel {
  position: relative; z-index: 1; width: 100%; max-width: 460px;
  max-height: min(86dvh, 86vh); overflow-y: auto;
  background: var(--color-bg-card); color: var(--color-text-primary);
  border: 1.5px solid var(--color-border-strong); border-radius: 18px;
  padding: clamp(22px, 4vw, 32px); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  animation: game-modal-rise 0.22s cubic-bezier(.2,.9,.3,1);
}
[data-theme="light"] .game-modal__panel { box-shadow: 6px 6px 0 var(--color-border-strong); }
@keyframes game-modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes game-modal-rise { from { transform: translateY(14px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .game-modal__backdrop, .game-modal__panel { animation: none; } }
.game-modal__close {
  position: absolute; top: 12px; right: 14px; width: 36px; height: 36px;
  border: none; background: transparent; color: var(--color-text-secondary);
  font-size: 26px; line-height: 1; cursor: pointer; border-radius: 9px;
}
.game-modal__close:hover { background: var(--color-bg-main); color: var(--color-accent); }
.game-modal__title { font-family: 'Fraunces', Georgia, serif; font-style: italic; font-weight: 600; font-size: clamp(22px, 3.4vw, 28px); margin: 4px 0 16px; }
.game-modal .label { font-family: 'Syne', sans-serif; font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--color-accent); }

/* How-to steps inside a modal. */
.game-howto-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.game-howto-list li { display: flex; gap: 14px; align-items: flex-start; }
.game-howto-step {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 14px;
  background: var(--fynbos-bistre, #767B39); color: var(--bento-on-brand-cream, #F4EFE2);
}
.game-howto-list h3 { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 15px; margin: 4px 0 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.game-howto-list p { font-size: 14px; line-height: 1.45; color: var(--color-text-secondary); margin: 0; }
.game-howto-byline { margin: 18px 0 0; font-family: 'Fraunces', Georgia, serif; font-style: italic; font-size: 13px; color: var(--color-text-secondary); line-height: 1.45; }
