:root {
  --bg: #FFF8E7;
  --ink: #2b2b2b;
  --animals: #6BBF59;
  --colors: #FF6B9D;
  --food: #FF9F40;
  --radius: 24px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Roboto', system-ui, -apple-system, sans-serif;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.hidden {
  display: none !important;
}

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.home-btn {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: #fff;
  font-size: 32px;
  box-shadow: var(--shadow);
  z-index: 10;
  cursor: pointer;
}

.mascot-slot {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10;
}

.mascot {
  font-size: 72px;
  display: inline-block;
  transform-origin: 50% 80%;
}

.mascot-idle {
  animation: mascot-sway 2s ease-in-out infinite;
}

.mascot-bounce {
  animation: mascot-bounce 0.5s ease-in-out infinite;
}

.mascot-confused {
  display: inline-block;
  transform: rotate(-15deg);
}

.mascot-thought {
  position: absolute;
  top: -20px;
  right: -36px;
  font-size: 0.5em;
  white-space: nowrap;
}

@keyframes mascot-sway {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

@keyframes mascot-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

.tts-indicator {
  position: fixed;
  top: 88px;
  right: 16px;
  background: #FFE08A;
  padding: 8px 12px;
  border-radius: 16px;
  font-size: 18px;
  z-index: 10;
}

.category-tiles {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.category-tile {
  width: 220px;
  height: 220px;
  border-radius: var(--radius);
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #fff;
  font-family: inherit;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.category-tile:active {
  transform: scale(0.96);
}

.category-emoji {
  font-size: 96px;
}

.category-label {
  font-size: 32px;
  font-weight: 700;
}

.tile-animals { background: var(--animals); }
.tile-food { background: var(--food); }
.tile-colors {
  background: linear-gradient(135deg, #FF6B6B, #FFD93D, #6BCB77, #4D96FF, #9D4EDD);
}

.mode-toggle {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  background: #fff;
  padding: 6px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 10;
}

.mode-option {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 24px;
  padding: 8px 20px;
  border-radius: 999px;
  cursor: pointer;
}

.mode-option.active {
  background: var(--bg);
  box-shadow: inset 0 0 0 2px var(--ink);
}

.word-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  max-width: 720px;
  width: 100%;
  margin-top: 64px;
}

.word-tile {
  aspect-ratio: 1;
  background: #fff;
  border: none;
  border-radius: 16px;
  font-size: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.word-tile:active {
  transform: scale(0.92);
}

.explore-card {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  background: transparent;
  border: none;
  cursor: pointer;
}

.explore-emoji {
  font-size: clamp(160px, 50vh, 360px);
  line-height: 1;
}

.explore-word {
  font-size: 72px;
  font-weight: 700;
  text-transform: lowercase;
  color: var(--ink);
}

.replay-btn {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: none;
  background: #fff;
  font-size: 48px;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.replay-btn:active {
  transform: scale(0.92);
}

.findit-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.findit-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  max-width: 560px;
  width: 100%;
}

.findit-tile {
  aspect-ratio: 1;
  min-width: 96px;
  min-height: 96px;
  background: #fff;
  border: none;
  border-radius: 24px;
  font-size: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.findit-tile:active {
  transform: scale(0.94);
}

.findit-tile.correct {
  background: #B7E4A6;
  animation: tile-bounce 0.6s ease;
}

.findit-tile.wrong {
  background: #FFB3B3;
  animation: tile-wobble 0.5s ease;
}

@keyframes tile-bounce {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(-24px) scale(1.05); }
  60% { transform: translateY(0) scale(0.98); }
}

@keyframes tile-wobble {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-6deg); }
  50% { transform: rotate(6deg); }
  75% { transform: rotate(-4deg); }
}

.findit-replay {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: none;
  background: #fff;
  font-size: 48px;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.findit-replay:active {
  transform: scale(0.92);
}

.yay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.yay-mascot {
  font-size: 160px;
  display: inline-block;
  animation: mascot-bounce 0.5s ease-in-out infinite;
}

.yay-text {
  font-size: 96px;
  font-weight: 700;
  color: var(--ink);
}

@keyframes mascot-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

.confetti-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  z-index: 5;
}

.confetti-piece {
  display: inline-block;
  font-size: 48px;
  animation: confetti-fall 1.5s ease-out forwards;
  animation-delay: var(--confetti-delay, 0s);
}

@keyframes confetti-fall {
  0% { transform: translateY(-40px) rotate(0deg); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateY(120px) rotate(360deg); opacity: 0; }
}

.rotate-nag {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px;
}

.rotate-nag-mascot-slot {
  position: relative;
}

.rotate-nag-icon {
  font-size: 64px;
}

.rotate-nag-text {
  font-size: 32px;
  font-weight: 700;
  color: var(--ink);
}
