.game-screen {
  display: flex; flex-direction: column; gap: var(--space);
  padding: var(--space);
}
.game-hud {
  display: flex; gap: var(--space); align-items: center; flex-wrap: wrap;
  padding: var(--space); background: var(--bg-2); border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.game-hud .hud-block { display: flex; flex-direction: column; min-width: 80px; }
.game-hud .hud-block .hud-label { font-size: 0.8em; color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.game-hud .hud-block .hud-value { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 1.3em; }
.game-hud .spacer { flex: 1; }
.game-hud .hud-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.game-board-wrap {
  display: flex; justify-content: center;
  padding: calc(var(--space) * 1.5);
  border-radius: 18px;
  background: radial-gradient(120% 90% at 50% 28%, #2e4d78 0%, #1d2f4a 55%, #152238 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), inset 0 0 60px rgba(0,0,0,0.35);
}
.game-footer { display: flex; justify-content: space-between; gap: var(--space); flex-wrap: wrap; }
.game-footer .tip { color: var(--fg-dim); font-size: 0.85em; }

/* First-game coach line for the card games: one plain sentence, dismissed
   on the first successful move or draw. */
.move-hint {
  text-align: center;
  color: var(--fg-dim);
  font-size: 1.05em;
  padding: 2px 8px;
}

/* Handheld: let the HUD pack tight instead of forcing wide blocks. */
@media (max-width: 700px) {
  .game-screen { padding: 6px; }
  .game-hud { row-gap: 6px; }
  .game-hud .hud-block { min-width: 0; margin-right: 6px; }
  .game-hud .hud-value { font-size: 1.1em; }
  .game-board-wrap { padding: 4px; margin: 0 -8px; }
}

/* Landscape phones: single-row compact HUD; board goes full-bleed. */
@media (max-height: 500px) {
  .game-hud { padding: 6px 8px; gap: 8px; flex-wrap: nowrap; }
  .game-hud .hud-block { min-width: 0; }
  .game-hud .hud-value { font-size: 1em; }
  .game-board-wrap { padding: 4px; margin: 0 -6px; }
  /* The coach line yields its height to the cards on short screens;
     players meet it in portrait first. */
  .move-hint { display: none; }
}

/* ---- Face v2 (Nov 16, 2026): match moment, focus dim, coach, win, map ---- */

/* Focus dim: while a card is face-up the rest of the board greys back. */
.joy__grid.has-faceup .joy__card:not(.is-up):not(.is-matched) {
  opacity: 0.38;
  filter: saturate(0.55) brightness(0.8);
}

/* The match moment: lift, tilt, grow, then settle. The base transform keeps
   the rotateY(180deg) of the face-up state throughout. */
.joy__card.is-celebrating {
  z-index: 3;
  animation: joyCelebrate 0.8s cubic-bezier(0.3, 0.6, 0.35, 1);
}
@keyframes joyCelebrate {
  0% { transform: rotateY(180deg) scale(1) translateY(0) rotate(0deg); }
  30% { transform: rotateY(180deg) scale(1.16) translateY(-9px) rotate(-2.2deg); }
  58% { transform: rotateY(180deg) scale(1.1) translateY(-5px) rotate(1.8deg); }
  100% { transform: rotateY(180deg) scale(1) translateY(0) rotate(0deg); }
}
.joy__burst {
  position: absolute; inset: -62%;
  z-index: 4; pointer-events: none;
  animation: joyBurst 0.95s ease-out forwards;
}
.joy__burst svg { width: 100%; height: 100%; display: block; }
@keyframes joyBurst {
  0% { transform: scale(0.3) rotate(0deg); opacity: 0.95; }
  100% { transform: scale(1.3) rotate(28deg); opacity: 0; }
}

/* Coach: pulsing gold ring on the suggested card, speech bubble below. */
.joy__card.coach-ring { animation: coachPulse 1.1s ease-in-out infinite; }
@keyframes coachPulse {
  0% { box-shadow: 0 0 0 3px rgba(245,197,66,0.9), 0 6px 14px rgba(0,0,0,0.42); }
  50% { box-shadow: 0 0 0 9px rgba(245,197,66,0.25), 0 6px 14px rgba(0,0,0,0.42); }
  100% { box-shadow: 0 0 0 3px rgba(245,197,66,0.9), 0 6px 14px rgba(0,0,0,0.42); }
}
.coach-bubble {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 900;
  width: min(620px, 92vw);
  margin: 0;
  background: linear-gradient(180deg, #fffdf6, #f3e9d2);
  color: #1c2733;
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 1.08em;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
  animation: coachIn 0.3s ease-out;
}
.coach-bubble::before {
  content: "";
  position: absolute; top: -9px; left: 50%;
  margin-left: -9px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 10px solid #fffdf6;
}
@keyframes coachIn {
  from { transform: translateX(-50%) translateY(8px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* Win celebration */
.coins-earned { font-weight: 700; color: var(--focus); font-size: 1.15em; }
.confetti {
  position: absolute; inset: 0;
  overflow: hidden; pointer-events: none; z-index: 5;
}
.confetti-piece {
  position: absolute; top: -16px;
  width: 9px; height: 14px; border-radius: 2px;
  animation-name: confettiFall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
@keyframes confettiFall {
  to { transform: translateY(108vh) rotate(680deg); }
}

/* Journey map */
.journey-hero {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: var(--space);
  box-shadow: 0 10px 24px rgba(0,0,0,0.4);
}
.journey-hero img { width: 100%; height: 180px; object-fit: cover; display: block; }
.journey-hero__title {
  position: absolute; left: 20px; bottom: 14px;
  font-size: 1.7em; font-weight: 800; color: #fff;
  text-shadow: 0 2px 10px rgba(0,0,0,0.65);
}
.journey-hero__stars {
  position: absolute; right: 20px; bottom: 16px;
  background: rgba(8,12,22,0.72);
  color: #f5c542; font-weight: 700;
  padding: 6px 14px; border-radius: 999px;
}
.journey-path {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 14px;
  margin-bottom: var(--space);
}
.level-node {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 6px;
  border-radius: 16px;
  background: var(--bg-2);
  border: 2px solid rgba(255,255,255,0.08);
  color: var(--fg);
  cursor: pointer;
  font: inherit;
}
.level-node .node-num { font-size: 1.5em; font-weight: 800; }
.level-node .node-stars { color: var(--focus); letter-spacing: 0.12em; min-height: 1.1em; font-size: 0.95em; }
.level-node.is-done { border-color: rgba(245,197,66,0.5); }
.level-node.is-current {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(245,197,66,0.3), 0 0 18px rgba(245,197,66,0.22);
}
.level-node.is-locked { opacity: 0.45; cursor: default; }

  /* FLUX-ART-2026-11-17: full-area card table felt — painted on the wrap,
   which encloses the whole play area including fanned columns. */
  .game-board-wrap { background-image: linear-gradient(rgba(4,26,17,0.45), rgba(4,26,17,0.45)), url("../img/bg-card-felt.jpg"); background-size: cover; background-position: center; }
