/* ============================================================
   GAMES.CSS
   Shared shell used by every game module, plus each game's own
   scoped styles. Keep every game's rules nested under its own
   wrapper class (e.g. .game-2048-wrap) so games never bleed
   into each other or into the main site theme.
   ============================================================ */

/* ---------- SHARED GAME SHELL ---------- */
.game-view{padding:44px 0 80px;}
.game-header{text-align:center;max-width:480px;margin:0 auto 26px;}
.game-header .back-button{
  display:inline-flex;align-items:center;gap:6px;
  font-size:14px;font-weight:700;text-decoration:none;color:var(--ink-soft);
  margin-bottom:18px;transition:transform .2s var(--ease-bounce), color .2s;
}
.game-header .back-button:hover{color:var(--ink);transform:translateX(-3px);}
.game-header h1{font-size:clamp(26px,4vw,32px);}
.game-header p{color:var(--ink-soft);font-size:15px;margin-top:8px;}

.game-loading, .game-not-found, .game-error, .game-coming-soon{
  max-width:480px;margin:60px auto;text-align:center;
  background:var(--white);border-radius:var(--radius-lg);
  padding:40px 30px;box-shadow:var(--shadow-sm);
}
.game-loading{color:var(--ink-soft);font-weight:600;}
.game-not-found h1, .game-error h1, .game-coming-soon h1{font-size:22px;margin-bottom:10px;}
.game-not-found p, .game-error p, .game-coming-soon p{color:var(--ink-soft);font-size:14.5px;line-height:1.6;margin-bottom:18px;}
.game-coming-soon .icon{font-size:40px;margin-bottom:12px;}

/* ============================================================
   GAME: Bubble Pop
   Scoped to .game-bubble-pop-wrap. Ported from the standalone
   "Bubble Break" file — background music removed (Break Dulu's
   own persistent music player already covers that); only the
   pop.mp3 sound effect is kept, playing on each bubble pop.
   Structure/logic lives in assets/js/games/bubble-pop.js
   ============================================================ */
.game-bubble-pop-wrap{
  --bp-cream:#FFF9F3;
  --bp-pink:#F8DCE5;
  --bp-peach:#F9D7C3;
  --bp-blue:#DCECF7;
  --bp-lavender:#E7DDF5;
  --bp-mint:#DDEFE6;
  --bp-yellow:#F7E9B8;
  --bp-ink:#6a5a72;
  --bp-ink-soft:#8b7d92;
  --bp-white:#ffffff;
  --bp-room-w: min(94vw, 460px);
  --bp-room-h: min(70vh, 640px);

  font-family:'Nunito', sans-serif;
  color:var(--bp-ink);
}

.game-bubble-pop-wrap *{ box-sizing:border-box; -webkit-tap-highlight-color: transparent; }

.game-bubble-pop-wrap #stage{
  position:relative;
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  touch-action: manipulation;
}

.game-bubble-pop-wrap #room{
  position:relative;
  width:var(--bp-room-w); height:var(--bp-room-h);
  max-width:520px; max-height:720px;
  border-radius:32px;
  overflow:hidden;
  box-shadow: 0 30px 60px -20px rgba(120,90,120,0.35), 0 0 0 1px rgba(255,255,255,0.4) inset;
  background: var(--bp-cream);
}

.game-bubble-pop-wrap #scene{ position:absolute; inset:0; z-index:1; }
.game-bubble-pop-wrap #scene svg{ width:100%; height:100%; display:block; }

.game-bubble-pop-wrap #bpContrastWash{
  position:absolute; inset:0; z-index:1; pointer-events:none;
  /* dusty lavender-to-teal wash — deepens the pale bathroom scene behind
     it so the translucent bubbles floating above it have real contrast
     to pop against, instead of pale-on-pale */
  background:
    linear-gradient(165deg,
      rgba(80,66,112,0.34) 0%,
      rgba(60,80,112,0.30) 45%,
      rgba(42,84,88,0.34) 100%);
}

.game-bubble-pop-wrap .bp-breathe{ animation: bp-breathe 6s ease-in-out infinite; }
@keyframes bp-breathe{ 0%,100%{ opacity:0.55; } 50%{ opacity:0.9; } }

.game-bubble-pop-wrap .bp-sway{ transform-origin: 50% 100%; animation: bp-sway 5s ease-in-out infinite; }
@keyframes bp-sway{ 0%,100%{ transform: rotate(-1.2deg); } 50%{ transform: rotate(1.4deg); } }

.game-bubble-pop-wrap .bp-steam-drift{ animation: bp-steamdrift 7s ease-in-out infinite; }
@keyframes bp-steamdrift{
  0%{ transform: translateY(0) scale(1); opacity:0; }
  20%{ opacity:0.5; }
  80%{ opacity:0.15; }
  100%{ transform: translateY(-46px) scale(1.3); opacity:0; }
}

.game-bubble-pop-wrap #bubbleLayerBack{ position:absolute; inset:0; z-index:2; pointer-events:none; }
.game-bubble-pop-wrap #bubbleLayerMain{ position:absolute; inset:0; z-index:3; }
.game-bubble-pop-wrap #particleLayer{ position:absolute; inset:0; z-index:4; pointer-events:none; }

.game-bubble-pop-wrap .bubble{
  position:absolute;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer;
  will-change: transform, opacity;
  transform: translate(-50%,-50%);
  /* soft dark shadow behind each bubble — makes it pop against whatever
     is behind it (background scene, other bubbles) regardless of exact
     background tone, since a translucent bubble alone has little
     inherent contrast on its own */
  filter: drop-shadow(0 3px 8px rgba(30,26,42,0.35));
}
.game-bubble-pop-wrap .bubble.back{ filter: drop-shadow(0 2px 5px rgba(30,26,42,0.22)); }
.game-bubble-pop-wrap .bubble svg{ width:100%; height:100%; display:block; overflow:visible; }
.game-bubble-pop-wrap .bubble.back{ pointer-events:none; }
.game-bubble-pop-wrap .bubble .hit{ position:absolute; inset:-14px; }
.game-bubble-pop-wrap .bubble.popping{ pointer-events:none; }

@keyframes bp-popAnim{
  0%   { transform: translate(-50%,-50%) scale(1); opacity:1; }
  35%  { transform: translate(-50%,-50%) scale(0.90); opacity:1; }
  65%  { transform: translate(-50%,-50%) scale(1.18); opacity:0.85; }
  100% { transform: translate(-50%,-50%) scale(0.05); opacity:0; }
}
.game-bubble-pop-wrap .bubble.popping{ animation: bp-popAnim 380ms ease-out forwards; }

@keyframes bp-heartPopAnim{
  0%   { transform: translate(-50%,-50%) scale(1); opacity:1; }
  25%  { transform: translate(-50%,-50%) scale(1.12); opacity:1; }
  45%  { transform: translate(-50%,-50%) scale(0.94); opacity:1; }
  70%  { transform: translate(-50%,-50%) scale(1.3); opacity:0.8; }
  100% { transform: translate(-50%,-50%) scale(0.05); opacity:0; }
}
.game-bubble-pop-wrap .bubble.heart-popping{ animation: bp-heartPopAnim 620ms ease-out forwards; }

.game-bubble-pop-wrap .particle{
  position:absolute;
  pointer-events:none;
  animation: bp-particleFly 620ms ease-out forwards;
}
@keyframes bp-particleFly{
  0%{ transform: translate(-50%,-50%) translate(0,0) scale(1); opacity:1; }
  100%{ transform: translate(-50%,-50%) var(--pt) scale(0.4); opacity:0; }
}

.game-bubble-pop-wrap #uiLayer{ position:absolute; inset:0; z-index:5; pointer-events:none; }
.game-bubble-pop-wrap #uiLayer > *{ pointer-events:auto; }

.game-bubble-pop-wrap .panel{
  position:absolute; inset:0;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  text-align:center;
  padding: 28px;
  transition: opacity 420ms ease, transform 420ms ease;
}
.game-bubble-pop-wrap #uiLayer > .panel.hidden{
  opacity:0; transform: translateY(10px) scale(0.98);
  pointer-events:none;
}

.game-bubble-pop-wrap .card{
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(6px);
  border-radius: 28px;
  padding: 30px 26px;
  box-shadow: 0 18px 40px -18px rgba(120,90,130,0.35);
  max-width: 340px;
}

.game-bubble-pop-wrap .bubble-emoji{
  font-size: 40px;
  display:block;
  margin-bottom: 6px;
  animation: bp-floatIdle 3.4s ease-in-out infinite;
}
@keyframes bp-floatIdle{ 0%,100%{ transform: translateY(0); } 50%{ transform: translateY(-8px); } }

.game-bubble-pop-wrap h1.bp-title{
  font-family:'Quicksand', sans-serif;
  font-weight:700;
  font-size: 30px;
  letter-spacing: 0.5px;
  margin: 4px 0 6px;
  color: #7a5c78;
}

.game-bubble-pop-wrap .bp-subtitle{ font-size: 16px; color: var(--bp-ink-soft); margin: 0 0 4px; }
.game-bubble-pop-wrap .bp-microtext{ font-size: 13.5px; color: var(--bp-ink-soft); margin: 10px 0 14px; line-height:1.5; }

.game-bubble-pop-wrap .bp-mode-row{
  display:flex; gap:8px; justify-content:center; margin-bottom:8px;
}
.game-bubble-pop-wrap .bp-mode-btn{
  font-family:'Quicksand', sans-serif; font-weight:700; font-size:13.5px;
  padding:9px 16px; border-radius:999px; border:none; cursor:pointer;
  background:var(--bp-cream); color:var(--bp-ink-soft);
  box-shadow: inset 0 0 0 1.5px rgba(122,92,120,0.18);
  transition: transform 150ms ease, background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}
.game-bubble-pop-wrap .bp-mode-btn:hover{ transform:translateY(-1px); }
.game-bubble-pop-wrap .bp-mode-btn.active{
  background: linear-gradient(180deg, #f6c9d8, #f2b6cd);
  color:#7a3f57;
  box-shadow: 0 6px 14px -6px rgba(233,150,180,0.6);
}
.game-bubble-pop-wrap .bp-mode-hint{
  font-size:12px; color:var(--bp-ink-soft); margin:0 0 18px; min-height:1.4em;
}

.game-bubble-pop-wrap button{
  font-family:'Quicksand', sans-serif;
  font-weight:700;
  border:none;
  cursor:pointer;
  font-size:16px;
}

.game-bubble-pop-wrap .bp-btn-primary{
  background: linear-gradient(180deg, #f6c9d8, #f2b6cd);
  color:#7a3f57;
  padding: 14px 40px;
  border-radius: 999px;
  box-shadow: 0 10px 22px -8px rgba(233,150,180,0.65);
  letter-spacing: 0.4px;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.game-bubble-pop-wrap .bp-btn-primary:hover{ transform: translateY(-2px); box-shadow: 0 14px 26px -8px rgba(233,150,180,0.7); }
.game-bubble-pop-wrap .bp-btn-primary:active{ transform: translateY(0) scale(0.97); }
.game-bubble-pop-wrap .bp-btn-primary:focus-visible{ outline: 3px solid #b46b8c; outline-offset: 3px; }

.game-bubble-pop-wrap .bp-sound-toggle{
  margin-top: 18px;
  background: none;
  color: var(--bp-ink-soft);
  font-size: 13.5px;
  padding: 6px 12px;
  border-radius: 999px;
  display:inline-flex; align-items:center; gap:6px;
}
.game-bubble-pop-wrap .bp-sound-toggle:focus-visible{ outline: 2px solid #b46b8c; outline-offset:2px; border-radius: 999px; }

.game-bubble-pop-wrap #hud{
  position:absolute; top:0; left:0; right:0;
  display:flex; align-items:center; justify-content:space-between;
  padding: 16px 18px;
  z-index:6;
  opacity:0; pointer-events:none;
  transition: opacity 300ms ease;
}
.game-bubble-pop-wrap #hud.visible{ opacity:1; pointer-events:auto; }

.game-bubble-pop-wrap .hud-pill{
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(4px);
  border-radius: 999px;
  padding: 7px 14px;
  font-family:'Quicksand', sans-serif;
  font-weight:600;
  font-size: 15px;
  color:#7a5c78;
  letter-spacing: 0.5px;
}

.game-bubble-pop-wrap .hud-round{
  width:38px; height:38px; border-radius:50%;
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(4px);
  display:flex; align-items:center; justify-content:center;
  font-size:16px;
  border:none; cursor:pointer;
}
.game-bubble-pop-wrap .hud-round:focus-visible{ outline: 2px solid #b46b8c; outline-offset:2px; }

.game-bubble-pop-wrap #heartMessage{
  position:absolute;
  left:50%; top:32%;
  transform: translate(-50%, 8px);
  opacity:0;
  font-family:'Quicksand', sans-serif;
  font-weight:600;
  font-size: 17px;
  color:#8a4667;
  background: rgba(255,255,255,0.85);
  padding: 10px 20px;
  border-radius: 999px;
  white-space: nowrap;
  z-index:6;
  pointer-events:none;
  transition: opacity 380ms ease, transform 380ms ease;
  box-shadow: 0 10px 24px -10px rgba(150,90,120,0.4);
}
.game-bubble-pop-wrap #heartMessage.show{ opacity:1; transform: translate(-50%, 0); }

.game-bubble-pop-wrap .result-stats{ display:flex; justify-content:center; gap:26px; margin: 14px 0 6px; }
.game-bubble-pop-wrap .stat-num{
  font-family:'Quicksand', sans-serif;
  font-weight:700;
  font-size: 34px;
  color:#7a5c78;
  line-height:1;
}
.game-bubble-pop-wrap .stat-label{ font-size:12.5px; color:var(--bp-ink-soft); margin-top:4px; }
.game-bubble-pop-wrap .best-badge{ font-size: 13px; color:#a15c86; margin-top: 6px; min-height: 18px; }
.game-bubble-pop-wrap .session-msg{ font-size: 13.5px; color: var(--bp-ink-soft); margin: 14px 0 20px; }

@media (prefers-reduced-motion: reduce){
  .game-bubble-pop-wrap .bp-breathe, .game-bubble-pop-wrap .bp-sway, .game-bubble-pop-wrap .bp-steam-drift, .game-bubble-pop-wrap .bubble-emoji{ animation: none !important; }
}
.game-bubble-pop-wrap.reduced-motion .bubble{ transition: none !important; }

/* ============================================================
   GAME: Mini Aquarium
   Scoped to .game-mini-aquarium-wrap. Ported from the standalone
   "Little Aquarium" file. All sound is procedural (Web Audio) —
   no audio files needed. Settings persistence uses localStorage
   instead of the original's window.storage (an Artifacts-only
   API that doesn't exist in a real deployed site).
   Structure/logic lives in assets/js/games/mini-aquarium.js
   ============================================================ */
.game-mini-aquarium-wrap{
  --aq-abyss:#07304A;
  --aq-lagoon:#0E5A6E;
  --aq-cream:#FBF7EE;
  --aq-sunlight:#FFD166;
  --aq-coral:#FF8C7A;
  --aq-seafoam:#4FAE7D;
  --aq-ink:#06232B;

  display:flex;
  justify-content:center;
  font-family:'Nunito', sans-serif;
}

.game-mini-aquarium-wrap *{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }

.game-mini-aquarium-wrap #app{
  position:relative;
  width:min(94vw, 460px);
  height:min(72vh, 780px);
  max-height:820px;
  min-height:480px;
  margin:0 auto;
  border-radius:32px;
  overflow:hidden;
  background:var(--aq-abyss);
  box-shadow:0 30px 60px -18px rgba(4,32,46,0.5);
  -webkit-user-select:none; user-select:none;
}

.game-mini-aquarium-wrap canvas#tank{
  position:absolute; inset:0;
  width:100%; height:100%;
  display:block;
  touch-action:none;
  cursor:pointer;
}

.game-mini-aquarium-wrap .glass-frame{
  position:absolute; inset:0; pointer-events:none;
  box-shadow:
    inset 0 0 70px 18px rgba(2,16,24,0.55),
    inset 0 8px 40px rgba(2,16,24,0.4),
    inset 0 -30px 60px rgba(2,16,24,0.35);
}

/* onboarding */
.game-mini-aquarium-wrap #onboarding{
  position:absolute; left:0; right:0; top:12%;
  display:flex; flex-direction:column; align-items:center;
  text-align:center; color:var(--aq-cream);
  pointer-events:none;
  opacity:0; transform:translateY(-8px);
  transition:opacity 0.9s ease, transform 0.9s ease;
  padding:0 12%;
  text-shadow:0 2px 14px rgba(0,0,0,0.45);
}
.game-mini-aquarium-wrap #onboarding.show{ opacity:1; transform:translateY(0); }
.game-mini-aquarium-wrap #onboarding.hide{ opacity:0; transform:translateY(-10px); transition:opacity 0.6s ease, transform 0.6s ease; }
.game-mini-aquarium-wrap #onboarding .ob-emoji{ font-size:2.4rem; margin-bottom:2px; filter:drop-shadow(0 4px 10px rgba(0,0,0,0.3)); }
.game-mini-aquarium-wrap #onboarding h1{
  font-family:'Baloo 2', sans-serif;
  font-weight:700;
  font-size:clamp(1.4rem,6vw,1.9rem);
  margin:2px 0 10px;
  letter-spacing:0.2px;
}
.game-mini-aquarium-wrap #onboarding p{
  font-family:'Nunito', sans-serif;
  font-weight:600;
  font-size:clamp(0.95rem,3.6vw,1.05rem);
  line-height:1.5;
  margin:0 0 6px;
  opacity:0.95;
}
.game-mini-aquarium-wrap #onboarding .ob-enjoy{ margin-top:6px; font-weight:700; color:var(--aq-sunlight); }

/* settings button */
.game-mini-aquarium-wrap #settingsBtn{
  position:absolute; top:16px; right:16px;
  width:44px; height:44px; border-radius:50%;
  background:rgba(255,255,255,0.14);
  backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px);
  border:1px solid rgba(255,255,255,0.28);
  color:var(--aq-cream);
  font-size:1.25rem;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer;
  z-index:20;
  transition:transform 0.25s ease, background 0.25s ease;
}
.game-mini-aquarium-wrap #settingsBtn:hover{ background:rgba(255,255,255,0.22); }
.game-mini-aquarium-wrap #settingsBtn:active{ transform:scale(0.9) rotate(25deg); }

/* backdrop */
.game-mini-aquarium-wrap #backdrop{
  position:absolute; inset:0; background:rgba(2,14,20,0.4);
  opacity:0; pointer-events:none; transition:opacity 0.3s ease;
  z-index:25;
}
.game-mini-aquarium-wrap #backdrop.show{ opacity:1; pointer-events:auto; }

/* settings panel */
.game-mini-aquarium-wrap #settingsPanel{
  position:absolute; left:0; right:0; bottom:0;
  z-index:30;
  background:rgba(14,58,66,0.72);
  backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px);
  border-radius:26px 26px 0 0;
  border-top:1px solid rgba(255,255,255,0.18);
  transform:translateY(105%);
  transition:transform 0.4s cubic-bezier(.2,.8,.25,1);
  padding:22px 22px 22px;
  color:var(--aq-cream);
}
.game-mini-aquarium-wrap #settingsPanel.open{ transform:translateY(0); }
.game-mini-aquarium-wrap #settingsPanel h2{
  font-family:'Baloo 2', sans-serif;
  font-size:1.25rem; margin:0 0 16px; font-weight:600;
}
.game-mini-aquarium-wrap .setting-row{
  display:flex; align-items:center; justify-content:space-between;
  padding:11px 2px; font-weight:700; font-size:0.98rem;
  border-bottom:1px solid rgba(255,255,255,0.12);
}
.game-mini-aquarium-wrap .setting-row:last-of-type{ border-bottom:none; }
.game-mini-aquarium-wrap .toggle{
  width:46px; height:26px; border-radius:20px;
  background:rgba(255,255,255,0.22);
  border:none; position:relative; cursor:pointer;
  padding:0; transition:background 0.25s ease;
  flex-shrink:0;
}
.game-mini-aquarium-wrap .toggle .knob{
  position:absolute; top:3px; left:3px;
  width:20px; height:20px; border-radius:50%;
  background:var(--aq-cream);
  transition:transform 0.25s ease;
  box-shadow:0 1px 4px rgba(0,0,0,0.3);
}
.game-mini-aquarium-wrap .toggle[aria-checked="true"]{ background:var(--aq-seafoam); }
.game-mini-aquarium-wrap .toggle[aria-checked="true"] .knob{ transform:translateX(20px); }

.game-mini-aquarium-wrap .text-btn{
  width:100%; margin-top:18px; padding:13px;
  border-radius:16px; border:1px solid rgba(255,255,255,0.28);
  background:rgba(255,255,255,0.1);
  color:var(--aq-cream); font-family:'Nunito', sans-serif;
  font-weight:700; font-size:0.95rem; cursor:pointer;
  transition:background 0.2s ease;
}
.game-mini-aquarium-wrap .text-btn:active{ background:rgba(255,255,255,0.22); }

.game-mini-aquarium-wrap .credits{
  margin:16px 0 4px; font-size:0.78rem; line-height:1.5;
  opacity:0.75; font-weight:600; text-align:center;
}

.game-mini-aquarium-wrap #closeSettings{
  position:absolute; top:16px; right:18px;
  width:34px; height:34px; border-radius:50%;
  background:rgba(255,255,255,0.12);
  border:none; color:var(--aq-cream); font-size:1rem;
  cursor:pointer;
}

/* toast */
.game-mini-aquarium-wrap #toast{
  position:absolute; left:50%; bottom:34px;
  transform:translate(-50%,20px);
  background:rgba(6,35,43,0.85);
  color:var(--aq-cream);
  padding:10px 18px; border-radius:999px;
  font-weight:700; font-size:0.85rem;
  opacity:0; pointer-events:none;
  transition:opacity 0.35s ease, transform 0.35s ease;
  z-index:40; white-space:nowrap;
}
.game-mini-aquarium-wrap #toast.show{ opacity:1; transform:translate(-50%,0); }

@media (prefers-reduced-motion: reduce){
  .game-mini-aquarium-wrap #onboarding, .game-mini-aquarium-wrap #settingsPanel,
  .game-mini-aquarium-wrap #backdrop, .game-mini-aquarium-wrap #toast,
  .game-mini-aquarium-wrap #settingsBtn{ transition:none !important; }
}

/* ============================================================
   GAME: Tic Tac Toe
   Scoped to .game-ttt-wrap. Single-player vs computer (Easy =
   random, Hard = minimax). Pure CSS/JS, no external assets.
   Structure/logic lives in assets/js/games/tic-tac-toe.js
   ============================================================ */
.game-ttt-wrap{
  --ttt-pink:#FFD6E8;
  --ttt-pink-deep:#F7A8C9;
  --ttt-blue:#C9E7FF;
  --ttt-blue-deep:#8FC4EE;
  --ttt-purple:#E3D6FF;
  --ttt-purple-deep:#B79CEE;
  --ttt-yellow:#FFF1B8;
  --ttt-yellow-deep:#F2CE5C;
  --ttt-green:#D3F3DE;
  --ttt-green-deep:#8FD9AC;
  --ttt-cream:#FFFDF8;
  --ttt-ink:#4A4256;
  --ttt-ink-soft:#8D839A;
  --ttt-shadow: 0 20px 45px -22px rgba(120,90,150,0.35);
  --ttt-shadow-sm: 0 8px 20px -12px rgba(120,90,150,0.28);

  display:flex;
  justify-content:center;
  font-family:'Nunito', sans-serif;
  color:var(--ttt-ink);
}

.game-ttt-wrap *{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }

.game-ttt-wrap .ttt-card{
  width:min(94vw, 400px);
  background:var(--ttt-cream);
  border-radius:32px;
  padding:30px 26px 26px;
  box-shadow:var(--ttt-shadow);
  display:flex;
  flex-direction:column;
  align-items:center;
  text-align:center;
}

.game-ttt-wrap .ttt-title{
  font-family:'Baloo 2', sans-serif;
  font-weight:700;
  font-size:clamp(1.6rem, 6vw, 2rem);
  background:linear-gradient(90deg, var(--ttt-pink-deep), var(--ttt-purple-deep), var(--ttt-blue-deep));
  -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent;
  margin-bottom:4px;
}
.game-ttt-wrap .ttt-subtitle{
  font-size:0.92rem;
  font-weight:600;
  color:var(--ttt-ink-soft);
  margin-bottom:20px;
}

/* difficulty selector */
.game-ttt-wrap .ttt-difficulty{
  display:flex;
  gap:10px;
  margin-bottom:18px;
}
.game-ttt-wrap .ttt-diff-btn{
  font-family:'Nunito', sans-serif;
  font-weight:700;
  font-size:0.88rem;
  padding:10px 18px;
  border-radius:999px;
  border:2px solid transparent;
  background:var(--ttt-cream);
  box-shadow:var(--ttt-shadow-sm);
  color:var(--ttt-ink-soft);
  cursor:pointer;
  transition:transform 0.18s ease, border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.game-ttt-wrap .ttt-diff-btn:hover{ transform:translateY(-2px); }
.game-ttt-wrap .ttt-diff-btn:active{ transform:translateY(0) scale(0.96); }
.game-ttt-wrap .ttt-diff-btn[data-diff="easy"].active{ background:var(--ttt-green); border-color:var(--ttt-green-deep); color:#2E6B48; }
.game-ttt-wrap .ttt-diff-btn[data-diff="hard"].active{ background:var(--ttt-pink); border-color:var(--ttt-pink-deep); color:#8A3B5C; }
.game-ttt-wrap .ttt-diff-btn:focus-visible{ outline:3px solid var(--ttt-blue-deep); outline-offset:2px; }

/* status */
.game-ttt-wrap .ttt-status{
  font-family:'Baloo 2', sans-serif;
  font-weight:600;
  font-size:1.05rem;
  min-height:1.6em;
  margin-bottom:16px;
  color:var(--ttt-ink);
  transition:color 0.2s ease;
}
.game-ttt-wrap .ttt-status.thinking{ color:var(--ttt-blue-deep); }
.game-ttt-wrap .ttt-status.win{ color:#3E9A6B; animation:ttt-statusPop 0.4s var(--ease-bounce, ease); }
.game-ttt-wrap .ttt-status.lose{ color:#D66E8C; animation:ttt-statusPop 0.4s var(--ease-bounce, ease); }
.game-ttt-wrap .ttt-status.draw{ color:var(--ttt-purple-deep); animation:ttt-statusPop 0.4s var(--ease-bounce, ease); }
@keyframes ttt-statusPop{ 0%{ transform:scale(0.85); opacity:0.4; } 60%{ transform:scale(1.06); } 100%{ transform:scale(1); opacity:1; } }

.game-ttt-wrap .ttt-dots span{
  display:inline-block;
  animation: ttt-dotBounce 1.2s ease-in-out infinite;
  opacity:0.3;
}
.game-ttt-wrap .ttt-dots span:nth-child(1){ animation-delay:0s; }
.game-ttt-wrap .ttt-dots span:nth-child(2){ animation-delay:0.2s; }
.game-ttt-wrap .ttt-dots span:nth-child(3){ animation-delay:0.4s; }
@keyframes ttt-dotBounce{ 0%,60%,100%{ opacity:0.3; transform:translateY(0); } 30%{ opacity:1; transform:translateY(-3px); } }

/* board */
.game-ttt-wrap .ttt-board{
  width:min(80vw, 280px);
  aspect-ratio:1/1;
  display:grid;
  grid-template-columns:repeat(3,1fr);
  grid-template-rows:repeat(3,1fr);
  gap:10px;
  margin-bottom:22px;
}
.game-ttt-wrap .ttt-board.locked{ pointer-events:none; }

.game-ttt-wrap .ttt-cell{
  position:relative;
  border:none;
  border-radius:18px;
  background:linear-gradient(160deg, #FBF6FF, #F3EEFA);
  box-shadow:var(--ttt-shadow-sm);
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  transition:transform 0.15s var(--ease-bounce, ease), background 0.2s ease, box-shadow 0.2s ease;
}
.game-ttt-wrap .ttt-cell:not(:disabled):hover{
  transform:translateY(-2px) scale(1.03);
  background:linear-gradient(160deg, #FFFFFF, #F8F2FF);
}
.game-ttt-wrap .ttt-cell:not(:disabled):active{ transform:translateY(0) scale(0.95); }
.game-ttt-wrap .ttt-cell:disabled{ cursor:default; }
.game-ttt-wrap .ttt-cell:focus-visible{ outline:3px solid var(--ttt-blue-deep); outline-offset:2px; }

.game-ttt-wrap .ttt-symbol{
  font-family:'Baloo 2', sans-serif;
  font-weight:700;
  font-size:clamp(1.8rem, 9vw, 2.6rem);
  line-height:1;
  animation: ttt-symbolPop 0.28s var(--ease-bounce, cubic-bezier(.34,1.56,.64,1)) both;
}
.game-ttt-wrap .ttt-cell.is-x .ttt-symbol{ color:var(--ttt-blue-deep); }
.game-ttt-wrap .ttt-cell.is-o .ttt-symbol{ color:var(--ttt-pink-deep); }
@keyframes ttt-symbolPop{
  0%{ transform:scale(0.3); opacity:0; }
  70%{ transform:scale(1.15); opacity:1; }
  100%{ transform:scale(1); opacity:1; }
}

.game-ttt-wrap .ttt-cell.win-cell{
  background:linear-gradient(160deg, var(--ttt-yellow), #FFF8DE);
  animation: ttt-winPulse 0.7s ease-in-out 2;
}
@keyframes ttt-winPulse{
  0%,100%{ transform:scale(1); box-shadow:var(--ttt-shadow-sm); }
  50%{ transform:scale(1.06); box-shadow:0 12px 26px -10px rgba(242,206,92,0.6); }
}

/* actions */
.game-ttt-wrap .ttt-actions{ margin-bottom:20px; }
.game-ttt-wrap .ttt-btn{
  font-family:'Baloo 2', sans-serif;
  font-weight:700;
  font-size:0.98rem;
  border:none;
  border-radius:999px;
  padding:13px 28px;
  cursor:pointer;
  transition:transform 0.18s var(--ease-bounce, ease), box-shadow 0.18s ease;
}
.game-ttt-wrap .ttt-btn:active{ transform:translateY(0) scale(0.95); }
.game-ttt-wrap .ttt-btn-primary{
  background:linear-gradient(135deg, var(--ttt-purple), var(--ttt-blue));
  color:#4A3B7A;
  box-shadow:var(--ttt-shadow-sm);
}
.game-ttt-wrap .ttt-btn-primary:hover{ transform:translateY(-2px); box-shadow:var(--ttt-shadow); }
.game-ttt-wrap .ttt-btn:focus-visible{ outline:3px solid var(--ttt-blue-deep); outline-offset:2px; }

/* score */
.game-ttt-wrap .ttt-score{
  display:flex;
  gap:22px;
  padding-top:16px;
  border-top:1.5px dashed rgba(140,120,160,0.25);
  width:100%;
  justify-content:center;
  margin-bottom:12px;
}
.game-ttt-wrap .ttt-score-item{ display:flex; flex-direction:column; align-items:center; gap:2px; }
.game-ttt-wrap .ttt-score-label{ font-size:0.72rem; font-weight:700; color:var(--ttt-ink-soft); text-transform:uppercase; letter-spacing:0.04em; }
.game-ttt-wrap .ttt-score-value{ font-family:'Baloo 2', sans-serif; font-weight:700; font-size:1.35rem; color:var(--ttt-ink); }

.game-ttt-wrap .ttt-reset-score{
  background:none;
  border:none;
  font-family:'Nunito', sans-serif;
  font-weight:700;
  font-size:0.8rem;
  color:var(--ttt-ink-soft);
  text-decoration:underline;
  text-underline-offset:3px;
  cursor:pointer;
  padding:4px 8px;
  transition:color 0.18s ease;
}
.game-ttt-wrap .ttt-reset-score:hover{ color:var(--ttt-pink-deep); }
.game-ttt-wrap .ttt-reset-score:focus-visible{ outline:2px solid var(--ttt-blue-deep); outline-offset:2px; border-radius:6px; }

@media (max-width:380px){
  .game-ttt-wrap .ttt-card{ padding:24px 18px 20px; }
  .game-ttt-wrap .ttt-score{ gap:14px; }
}

@media (prefers-reduced-motion: reduce){
  .game-ttt-wrap .ttt-symbol, .game-ttt-wrap .ttt-cell.win-cell, .game-ttt-wrap .ttt-status.win,
  .game-ttt-wrap .ttt-status.lose, .game-ttt-wrap .ttt-status.draw, .game-ttt-wrap .ttt-dots span{
    animation:none !important;
  }
}

/* ============================================================
   GAME: Dino Run
   Scoped to .game-dino-run-wrap. Pastel endless runner — the
   dinosaur, obstacles and parallax scene are canvas-drawn; every
   text panel (menu/pause/game-over/HUD) is a DOM overlay, same
   pattern as Mini Aquarium.
   Structure/logic lives in assets/js/games/dino-run.js
   ============================================================ */
.game-dino-run-wrap{
  --dino-mint:#A8E6CF;
  --dino-mint-deep:#7FCBAE;
  --dino-belly:#FFF3B0;
  --dino-lavender:#CDB4DB;
  --dino-pink:#FFAFCC;
  --dino-peach:#FFD6A5;
  --dino-blue:#A2D2FF;
  --dino-cream:#FFFDF8;
  --dino-ink:#4A4256;
  --dino-ink-soft:#8D839A;
  --dino-shadow: 0 26px 50px -24px rgba(120,150,140,0.4);
  --dino-shadow-sm: 0 8px 18px -10px rgba(120,150,140,0.3);

  display:flex;
  justify-content:center;
  font-family:'Nunito', sans-serif;
  color:var(--dino-ink);
}

.game-dino-run-wrap *{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }

.game-dino-run-wrap #dinoApp{
  position:relative;
  width:min(94vw, 760px);
  height:clamp(210px, 34vw, 320px);
  margin:0 auto;
  border-radius:28px;
  overflow:hidden;
  background:#EAF6FF;
  box-shadow:var(--dino-shadow);
  -webkit-user-select:none; user-select:none;
}

.game-dino-run-wrap canvas#dinoCanvas{
  position:absolute; inset:0;
  width:100%; height:100%;
  display:block;
  touch-action:none;
  cursor:pointer;
}

/* ---------- HUD ---------- */
.game-dino-run-wrap #dinoHud{
  position:absolute; top:0; left:0; right:0;
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 14px;
  z-index:10;
  opacity:0; pointer-events:none;
  transition:opacity 0.25s ease;
}
.game-dino-run-wrap #dinoHud.visible{ opacity:1; pointer-events:auto; }
.game-dino-run-wrap .dino-hud-scores{ display:flex; flex-direction:column; gap:2px; }
.game-dino-run-wrap .dino-score, .game-dino-run-wrap .dino-hi{
  font-family:'Baloo 2', sans-serif;
  font-weight:700;
  font-size:0.82rem;
  letter-spacing:0.03em;
  color:#3D5A50;
  text-shadow:0 1px 2px rgba(255,255,255,0.6);
}
.game-dino-run-wrap .dino-hi{ font-size:0.7rem; opacity:0.75; }
.game-dino-run-wrap .dino-hud-buttons{ display:flex; gap:8px; }
.game-dino-run-wrap .dino-hud-buttons button{
  width:32px; height:32px; border-radius:50%;
  border:none; cursor:pointer;
  background:rgba(255,255,255,0.7);
  backdrop-filter:blur(6px);
  font-size:0.95rem;
  display:flex; align-items:center; justify-content:center;
  box-shadow:var(--dino-shadow-sm);
  transition:transform 0.18s ease;
}
.game-dino-run-wrap .dino-hud-buttons button:hover{ transform:scale(1.08); }
.game-dino-run-wrap .dino-hud-buttons button:active{ transform:scale(0.92); }

/* ---------- milestone toast ---------- */
.game-dino-run-wrap #dinoMilestoneToast{
  position:absolute; left:50%; top:16%;
  transform:translate(-50%,-8px);
  background:rgba(255,255,255,0.88);
  color:#6B4A8A;
  font-family:'Baloo 2', sans-serif;
  font-weight:700;
  font-size:0.85rem;
  padding:8px 16px;
  border-radius:999px;
  box-shadow:var(--dino-shadow-sm);
  opacity:0;
  pointer-events:none;
  transition:opacity 0.3s ease, transform 0.3s ease;
  z-index:15;
  white-space:nowrap;
}
.game-dino-run-wrap #dinoMilestoneToast.show{ opacity:1; transform:translate(-50%,0); }

/* ---------- panels (menu / pause / game over) ---------- */
.game-dino-run-wrap .dino-panel{
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
  background:rgba(255,253,248,0.55);
  backdrop-filter:blur(3px);
  z-index:20;
  transition:opacity 0.3s ease;
}
.game-dino-run-wrap .dino-panel.hidden{ display:none; }

.game-dino-run-wrap .dino-panel-card{
  background:rgba(255,255,255,0.92);
  border-radius:24px;
  padding:22px 26px 24px;
  text-align:center;
  max-width:88%;
  box-shadow:var(--dino-shadow);
}
.game-dino-run-wrap .dino-emoji-title{ font-size:2.2rem; margin-bottom:2px; }
.game-dino-run-wrap .dino-panel-card h1{
  font-family:'Baloo 2', sans-serif;
  font-weight:700;
  font-size:clamp(1.15rem, 4.5vw, 1.5rem);
  color:#4A6B5C;
  letter-spacing:0.02em;
  margin:2px 0 6px;
}
.game-dino-run-wrap .dino-subtitle{
  font-size:0.85rem;
  font-weight:600;
  color:var(--dino-ink-soft);
  margin-bottom:14px;
}

.game-dino-run-wrap .dino-controls-guide{
  display:flex; flex-direction:column; gap:6px;
  margin-bottom:16px;
}
.game-dino-run-wrap .dino-control-row{
  display:flex; align-items:center; justify-content:center; gap:10px;
  font-size:0.8rem; font-weight:700; color:var(--dino-ink);
}
.game-dino-run-wrap .dino-key{
  background:var(--dino-mint);
  color:#2E5C4A;
  padding:4px 10px;
  border-radius:8px;
  font-family:'Baloo 2', sans-serif;
  font-size:0.75rem;
}

.game-dino-run-wrap .dino-hint{
  margin-top:10px;
  font-size:0.72rem;
  font-weight:700;
  letter-spacing:0.04em;
  color:var(--dino-ink-soft);
  animation: dino-hintPulse 1.6s ease-in-out infinite;
}
@keyframes dino-hintPulse{ 0%,100%{ opacity:0.55; } 50%{ opacity:1; } }

.game-dino-run-wrap .dino-go-score, .game-dino-run-wrap .dino-go-hiscore{
  font-size:0.9rem; font-weight:700; color:var(--dino-ink);
  margin:2px 0;
}
.game-dino-run-wrap .dino-go-hiscore{ color:#C77FA0; margin-bottom:14px; }

.game-dino-run-wrap .dino-panel-buttons{
  display:flex; flex-direction:column; gap:9px;
}

/* buttons */
.game-dino-run-wrap .dino-btn{
  font-family:'Baloo 2', sans-serif;
  font-weight:700;
  font-size:0.92rem;
  border:none;
  border-radius:999px;
  padding:11px 26px;
  cursor:pointer;
  transition:transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.18s ease;
  margin-top:4px;
}
.game-dino-run-wrap .dino-btn:hover{ transform:translateY(-2px); }
.game-dino-run-wrap .dino-btn:active{ transform:translateY(0) scale(0.95); }
.game-dino-run-wrap .dino-btn-primary{
  background:linear-gradient(135deg, var(--dino-mint), #C9F2E1);
  color:#2E5C4A;
  box-shadow:var(--dino-shadow-sm);
}
.game-dino-run-wrap .dino-btn-secondary{
  background:linear-gradient(135deg, var(--dino-blue), #D4E9FF);
  color:#2E4E7A;
  box-shadow:var(--dino-shadow-sm);
}
.game-dino-run-wrap .dino-btn-ghost{
  background:rgba(141,131,154,0.12);
  color:var(--dino-ink-soft);
}

/* ---------- mobile controls ---------- */
.game-dino-run-wrap #dinoMobileControls{
  position:absolute; bottom:14px; left:0; right:0;
  display:none;
  justify-content:space-between;
  padding:0 16px;
  z-index:12;
  pointer-events:none;
}
.game-dino-run-wrap #dinoMobileControls button{
  pointer-events:auto;
  font-family:'Baloo 2', sans-serif;
  font-weight:700;
  font-size:0.78rem;
  letter-spacing:0.03em;
  padding:12px 22px;
  border-radius:999px;
  border:1.5px solid rgba(255,255,255,0.6);
  background:rgba(255,255,255,0.35);
  backdrop-filter:blur(6px);
  color:#3D5A50;
  box-shadow:0 6px 16px -8px rgba(0,0,0,0.25);
}
.game-dino-run-wrap #dinoMobileControls button:active{ background:rgba(255,255,255,0.55); }

@media (pointer:coarse), (hover:none){
  .game-dino-run-wrap #dinoMobileControls{ display:flex; }
}

@media (max-width:420px){
  .game-dino-run-wrap .dino-panel-card{ padding:18px 18px 20px; }
}

@media (prefers-reduced-motion: reduce){
  .game-dino-run-wrap .dino-hint{ animation:none !important; }
}

/* ============================================================
   GAME: Memory Puzzle
   Scoped to .game-memory-wrap. Relaxed card-matching game, no
   timer, no game-over, no penalty. Two difficulty levels: Easy
   (4x4, default) and Normal (6x6).
   Structure/logic lives in assets/js/games/memory-puzzle.js
   ============================================================ */
.game-memory-wrap{
  --mem-pink:#FFD6E8;
  --mem-pink-deep:#F0A8C9;
  --mem-green:#D3F3DE;
  --mem-green-deep:#7FCBAE;
  --mem-yellow:#FFF1B8;
  --mem-yellow-deep:#E8C158;
  --mem-blue:#C9E7FF;
  --mem-purple:#E3D6FF;
  --mem-purple-deep:#B79CEE;
  --mem-cream:#FFFDF8;
  --mem-ink:#4A4256;
  --mem-ink-soft:#8D839A;
  --mem-shadow: 0 20px 44px -22px rgba(120,90,150,0.32);
  --mem-shadow-sm: 0 8px 18px -12px rgba(120,90,150,0.26);

  display:flex;
  justify-content:center;
  font-family:'Nunito', sans-serif;
  color:var(--mem-ink);
}

.game-memory-wrap *{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }

.game-memory-wrap .mem-shell{
  width:min(94vw, 480px);
  background:var(--mem-cream);
  border-radius:28px;
  padding:24px 22px 26px;
  box-shadow:var(--mem-shadow);
  display:flex;
  flex-direction:column;
  align-items:center;
}

/* ---------- mode picker ---------- */
.game-memory-wrap .mem-mode-picker{ text-align:center; margin-bottom:16px; }
.game-memory-wrap .mem-mode-label{
  display:block;
  font-size:0.7rem;
  font-weight:700;
  letter-spacing:0.08em;
  color:var(--mem-ink-soft);
  margin-bottom:8px;
}
.game-memory-wrap .mem-mode-buttons{ display:flex; gap:10px; justify-content:center; }
.game-memory-wrap .mem-mode-btn{
  font-family:'Baloo 2', sans-serif;
  font-weight:700;
  font-size:0.86rem;
  padding:9px 16px;
  border-radius:999px;
  border:2px solid transparent;
  background:rgba(141,131,154,0.08);
  color:var(--mem-ink-soft);
  cursor:pointer;
  box-shadow:none;
  transform:scale(0.96);
  transition:transform 0.2s cubic-bezier(.34,1.56,.64,1), background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.game-memory-wrap .mem-mode-btn:hover{ transform:scale(1.0); }
.game-memory-wrap .mem-mode-btn:focus-visible{ outline:3px solid var(--mem-blue); outline-offset:2px; }
.game-memory-wrap .mem-mode-btn[data-difficulty="easy"].active{
  background:var(--mem-green); border-color:var(--mem-green-deep); color:#2E6B48;
  box-shadow:var(--mem-shadow-sm); transform:scale(1.08);
}
.game-memory-wrap .mem-mode-btn[data-difficulty="normal"].active{
  background:var(--mem-yellow); border-color:var(--mem-yellow-deep); color:#7A5F14;
  box-shadow:var(--mem-shadow-sm); transform:scale(1.08);
}

/* ---------- stats ---------- */
.game-memory-wrap .mem-stats{
  display:flex;
  gap:10px;
  margin-bottom:18px;
  flex-wrap:wrap;
  justify-content:center;
}
.game-memory-wrap .mem-stat-badge{
  background:var(--mem-blue);
  color:#2E5580;
  font-weight:700;
  font-size:0.8rem;
  padding:8px 14px;
  border-radius:14px;
  box-shadow:var(--mem-shadow-sm);
}
.game-memory-wrap .mem-stat-badge:nth-child(2){ background:var(--mem-purple); color:#5B3E8A; }

/* ---------- board ---------- */
.game-memory-wrap .mem-board{
  width:100%;
  aspect-ratio:1/1;
  display:grid;
  grid-template-columns:repeat(var(--mem-cols), 1fr);
  gap:min(1.8vw, 9px);
}

.game-memory-wrap .mem-card{
  position:relative;
  border:none;
  padding:0;
  background:none;
  cursor:pointer;
  perspective:600px;
  border-radius:12px;
}
.game-memory-wrap .mem-card:disabled{ cursor:default; }
.game-memory-wrap .mem-card:focus-visible{ outline:3px solid var(--mem-blue-deep, #6BAEE8); outline-offset:2px; border-radius:12px; }

.game-memory-wrap .mem-card-inner{
  position:relative;
  width:100%; height:100%;
  transition:transform 0.45s cubic-bezier(.4,.2,.2,1);
  transform-style:preserve-3d;
}
.game-memory-wrap .mem-card.flipped .mem-card-inner{ transform:rotateY(180deg); }

.game-memory-wrap .mem-card-face{
  position:absolute; inset:0;
  backface-visibility:hidden;
  border-radius:12px;
  display:flex; align-items:center; justify-content:center;
  font-size:clamp(1.1rem, 5vw, 1.7rem);
  box-shadow:var(--mem-shadow-sm);
}
.game-memory-wrap .mem-card-front{
  background:linear-gradient(155deg, var(--mem-pink), #FFE9F2);
  color:var(--mem-pink-deep);
  font-weight:700;
}
.game-memory-wrap .mem-card:hover:not(:disabled):not(.flipped) .mem-card-front{
  background:linear-gradient(155deg, #FFE0EE, #FFF3F8);
  transform:translateY(-1px);
}
.game-memory-wrap .mem-card-back{
  background:var(--mem-cream);
  transform:rotateY(180deg);
}

.game-memory-wrap .mem-card.matched .mem-card-back{
  background:linear-gradient(155deg, var(--mem-green), #EAFAF0);
  animation: mem-matchPulse 0.5s ease;
}
@keyframes mem-matchPulse{
  0%{ transform:rotateY(180deg) scale(1); }
  45%{ transform:rotateY(180deg) scale(1.12); }
  100%{ transform:rotateY(180deg) scale(1); }
}
.game-memory-wrap .mem-card.matched{ opacity:0.88; }

/* ---------- win modal ---------- */
.game-memory-wrap .mem-modal-overlay{
  position:fixed; inset:0;
  background:rgba(74,66,86,0.35);
  display:flex; align-items:center; justify-content:center;
  padding:20px;
  z-index:70;
  opacity:0; pointer-events:none;
  transition:opacity 0.25s ease;
}
.game-memory-wrap .mem-modal-overlay.open{ opacity:1; pointer-events:auto; }

.game-memory-wrap .mem-modal{
  background:linear-gradient(180deg, #FFFFFF, #FFF8FC);
  border-radius:24px;
  padding:30px 26px 26px;
  max-width:340px;
  width:100%;
  text-align:center;
  box-shadow:0 24px 55px rgba(120,90,150,0.35);
  border-top:5px solid var(--mem-pink-deep);
  transform:translateY(14px) scale(0.96);
  opacity:0;
  transition:transform 0.25s ease, opacity 0.25s ease;
}
.game-memory-wrap .mem-modal-overlay.open .mem-modal{ transform:translateY(0) scale(1); opacity:1; }

.game-memory-wrap .mem-modal-emoji{ font-size:2.2rem; margin-bottom:6px; }
.game-memory-wrap .mem-modal h2{
  font-family:'Baloo 2', sans-serif;
  font-weight:700;
  font-size:1.35rem;
  color:#4A6B5C;
  margin:0 0 8px;
}
.game-memory-wrap .mem-modal-sub{
  font-size:0.86rem;
  color:var(--mem-ink-soft);
  line-height:1.5;
  margin:0 0 16px;
}
.game-memory-wrap .mem-modal-stats{
  display:flex;
  flex-direction:column;
  gap:5px;
  background:var(--mem-cream);
  border-radius:14px;
  padding:12px;
  font-weight:700;
  font-size:0.85rem;
  margin-bottom:18px;
}

.game-memory-wrap .mem-btn{
  font-family:'Baloo 2', sans-serif;
  font-weight:700;
  font-size:0.95rem;
  border:none;
  border-radius:999px;
  padding:12px 26px;
  cursor:pointer;
  transition:transform 0.18s cubic-bezier(.34,1.56,.64,1);
}
.game-memory-wrap .mem-btn:hover{ transform:translateY(-2px); }
.game-memory-wrap .mem-btn:active{ transform:translateY(0) scale(0.95); }
.game-memory-wrap .mem-btn-primary{
  background:linear-gradient(135deg, var(--mem-green), #C9F2E1);
  color:#2E6B48;
  box-shadow:var(--mem-shadow-sm);
}

@media (max-width:380px){
  .game-memory-wrap .mem-shell{ padding:20px 16px 22px; }
  .game-memory-wrap .mem-stat-badge{ font-size:0.74rem; padding:7px 11px; }
}

@media (prefers-reduced-motion: reduce){
  .game-memory-wrap .mem-card-inner, .game-memory-wrap .mem-card.matched .mem-card-back,
  .game-memory-wrap .mem-modal, .game-memory-wrap .mem-modal-overlay{
    transition:none !important; animation:none !important;
  }
}

/* ============================================================
   GAME: Break Block
   Scoped to .game-breakblock-wrap. Pastel brick-breaker — blocks,
   ball, paddle and particles are canvas-drawn; stats/modals are
   DOM overlays, same split as Dino Run and Mini Aquarium.
   Structure/logic lives in assets/js/games/break-block.js
   ============================================================ */
.game-breakblock-wrap{
  --bb-pink:#FFC8DD;
  --bb-purple:#CDB4DB;
  --bb-blue:#BDE0FE;
  --bb-blue-deep:#A2D2FF;
  --bb-mint:#CDEAC0;
  --bb-yellow:#FFF1A8;
  --bb-peach:#FFD6A5;
  --bb-ink:#4A4256;
  --bb-ink-soft:#8D839A;
  --bb-shadow: 0 22px 46px -22px rgba(120,110,150,0.32);
  --bb-shadow-sm: 0 8px 18px -12px rgba(120,110,150,0.26);

  display:flex;
  justify-content:center;
  font-family:'Nunito', sans-serif;
  color:var(--bb-ink);
}

.game-breakblock-wrap *{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }

.game-breakblock-wrap .bb-shell{
  width:min(94vw, 640px);
  display:flex;
  flex-direction:column;
  align-items:center;
}

/* ---------- mode picker ---------- */
.game-breakblock-wrap .bb-mode-picker{ text-align:center; margin-bottom:14px; }
.game-breakblock-wrap .bb-mode-label{
  display:block;
  font-size:0.7rem; font-weight:700; letter-spacing:0.08em;
  color:var(--bb-ink-soft); margin-bottom:8px;
}
.game-breakblock-wrap .bb-mode-buttons{ display:flex; gap:10px; justify-content:center; }
.game-breakblock-wrap .bb-mode-btn{
  font-family:'Baloo 2', sans-serif;
  font-weight:700; font-size:0.86rem;
  padding:9px 16px;
  border-radius:999px;
  border:2px solid transparent;
  background:rgba(141,131,154,0.08);
  color:var(--bb-ink-soft);
  cursor:pointer;
  transform:scale(0.96);
  transition:transform 0.2s cubic-bezier(.34,1.56,.64,1), background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  opacity:0.75;
}
.game-breakblock-wrap .bb-mode-btn:hover{ opacity:1; }
.game-breakblock-wrap .bb-mode-btn:focus-visible{ outline:3px solid var(--bb-blue-deep); outline-offset:2px; }
.game-breakblock-wrap .bb-mode-btn[data-difficulty="easy"].active{
  background:var(--bb-mint); border-color:#7FCBAE; color:#2E6B48;
  box-shadow:var(--bb-shadow-sm); transform:scale(1.08); opacity:1;
}
.game-breakblock-wrap .bb-mode-btn[data-difficulty="hard"].active{
  background:var(--bb-pink); border-color:#E888AE; color:#8A3B5C;
  box-shadow:var(--bb-shadow-sm); transform:scale(1.08); opacity:1;
}

/* ---------- stats ---------- */
.game-breakblock-wrap .bb-stats{
  display:flex; align-items:center; gap:10px;
  margin-bottom:14px; flex-wrap:wrap; justify-content:center;
}
.game-breakblock-wrap .bb-stat-badge{
  background:var(--bb-blue);
  color:#2E5580;
  font-weight:700; font-size:0.8rem;
  padding:8px 14px;
  border-radius:14px;
  box-shadow:var(--bb-shadow-sm);
}
.game-breakblock-wrap .bb-lives{ font-size:1rem; letter-spacing:2px; }
.game-breakblock-wrap .bb-sound-btn{
  width:34px; height:34px; border-radius:50%;
  border:none; cursor:pointer;
  background:rgba(141,131,154,0.1);
  font-size:0.95rem;
  display:flex; align-items:center; justify-content:center;
  transition:transform 0.18s ease;
}
.game-breakblock-wrap .bb-sound-btn:hover{ transform:scale(1.08); }

/* ---------- game area ---------- */
.game-breakblock-wrap #bbApp{
  position:relative;
  width:100%;
  height:clamp(420px, 92vw, 560px);
  border-radius:26px;
  overflow:hidden;
  box-shadow:var(--bb-shadow);
  -webkit-user-select:none; user-select:none;
  margin-bottom:16px;
}
.game-breakblock-wrap canvas#bbCanvas{
  position:absolute; inset:0;
  width:100%; height:100%;
  display:block;
  touch-action:none;
  cursor:pointer;
}

.game-breakblock-wrap .bb-hint{
  position:absolute; left:50%; bottom:14%;
  transform:translate(-50%,6px);
  background:rgba(255,255,255,0.85);
  color:var(--bb-ink);
  font-weight:700; font-size:0.8rem;
  padding:8px 16px;
  border-radius:999px;
  box-shadow:var(--bb-shadow-sm);
  opacity:0;
  pointer-events:none;
  transition:opacity 0.3s ease, transform 0.3s ease;
  z-index:8;
  animation: bb-hintPulse 1.6s ease-in-out infinite;
}
.game-breakblock-wrap .bb-hint.visible{ opacity:1; transform:translate(-50%,0); }
@keyframes bb-hintPulse{ 0%,100%{ opacity:0.6; } 50%{ opacity:1; } }
.game-breakblock-wrap .bb-hint:not(.visible){ animation:none; }

/* ---------- modals ---------- */
.game-breakblock-wrap .bb-modal-overlay{
  position:absolute; inset:0;
  background:rgba(74,66,86,0.35);
  display:flex; align-items:center; justify-content:center;
  padding:20px;
  z-index:20;
  opacity:0; pointer-events:none;
  transition:opacity 0.25s ease;
}
.game-breakblock-wrap .bb-modal-overlay.open{ opacity:1; pointer-events:auto; }

.game-breakblock-wrap .bb-modal{
  background:linear-gradient(180deg, #FFFFFF, #FFF8FC);
  border-radius:24px;
  padding:28px 26px 24px;
  max-width:88%;
  width:320px;
  text-align:center;
  box-shadow:0 24px 55px rgba(120,110,150,0.35);
  transform:translateY(14px) scale(0.96);
  opacity:0;
  transition:transform 0.25s ease, opacity 0.25s ease;
  border-top:5px solid var(--bb-purple);
}
.game-breakblock-wrap .bb-modal-overlay.open .bb-modal{ transform:translateY(0) scale(1); opacity:1; }

.game-breakblock-wrap .bb-modal-emoji{ font-size:2.2rem; margin-bottom:6px; }
.game-breakblock-wrap .bb-modal h2{
  font-family:'Baloo 2', sans-serif;
  font-weight:700; font-size:1.3rem;
  color:#4A6B5C;
  margin:0 0 8px;
}
.game-breakblock-wrap .bb-modal p{
  font-size:0.86rem; color:var(--bb-ink-soft);
  line-height:1.5; margin:0 0 6px;
}
.game-breakblock-wrap .bb-win-mode{ font-weight:700; color:var(--bb-ink); margin-bottom:16px !important; }

.game-breakblock-wrap .bb-btn{
  font-family:'Baloo 2', sans-serif;
  font-weight:700; font-size:0.94rem;
  border:none; border-radius:999px;
  padding:12px 26px;
  cursor:pointer;
  margin-top:8px;
  transition:transform 0.18s cubic-bezier(.34,1.56,.64,1);
}
.game-breakblock-wrap .bb-btn:hover{ transform:translateY(-2px); }
.game-breakblock-wrap .bb-btn:active{ transform:translateY(0) scale(0.95); }
.game-breakblock-wrap .bb-btn-primary{
  background:linear-gradient(135deg, var(--bb-mint), #E4F5DC);
  color:#2E6B48;
  box-shadow:var(--bb-shadow-sm);
}
.game-breakblock-wrap .bb-btn-ghost{
  background:rgba(141,131,154,0.1);
  color:var(--bb-ink-soft);
}

.game-breakblock-wrap .bb-restart-row{ margin-top:2px; }

@media (max-width:380px){
  .game-breakblock-wrap .bb-stat-badge{ font-size:0.72rem; padding:7px 10px; }
}

@media (prefers-reduced-motion: reduce){
  .game-breakblock-wrap .bb-hint{ animation:none !important; }
  .game-breakblock-wrap .bb-modal, .game-breakblock-wrap .bb-modal-overlay{ transition:none !important; }
}

/* ============================================================
   GAME: Flappy Breeze
   Scoped to .game-flappy-wrap. Neutral pastel sky + soft gray
   "cloud pillar" obstacles (deliberately one gray color family —
   no pink/purple — per the revision brief, kept universal rather
   than feminine-coded). Sky/clouds/pillars/bird are canvas-drawn;
   HUD/modals are DOM overlays, same split as Dino Run.
   Structure/logic lives in assets/js/games/flappy-breeze.js
   ============================================================ */
.game-flappy-wrap{
  --fbz-ink:#4A4A4E;
  --fbz-ink-soft:#83868D;
  --fbz-shadow: 0 22px 46px -22px rgba(90,95,100,0.3);
  --fbz-shadow-sm: 0 8px 18px -12px rgba(90,95,100,0.24);

  display:flex;
  justify-content:center;
  font-family:'Nunito', sans-serif;
  color:var(--fbz-ink);
}

.game-flappy-wrap *{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }

.game-flappy-wrap .fb-shell{
  width:min(94vw, 460px);
  display:flex;
  flex-direction:column;
  align-items:center;
}

/* ---------- mode picker ---------- */
.game-flappy-wrap .fb-mode-picker{ text-align:center; margin-bottom:14px; }
.game-flappy-wrap .fb-mode-label{
  display:block;
  font-size:0.7rem; font-weight:700; letter-spacing:0.08em;
  color:var(--fbz-ink-soft); margin-bottom:8px;
}
.game-flappy-wrap .fb-mode-buttons{ display:flex; gap:10px; justify-content:center; }
.game-flappy-wrap .fb-mode-btn{
  font-family:'Baloo 2', sans-serif;
  font-weight:700; font-size:0.86rem;
  padding:9px 16px;
  border-radius:999px;
  border:2px solid transparent;
  background:rgba(111,116,122,0.1);
  color:var(--fbz-ink-soft);
  cursor:pointer;
  transform:scale(0.96);
  opacity:0.75;
  transition:transform 0.2s cubic-bezier(.34,1.56,.64,1), background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}
.game-flappy-wrap .fb-mode-btn:hover{ opacity:1; }
.game-flappy-wrap .fb-mode-btn:focus-visible{ outline:3px solid #9BC7DE; outline-offset:2px; }
.game-flappy-wrap .fb-mode-btn[data-difficulty="easy"].active{
  background:#CDEAC0; border-color:#8FC79E; color:#2E6B48;
  box-shadow:var(--fbz-shadow-sm); transform:scale(1.08); opacity:1;
}
.game-flappy-wrap .fb-mode-btn[data-difficulty="hard"].active{
  background:#F2C66D; border-color:#D8A94F; color:#7A5514;
  box-shadow:var(--fbz-shadow-sm); transform:scale(1.08); opacity:1;
}

/* ---------- game area ---------- */
.game-flappy-wrap #fbApp{
  position:relative;
  width:100%;
  height:clamp(520px, 145vw, 700px);
  border-radius:26px;
  overflow:hidden;
  box-shadow:var(--fbz-shadow);
  -webkit-user-select:none; user-select:none;
}
.game-flappy-wrap canvas#fbCanvas{
  position:absolute; inset:0;
  width:100%; height:100%;
  display:block;
  touch-action:none;
  cursor:pointer;
}

/* ---------- HUD ---------- */
.game-flappy-wrap .fb-hud{
  position:absolute; top:0; left:0; right:0;
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 14px 0;
  z-index:10;
  gap:8px;
}
.game-flappy-wrap .fb-score-badge, .game-flappy-wrap .fb-best-badge{
  background:rgba(255,255,255,0.75);
  backdrop-filter:blur(6px);
  color:var(--fbz-ink);
  font-weight:700; font-size:0.78rem;
  padding:7px 12px;
  border-radius:999px;
  box-shadow:var(--fbz-shadow-sm);
  white-space:nowrap;
}
.game-flappy-wrap .fb-sound-btn{
  width:34px; height:34px; border-radius:50%;
  border:none; cursor:pointer;
  background:rgba(255,255,255,0.75);
  backdrop-filter:blur(6px);
  font-size:0.95rem;
  display:flex; align-items:center; justify-content:center;
  box-shadow:var(--fbz-shadow-sm);
  transition:transform 0.18s ease;
  flex-shrink:0;
}
.game-flappy-wrap .fb-sound-btn:hover{ transform:scale(1.08); }

/* ---------- hint ---------- */
.game-flappy-wrap .fb-hint{
  position:absolute; left:50%; top:62%;
  transform:translate(-50%,6px);
  background:rgba(255,255,255,0.85);
  color:var(--fbz-ink);
  font-weight:700; font-size:0.8rem;
  padding:8px 16px;
  border-radius:999px;
  box-shadow:var(--fbz-shadow-sm);
  opacity:0;
  pointer-events:none;
  transition:opacity 0.3s ease, transform 0.3s ease;
  z-index:8;
  animation: fb-hintPulse 1.6s ease-in-out infinite;
}
.game-flappy-wrap .fb-hint.visible{ opacity:1; transform:translate(-50%,0); }
.game-flappy-wrap .fb-hint:not(.visible){ animation:none; }
@keyframes fb-hintPulse{ 0%,100%{ opacity:0.6; } 50%{ opacity:1; } }

/* ---------- modal ---------- */
.game-flappy-wrap .fb-modal-overlay{
  position:absolute; inset:0;
  background:rgba(70,70,74,0.35);
  display:flex; align-items:center; justify-content:center;
  padding:20px;
  z-index:20;
  opacity:0; pointer-events:none;
  transition:opacity 0.25s ease;
}
.game-flappy-wrap .fb-modal-overlay.open{ opacity:1; pointer-events:auto; }

.game-flappy-wrap .fb-modal{
  background:linear-gradient(180deg, #FFFFFF, #FBFAF6);
  border-radius:24px;
  padding:28px 26px 24px;
  max-width:88%;
  width:320px;
  text-align:center;
  box-shadow:0 24px 55px rgba(90,95,100,0.35);
  border-top:5px solid var(--fbz-ink-soft);
  transform:translateY(14px) scale(0.96);
  opacity:0;
  transition:transform 0.25s ease, opacity 0.25s ease;
}
.game-flappy-wrap .fb-modal-overlay.open .fb-modal{ transform:translateY(0) scale(1); opacity:1; }

.game-flappy-wrap .fb-modal-emoji{ font-size:2.1rem; margin-bottom:6px; }
.game-flappy-wrap .fb-modal h2{
  font-family:'Baloo 2', sans-serif;
  font-weight:700; font-size:1.3rem;
  color:var(--fbz-ink);
  margin:0 0 8px;
}
.game-flappy-wrap .fb-modal p{
  font-size:0.86rem; color:var(--fbz-ink-soft);
  line-height:1.5; margin:0 0 14px;
}
.game-flappy-wrap .fb-modal-stats{
  display:flex; flex-direction:column; gap:5px;
  background:#F3F7FF;
  border-radius:14px;
  padding:12px;
  font-weight:700; font-size:0.85rem;
  margin-bottom:8px;
}
.game-flappy-wrap .fb-new-best{
  font-weight:700; font-size:0.82rem;
  color:#B98A2E;
  margin-bottom:14px !important;
  animation: fb-newBestPop 0.5s var(--ease-bounce, ease);
}
.game-flappy-wrap .fb-new-best.hidden{ display:none; }
@keyframes fb-newBestPop{ 0%{ transform:scale(0.8); opacity:0; } 60%{ transform:scale(1.1); } 100%{ transform:scale(1); opacity:1; } }

.game-flappy-wrap .fb-btn{
  font-family:'Baloo 2', sans-serif;
  font-weight:700; font-size:0.94rem;
  border:none; border-radius:999px;
  padding:12px 26px;
  cursor:pointer;
  transition:transform 0.18s cubic-bezier(.34,1.56,.64,1);
}
.game-flappy-wrap .fb-btn:hover{ transform:translateY(-2px); }
.game-flappy-wrap .fb-btn:active{ transform:translateY(0) scale(0.95); }
.game-flappy-wrap .fb-btn-primary{
  background:linear-gradient(135deg, #CDEAC0, #E4F5DC);
  color:#2E6B48;
  box-shadow:var(--fbz-shadow-sm);
}

@media (prefers-reduced-motion: reduce){
  .game-flappy-wrap .fb-hint{ animation:none !important; }
  .game-flappy-wrap .fb-modal, .game-flappy-wrap .fb-modal-overlay, .game-flappy-wrap .fb-new-best{ transition:none !important; animation:none !important; }
}

/* ============================================================
   GAME: Block Space
   Scoped to .game-blockspace-wrap. Strategic block-placement
   puzzle, 10x10 grid, DOM-based (drag & drop grid cells rather
   than canvas — better suited to discrete grid hit-testing).
   Structure/logic lives in assets/js/games/block-space.js
   ============================================================ */
.game-blockspace-wrap{
  --bsp-board-bg:#F1F2F0;
  --bsp-cell-empty:#E4E6E3;
  --bsp-ink:#4A4A48;
  --bsp-ink-soft:#8A8C87;
  --bsp-shadow: 0 20px 44px -22px rgba(90,95,90,0.28);
  --bsp-shadow-sm: 0 8px 18px -12px rgba(90,95,90,0.22);
  --bs-cell-size: 26px; /* fixed square size for block-preview cells (tray + drag ghost) — NEVER width:100%, or non-square shapes (e.g. a 1-col x 5-row piece) stretch into bars instead of staying square */
  background: linear-gradient(180deg, #EAF4F4, #F5F0E8);
  border-radius:28px;
  padding:22px 18px 26px;

  display:flex;
  justify-content:center;
  font-family:'Nunito', sans-serif;
  color:var(--bsp-ink);
}

@media (max-width:600px){ .game-blockspace-wrap{ --bs-cell-size: 22px; } }
@media (max-width:380px){ .game-blockspace-wrap{ --bs-cell-size: 18px; } }

.game-blockspace-wrap *{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }

.game-blockspace-wrap .bs-shell{
  width:min(94vw, 480px);
  display:flex;
  flex-direction:column;
  align-items:center;
  position:relative;
}

/* ---------- stats ---------- */
.game-blockspace-wrap .bs-stats{
  display:flex; align-items:center; gap:10px;
  margin-bottom:16px; flex-wrap:wrap; justify-content:center;
}
.game-blockspace-wrap .bs-stat-badge{
  background:#FFFFFF;
  color:var(--bsp-ink);
  font-family:'Baloo 2', sans-serif;
  font-weight:700; font-size:0.78rem; letter-spacing:0.03em;
  padding:8px 14px;
  border-radius:14px;
  box-shadow:var(--bsp-shadow-sm);
}
.game-blockspace-wrap .bs-sound-btn{
  width:34px; height:34px; border-radius:50%;
  border:none; cursor:pointer;
  background:#FFFFFF;
  font-size:0.95rem;
  display:flex; align-items:center; justify-content:center;
  box-shadow:var(--bsp-shadow-sm);
  transition:transform 0.18s ease;
}
.game-blockspace-wrap .bs-sound-btn:hover{ transform:scale(1.08); }

/* ---------- board ---------- */
.game-blockspace-wrap .bs-board-area{
  position:relative;
  width:100%;
  margin-bottom:20px;
}
.game-blockspace-wrap .bs-board{
  width:100%;
  aspect-ratio:1/1;
  background:var(--bsp-board-bg);
  border-radius:18px;
  padding:min(1.6vw,8px);
  box-shadow:var(--bsp-shadow);
  display:grid;
  grid-template-columns:repeat(10,1fr);
  grid-template-rows:repeat(10,1fr);
  gap:min(0.9vw,4px);
  transition:transform 0.15s ease;
  touch-action:none;
}
.game-blockspace-wrap .bs-board.pulse{ animation: bsp-boardPulse 0.26s ease; }
@keyframes bsp-boardPulse{ 0%,100%{ transform:scale(1); } 50%{ transform:scale(1.012); } }

.game-blockspace-wrap .bs-cell{
  background:var(--bsp-cell-empty);
  border-radius:6px;
  box-shadow:inset 0 1px 3px rgba(0,0,0,0.06);
  transition:background 0.15s ease;
}
.game-blockspace-wrap .bs-cell.filled{
  box-shadow:inset 0 -2px 3px rgba(0,0,0,0.12), inset 0 1px 2px rgba(255,255,255,0.5);
}
.game-blockspace-wrap .bs-cell.just-placed{ animation: bsp-cellPlace 0.24s ease-out; }
@keyframes bsp-cellPlace{
  0%{ transform:scale(1); }
  40%{ transform:scale(1.08); }
  70%{ transform:scale(0.96); }
  100%{ transform:scale(1); }
}
.game-blockspace-wrap .bs-cell.clearing{
  animation: bsp-cellClear 0.3s ease-out forwards;
}
@keyframes bsp-cellClear{
  0%{ transform:scale(1); opacity:1; filter:brightness(1); }
  35%{ transform:scale(1.06); filter:brightness(1.3); }
  100%{ transform:scale(0.82); opacity:0; }
}
.game-blockspace-wrap .bs-cell.preview-valid{
  background:rgba(120,168,155,0.45);
  box-shadow:inset 0 0 0 2px rgba(120,168,155,0.6);
}
.game-blockspace-wrap .bs-cell.preview-invalid{
  background:rgba(150,140,135,0.35);
  box-shadow:inset 0 0 0 2px rgba(150,140,135,0.45);
}

/* score popups */
.game-blockspace-wrap .bs-popup-layer{
  position:absolute; inset:0;
  pointer-events:none;
  overflow:visible;
  z-index:15;
}
.game-blockspace-wrap .bs-score-popup{
  position:absolute;
  top:6%;
  transform:translateX(-50%);
  font-family:'Baloo 2', sans-serif;
  font-weight:700;
  font-size:1rem;
  color:#5A8478;
  animation: bsp-popupFloat 0.95s ease-out forwards;
}
@keyframes bsp-popupFloat{
  0%{ opacity:0; transform:translate(-50%,4px) scale(0.85); }
  25%{ opacity:1; transform:translate(-50%,-4px) scale(1.05); }
  100%{ opacity:0; transform:translate(-50%,-46px) scale(1); }
}
.game-blockspace-wrap .bs-particle{
  position:absolute;
  width:6px; height:6px;
  border-radius:2px;
  transform:translate(-50%,-50%);
  animation: bsp-particleFly 0.5s ease-out forwards;
}
@keyframes bsp-particleFly{
  0%{ transform:translate(-50%,-50%) translate(0,0) scale(1); opacity:1; }
  100%{ transform:translate(-50%,-50%) translate(var(--px),var(--py)) scale(0.4); opacity:0; }
}

/* combo toast */
.game-blockspace-wrap .bs-combo-toast{
  position:absolute; left:50%; top:38%;
  transform:translate(-50%,8px);
  background:rgba(255,255,255,0.92);
  color:var(--bsp-ink);
  font-family:'Baloo 2', sans-serif;
  font-weight:700; font-size:1.05rem;
  padding:9px 20px;
  border-radius:999px;
  box-shadow:var(--bsp-shadow-sm);
  opacity:0;
  pointer-events:none;
  transition:opacity 0.28s ease, transform 0.28s ease;
  z-index:16;
  white-space:nowrap;
}
.game-blockspace-wrap .bs-combo-toast.show{ opacity:1; transform:translate(-50%,0); }

/* ---------- block tray ---------- */
.game-blockspace-wrap .bs-blocks-tray{
  width:100%;
  display:flex;
  gap:10px;
  justify-content:center;
  min-height:96px;
}
.game-blockspace-wrap .bs-block-slot{
  flex:1;
  max-width:120px;
  aspect-ratio:1/1;
  background:rgba(255,255,255,0.55);
  border-radius:16px;
  box-shadow:var(--bsp-shadow-sm);
  display:flex; align-items:center; justify-content:center;
  padding:10px;
  cursor:grab;
  transition:transform 0.18s cubic-bezier(.34,1.56,.64,1), box-shadow 0.18s ease, background 0.18s ease;
  touch-action:none;
}
.game-blockspace-wrap .bs-block-slot.empty{ background:rgba(255,255,255,0.25); box-shadow:none; }
.game-blockspace-wrap .bs-block-slot.selected{
  transform:translateY(-6px) scale(1.05);
  background:rgba(255,255,255,0.85);
  box-shadow:0 14px 24px -12px rgba(90,95,90,0.35);
}
.game-blockspace-wrap .bs-block-slot.spawn-in{ animation: bsp-slotSpawn 0.36s cubic-bezier(.34,1.56,.64,1); }
@keyframes bsp-slotSpawn{
  0%{ transform:scale(0.8); opacity:0.3; }
  60%{ transform:scale(1.05); opacity:1; }
  100%{ transform:scale(1); opacity:1; }
}
.game-blockspace-wrap .bs-block-slot.shake{ animation: bsp-shake 0.32s ease; }
@keyframes bsp-shake{
  0%,100%{ transform:translateX(0); }
  25%{ transform:translateX(-5px); }
  50%{ transform:translateX(5px); }
  75%{ transform:translateX(-3px); }
}

.game-blockspace-wrap .bs-mini-grid{
  display:grid;
  gap:2px;
  /* width/height intentionally NOT set to 100% — the grid's overall size
     comes from its tracks below (fixed --bs-cell-size per track), so a
     5-wide shape and a 1-wide shape each render at their true proportions
     instead of both stretching to fill the same square slot. */
}
.game-blockspace-wrap .bs-mini-cell{
  width:var(--bs-cell-size);
  height:var(--bs-cell-size);
  aspect-ratio:1/1;
  border-radius:4px;
  box-shadow:inset 0 -1px 2px rgba(0,0,0,0.15), inset 0 1px 1px rgba(255,255,255,0.5);
}
.game-blockspace-wrap .bs-mini-cell.empty{ background:transparent; box-shadow:none; }

/* ---------- drag ghost ---------- */
.game-blockspace-wrap .bs-ghost{
  position:fixed;
  left:0; top:0;
  pointer-events:none;
  z-index:50;
  opacity:0;
  filter:drop-shadow(0 10px 14px rgba(0,0,0,0.2));
}
.game-blockspace-wrap .bs-ghost.active{ opacity:0.92; }
.game-blockspace-wrap .bs-ghost .bs-mini-grid{ gap:min(0.9vw,4px); }
.game-blockspace-wrap .bs-ghost .bs-mini-cell{
  /* the ghost's grid tracks are sized in JS to match the board's actual
     cell size (in px, via inline style) — so here the cell must fill
     that track completely rather than using the small fixed tray size. */
  width:100%; height:100%;
  border-radius:6px;
}

/* ---------- modal ---------- */
.game-blockspace-wrap .bs-modal-overlay{
  position:fixed; inset:0;
  background:rgba(74,74,72,0.35);
  display:flex; align-items:center; justify-content:center;
  padding:20px;
  z-index:60;
  opacity:0; pointer-events:none;
  transition:opacity 0.25s ease;
}
.game-blockspace-wrap .bs-modal-overlay.open{ opacity:1; pointer-events:auto; }

.game-blockspace-wrap .bs-modal{
  background:linear-gradient(180deg, #FFFFFF, #FBFAF6);
  border-radius:24px;
  padding:28px 26px 24px;
  max-width:340px; width:100%;
  text-align:center;
  box-shadow:0 24px 55px rgba(90,95,90,0.35);
  border-top:5px solid #78A89B;
  transform:translateY(14px) scale(0.96);
  opacity:0;
  transition:transform 0.25s ease, opacity 0.25s ease;
}
.game-blockspace-wrap .bs-modal-overlay.open .bs-modal{ transform:translateY(0) scale(1); opacity:1; }

.game-blockspace-wrap .bs-modal-emoji{ font-size:2.1rem; margin-bottom:6px; }
.game-blockspace-wrap .bs-modal h2{
  font-family:'Baloo 2', sans-serif;
  font-weight:700; font-size:1.25rem;
  color:var(--bsp-ink);
  margin:0 0 8px;
}
.game-blockspace-wrap .bs-modal p{
  font-size:0.86rem; color:var(--bsp-ink-soft);
  line-height:1.5; margin:0 0 14px;
}
.game-blockspace-wrap .bs-modal-stats{
  display:flex; flex-direction:column; gap:5px;
  background:#EAF4F4;
  border-radius:14px;
  padding:12px;
  font-weight:700; font-size:0.85rem;
  margin-bottom:8px;
}
.game-blockspace-wrap .bs-new-record{
  font-weight:700; font-size:0.82rem;
  color:#B98A2E;
  margin-bottom:14px !important;
  animation: bsp-newRecordPop 0.5s var(--ease-bounce, ease);
}
.game-blockspace-wrap .bs-new-record.hidden{ display:none; }
@keyframes bsp-newRecordPop{ 0%{ transform:scale(0.8); opacity:0; } 60%{ transform:scale(1.1); } 100%{ transform:scale(1); opacity:1; } }

.game-blockspace-wrap .bs-btn{
  font-family:'Baloo 2', sans-serif;
  font-weight:700; font-size:0.94rem;
  border:none; border-radius:999px;
  padding:12px 26px;
  cursor:pointer;
  transition:transform 0.18s cubic-bezier(.34,1.56,.64,1);
}
.game-blockspace-wrap .bs-btn:hover{ transform:translateY(-2px); }
.game-blockspace-wrap .bs-btn:active{ transform:translateY(0) scale(0.95); }
.game-blockspace-wrap .bs-btn-primary{
  background:linear-gradient(135deg, #A9C9BD, #CFE3D9);
  color:#33564A;
  box-shadow:var(--bsp-shadow-sm);
}

@media (max-width:380px){
  .game-blockspace-wrap{ padding:18px 12px 20px; }
  .game-blockspace-wrap .bs-stat-badge{ font-size:0.7rem; padding:7px 10px; }
}

@media (prefers-reduced-motion: reduce){
  .game-blockspace-wrap .bs-cell.just-placed, .game-blockspace-wrap .bs-cell.clearing,
  .game-blockspace-wrap .bs-board.pulse, .game-blockspace-wrap .bs-block-slot.spawn-in,
  .game-blockspace-wrap .bs-block-slot.shake, .game-blockspace-wrap .bs-score-popup,
  .game-blockspace-wrap .bs-particle, .game-blockspace-wrap .bs-new-record{
    animation:none !important;
  }
  .game-blockspace-wrap .bs-cell.clearing{ opacity:0.15; }
}

/* ============================================================
   GAME: 2048 (pastel edition)
   Everything below is scoped to .game-2048-wrap so it can keep
   its own font/colour system without touching the rest of the
   site. Structure/logic lives in assets/js/games/game-2048.js
   ============================================================ */
.game-2048-wrap{
  --g2048-bg-2:#F3E9F7;
  --g2048-ink:#5B4B63;
  --g2048-ink-soft:#8B7B93;
  --g2048-panel:#FFFFFF;
  --g2048-board-bg:#E4D9F2;
  --g2048-cell:#F1E9F8;
  --g2048-accent-pink:#F6A9B7;
  --g2048-accent-mint:#A9E0C9;
  --g2048-accent-blue:#AFD9F2;
  --g2048-shadow: 0 12px 30px rgba(139, 112, 150, 0.18);
  --g2048-shadow-soft: 0 4px 14px rgba(139, 112, 150, 0.12);

  --g2048-t2-bg:#FFF9F0;    --g2048-t2-fg:#9C8A76;
  --g2048-t4-bg:#FFE3C2;    --g2048-t4-fg:#8C6A40;
  --g2048-t8-bg:#FFF0A6;    --g2048-t8-fg:#8C7A26;
  --g2048-t16-bg:#D6F0D2;   --g2048-t16-fg:#3E6B39;
  --g2048-t32-bg:#B7ECD3;   --g2048-t32-fg:#25664D;
  --g2048-t64-bg:#BAE3F7;   --g2048-t64-fg:#295E7A;
  --g2048-t128-bg:#DACFF2;  --g2048-t128-fg:#523C7D;
  --g2048-t256-bg:#F7D2E4;  --g2048-t256-fg:#7A3B5C;
  --g2048-t512-bg:#FDB3A6;  --g2048-t512-fg:#ffffff;
  --g2048-t1024-bg:#C79EE8; --g2048-t1024-fg:#ffffff;
  --g2048-t2048-bg:#FFD466; --g2048-t2048-fg:#6B4A00;
  --g2048-thigh-bg:linear-gradient(135deg,#F79ABE,#B98CE8); --g2048-thigh-fg:#ffffff;

  font-family:'Nunito', sans-serif;
  color:var(--g2048-ink);
  display:flex;
  justify-content:center;
}

.game-2048-wrap .app{
  width:min(94vw, 440px);
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:14px;
  margin:0 auto;
}

.game-2048-wrap header{
  width:100%;
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:10px;
}

.game-2048-wrap .title-block h1{
  font-family:'Baloo 2', sans-serif;
  font-weight:800;
  font-size:clamp(1.7rem, 6vw, 2.2rem);
  margin:0;
  color:var(--g2048-ink);
  letter-spacing:0.5px;
}

.game-2048-wrap .title-block p{
  margin:2px 0 0;
  font-size:0.85rem;
  color:var(--g2048-ink-soft);
  font-weight:600;
}

.game-2048-wrap .scores{
  display:flex;
  gap:8px;
  align-items:center;
}

.game-2048-wrap .icon-btn{
  padding:0;
  width:44px;
  height:44px;
  min-width:44px;
  font-size:1.15rem;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:50%;
}

.game-2048-wrap .score-box{
  background:var(--g2048-panel);
  border-radius:14px;
  padding:8px 14px;
  text-align:center;
  box-shadow:var(--g2048-shadow-soft);
  min-width:68px;
}

.game-2048-wrap .score-box .label{
  font-size:0.62rem;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:0.6px;
  color:var(--g2048-ink-soft);
}

.game-2048-wrap .score-box .value{
  font-family:'Baloo 2', sans-serif;
  font-size:1.2rem;
  font-weight:700;
  color:var(--g2048-ink);
}

.game-2048-wrap .board-wrap{
  position:relative;
  width:100%;
  aspect-ratio:1/1;
  background:var(--g2048-board-bg);
  border-radius:22px;
  box-shadow:var(--g2048-shadow);
  padding:min(2.5vw, 12px);
  touch-action:none;
  -webkit-user-select:none;
  user-select:none;
  -webkit-touch-callout:none;
}

.game-2048-wrap .cells-layer, .game-2048-wrap .tiles-layer{
  position:absolute;
  inset:min(2.5vw, 12px);
  display:grid;
  grid-template-columns:repeat(4, 1fr);
  grid-template-rows:repeat(4, 1fr);
  gap:min(2.2vw, 10px);
}

.game-2048-wrap .cell{
  background:var(--g2048-cell);
  border-radius:14px;
}

.game-2048-wrap .tiles-layer{
  pointer-events:none;
}

.game-2048-wrap .tile{
  position:absolute;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:14px;
  font-family:'Baloo 2', sans-serif;
  font-weight:700;
  box-shadow: 0 3px 8px rgba(139,112,150,0.15);
  transition: top 0.13s ease, left 0.13s ease, width 0.13s ease, height 0.13s ease;
  will-change: top, left;
}

.game-2048-wrap .tile.spawning{ animation: g2048-spawnIn 0.18s ease-out; }
.game-2048-wrap .tile.merging::after{
  content:'';
  position:absolute;
  inset:0;
  border-radius:14px;
  animation: g2048-mergePulse 0.18s ease-out;
}

@keyframes g2048-spawnIn{
  0%{ transform:scale(0.3); opacity:0; }
  70%{ transform:scale(1.08); opacity:1; }
  100%{ transform:scale(1); opacity:1; }
}
@keyframes g2048-mergePulse{
  0%{ box-shadow: 0 0 0 0 rgba(255,255,255,0.6); }
  100%{ box-shadow: 0 0 0 14px rgba(255,255,255,0); }
}

.game-2048-wrap .t2   { background:var(--g2048-t2-bg);   color:var(--g2048-t2-fg); }
.game-2048-wrap .t4   { background:var(--g2048-t4-bg);   color:var(--g2048-t4-fg); }
.game-2048-wrap .t8   { background:var(--g2048-t8-bg);   color:var(--g2048-t8-fg); }
.game-2048-wrap .t16  { background:var(--g2048-t16-bg);  color:var(--g2048-t16-fg); }
.game-2048-wrap .t32  { background:var(--g2048-t32-bg);  color:var(--g2048-t32-fg); }
.game-2048-wrap .t64  { background:var(--g2048-t64-bg);  color:var(--g2048-t64-fg); }
.game-2048-wrap .t128 { background:var(--g2048-t128-bg); color:var(--g2048-t128-fg); }
.game-2048-wrap .t256 { background:var(--g2048-t256-bg); color:var(--g2048-t256-fg); }
.game-2048-wrap .t512 { background:var(--g2048-t512-bg); color:var(--g2048-t512-fg); }
.game-2048-wrap .t1024{ background:var(--g2048-t1024-bg);color:var(--g2048-t1024-fg); }
.game-2048-wrap .t2048{ background:var(--g2048-t2048-bg);color:var(--g2048-t2048-fg); box-shadow: 0 0 0 3px rgba(255,255,255,0.6), 0 4px 12px rgba(139,112,150,0.25); }
.game-2048-wrap .thigh{ background:var(--g2048-thigh-bg);color:var(--g2048-thigh-fg); }

.game-2048-wrap .digits-4 .num{ font-size:clamp(0.95rem, 5.6vw, 1.4rem); }
.game-2048-wrap .digits-3 .num{ font-size:clamp(1.15rem, 6.4vw, 1.7rem); }
.game-2048-wrap .digits-2 .num{ font-size:clamp(1.4rem, 7.4vw, 2rem); }
.game-2048-wrap .digits-1 .num{ font-size:clamp(1.6rem, 8.4vw, 2.2rem); }

.game-2048-wrap footer.instructions{
  font-size:0.82rem;
  color:var(--g2048-ink-soft);
  font-weight:700;
  text-align:center;
}

.game-2048-wrap .controls-row{
  display:flex;
  gap:10px;
}

.game-2048-wrap .btn{
  font-family:'Baloo 2', sans-serif;
  font-weight:700;
  font-size:0.9rem;
  padding:12px 20px;
  min-height:44px;
  min-width:44px;
  border-radius:14px;
  border:none;
  cursor:pointer;
  color:var(--g2048-ink);
  background:var(--g2048-panel);
  box-shadow:var(--g2048-shadow-soft);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.game-2048-wrap .btn:hover{ transform:translateY(-1px); }
.game-2048-wrap .btn:active{ transform:translateY(0); }
.game-2048-wrap .btn:focus-visible{ outline:3px solid var(--g2048-accent-blue); outline-offset:2px; }

.game-2048-wrap .btn-primary{ background:var(--g2048-accent-pink); color:#6b3547; }
.game-2048-wrap .btn-secondary{ background:var(--g2048-accent-mint); color:#255245; }

.game-2048-wrap .modal-overlay{
  position:fixed;
  inset:0;
  background:rgba(91, 75, 99, 0.35);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  z-index:70;
  opacity:0;
  pointer-events:none;
  transition:opacity 0.18s ease;
}
.game-2048-wrap .modal-overlay.open{ opacity:1; pointer-events:auto; }

.game-2048-wrap .modal{
  background:linear-gradient(180deg, #FFFFFF, #FDF8FB);
  border-radius:20px;
  padding:28px 26px 24px;
  max-width:340px;
  width:100%;
  text-align:center;
  box-shadow:0 20px 50px rgba(91,75,99,0.3);
  transform:translateY(14px) scale(0.96);
  opacity:0;
  transition: transform 0.22s ease, opacity 0.22s ease;
  border-top:5px solid var(--g2048-accent-pink);
}
.game-2048-wrap .modal-overlay.open .modal{ transform:translateY(0) scale(1); opacity:1; }
.game-2048-wrap .modal.gameover{ border-top-color:var(--g2048-accent-blue); }

.game-2048-wrap .modal h2{
  font-family:'Baloo 2', sans-serif;
  font-size:1.5rem;
  margin:0 0 6px;
}
.game-2048-wrap .modal p.sub{
  margin:0 0 16px;
  color:var(--g2048-ink-soft);
  font-weight:600;
  font-size:0.92rem;
}
.game-2048-wrap .modal .modal-score{
  font-family:'Baloo 2', sans-serif;
  font-size:1.7rem;
  font-weight:800;
  margin-bottom:18px;
  color:var(--g2048-ink);
}
.game-2048-wrap .modal .modal-buttons{
  display:flex;
  gap:10px;
  justify-content:center;
  flex-wrap:wrap;
}

@media (max-width: 380px){
  .game-2048-wrap .score-box{ min-width:56px; padding:6px 10px; }
}

@media (prefers-reduced-motion: reduce){
  .game-2048-wrap .tile, .game-2048-wrap .tile.spawning, .game-2048-wrap .modal, .game-2048-wrap .modal-overlay{ transition:none !important; animation:none !important; }
}

/* ============================================================
   GAME: Sliding Puzzle
   Scoped to .game-sliding-puzzle-wrap. Adapted from the uploaded
   "Daily Picture Puzzle" file — same 4x4 sliding board and cozy
   lavender palette, reframed around a search screen (Pexels API,
   falls back to a local cat photo) instead of a fixed daily image.
   Structure/logic lives in assets/js/games/sliding-puzzle.js
   ============================================================ */
.game-sliding-puzzle-wrap{
  --sp-cream:#FFF9F3;
  --sp-board-bg:#F3E9DD;
  --sp-soft-pink:#F6D9DC;
  --sp-peach:#FBE3C8;
  --sp-lavender:#E4DBF6;
  --sp-baby-blue:#DCEBF7;
  --sp-mint:#DCF3E6;
  --sp-ink:#463D4E;
  --sp-ink-soft:#8A7F91;
  --sp-ink-faint:#C2B9CC;
  --sp-accent:#A796D6;
  --sp-accent-strong:#8E7BC4;
  --sp-surface:#FFFDFB;
  --sp-shadow-soft: 0 10px 28px rgba(120,100,130,0.10);
  --sp-shadow-tile: 0 3px 10px rgba(120,100,130,0.16);
  --sp-radius-lg:26px;
  --sp-radius-md:18px;

  display:flex;
  justify-content:center;
  font-family:'Karla', sans-serif;
  color:var(--sp-ink);
}

.game-sliding-puzzle-wrap *{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
.game-sliding-puzzle-wrap .hidden{ display:none !important; }

.game-sliding-puzzle-wrap .sp-shell{
  position:relative;
  width:min(94vw, 480px);
  background:var(--sp-surface);
  border-radius:var(--sp-radius-lg);
  padding:26px 20px 30px;
  box-shadow:var(--sp-shadow-soft);
  border:1px solid rgba(167,150,214,0.10);
  text-align:center;
}

/* ---------- search / loading screens ---------- */
.game-sliding-puzzle-wrap .sp-screen{ padding:10px 0 4px; }
.game-sliding-puzzle-wrap .sp-play-area{ padding:4px 0 0; }
.game-sliding-puzzle-wrap .sp-search-emoji{ font-size:2.2rem; margin-bottom:6px; }
.game-sliding-puzzle-wrap .sp-screen h2{
  font-family:'Quicksand', sans-serif;
  font-weight:700; font-size:1.4rem;
  margin:4px 0 4px;
}
.game-sliding-puzzle-wrap .sp-subtitle{ color:var(--sp-ink-soft); font-size:0.92rem; margin:0 0 18px; }

.game-sliding-puzzle-wrap .sp-search-row{
  display:flex; gap:8px; margin-bottom:14px;
}
.game-sliding-puzzle-wrap .sp-search-row input{
  flex:1; min-width:0;
  font-family:'Karla', sans-serif;
  font-size:0.95rem;
  padding:12px 16px;
  border-radius:999px;
  border:1.5px solid rgba(167,150,214,0.25);
  background:var(--sp-cream);
  color:var(--sp-ink);
}
.game-sliding-puzzle-wrap .sp-search-row input:focus-visible{
  outline:none; border-color:var(--sp-accent);
  box-shadow:0 0 0 3px rgba(167,150,214,0.25);
}

.game-sliding-puzzle-wrap .sp-chip-row{
  display:flex; flex-wrap:wrap; justify-content:center; gap:8px; margin-bottom:8px;
}
.game-sliding-puzzle-wrap .sp-chip{
  font-family:'Karla', sans-serif; font-weight:700; font-size:0.82rem;
  padding:8px 14px; border-radius:999px;
  background:var(--sp-lavender); color:var(--sp-ink);
  border:none; cursor:pointer;
  transition:transform 0.15s ease;
}
.game-sliding-puzzle-wrap .sp-chip:hover{ transform:translateY(-1px); }

.game-sliding-puzzle-wrap .sp-inline-error{
  color:#B4485B; font-size:0.85rem; font-weight:600; margin-top:10px;
}

.game-sliding-puzzle-wrap .sp-spinner{
  width:36px; height:36px; margin:12px auto 14px;
  border-radius:50%;
  border:4px solid var(--sp-lavender);
  border-top-color:var(--sp-accent-strong);
  animation:sp-spin 0.8s linear infinite;
}
@keyframes sp-spin{ to{ transform:rotate(360deg); } }

/* ---------- stats ---------- */
.game-sliding-puzzle-wrap .sp-stats-row, .game-sliding-puzzle-wrap .sp-complete-stats{
  display:flex; justify-content:center; gap:34px; margin-bottom:16px;
}
.game-sliding-puzzle-wrap .sp-stat{ display:flex; flex-direction:column; align-items:center; gap:2px; }
.game-sliding-puzzle-wrap .sp-stat-label{
  font-size:0.7rem; font-weight:700; letter-spacing:0.12em; text-transform:uppercase; color:var(--sp-ink-faint);
}
.game-sliding-puzzle-wrap .sp-stat-value{
  font-family:'Quicksand', sans-serif; font-weight:700; font-size:1.25rem; color:var(--sp-ink);
}

/* ---------- board ---------- */
.game-sliding-puzzle-wrap .sp-board-wrapper{ display:flex; justify-content:center; margin-bottom:20px; }
.game-sliding-puzzle-wrap .sp-board{
  position:relative;
  width:min(84vw, 380px);
  aspect-ratio:1/1;
  background:var(--sp-board-bg);
  border-radius:var(--sp-radius-md);
  padding:8px;
  touch-action:none;
  outline:none;
  user-select:none;
}
.game-sliding-puzzle-wrap .sp-board:focus-visible{ box-shadow:0 0 0 3px var(--sp-accent); }

.game-sliding-puzzle-wrap .sp-tile-layer{
  position:relative; width:100%; height:100%;
  border-radius:calc(var(--sp-radius-md) - 8px);
  overflow:hidden;
}

.game-sliding-puzzle-wrap .sp-tile{
  position:absolute; width:25%; height:25%;
  background-repeat:no-repeat; background-size:400% 400%;
  border-radius:8px; box-shadow:var(--sp-shadow-tile);
  transition:transform 0.16s cubic-bezier(0.34,1.15,0.4,1);
  will-change:transform; cursor:grab; padding:2px;
}
.game-sliding-puzzle-wrap .sp-tile:active{ cursor:grabbing; }
.game-sliding-puzzle-wrap .sp-tile:focus-visible{ outline:3px solid var(--sp-accent); outline-offset:2px; z-index:5; }

/* ---------- controls ---------- */
.game-sliding-puzzle-wrap .sp-controls-row{ display:flex; justify-content:center; gap:12px; flex-wrap:wrap; }
.game-sliding-puzzle-wrap .sp-btn{
  font-family:'Quicksand', sans-serif; font-weight:600; font-size:0.95rem;
  padding:12px 24px; border-radius:999px;
  transition:transform 0.12s ease, box-shadow 0.12s ease;
  box-shadow:var(--sp-shadow-tile); border:none; cursor:pointer;
}
.game-sliding-puzzle-wrap .sp-btn:hover{ transform:translateY(-1px); }
.game-sliding-puzzle-wrap .sp-btn:active{ transform:translateY(0); }
.game-sliding-puzzle-wrap .sp-btn:focus-visible{ outline:3px solid var(--sp-accent-strong); outline-offset:2px; }
.game-sliding-puzzle-wrap .sp-btn-primary{ background:var(--sp-accent); color:#fff; }
.game-sliding-puzzle-wrap .sp-btn-hint{ background:var(--sp-peach); color:var(--sp-ink); }
.game-sliding-puzzle-wrap .sp-btn-ghost{ background:var(--sp-baby-blue); color:var(--sp-ink); }

/* ---------- hint overlay ---------- */
.game-sliding-puzzle-wrap .sp-hint-overlay, .game-sliding-puzzle-wrap .sp-complete-overlay{
  position:absolute; inset:0;
  background:rgba(70,61,78,0.42);
  display:flex; align-items:center; justify-content:center;
  padding:20px; z-index:20; border-radius:var(--sp-radius-lg);
}
.game-sliding-puzzle-wrap .sp-hint-modal{
  background:var(--sp-surface); border-radius:var(--sp-radius-lg);
  padding:14px; box-shadow:var(--sp-shadow-soft);
  max-width:min(90%, 380px);
}
.game-sliding-puzzle-wrap .sp-hint-modal img{
  display:block; width:100%; aspect-ratio:1/1; object-fit:cover; border-radius:var(--sp-radius-md);
}
.game-sliding-puzzle-wrap .sp-hint-timer{
  text-align:center; margin-top:10px;
  font-family:'Quicksand', sans-serif; font-weight:700; font-size:1.1rem; color:var(--sp-accent-strong);
}

/* ---------- completion overlay ---------- */
.game-sliding-puzzle-wrap .sp-complete-modal{
  background:var(--sp-surface); border-radius:var(--sp-radius-lg);
  padding:30px 24px; max-width:min(90%, 360px); text-align:center;
  box-shadow:var(--sp-shadow-soft);
  animation:sp-pop-in 0.3s ease;
}
@keyframes sp-pop-in{ from{ transform:scale(0.9); opacity:0; } to{ transform:scale(1); opacity:1; } }

.game-sliding-puzzle-wrap .sp-complete-mark{
  width:44px; height:44px; margin:0 auto 14px; border-radius:50%; background:var(--sp-mint); position:relative;
}
.game-sliding-puzzle-wrap .sp-complete-mark::after{
  content:""; position:absolute; left:13px; top:21px; width:8px; height:14px;
  border-right:3px solid #3E6B54; border-bottom:3px solid #3E6B54; transform:rotate(45deg);
}
.game-sliding-puzzle-wrap .sp-complete-modal h2{ font-family:'Quicksand', sans-serif; margin:4px 0 2px; }
.game-sliding-puzzle-wrap .sp-complete-modal p{ color:var(--sp-ink-soft); font-size:0.92rem; margin:0 0 10px; }
.game-sliding-puzzle-wrap .sp-complete-best{
  font-family:'Quicksand', sans-serif; font-weight:700; color:var(--sp-accent-strong); margin-bottom:16px !important;
}

/* ---------- sparkles ---------- */
.game-sliding-puzzle-wrap .sp-sparkle{
  position:absolute; pointer-events:none; width:8px; height:8px; border-radius:50%;
  animation:sp-sparkle-float 0.9s ease-out forwards;
}
@keyframes sp-sparkle-float{
  0%{ transform:translateY(0) scale(0.6); opacity:1; }
  100%{ transform:translateY(-42px) scale(1); opacity:0; }
}

/* ---------- toast ---------- */
.game-sliding-puzzle-wrap .sp-toast{
  position:absolute; left:50%; bottom:14px; transform:translate(-50%,10px);
  background:rgba(70,61,78,0.92); color:#fff;
  font-size:0.85rem; font-weight:600;
  padding:10px 18px; border-radius:999px;
  opacity:0; pointer-events:none;
  transition:opacity 0.3s ease, transform 0.3s ease;
  max-width:88%; text-align:center;
  z-index:30;
}
.game-sliding-puzzle-wrap .sp-toast.show{ opacity:1; transform:translate(-50%,0); }

@media (max-width:380px){
  .game-sliding-puzzle-wrap .sp-shell{ padding:20px 14px 24px; }
  .game-sliding-puzzle-wrap .sp-btn{ padding:10px 18px; font-size:0.88rem; }
}

@media (prefers-reduced-motion: reduce){
  .game-sliding-puzzle-wrap .sp-tile{ transition:none; }
  .game-sliding-puzzle-wrap .sp-complete-modal{ animation:none; }
  .game-sliding-puzzle-wrap .sp-sparkle{ display:none; }
  .game-sliding-puzzle-wrap .sp-spinner{ animation-duration:1.6s; }
}

/* ============================================================
   GAME: Minesweeper
   Scoped to .game-minesweeper-wrap. Modern pastel Minesweeper —
   soft lavender/dusty-blue/sage/teal palette, chain-reaction mine
   reveal on loss, satisfying reveal/flag/victory animations, and
   procedural Web Audio sound. Structure/logic lives in
   assets/js/games/minesweeper.js
   ============================================================ */
.game-minesweeper-wrap{
  --ms-cream:#FBF6EE;
  --ms-lavender:#E4DBF6;
  --ms-dusty-blue:#C7D9EC;
  --ms-sage:#CFE3D2;
  --ms-teal:#BFE3DE;
  --ms-yellow:#F0DB8C;
  --ms-ink:#3E3A45;
  --ms-ink-soft:#7A7585;
  --ms-ink-faint:#B3ADC0;
  --ms-accent:#8C6FB0;
  --ms-accent-strong:#6F5490;
  --ms-surface:#FFFFFF;
  --ms-shadow-soft: 0 12px 30px -14px rgba(60,50,80,0.28);
  --ms-shadow-cell: 0 2px 4px -1px rgba(60,50,80,0.18);
  --ms-radius-lg:24px;
  --ms-radius-md:14px;

  display:flex; justify-content:center;
  font-family:'Nunito', 'Inter', sans-serif;
  color:var(--ms-ink);
}
.game-minesweeper-wrap *{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
.game-minesweeper-wrap .hidden{ display:none !important; }

.game-minesweeper-wrap .ms-shell{
  position:relative;
  width:min(96vw, 720px);
  background:var(--ms-cream);
  border-radius:var(--ms-radius-lg);
  padding:22px 18px 26px;
  box-shadow:var(--ms-shadow-soft);
  text-align:center;
}

/* ---------- difficulty selector ---------- */
.game-minesweeper-wrap .ms-diff-row{
  display:flex; justify-content:center; gap:8px; margin-bottom:16px;
}
.game-minesweeper-wrap .ms-diff-btn{
  font-family:'Nunito', sans-serif; font-weight:800; font-size:13px;
  padding:8px 18px; border-radius:999px; border:none; cursor:pointer;
  background:var(--ms-surface); color:var(--ms-ink-soft);
  box-shadow: inset 0 0 0 1.5px rgba(140,111,176,0.2);
  transition: transform 150ms ease, background 150ms ease, color 150ms ease;
}
.game-minesweeper-wrap .ms-diff-btn:hover{ transform:translateY(-1px); }
.game-minesweeper-wrap .ms-diff-btn.active{
  background: linear-gradient(180deg, var(--ms-lavender), #D3C4EE);
  color:var(--ms-accent-strong);
  box-shadow: 0 6px 16px -8px rgba(140,111,176,0.5);
}

/* ---------- HUD (mines / face / timer) ---------- */
.game-minesweeper-wrap .ms-hud{
  display:flex; align-items:center; justify-content:center; gap:18px;
  margin-bottom:14px;
}
.game-minesweeper-wrap .ms-counter{
  background:var(--ms-ink); border-radius:var(--ms-radius-md);
  padding:8px 16px; min-width:74px;
  display:flex; flex-direction:column; align-items:center; gap:2px;
  box-shadow:var(--ms-shadow-cell);
}
.game-minesweeper-wrap .ms-counter-label{
  font-size:9.5px; font-weight:800; letter-spacing:0.12em; color:#B8AFCC;
}
.game-minesweeper-wrap .ms-counter-value{
  font-family:'Nunito', monospace; font-weight:800; font-size:22px;
  color:#F0DB8C; letter-spacing:0.06em; font-variant-numeric: tabular-nums;
}
.game-minesweeper-wrap .ms-face-btn{
  width:52px; height:52px; border-radius:50%; border:none; cursor:pointer;
  background:var(--ms-surface); font-size:26px;
  box-shadow: var(--ms-shadow-cell), inset 0 0 0 1.5px rgba(140,111,176,0.18);
  transition: transform 150ms cubic-bezier(.34,1.4,.4,1);
}
.game-minesweeper-wrap .ms-face-btn:hover{ transform:scale(1.08) rotate(-4deg); }
.game-minesweeper-wrap .ms-face-btn:active{ transform:scale(0.94); }

/* ---------- toolbar ---------- */
.game-minesweeper-wrap .ms-toolbar{
  display:flex; justify-content:center; gap:8px; flex-wrap:wrap; margin-bottom:8px;
}
.game-minesweeper-wrap .ms-tool-btn{
  font-family:'Nunito', sans-serif; font-weight:700; font-size:13px;
  padding:9px 14px; border-radius:999px; border:none; cursor:pointer;
  background:var(--ms-surface); color:var(--ms-ink);
  box-shadow: inset 0 0 0 1.5px rgba(60,50,80,0.1);
  transition: transform 150ms ease, background 150ms ease, color 150ms ease;
}
.game-minesweeper-wrap .ms-tool-btn:hover{ transform:translateY(-1px); }
.game-minesweeper-wrap .ms-tool-btn.active{
  background: linear-gradient(180deg, var(--ms-sage), #A9D2AF);
  color:#2E5C3A;
  box-shadow: 0 6px 14px -8px rgba(111,169,126,0.5);
}
.game-minesweeper-wrap .ms-hint{
  font-size:11.5px; color:var(--ms-ink-faint); margin:0 0 16px;
}

/* ---------- board ---------- */
.game-minesweeper-wrap .ms-board-scroll{
  overflow-x:auto; overflow-y:hidden; -webkit-overflow-scrolling:touch;
  padding-bottom:4px;
}
.game-minesweeper-wrap .ms-board{
  display:inline-grid;
  grid-template-columns: repeat(var(--ms-cols), var(--ms-cell-size, 36px));
  grid-auto-rows: var(--ms-cell-size, 36px);
  gap:3px;
  background:var(--ms-dusty-blue);
  padding:8px;
  border-radius:var(--ms-radius-md);
  margin:0 auto;
  position:relative;
}

.game-minesweeper-wrap .ms-cell{
  position:relative;
  border:none; border-radius:6px; cursor:pointer; padding:0;
  background: linear-gradient(160deg, #F3EDFB, var(--ms-lavender));
  box-shadow:
    inset 0 -2px 0 rgba(140,111,176,0.28),
    inset 0 2px 0 rgba(255,255,255,0.55);
  display:flex; align-items:center; justify-content:center;
  font-size: calc(var(--ms-cell-size, 36px) * 0.5);
  font-weight:800;
  transition: transform 120ms cubic-bezier(.34,1.4,.4,1), box-shadow 150ms ease, background 150ms ease;
  overflow:visible;
  -webkit-user-select:none; user-select:none;
  touch-action: manipulation;
}
.game-minesweeper-wrap .ms-cell:hover:not(.revealed){
  transform: translateY(-1px) scale(1.05);
  box-shadow:
    inset 0 -2px 0 rgba(140,111,176,0.28),
    inset 0 2px 0 rgba(255,255,255,0.65),
    0 0 0 2px rgba(140,111,176,0.35);
}
.game-minesweeper-wrap .ms-cell:active:not(.revealed){ transform: scale(0.92); }

.game-minesweeper-wrap .ms-cell.revealed{
  background:var(--ms-cream);
  box-shadow: inset 0 0 0 1px rgba(60,50,80,0.08);
  cursor:default;
}
.game-minesweeper-wrap .ms-cell.flagged{ background: linear-gradient(160deg, #F3EDFB, var(--ms-lavender)); }

.game-minesweeper-wrap .ms-num{ line-height:1; }
.game-minesweeper-wrap .ms-flag{ font-size:0.85em; display:inline-block; }
.game-minesweeper-wrap .ms-mine{ font-size:0.95em; display:inline-block; }

.game-minesweeper-wrap .ms-cell.mine.exploded{
  background: linear-gradient(160deg, #F6C199, #E08A5B);
  animation: ms-explode-shake 400ms ease;
}
.game-minesweeper-wrap .ms-cell.mine:not(.exploded){
  background: linear-gradient(160deg, #F3EDFB, #E2D6F5);
}
.game-minesweeper-wrap .ms-cell.wrong-flag{ background: linear-gradient(160deg, #F6C7C7, #E8A0A0); }
.game-minesweeper-wrap .ms-wrong-x{
  position:absolute; color:#8C2F2F; font-weight:900;
  font-size:0.75em; transform:translate(3px,-3px);
}

@keyframes ms-explode-shake{
  0%,100%{ transform:translate(0,0); }
  15%{ transform:translate(-3px,2px); }
  30%{ transform:translate(3px,-2px); }
  45%{ transform:translate(-3px,-1px); }
  60%{ transform:translate(3px,2px); }
  75%{ transform:translate(-2px,0); }
}

.game-minesweeper-wrap .ms-pop-in{ animation: ms-pop-in 220ms cubic-bezier(.34,1.4,.4,1); }
@keyframes ms-pop-in{
  0%{ transform:scale(0.7); opacity:0.4; }
  60%{ transform:scale(1.08); opacity:1; }
  100%{ transform:scale(1); }
}
.game-minesweeper-wrap .ms-mine-pop{ animation: ms-pop-in 260ms cubic-bezier(.34,1.4,.4,1); }
.game-minesweeper-wrap .ms-flag-pop .ms-flag{ display:inline-block; animation: ms-flag-pop 220ms cubic-bezier(.34,1.6,.4,1); }
@keyframes ms-flag-pop{
  0%{ transform:scale(0.4) rotate(-15deg); opacity:0.5; }
  70%{ transform:scale(1.15) rotate(4deg); }
  100%{ transform:scale(1) rotate(0); }
}

/* number colors — soft pastel but readable contrast, per the brief */
.game-minesweeper-wrap .ms-num{ }

/* ---------- shockwave / particles ---------- */
.game-minesweeper-wrap .ms-shockwave{
  position:absolute; left:50%; top:50%; width:10px; height:10px;
  border:3px solid rgba(224,138,91,0.75); border-radius:50%;
  transform:translate(-50%,-50%);
  animation: ms-shockwave-expand 600ms ease-out forwards;
  pointer-events:none;
}
@keyframes ms-shockwave-expand{
  0%{ width:10px; height:10px; opacity:0.9; }
  100%{ width:140px; height:140px; opacity:0; }
}

.game-minesweeper-wrap .ms-particle{
  position:absolute; left:50%; top:50%; width:6px; height:6px; border-radius:50%;
  transform:translate(-50%,-50%);
  animation: ms-particle-burst 600ms ease-out forwards;
  pointer-events:none;
}
.game-minesweeper-wrap .ms-particle-soft{
  width:4px; height:4px; background:var(--ms-accent);
  animation-duration: 480ms;
}
@keyframes ms-particle-burst{
  0%{ transform:translate(-50%,-50%) scale(1); opacity:1; }
  100%{ transform:translate(calc(-50% + var(--ms-dx)), calc(-50% + var(--ms-dy))) scale(0.3); opacity:0; }
}

.game-minesweeper-wrap .ms-confetti{
  position:absolute; top:-10px; width:8px; height:12px;
  border-radius:2px;
  animation: ms-confetti-fall 1.2s ease-in forwards;
  pointer-events:none;
}
@keyframes ms-confetti-fall{
  0%{ transform:translateY(0) rotate(0); opacity:1; }
  100%{ transform:translateY(320px) rotate(var(--ms-rot)); opacity:0; }
}

.game-minesweeper-wrap .ms-board.ms-victory-glow .ms-cell.revealed{
  animation: ms-victory-cell-glow 1.1s ease-in-out;
}
@keyframes ms-victory-cell-glow{
  0%,100%{ box-shadow: inset 0 0 0 1px rgba(60,50,80,0.08); }
  50%{ box-shadow: inset 0 0 0 1px rgba(60,50,80,0.08), 0 0 14px 2px rgba(140,111,176,0.55); }
}

.game-minesweeper-wrap.game-minesweeper-wrap .ms-screen-shake,
.game-minesweeper-wrap .ms-screen-shake{
  animation: ms-screen-shake 400ms ease;
}
@keyframes ms-screen-shake{
  0%,100%{ transform:translate(0,0); }
  20%{ transform:translate(-6px,3px); }
  40%{ transform:translate(5px,-3px); }
  60%{ transform:translate(-4px,-2px); }
  80%{ transform:translate(3px,2px); }
}

/* ---------- overlay (win / game over) ---------- */
.game-minesweeper-wrap .ms-overlay{
  position:absolute; inset:0;
  background:rgba(62,58,69,0.4);
  display:flex; align-items:center; justify-content:center;
  padding:20px; border-radius:var(--ms-radius-lg); z-index:20;
}
.game-minesweeper-wrap .ms-overlay-card{
  background:var(--ms-surface); border-radius:var(--ms-radius-lg);
  padding:30px 26px; max-width:min(90%,360px); text-align:center;
  box-shadow:var(--ms-shadow-soft);
  animation: ms-overlay-pop 320ms cubic-bezier(.34,1.3,.4,1);
}
@keyframes ms-overlay-pop{
  0%{ transform:scale(0.85); opacity:0; }
  100%{ transform:scale(1); opacity:1; }
}
.game-minesweeper-wrap .ms-overlay-icon{ font-size:40px; margin-bottom:6px; }
.game-minesweeper-wrap .ms-overlay-card h2{ font-family:'Nunito',sans-serif; margin:2px 0 6px; font-size:1.4rem; }
.game-minesweeper-wrap .ms-overlay-card p{ color:var(--ms-ink-soft); font-size:0.92rem; margin:0 0 16px; }
.game-minesweeper-wrap .ms-overlay-stats{ display:flex; justify-content:center; gap:30px; margin-bottom:10px; }
.game-minesweeper-wrap .ms-stat{ display:flex; flex-direction:column; gap:2px; }
.game-minesweeper-wrap .ms-stat-label{ font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:0.08em; color:var(--ms-ink-faint); }
.game-minesweeper-wrap .ms-stat-value{ font-family:'Nunito',sans-serif; font-weight:800; font-size:1.2rem; }
.game-minesweeper-wrap .ms-overlay-best{ font-weight:800; color:var(--ms-accent-strong); margin-bottom:16px !important; }
.game-minesweeper-wrap .ms-overlay-btn{
  font-family:'Nunito',sans-serif; font-weight:800; font-size:0.95rem;
  padding:12px 32px; border-radius:999px; border:none; cursor:pointer;
  background: linear-gradient(180deg, var(--ms-lavender), #D3C4EE);
  color:var(--ms-accent-strong);
  box-shadow: 0 10px 22px -10px rgba(140,111,176,0.6);
  transition: transform 150ms ease;
}
.game-minesweeper-wrap .ms-overlay-btn:hover{ transform:translateY(-2px); }
.game-minesweeper-wrap .ms-overlay-btn:active{ transform:translateY(0) scale(0.97); }

@media (max-width:480px){
  .game-minesweeper-wrap .ms-shell{ padding:18px 10px 22px; }
  .game-minesweeper-wrap .ms-counter{ min-width:62px; padding:6px 10px; }
  .game-minesweeper-wrap .ms-counter-value{ font-size:18px; }
  .game-minesweeper-wrap .ms-face-btn{ width:44px; height:44px; font-size:22px; }
}

@media (prefers-reduced-motion: reduce){
  .game-minesweeper-wrap .ms-cell,
  .game-minesweeper-wrap .ms-pop-in,
  .game-minesweeper-wrap .ms-mine-pop,
  .game-minesweeper-wrap .ms-flag-pop .ms-flag,
  .game-minesweeper-wrap .ms-cell.mine.exploded,
  .game-minesweeper-wrap .ms-overlay-card,
  .game-minesweeper-wrap .ms-screen-shake,
  .game-minesweeper-wrap .ms-board.ms-victory-glow .ms-cell.revealed{
    animation:none !important; transition:none !important;
  }
}
