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

:root {
  --forest-dark:  #1A3A2A;
  --forest-mid:   #2D6A4F;
  --forest-light: #52B788;
  --amber:        #F4A21E;
  --amber-dark:   #D97706;
  --cream:        #FFF8E7;
  --white:        #FFFFFF;
  --text-dark:    #162216;
  --text-mid:     #3D5A40;
  --success:      #22C55E;
  --error:        #EF4444;
  --shadow:       rgba(26, 58, 42, 0.14);
  --radius:       20px;
  --radius-lg:    30px;
}

body {
  font-family: 'Nunito', sans-serif;
  background: linear-gradient(160deg, #d4edda 0%, #fff8e7 55%, #fffbf0 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle dot texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, #52B788 1.5px, transparent 1.5px);
  background-size: 38px 38px;
  opacity: 0.07;
  pointer-events: none;
  z-index: 0;
}

/* ──────────────────────────────────────────
   SCREEN SYSTEM
────────────────────────────────────────── */

.screen {
  display: none;
  min-height: 100vh;
  padding: 16px 20px 32px;
  position: relative;
  z-index: 1;
}

.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.screen.active { animation: fadeSlideIn 0.35s ease; }

/* ──────────────────────────────────────────
   WELCOME SCREEN
────────────────────────────────────────── */

.trees-top,
.trees-bottom {
  font-size: 1.8rem;
  letter-spacing: 4px;
  opacity: 0.75;
  user-select: none;
}

.trees-top  { margin-bottom: 8px; }
.trees-bottom {
  margin-top: auto;
  padding-top: 24px;
}

.welcome-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 480px;
  width: 100%;
}

.app-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.title-text { text-align: center; }

h1 {
  font-family: 'Baloo 2', cursive;
  font-size: 2.2rem;
  color: var(--forest-dark);
  line-height: 1.1;
  text-shadow: 3px 3px 0 rgba(82, 183, 136, 0.25);
}

.title-animal {
  font-size: 2.2rem;
  display: inline-block;
  animation: animalBounce 2.2s ease-in-out infinite;
}

.title-animal.flip {
  animation-delay: 0.4s;
  display: inline-block;
  transform-origin: center;
}

@keyframes animalBounce {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%       { transform: translateY(-10px) rotate(4deg); }
}

.subtitle {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-mid);
  text-align: center;
  line-height: 1.5;
}

.animal-parade {
  display: flex;
  gap: 6px;
  font-size: 1.5rem;
}

.animal-parade span {
  display: inline-block;
  animation: paradeWave 1.8s ease-in-out infinite;
}

.animal-parade span:nth-child(1) { animation-delay: 0.0s; }
.animal-parade span:nth-child(2) { animation-delay: 0.2s; }
.animal-parade span:nth-child(3) { animation-delay: 0.4s; }
.animal-parade span:nth-child(4) { animation-delay: 0.6s; }
.animal-parade span:nth-child(5) { animation-delay: 0.8s; }
.animal-parade span:nth-child(6) { animation-delay: 1.0s; }

@keyframes paradeWave {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

.session-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow:
    0 8px 32px var(--shadow),
    0 3px 0 0 var(--forest-light);
  width: 100%;
}

.picker-section { width: 100%; }

.picker-divider {
  height: 1px;
  background: rgba(82, 183, 136, 0.2);
  margin: 12px 0;
}

.picker-label {
  font-family: 'Baloo 2', cursive;
  font-size: 1rem;
  color: var(--forest-dark);
  text-align: center;
  margin-bottom: 10px;
}

.diff-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.diff-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 6px;
  background: var(--cream);
  border: 3px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s, background 0.18s;
}

.diff-btn:hover:not(.selected) {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px var(--shadow);
  border-color: var(--amber);
}

.diff-btn.selected {
  background: var(--amber);
  border-color: var(--amber-dark);
}

.diff-icon { font-size: 1.2rem; line-height: 1; }

.diff-name {
  font-family: 'Baloo 2', cursive;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--forest-dark);
}

.diff-range {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-mid);
}

.diff-btn.selected .diff-name  { color: white; }
.diff-btn.selected .diff-range { color: rgba(255,255,255,0.85); }

/* ── Number slider ─────────────────────────────────────────────────────────── */

.num-badge {
  display: inline-block;
  background: var(--forest-light);
  color: white;
  padding: 1px 12px;
  border-radius: 100px;
  font-size: 1.05rem;
  min-width: 48px;
  text-align: center;
}

.slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}

.slider-end {
  font-family: 'Baloo 2', cursive;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-mid);
  min-width: 26px;
  text-align: center;
}

.max-num-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 10px;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--forest-light), var(--amber));
  outline: none;
  cursor: pointer;
}

.max-num-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: white;
  border: 4px solid var(--forest-mid);
  box-shadow: 0 2px 8px var(--shadow);
  cursor: pointer;
  transition: transform 0.15s;
}

.max-num-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.max-num-slider::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: white;
  border: 4px solid var(--forest-mid);
  box-shadow: 0 2px 8px var(--shadow);
  cursor: pointer;
}

.session-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.session-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 8px;
  background: var(--cream);
  border: 3px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s, background 0.18s;
}

.session-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px var(--shadow);
  border-color: var(--forest-light);
}

.session-btn:active {
  transform: translateY(-1px);
}

.session-btn.selected {
  background: var(--forest-light);
  border-color: var(--forest-mid);
}

.session-btn.selected .btn-num { color: white; }
.session-btn.selected .btn-sub { color: rgba(255,255,255,0.88); }

.btn-num {
  font-family: 'Baloo 2', cursive;
  font-size: 2rem;
  color: var(--forest-dark);
  line-height: 1;
}

.btn-sub {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-top: 3px;
}

.btn-start {
  font-family: 'Baloo 2', cursive;
  font-size: 1.35rem;
  padding: 14px 0;
  width: 100%;
  max-width: 480px;
  background: linear-gradient(135deg, var(--forest-mid), var(--forest-light));
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
  box-shadow: 0 6px 20px rgba(45, 106, 79, 0.38);
  margin-top: 4px;
}

.btn-start:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(45, 106, 79, 0.48);
}

.btn-start:active { transform: translateY(0); }

/* ──────────────────────────────────────────
   GAME SCREEN
────────────────────────────────────────── */

.game-header {
  width: 100%;
  max-width: 600px;
  padding: 12px 0 8px;
}

.progress-track {
  position: relative;
  background: rgba(82, 183, 136, 0.2);
  border-radius: 100px;
  height: 16px;
  overflow: visible;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--forest-light), var(--amber));
  border-radius: 100px;
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 0%;
  min-width: 16px;
}

.progress-rabbit {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.4rem;
  transition: left 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  left: 0%;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.game-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.progress-text {
  font-family: 'Baloo 2', cursive;
  font-size: 1rem;
  color: var(--text-mid);
}

.score-display {
  font-family: 'Baloo 2', cursive;
  font-size: 1.05rem;
  color: var(--amber-dark);
  background: rgba(244, 162, 30, 0.15);
  border: 2px solid rgba(244, 162, 30, 0.3);
  padding: 3px 14px;
  border-radius: 100px;
}

.story-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  max-width: 600px;
  width: 100%;
  box-shadow:
    0 8px 32px var(--shadow),
    0 3px 0 0 var(--forest-light);
  margin: 14px 0 10px;
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-card.shake {
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

.story-text {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.75;
  text-align: center;
}

.story-text strong {
  color: var(--forest-mid);
  font-weight: 800;
}

.feedback-area {
  font-family: 'Baloo 2', cursive;
  font-size: 1.15rem;
  padding: 8px 24px;
  border-radius: 100px;
  text-align: center;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.25s, background 0.25s;
  margin-bottom: 10px;
}

.feedback-area.correct {
  background: rgba(34, 197, 94, 0.18);
  color: #15803d;
}

.feedback-area.wrong {
  background: rgba(239, 68, 68, 0.14);
  color: #b91c1c;
}

.choices-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 600px;
  width: 100%;
}

.choice-btn {
  font-family: 'Baloo 2', cursive;
  font-size: 2rem;
  padding: 22px 16px;
  background: var(--white);
  border: 3px solid rgba(82, 183, 136, 0.28);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s, background 0.18s;
  box-shadow: 0 4px 14px var(--shadow);
  color: var(--forest-dark);
  line-height: 1;
}

.choice-btn:hover:not(:disabled) {
  transform: translateY(-5px) scale(1.03);
  box-shadow: 0 12px 28px var(--shadow);
  border-color: var(--forest-light);
  background: #f0faf5;
}

.choice-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.97);
}

.choice-btn.correct {
  background: var(--success);
  border-color: #15803d;
  color: white;
  transform: scale(1.06);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

.choice-btn.wrong {
  background: var(--error);
  border-color: #b91c1c;
  color: white;
}

.choice-btn:disabled { cursor: not-allowed; }

/* ──────────────────────────────────────────
   RESULTS SCREEN
────────────────────────────────────────── */

.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-30px) rotate(0deg) translateX(0px);
    opacity: 1;
  }
  60% {
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) rotate(800deg) translateX(var(--drift));
    opacity: 0;
  }
}

.confetti-piece {
  position: absolute;
  top: -30px;
  animation: confettiFall linear forwards;
  border-radius: var(--piece-radius, 2px);
}

.results-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 480px;
  width: 100%;
  padding-top: 64px;
  position: relative;
  z-index: 1;
}

.result-emoji {
  font-size: 5.5rem;
  animation: pop 0.55s cubic-bezier(0.175, 0.885, 0.32, 1.4);
  line-height: 1;
}

@keyframes pop {
  from { transform: scale(0) rotate(-15deg); }
  to   { transform: scale(1) rotate(0deg); }
}

.result-score {
  font-family: 'Baloo 2', cursive;
  font-size: 4.5rem;
  color: var(--forest-dark);
  text-shadow: 4px 4px 0 rgba(82, 183, 136, 0.25);
  animation: fadeSlideIn 0.4s ease 0.15s both;
}

.result-stars {
  font-size: 2.8rem;
  letter-spacing: 6px;
  animation: fadeSlideIn 0.4s ease 0.3s both;
}

.result-msg {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-mid);
  text-align: center;
  animation: fadeSlideIn 0.4s ease 0.45s both;
}

.btn-restart {
  font-family: 'Baloo 2', cursive;
  font-size: 1.3rem;
  padding: 16px 44px;
  background: linear-gradient(135deg, var(--forest-mid), var(--forest-light));
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
  box-shadow: 0 6px 20px rgba(45, 106, 79, 0.38);
  margin-top: 8px;
  animation: fadeSlideIn 0.4s ease 0.6s both;
}

.btn-restart:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(45, 106, 79, 0.48);
}

.btn-restart:active {
  transform: translateY(0);
}

/* ──────────────────────────────────────────
   RESPONSIVE
────────────────────────────────────────── */

@media (max-width: 420px) {
  h1 { font-size: 2.3rem; }
  .title-animal { font-size: 2.3rem; }
  .story-card { padding: 20px 18px; }
  .story-text { font-size: 1rem; }
  .choice-btn { font-size: 1.6rem; padding: 18px 12px; }
  .result-score { font-size: 3.5rem; }
  .result-emoji { font-size: 4.5rem; }
}

@media (max-width: 340px) {
  .choices-grid { grid-template-columns: 1fr; }
}
