/* Shared frame for the website games (games/<slug>/): card, score and hearts, the speaker's
   speech bubble, the 600 x 760 board panel and its overlay. Loaded after styles.css. */
.game-page { padding: 32px 0 64px; }
.game-head { margin-bottom: 20px; }

/* The card is as wide as the board, which is sized so the whole game fits the window. */
.game {
  --board-w: 100%;
  width: min(100%, 550px, calc((100svh - 300px) * 600 / 760 + 30px));
  margin: 0 auto; padding: 14px;
}
@media (max-width: 520px) { .game { width: 100%; padding: 10px; } }

.game__hud { display: flex; align-items: center; gap: 18px; margin: 0 4px 10px; }
.game__stat { margin: 0; font: 600 1rem/1 var(--heading); color: var(--muted); }
.game__stat strong { color: var(--ink); font-size: 1.35rem; margin-left: 4px; }
.game__hearts { margin: 0 0 0 auto; display: flex; gap: 4px; }
.game__hearts svg { width: 28px; height: 26px; }

/* Speaker + speech bubble, like a strip's dialogue */
/* A fixed height, so a longer line never pushes the board down; game.js shrinks the text
   to fit instead (see fitBubble). */
.game__talk { display: flex; align-items: flex-end; gap: 10px; height: 112px; margin-bottom: 10px; width: var(--board-w); }
.game__speaker { width: 92px; height: 92px; object-fit: contain; object-position: bottom; flex: none; }
.game__bubble {
  position: relative; flex: 1; margin: 0 0 18px; padding: 10px 14px;
  background: #fff; border: var(--outline); border-radius: 18px;
  font: 400 1.15rem/1.15 var(--comic); letter-spacing: .03em; text-transform: uppercase; color: var(--ink);
  height: calc(100% - 18px); display: flex; align-items: center; /* no overflow clip: the tail sits outside */
}
/* tail: a white square turned 45°, outlined on its two outer sides, covering the bubble's border where they meet */
.game__bubble::before {
  content: ''; position: absolute; left: -10px; bottom: 16px; width: 16px; height: 16px;
  background: #fff; border-left: 3px solid var(--ink); border-bottom: 3px solid var(--ink);
  transform: rotate(45deg);
}

/* The board is a comic panel: 600 x 760 board units, scaled to fit */
.board {
  position: relative; width: var(--board-w); aspect-ratio: 600 / 760;
  border: 5px solid var(--ink); border-radius: 12px; overflow: hidden;
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer;
  background: #e6f4fd;
}
.board img { position: absolute; pointer-events: none; -webkit-user-drag: none; }
.board__bg { inset: 0; width: 100%; height: 100%; }
.board__fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.board__overlay {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 16px;
  background: rgb(21 61 70 / .35); cursor: default;
}
.board__overlay[hidden] { display: none; }
.board__panel {
  background: var(--card); border: var(--outline); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 18px; max-width: 360px; text-align: center; font-size: 1rem;
}
.board__title { font: 400 2rem/1 var(--comic); letter-spacing: .04em; color: var(--accent); margin-bottom: .4em; }
.board__keys { font-size: .9rem; color: var(--muted); }
/* How-to-play text: touch controls on touch screens, mouse and keys everywhere else */
.only-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .only-touch { display: inline; }
  .only-pointer { display: none; }
}
kbd { font: 700 .85em var(--body); border: 2px solid var(--ink); border-bottom-width: 3px; border-radius: 6px; padding: 0 .35em; background: #fff; color: var(--ink); }

.game-more { text-align: center; color: var(--muted); margin-top: 24px; }
.game-more--links { margin-top: 8px; font-weight: 700; }

/* the overlay (start, pause, game over) fades in and its panel settles; none with reduced motion */
@media (prefers-reduced-motion: no-preference) {
  .board__overlay:not([hidden]) { animation: game-fade .22s ease both; }
  .board__overlay:not([hidden]) .board__panel { animation: game-panel .28s ease both; }
}
@keyframes game-fade { from { opacity: 0; } }
@keyframes game-panel { from { opacity: 0; scale: .96; } }

