/* === Reset & Base === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #1a1a2e;
  touch-action: manipulation;
  /* Prevent pull-to-refresh and overscroll */
  overscroll-behavior: none;
  position: fixed;
  inset: 0;
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
  /* Safe area for notched phones */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  /* Inherit safe area */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.screen.active {
  display: flex;
}

.hidden {
  display: none !important;
}

/* === Menu Screen === */
#menu-screen {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  align-items: center;
  justify-content: center;
  gap: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.menu-header {
  text-align: center;
  flex-shrink: 0;
}

.rainbow-text {
  font-size: clamp(1.8rem, 7vw, 3.5rem);
  font-weight: 900;
  background: linear-gradient(90deg, #ff6b6b, #ffd93d, #6bcb77, #4d96ff, #9b59b6, #ff6b6b);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: rainbow-shift 3s linear infinite;
  text-shadow: none;
  filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.3));
}

@keyframes rainbow-shift {
  to { background-position: 200% center; }
}

.subtitle {
  color: rgba(255,255,255,0.9);
  font-size: clamp(0.85rem, 2.5vw, 1.2rem);
  margin-top: 2px;
  font-weight: 500;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(8px, 2vw, 16px);
  max-width: 500px;
  width: 100%;
  padding: 4px;
  flex-shrink: 0;
}

@media (min-width: 600px) {
  .game-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.game-card {
  background: var(--card-color);
  border: none;
  border-radius: 16px;
  padding: clamp(10px, 2.5vw, 20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2), inset 0 -3px 0 rgba(0,0,0,0.1);
  aspect-ratio: 1;
  justify-content: center;
  /* Minimum touch target */
  min-height: 80px;
  min-width: 80px;
}

.game-card:active {
  transform: scale(0.93);
  box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.game-icon {
  font-size: clamp(1.8rem, 7vw, 3rem);
  line-height: 1;
}

.game-name {
  font-size: clamp(0.65rem, 2.2vw, 0.95rem);
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.stars-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.2);
  padding: 8px 20px;
  border-radius: 50px;
  font-size: 1.2rem;
  color: white;
  font-weight: 700;
  flex-shrink: 0;
}

.star-icon {
  font-size: 1.3rem;
}

/* === Game Screen === */
#game-screen {
  background: #f0f4ff;
}

.game-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  padding-top: max(6px, env(safe-area-inset-top));
  background: rgba(255,255,255,0.95);
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  z-index: 100;
  min-height: 48px;
  flex-shrink: 0;
}

.topbar-btn {
  background: none;
  border: 2px solid #ddd;
  border-radius: 12px;
  padding: 8px 16px;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.2s;
  /* Big enough for toddler fingers */
  min-width: 52px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-btn:active {
  background: #e8e8e8;
  transform: scale(0.95);
}

.game-stars {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #333;
}

#game-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  /* Prevent any scroll/bounce */
  touch-action: none;
}

/* === Celebration === */
.celebration {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.4);
  animation: fadeIn 0.3s ease;
}

.celebration-content {
  text-align: center;
  animation: celebBounce 0.5s ease;
}

.celebration-emoji {
  font-size: clamp(3rem, 15vw, 5rem);
  animation: celebSpin 0.8s ease;
}

.celebration-text {
  font-size: clamp(1.4rem, 6vw, 2rem);
  font-weight: 900;
  color: white;
  text-shadow: 0 3px 10px rgba(0,0,0,0.3);
  margin-top: 10px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes celebBounce {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

@keyframes celebSpin {
  0% { transform: rotate(0deg) scale(0); }
  50% { transform: rotate(180deg) scale(1.3); }
  100% { transform: rotate(360deg) scale(1); }
}

/* Confetti */
.confetti-piece {
  position: fixed;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  animation: confettiFall 2s ease-out forwards;
  z-index: 10000;
}

@keyframes confettiFall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* === Bubble Pop Game === */
.bubble-pop-area {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #87CEEB 0%, #E0F7FA 100%);
  position: relative;
  overflow: hidden;
  touch-action: none;
}

.bubble {
  position: absolute;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: bubbleFloat linear forwards;
  box-shadow: inset -8px -8px 20px rgba(0,0,0,0.1), inset 4px 4px 10px rgba(255,255,255,0.6);
  /* Ensure touch target is big enough */
  min-width: 50px;
  min-height: 50px;
}

.bubble:active {
  transform: scale(0.9);
}

.bubble-content {
  font-size: 2rem;
  font-weight: 900;
  color: white;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
  pointer-events: none;
}

.bubble-pop-effect {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: popEffect 0.4s ease-out forwards;
}

.bubble-label {
  position: absolute;
  font-size: 1.5rem;
  font-weight: 900;
  pointer-events: none;
  animation: labelFloat 1.5s ease-out forwards;
  z-index: 10;
}

@keyframes bubbleFloat {
  from { bottom: -120px; }
  to { bottom: 110%; }
}

@keyframes popEffect {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(2.5); opacity: 0; }
}

@keyframes labelFloat {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-80px) scale(1.5); opacity: 0; }
}

/* Score popup */
.score-popup {
  position: absolute;
  font-size: 1.8rem;
  font-weight: 900;
  color: #FFD700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
  pointer-events: none;
  animation: scoreUp 0.8s ease-out forwards;
  z-index: 10;
}

@keyframes scoreUp {
  0% { transform: translateY(0) scale(0.5); opacity: 1; }
  100% { transform: translateY(-60px) scale(1.2); opacity: 0; }
}

/* === Animal Piano === */
.piano-area {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, #FFECD2, #FCB69F);
}

.piano-display {
  flex: 0 0 35%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.piano-animal {
  font-size: clamp(3.5rem, 16vw, 8rem);
  transition: transform 0.2s;
  cursor: default;
}

.piano-animal.bounce {
  animation: animalBounce 0.4s ease;
}

.piano-animal-name {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(1rem, 3.5vw, 1.6rem);
  font-weight: 900;
  color: #5D4037;
  background: rgba(255,255,255,0.8);
  padding: 4px 16px;
  border-radius: 20px;
  white-space: nowrap;
}

@keyframes animalBounce {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.3) rotate(-5deg); }
  50% { transform: scale(1.1) rotate(5deg); }
  75% { transform: scale(1.2) rotate(-3deg); }
}

.piano-keys {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 4px;
  padding: 4px;
  padding-bottom: max(4px, env(safe-area-inset-bottom));
}

.piano-key {
  border: none;
  border-radius: 14px;
  font-size: clamp(1.8rem, 6vw, 3rem);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15), inset 0 -3px 0 rgba(0,0,0,0.1);
  min-height: 60px;
}

.piano-key:active {
  transform: scale(0.92);
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

/* === Color Splash === */
.color-splash-area {
  width: 100%;
  height: 100%;
  position: relative;
  background: white;
  overflow: hidden;
}

.splash-canvas {
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.color-palette {
  position: absolute;
  bottom: max(8px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.92);
  border-radius: 30px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  z-index: 10;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 95vw;
}

.color-btn {
  width: clamp(38px, 9vw, 48px);
  height: clamp(38px, 9vw, 48px);
  border-radius: 50%;
  border: 3px solid white;
  cursor: pointer;
  transition: transform 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.color-btn:active, .color-btn.active {
  transform: scale(1.15);
  border-color: #333;
}

.clear-canvas-btn {
  width: clamp(38px, 9vw, 48px);
  height: clamp(38px, 9vw, 48px);
  border-radius: 50%;
  border: 3px solid white;
  background: #eee;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.color-name-popup {
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(1.3rem, 5vw, 2.2rem);
  font-weight: 900;
  padding: 8px 24px;
  border-radius: 20px;
  background: rgba(255,255,255,0.9);
  animation: colorNamePop 1.2s ease-out forwards;
  z-index: 20;
  pointer-events: none;
  white-space: nowrap;
}

@keyframes colorNamePop {
  0% { transform: translateX(-50%) scale(0); opacity: 0; }
  20% { transform: translateX(-50%) scale(1.2); opacity: 1; }
  80% { transform: translateX(-50%) scale(1); opacity: 1; }
  100% { transform: translateX(-50%) scale(0.8); opacity: 0; }
}

.stamp-emoji {
  position: absolute;
  pointer-events: none;
  animation: stampAppear 0.3s ease;
  z-index: 5;
}

@keyframes stampAppear {
  0% { transform: translate(-50%, -50%) scale(0) rotate(-180deg); }
  100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}

.brush-size-btns {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 10;
}

.brush-size-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #ccc;
  background: rgba(255,255,255,0.9);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.brush-size-btn.active {
  border-color: #333;
  background: #e0e0e0;
}

.tool-btns {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 10;
}

.tool-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #ccc;
  background: rgba(255,255,255,0.9);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.tool-btn.active {
  border-color: #333;
  background: #e0e0e0;
}

/* === Shape Sorter === */
.shape-sorter-area {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, #a8edea, #fed6e3);
  touch-action: none;
}

.shape-targets {
  flex: 0 0 40%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 2vw, 20px);
  padding: 8px;
  flex-wrap: wrap;
}

.shape-target {
  width: clamp(56px, 14vw, 110px);
  height: clamp(56px, 14vw, 110px);
  border: 4px dashed rgba(0,0,0,0.3);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.6rem, 5vw, 3.5rem);
  opacity: 0.4;
  transition: all 0.3s;
}

.shape-target.highlight {
  border-color: #4CAF50;
  background: rgba(76, 175, 80, 0.2);
  opacity: 1;
  transform: scale(1.1);
}

.shape-target.matched {
  opacity: 1;
  border-style: solid;
  border-color: #4CAF50;
  background: rgba(76, 175, 80, 0.15);
  animation: matchPulse 0.5s ease;
}

@keyframes matchPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.shape-divider {
  width: 90%;
  margin: 0 auto;
  height: 3px;
  background: rgba(0,0,0,0.1);
  border-radius: 2px;
  flex-shrink: 0;
}

.shape-pieces {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 2vw, 20px);
  padding: 8px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  flex-wrap: wrap;
}

.shape-piece {
  width: clamp(52px, 13vw, 90px);
  height: clamp(52px, 13vw, 90px);
  background: white;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.6rem, 5vw, 3rem);
  cursor: grab;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
  transition: transform 0.2s, box-shadow 0.2s;
  touch-action: none;
}

.shape-piece:active {
  cursor: grabbing;
  transform: scale(1.15);
  box-shadow: 0 8px 25px rgba(0,0,0,0.25);
}

.shape-piece.dragging {
  position: fixed;
  z-index: 1000;
  transform: scale(1.2);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  pointer-events: none;
}

.shape-piece.matched {
  opacity: 0.3;
  pointer-events: none;
}

.shape-level-info {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.9);
  padding: 4px 16px;
  border-radius: 20px;
  font-weight: 700;
  color: #555;
  font-size: 0.85rem;
  white-space: nowrap;
  z-index: 5;
}

/* === Counting Garden === */
.garden-area {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #87CEEB 0%, #87CEEB 40%, #90EE90 40%, #228B22 100%);
  position: relative;
  touch-action: none;
}

.garden-counter {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.92);
  padding: 6px 20px;
  border-radius: 20px;
  font-size: clamp(1.1rem, 3.5vw, 1.8rem);
  font-weight: 900;
  color: #333;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.garden-target {
  color: #888;
  font-size: 0.8em;
}

.garden-plot {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(var(--garden-cols, 3), 1fr);
  grid-template-rows: repeat(var(--garden-rows, 3), 1fr);
  gap: 6px;
  padding: 56px 8px 8px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.garden-spot {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  min-height: 48px;
  min-width: 48px;
  border-radius: 16px;
  transition: transform 0.2s, background 0.2s;
  position: relative;
}

/* Empty spots show a dirt mound indicator */
.garden-spot:not(.planted) {
  background: rgba(139, 90, 43, 0.25);
  border: 3px dashed rgba(139, 90, 43, 0.35);
}

.garden-spot:not(.planted)::after {
  content: '🌱';
  font-size: clamp(1.2rem, 3.5vw, 1.8rem);
  opacity: 0.4;
}

.garden-spot:not(.planted):active {
  transform: scale(0.92);
  background: rgba(139, 90, 43, 0.4);
}

.garden-spot.planted {
  background: rgba(76, 175, 80, 0.15);
  border: 3px solid rgba(76, 175, 80, 0.3);
  pointer-events: none;
}

.garden-item {
  font-size: clamp(1.8rem, 6vw, 3rem);
  animation: growPlant 0.5s ease;
}

@keyframes growPlant {
  0% { transform: scale(0) translateY(20px); }
  60% { transform: scale(1.3) translateY(-5px); }
  100% { transform: scale(1) translateY(0); }
}

.garden-sun {
  position: absolute;
  top: 8%;
  right: 10%;
  font-size: clamp(1.8rem, 7vw, 3.5rem);
  animation: sunPulse 3s ease-in-out infinite;
  z-index: 5;
}

@keyframes sunPulse {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.1) rotate(10deg); }
}

.garden-cloud {
  position: absolute;
  font-size: clamp(1.2rem, 4vw, 2rem);
  animation: cloudDrift 20s linear infinite;
  opacity: 0.8;
  z-index: 5;
}

@keyframes cloudDrift {
  0% { transform: translateX(-100px); }
  100% { transform: translateX(calc(100vw + 100px)); }
}

.garden-number-popup {
  position: absolute;
  font-size: clamp(2rem, 8vw, 3.5rem);
  font-weight: 900;
  color: #FF6B6B;
  text-shadow: 0 2px 6px rgba(0,0,0,0.2), 0 0 20px rgba(255,107,107,0.3);
  pointer-events: none;
  animation: numberPop 1.2s ease-out forwards;
  z-index: 20;
}

@keyframes numberPop {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  20% { transform: translate(-50%, -50%) scale(1.5); opacity: 1; }
  60% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  100% { transform: translate(-50%, -60%) scale(1); opacity: 0; }
}

/* === Dance Party === */
.dance-area {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: background 0.3s;
  touch-action: none;
}

.dance-floor {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 2px;
  opacity: 0.3;
}

.dance-tile {
  border-radius: 4px;
  transition: background 0.3s;
}

.dance-character {
  font-size: clamp(3.5rem, 16vw, 8rem);
  z-index: 10;
  transition: transform 0.15s;
}

.dance-character.move1 { transform: rotate(-15deg) scale(1.1); }
.dance-character.move2 { transform: rotate(15deg) scale(0.9); }
.dance-character.move3 { transform: translateY(-20px) scale(1.2); }
.dance-character.move4 { transform: rotate(-10deg) translateX(-20px); }
.dance-character.move5 { transform: rotate(10deg) translateX(20px); }

.dance-instruction {
  position: absolute;
  bottom: 15%;
  font-size: clamp(0.9rem, 3vw, 1.3rem);
  font-weight: 700;
  color: white;
  background: rgba(0,0,0,0.5);
  padding: 8px 20px;
  border-radius: 20px;
  z-index: 10;
  text-align: center;
}

.dance-emoji-burst {
  position: absolute;
  font-size: clamp(1.5rem, 5vw, 2rem);
  pointer-events: none;
  animation: emojiBurst 1s ease-out forwards;
  z-index: 5;
}

@keyframes emojiBurst {
  0% { transform: scale(0) rotate(0deg); opacity: 1; }
  100% { transform: scale(1.5) rotate(360deg) translateY(-100px); opacity: 0; }
}

.dance-beat-indicator {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}

.beat-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transition: all 0.15s;
}

.beat-dot.active {
  background: white;
  transform: scale(1.3);
  box-shadow: 0 0 10px white;
}

/* === Utility Animations === */
.wiggle {
  animation: wiggle 0.5s ease;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}

.pulse {
  animation: pulse 0.3s ease;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* Star earned animation */
.star-earned {
  position: fixed;
  font-size: 3rem;
  z-index: 10000;
  pointer-events: none;
  animation: starEarned 1s ease-out forwards;
}

@keyframes starEarned {
  0% { transform: scale(0) rotate(0deg); opacity: 1; }
  50% { transform: scale(1.5) rotate(180deg); opacity: 1; }
  100% { transform: scale(0.5) rotate(360deg) translateY(-100px); opacity: 0; }
}

/* Keyboard hint for dance party - hide on touch devices */
.keyboard-hint {
  position: absolute;
  bottom: max(5%, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.6);
  font-size: 0.75rem;
  z-index: 10;
  text-align: center;
}

@media (pointer: coarse) {
  .keyboard-hint {
    display: none;
  }
}

/* === Small screen / landscape adjustments === */
@media (max-height: 500px) {
  .menu-header { gap: 0; }
  .rainbow-text { font-size: clamp(1.4rem, 5vw, 2rem); }
  .subtitle { display: none; }
  .game-grid { gap: 6px; }
  .game-card { aspect-ratio: auto; padding: 8px; min-height: 60px; }
  .stars-display { padding: 4px 14px; font-size: 1rem; }
  .piano-display { flex: 0 0 30%; }
  .garden-counter { padding: 4px 14px; font-size: 0.95rem; }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 500px) {
  .game-grid {
    grid-template-columns: repeat(3, 1fr);
    max-width: 80%;
  }
  .piano-keys {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
  }
  .shape-sorter-area {
    flex-direction: row;
  }
  .shape-targets {
    flex: 0 0 45%;
  }
  .shape-divider {
    width: 3px;
    height: 90%;
    margin: auto 0;
  }
}
