/* ======================================================
   Mascot — Game Library CSS
   games.css
   ====================================================== */

.games-page {
  background-color: #F8F4FF; /* soft cream-purple */
  position: relative;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ── HEADER ── */
.player-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0.65rem 2rem;
  background: rgba(248, 244, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 2px solid rgba(156,122,245,0.2);
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1.1rem;
  background: rgba(255,143,171,0.18);
  border: 2px solid var(--clr-pink);
  border-radius: var(--r-full);
  color: var(--clr-pink);
  text-decoration: none;
  font-weight: 800;
  font-size: 0.9rem;
  translate: 0px;
  scale: 1;
  transition: scale 0.2s var(--ease-bounce), background 0.2s ease;
}
.back-btn:hover { scale: 1.08; background: rgba(255,143,171,0.3); }

/* Background pattern container */
.pattern-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-shape {
  position: absolute;
  opacity: 0.5;
  filter: blur(2px);
  animation: drift 20s infinite alternate ease-in-out;
}

@keyframes drift {
  0% { translate: 0 0; rotate: 0deg; }
  100% { translate: 30px -40px; rotate: 20deg; }
}

.library-main {
  position: relative;
  z-index: 10;
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2rem 6rem;
}

.library-header {
  text-align: center;
  margin-bottom: 3.5rem;
  animation: slideDown 0.8s var(--ease-bounce) both;
}

.library-title {
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 900;
  color: var(--clr-text);
  line-height: 1.1;
  text-shadow: 0 4px 0 rgba(0,0,0,0.08);
}
.library-desc {
  font-size: 1.4rem;
  color: var(--clr-text-soft);
  font-weight: 700;
  margin-top: 0.5rem;
}

/* ── THE GRID ── */
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 3.5rem 2.5rem;
}

/* ── THE CARD ── */
.lib-card {
  position: relative;
  outline: none;
  cursor: pointer;
  border-radius: var(--r-xl);
}

.lib-card:focus-visible {
  outline: 4px solid var(--clr-yellow);
  outline-offset: 6px;
}

/* PEEKABOO CHARACTER */
.peekaboo {
  position: absolute;
  top: 15px;
  right: 20px;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  translate: 0 0;
  rotate: 0deg;
  transition: all 0.5s var(--ease-bounce);
}
.peek-char {
  font-size: 3.5rem;
  line-height: 1;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
}
.peek-hand {
  font-size: 1.8rem;
  position: absolute;
  bottom: -10px;
  right: -15px;
  opacity: 0;
  transform-origin: bottom center;
  transition: opacity 0.2s ease;
}

.lib-card:hover .peekaboo,
.lib-card:focus-visible .peekaboo {
  translate: 25px -55px;
  rotate: 15deg;
}
.lib-card:hover .peek-hand,
.lib-card:focus-visible .peek-hand {
  opacity: 1;
  animation: waveHand 0.8s ease-in-out infinite alternate;
}

@keyframes waveHand {
  0% { rotate: -15deg; }
  100% { rotate: 35deg; }
}

/* CARD INNER */
.lib-card-inner {
  position: relative;
  z-index: 1;
  background: var(--card-bg, #fff);
  border-radius: var(--r-xl);
  padding: 2.5rem 1.5rem;
  text-align: center;
  border: 5px solid #fff;
  box-shadow: 0 12px 24px rgba(0,0,0,0.08);
  translate: 0 0;
  scale: 1;
  transition: transform 0.4s var(--ease-bounce), box-shadow 0.4s ease;
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.lib-card:hover .lib-card-inner,
.lib-card:focus-visible .lib-card-inner {
  scale: 1.05;
  translate: 0 -10px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.15);
}

/* GLOW EFFECT */
.lib-card-glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 0 var(--card-color);
  opacity: 0;
  transition: all 0.4s ease;
  z-index: 2;
  pointer-events: none;
}
.lib-card:hover .lib-card-glow,
.lib-card:focus-visible .lib-card-glow {
  opacity: 0.6;
  box-shadow: inset 0 0 40px 10px rgba(255,255,255,0.4), 0 0 50px 15px var(--card-color);
}

/* BIG ICONS */
.lib-icon {
  position: relative;
  width: 130px;
  height: 130px;
  margin: 0 auto 1.5rem;
  background: rgba(255,255,255,0.45);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 4px 12px rgba(255,255,255,0.9), 0 8px 16px rgba(0,0,0,0.1);
  transition: scale 0.4s var(--ease-bounce);
}
.lib-card:hover .lib-icon {
  scale: 1.15;
}

.main-icon {
  font-size: 4.5rem;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.2));
  z-index: 2;
  animation: floatIcon 3.5s ease-in-out infinite;
}

/* SUB ICONS (pop out on hover) */
.sub-icon {
  position: absolute;
  font-size: 2rem;
  z-index: 3;
  opacity: 0;
  scale: 0.3;
  transition: all 0.4s var(--ease-bounce);
}
.s1 { top: -5px; right: -5px; }
.s2 { bottom: -5px; left: -10px; }

.lib-card:hover .sub-icon {
  opacity: 1;
  scale: 1;
}
.lib-card:hover .s1 { translate: 25px -15px; rotate: 20deg; }
.lib-card:hover .s2 { translate: -20px 15px; rotate: -25deg; }

/* CONTENT */
.lib-content {
  flex: 1;
  position: relative;
  z-index: 3;
}
.lib-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: #2D1E4A;
  line-height: 1.1;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 4px rgba(255,255,255,0.5);
}
.lib-desc {
  font-size: 1.05rem;
  font-weight: 700;
  color: rgba(45, 30, 74, 0.75);
}

/* PLAY BUTTON (Inside card) */
.lib-play-btn {
  margin-top: 1.5rem;
  align-self: center;
  background: #fff;
  border: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 1.6rem;
  color: var(--card-color);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
  transition: scale 0.3s var(--ease-bounce), background 0.3s, color 0.3s, box-shadow 0.3s;
  cursor: pointer;
  z-index: 3;
}
.lib-card:hover .lib-play-btn {
  scale: 1.25;
  background: var(--card-color);
  color: #fff;
  box-shadow: 0 8px 24px var(--card-color);
}

@keyframes floatIcon {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -12px; rotate: 3deg; }
}

@keyframes slideDown {
  0% { translate: 0 -40px; opacity: 0; }
  100% { translate: 0 0; opacity: 1; }
}

/* RESPONSIVE */
@media (max-width: 600px) {
  .library-title { font-size: 2.8rem; }
  .library-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2.5rem 1.5rem; }
  .lib-card-inner { padding: 1.5rem 1rem; }
  .main-icon { font-size: 3.5rem; }
  .lib-icon { width: 100px; height: 100px; }
}

/* ════════════════════════════════════════════════════
   TOUCH FEEDBACK
════════════════════════════════════════════════════ */
.card-touch-active {
  scale: 0.97 !important;
  translate: 0 5px !important;
  transition: scale 0.1s ease, translate 0.1s ease !important;
}

/* ════════════════════════════════════════════════════
   VFX ANIMATIONS
════════════════════════════════════════════════════ */
@keyframes glowPulse {
  0%   { box-shadow: 0 0 0 0   rgba(82,217,164,0.9); }
  50%  { box-shadow: 0 0 40px 20px rgba(82,217,164,0.5); }
  100% { box-shadow: 0 0 0 0   rgba(82,217,164,0); }
}
.vfx-glow-success {
  animation: glowPulse 0.55s ease-out both;
}

@keyframes shakeAnim {
  0%,100% { translate: 0; }
  15%  { translate: -10px; }
  35%  { translate:  10px; }
  55%  { translate:  -7px; }
  75%  { translate:   7px; }
  90%  { translate:  -3px; }
}
.vfx-shake {
  animation: shakeAnim 0.45s ease both;
  background: rgba(255, 80, 80, 0.18) !important;
}

@keyframes popBounce {
  0%   { scale: 1; }
  35%  { scale: 1.45; }
  65%  { scale: 0.88; }
  100% { scale: 1; }
}
.vfx-pop {
  animation: popBounce 0.38s cubic-bezier(0.34,1.56,0.64,1) both;
}

/* ════════════════════════════════════════════════════
   GAME MODAL OVERLAY
════════════════════════════════════════════════════ */
.game-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(20, 10, 45, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: modalFadeIn 0.3s ease both;
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.game-modal[hidden] { display: none; }

.game-modal-inner {
  background: linear-gradient(160deg, #fff9ff 0%, #f0e8ff 100%);
  border-radius: 2.5rem;
  width: min(860px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 32px 80px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
  animation: modalSlideUp 0.38s cubic-bezier(0.34,1.4,0.64,1) both;
}
@keyframes modalSlideUp {
  from { transform: translateY(60px) scale(0.95); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

/* MODAL HEADER */
.game-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.8rem;
  border-bottom: 3px solid rgba(156,122,245,0.2);
  flex-shrink: 0;
}
.game-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.game-modal-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.18));
}
.game-modal-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  color: #2D1E4A;
  margin: 0;
}
.game-modal-controls {
  display: flex;
  gap: 0.7rem;
  align-items: center;
}
.game-modal-restart {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.95rem;
  padding: 0.55rem 1.2rem;
  background: #C8B6FF;
  color: #2D1E4A;
  border: none;
  border-radius: 2rem;
  cursor: pointer;
  transition: scale 0.2s var(--ease-bounce), background 0.2s;
}
.game-modal-restart:hover { scale: 1.08; background: #B3A0FF; }
.game-modal-close {
  font-size: 1.3rem;
  font-weight: 900;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: #FFB3C6;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: scale 0.2s var(--ease-bounce), background 0.2s;
}
.game-modal-close:hover { scale: 1.15; background: #FF8FAB; }

/* SCORE BAR */
.game-score-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.8rem 1.5rem;
  background: rgba(255,255,255,0.6);
  border-bottom: 2px solid rgba(0,0,0,0.05);
  flex-shrink: 0;
}
.score-stars {
  font-size: 1.6rem;
  letter-spacing: 0.1rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}
.score-label {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: #6B4EFF;
}

/* GAME CANVAS */
.game-canvas {
  flex: 1;
  padding: 1.8rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 340px;
  position: relative;
}

/* WIN SCREEN */
.game-win-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  background: linear-gradient(135deg, #fff 0%, #f0e8ff 100%);
  border-radius: 0 0 2.5rem 2.5rem;
  z-index: 10;
  animation: modalSlideUp 0.38s cubic-bezier(0.34,1.4,0.64,1) both;
}
.game-win-screen[hidden] { display: none; }
.win-emoji { font-size: 5rem; animation: popBounce 0.6s cubic-bezier(0.34,1.56,0.64,1) both; }
.win-title {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 900;
  color: #2D1E4A;
  margin: 0;
}
.win-sub {
  font-size: 1.1rem;
  font-weight: 700;
  color: #6B4EFF;
  margin: 0;
}
.win-play-again {
  margin-top: 0.5rem;
  padding: 0.85rem 2.2rem;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  background: linear-gradient(135deg, #9C7AF5, #FF8FAB);
  color: #fff;
  border: none;
  border-radius: 2rem;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(156,122,245,0.4);
  transition: scale 0.2s var(--ease-bounce);
}
.win-play-again:hover { scale: 1.08; }

/* ════════════════════════════════════════════════════
   SHAPES GAME
════════════════════════════════════════════════════ */
.shapes-canvas { gap: 1rem; }
.shapes-layout {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  flex-wrap: wrap;
  justify-content: center;
}
.shapes-pool, .shapes-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  flex: 1;
  min-width: 180px;
  max-width: 280px;
}
.shapes-arrow {
  font-size: 2.5rem;
  color: #C8B6FF;
  font-weight: 900;
  flex-shrink: 0;
}

/* Draggable piece */
.shape-piece {
  width: 80px;
  height: 80px;
  font-size: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 1.2rem;
  background: rgba(255,255,255,0.9);
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: box-shadow 0.2s ease, opacity 0.2s ease;
  will-change: left, top;
}
.shape-piece:hover { box-shadow: 0 10px 28px rgba(0,0,0,0.18); }
.shape-piece.dragging {
  cursor: grabbing;
  box-shadow: 0 20px 50px rgba(0,0,0,0.28);
  opacity: 0.9;
}
.shape-piece.matched { opacity: 0; pointer-events: none; }

/* Drop slot */
.shape-slot {
  width: 80px;
  height: 80px;
  border-radius: 1.2rem;
  border: 3px dashed rgba(156,122,245,0.4);
  background: rgba(200,182,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.shape-slot.slot-hover {
  background: rgba(200,182,255,0.35);
  border-color: #9C7AF5;
  box-shadow: 0 0 20px rgba(156,122,245,0.4);
}
.shape-slot.slot-done {
  border-style: solid;
  border-color: #52D9A4;
  background: rgba(82,217,164,0.15);
}
.slot-ghost {
  font-size: 2.8rem;
  opacity: 0.25;
  pointer-events: none;
}

/* ════════════════════════════════════════════════════
   COUNTING GAME
════════════════════════════════════════════════════ */
.counting-canvas { gap: 1.2rem; }
.counting-banner {
  text-align: center;
}
.counting-q {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  color: #2D1E4A;
}
.counting-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  justify-content: center;
  max-width: 480px;
}
.fruit-btn {
  font-size: 3rem;
  background: rgba(255,255,255,0.85);
  border: 3px solid rgba(255,207,71,0.5);
  border-radius: 1.2rem;
  width: 80px;
  height: 80px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
  animation: fruitAppear 0.5s cubic-bezier(0.34,1.56,0.64,1) both;
  transition: box-shadow 0.15s ease;
  touch-action: manipulation;
}
.fruit-btn:hover { box-shadow: 0 10px 26px rgba(0,0,0,0.18); }
.fruit-btn:active { scale: 0.9; }
.fruit-popped {
  animation: popBounce 0.3s cubic-bezier(0.34,1.56,0.64,1) both !important;
}
@keyframes fruitAppear {
  from { scale: 0; rotate: -30deg; opacity: 0; }
  to   { scale: 1; rotate: 0deg;   opacity: 1; }
}
.counting-counter {
  font-family: var(--font-display);
  font-size: 5rem;
  font-weight: 900;
  color: #FFCF47;
  text-shadow: 0 4px 0 rgba(0,0,0,0.12);
  line-height: 1;
}
.counting-reveal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  animation: modalSlideUp 0.4s cubic-bezier(0.34,1.4,0.64,1) both;
}
.reveal-number {
  font-family: var(--font-display);
  font-size: 7rem;
  font-weight: 900;
  color: #9C7AF5;
  line-height: 1;
}
.reveal-fruit { font-size: 3.5rem; }
.reveal-label {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  color: #52D9A4;
}

/* ════════════════════════════════════════════════════
   MEMORY GAME
════════════════════════════════════════════════════ */
.memory-canvas { gap: 1rem; }
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  width: 100%;
  max-width: 460px;
}

.mem-card {
  aspect-ratio: 1;
  perspective: 600px;
  cursor: pointer;
  border-radius: 1.2rem;
  animation: fruitAppear 0.45s cubic-bezier(0.34,1.56,0.64,1) both;
  touch-action: manipulation;
}
.mem-card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.38s cubic-bezier(0.4,0,0.2,1);
  border-radius: inherit;
}
.mem-card.is-flipped .mem-card-inner { transform: rotateY(180deg); }

.mem-card-front, .mem-card-back {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  backface-visibility: hidden;
  font-size: 2.6rem;
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
  border: 3px solid rgba(255,255,255,0.9);
}
.mem-card-front {
  background: linear-gradient(145deg, #C8B6FF, #9C7AF5);
  font-size: 2rem;
}
.mem-card-back {
  background: linear-gradient(145deg, #fff 0%, #f0e8ff 100%);
  transform: rotateY(180deg);
}
.mem-card.is-matched .mem-card-back {
  background: linear-gradient(145deg, #B8F0D8, #52D9A4);
  border-color: #52D9A4;
}

/* ════════════════════════════════════════════════════
   COMING SOON SCREEN
════════════════════════════════════════════════════ */
.coming-soon-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  padding: 2rem;
}
.cs-emoji { font-size: 5rem; animation: popBounce 0.5s cubic-bezier(0.34,1.56,0.64,1) both; }
.cs-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  color: #2D1E4A;
  margin: 0;
}
.cs-sub {
  font-size: 1.05rem;
  font-weight: 700;
  color: #9C7AF5;
  margin: 0;
}

/* ════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════ */

/* ── Tablet / large phone ── */
@media (max-width: 768px) {
  .player-header { padding: 0.55rem 1.2rem; }
  .library-title { font-size: 3rem; }
  .library-desc  { font-size: 1.2rem; }
  .library-main  { padding: 2rem 1.5rem 5rem; }
  .library-grid  { grid-template-columns: repeat(2, 1fr); gap: 2rem 1.2rem; }
}

/* ── Small phone ── */
@media (max-width: 600px) {
  .player-header { padding: 0.5rem 1rem; gap: 0.5rem; }
  /* shrink/hide the centre title so back-btn and logo fit */
  .header-logo .logo-text { font-size: 1.1rem; }

  .library-title { font-size: 2.2rem; }
  .library-desc  { font-size: 1rem; }
  .library-main  { padding: 1.5rem 1rem 4rem; }
  .library-grid  { grid-template-columns: 1fr; gap: 1.4rem; }

  .lib-card-inner { padding: 1.5rem 1rem; border-width: 3px; }
  .lib-icon       { width: 100px; height: 100px; margin-bottom: 0.7rem; }
  .main-icon      { font-size: 3.5rem; }
  .lib-title      { font-size: 1.5rem; }
  .lib-desc       { font-size: 0.82rem;
                    display: -webkit-box;
                    -webkit-box-orient: vertical;
                    -webkit-line-clamp: 2;
                    overflow: hidden; }
  .lib-play-btn   { width: 42px; height: 42px; font-size: 1.2rem; margin-top: 0.9rem; }
  .peekaboo       { top: 4px; right: 4px; }
  .peek-char      { font-size: 2rem; }
  .lib-card:hover .peekaboo,
  .lib-card:focus-visible .peekaboo {
    translate: 5px -25px;
  }
  .lib-card:hover .peek-hand,
  .lib-card:focus-visible .peek-hand {
    opacity: 1;
  }

  /* --- Game modal --- */
  .game-modal         { padding: 0.5rem; }
  .game-modal-inner   { border-radius: 1.4rem; max-height: 96vh; }
  .game-modal-header  { padding: 0.85rem 1rem; }
  .game-modal-title   { font-size: 1.1rem; }
  .game-modal-icon    { font-size: 1.4rem; }
  .game-modal-restart { font-size: 0.8rem; padding: 0.45rem 0.9rem; }
  .game-canvas        { padding: 1.2rem 0.8rem; min-height: 280px; }

  /* Shapes game */
  .shapes-pool, .shapes-board { max-width: 130px; gap: 0.5rem; }
  .shape-piece, .shape-slot   { width: 52px; height: 52px; font-size: 1.8rem; }
  .shapes-arrow               { display: none; }

  /* Memory game */
  .memory-grid             { gap: 0.45rem; }
  .mem-card-front,
  .mem-card-back           { font-size: 1.4rem; }

  /* Counting game */
  .fruit-btn      { width: 58px; height: 58px; font-size: 2rem; }
  .counting-counter { font-size: 3.8rem; }
  .reveal-number  { font-size: 5rem; }

  /* Win screen */
  .win-emoji  { font-size: 3.5rem; }
  .win-title  { font-size: 1.8rem; }
}

/* ── Extra small (≤ 400px) – single column grid ── */
@media (max-width: 400px) {
  .lib-desc      { -webkit-line-clamp: 3; }
}

/* ══════════════════════════════════════════════════
   GAME: COLORING ANIMALS
══════════════════════════════════════════════════ */
.coloring-canvas { display: flex; flex-direction: column; align-items: center; gap: 0.8rem; padding: 0.5rem; }
.coloring-title  { font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; color: var(--clr-text); text-align: center; }
.coloring-svg    { width: 100%; max-width: 300px; height: auto; touch-action: manipulation; }
.coloring-svg ellipse,
.coloring-svg polygon { cursor: pointer; transition: filter 0.15s ease; }
.coloring-svg ellipse:hover,
.coloring-svg polygon:hover { filter: brightness(1.15) drop-shadow(0 0 6px rgba(156,122,245,0.5)); }
.coloring-palette { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 280px; }
.color-swatch {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(0,0,0,0.15);
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.18s ease;
}
.color-swatch:hover  { transform: scale(1.25); }
.active-swatch { border: 4px solid #3D2C5A; transform: scale(1.3); box-shadow: 0 0 0 3px rgba(61,44,90,0.3); }

/* ══════════════════════════════════════════════════
   GAME: ALPHABET BUBBLES
══════════════════════════════════════════════════ */
.alphabet-canvas { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 0.5rem; overflow: hidden; }
.alpha-target {
  font-family: var(--font-display);
  font-size: 1.6rem; font-weight: 800;
  background: linear-gradient(135deg,#FF8FAB,#9C7AF5);
  color: #fff; border-radius: 2rem;
  padding: 0.5rem 1.5rem; text-align: center;
}
.alpha-letter { font-size: 2.4rem; font-weight: 900; margin-left: 0.3rem; }
.alpha-find   { font-size: 1rem; opacity: 0.85; }
.alpha-hint   { font-size: 1.1rem; font-weight: 700; color: var(--clr-text); min-height: 1.5rem; text-align: center; }
.alpha-field  { position: relative; width: 100%; height: 220px; overflow: hidden; border-radius: 1rem; background: linear-gradient(180deg,#E8F4FF 0%,#FFF3E0 100%); }

.alpha-bubble {
  position: absolute;
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.6);
  font-family: var(--font-display);
  font-size: 1.8rem; font-weight: 900;
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15), inset 0 -4px 8px rgba(0,0,0,0.1);
  animation: bubbleRise linear forwards;
  transition: transform 0.15s ease;
}
.alpha-bubble:hover { transform: scale(1.15); }
@keyframes bubbleRise {
  from { bottom: -80px; opacity: 1; }
  to   { bottom: 110%;  opacity: 0.6; }
}
.bubble-popped { animation: bubblePop 0.4s ease forwards !important; }
@keyframes bubblePop {
  0%   { transform: scale(1); opacity: 1; }
  50%  { transform: scale(1.5); }
  100% { transform: scale(0); opacity: 0; }
}
.bubble-wrong { outline: 4px solid #FF4757; animation: none !important; }

/* ══════════════════════════════════════════════════
   GAME: PUZZLE TIME
══════════════════════════════════════════════════ */
.puzzle-canvas { display: flex; flex-direction: column; align-items: center; gap: 0.8rem; padding: 0.5rem; }
.puzzle-title  { font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; color: var(--clr-text); text-align: center; }
.puzzle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 240px;
  background: rgba(156,122,245,0.1);
  border-radius: 1rem;
  padding: 8px;
}
.puzzle-tile {
  width: 72px; height: 72px;
  font-size: 2.4rem;
  border-radius: 0.75rem;
  border: 3px solid rgba(156,122,245,0.3);
  background: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.15s ease;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}
.puzzle-tile:hover  { transform: scale(1.08); box-shadow: 0 6px 18px rgba(156,122,245,0.3); }
.puzzle-tile:active { transform: scale(0.95); }
.puzzle-blank {
  width: 72px; height: 72px;
  border-radius: 0.75rem;
  background: rgba(156,122,245,0.08);
  border: 3px dashed rgba(156,122,245,0.25);
}
.puzzle-moves { font-size: 0.9rem; font-weight: 700; color: var(--clr-text-soft); text-align: center; }

/* ══════════════════════════════════════════════════
   GAME: MUSIC MAKER
══════════════════════════════════════════════════ */
.music-canvas { display: flex; flex-direction: column; align-items: center; gap: 0.7rem; padding: 0.5rem; }
.music-status { font-family: var(--font-display); font-size: 1.1rem; font-weight: 800; text-align: center; color: var(--clr-text); min-height: 1.8rem; }
.music-pattern-display { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; min-height: 46px; align-items: center; }
.pattern-dot {
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 1.3rem;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(255,255,255,0.5);
  animation: dotIn 0.25s cubic-bezier(0.34,1.56,0.64,1) both;
}
@keyframes dotIn { from { transform: scale(0); } to { transform: scale(1); } }

.music-pad-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; max-width: 300px; }
.music-pad {
  height: 68px;
  border-radius: 1rem;
  border: 3px solid rgba(255,255,255,0.4);
  font-size: 2rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s cubic-bezier(0.34,1.56,0.64,1), filter 0.15s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15), 0 6px 0 rgba(0,0,0,0.2);
}
.music-pad:hover  { transform: translateY(-3px); filter: brightness(1.1); }
.music-pad:active { transform: translateY(3px); box-shadow: 0 1px 4px rgba(0,0,0,0.15); }
.pad-active { transform: scale(0.92) translateY(4px) !important; filter: brightness(1.3) !important; box-shadow: 0 1px 4px rgba(0,0,0,0.1), 0 0 16px rgba(255,207,71,0.5) !important; }

/* ══════════════════════════════════════════════════
   GAME: PET CARE
══════════════════════════════════════════════════ */
.petcare-canvas { display: flex; flex-direction: column; align-items: center; gap: 0.7rem; padding: 0.5rem; }
.pet-face  { font-size: 5rem; animation: petBounce 2s ease-in-out infinite; }
@keyframes petBounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.pet-mood  { font-size: 1.1rem; font-weight: 800; color: var(--clr-text); text-align: center; }

.pet-bars  { width: 100%; max-width: 300px; display: flex; flex-direction: column; gap: 8px; }
.pet-bar-row { display: flex; align-items: center; gap: 10px; }
.pet-bar-label { font-size: 0.9rem; font-weight: 800; color: var(--clr-text); white-space: nowrap; min-width: 90px; }
.pet-bar-track { flex: 1; height: 18px; background: rgba(0,0,0,0.08); border-radius: 9px; overflow: hidden; }
.pet-bar-fill  { height: 100%; border-radius: 9px; transition: width 0.4s ease; }

.pet-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.pet-action-btn {
  padding: 0.6rem 1.2rem;
  border-radius: 2rem;
  border: 3px solid transparent;
  background: linear-gradient(135deg, #FF8FAB, #FFCF47);
  color: #3D2C5A; font-family: var(--font-display);
  font-size: 1.1rem; font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.18s ease;
  box-shadow: 0 4px 12px rgba(255,143,171,0.3);
}
.pet-action-btn:nth-child(2) { background: linear-gradient(135deg, #52D9A4, #68D8D6); box-shadow: 0 4px 12px rgba(82,217,164,0.3); }
.pet-action-btn:nth-child(3) { background: linear-gradient(135deg, #9C7AF5, #68D8D6); box-shadow: 0 4px 12px rgba(156,122,245,0.3); }
.pet-action-btn:hover  { transform: scale(1.1); }
.pet-action-btn:active { transform: scale(0.95); }
.pet-progress { font-size: 0.9rem; font-weight: 700; color: var(--clr-text-soft); text-align: center; }

/* ── Mobile tweaks for new games ── */
@media (max-width: 600px) {
  .music-pad-grid { max-width: 260px; }
  .music-pad { height: 58px; font-size: 1.7rem; }
  .puzzle-grid { width: 210px; }
  .puzzle-tile, .puzzle-blank { width: 62px; height: 62px; font-size: 2rem; }
  .alpha-field { height: 180px; }
  .alpha-bubble { width: 54px; height: 54px; font-size: 1.5rem; }
  .pet-bar-label { min-width: 75px; font-size: 0.8rem; }
  .coloring-svg { max-width: 260px; }
}

