:root {
  --sky-top: #4ec0f0;
  --sky-bottom: #87ceeb;
  --sun: #ffd93d;
  --sun-glow: #ffec8b;
  --grass-light: #7cb342;
  --grass-dark: #558b2f;
  --hill-back: #81c784;
  --hill-front: #66bb6a;
  --card: #fffef7;
  --card-border: #ffe082;
  --primary: #ff9800;
  --primary-dark: #f57c00;
  --success: #43a047;
  --success-light: #c8e6c9;
  --error: #e53935;
  --error-light: #ffcdd2;
  --text: #2e4a2e;
  --muted: #5d7a5d;
  --shadow: 0 8px 32px rgba(46, 74, 46, 0.15);
  --radius: 20px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Fredoka", "Comic Sans MS", system-ui, sans-serif;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* ===== Outdoor scene ===== */
.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.sky {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 55%, #b3e5fc 100%);
}

.sun {
  position: absolute;
  top: 4%;
  right: 12%;
  width: 72px;
  height: 72px;
  background: radial-gradient(circle at 35% 35%, var(--sun-glow), var(--sun));
  border-radius: 50%;
  box-shadow: 0 0 40px rgba(255, 217, 61, 0.7);
  animation: sun-pulse 4s ease-in-out infinite;
}

.sun::before,
.sun::after {
  content: "";
  position: absolute;
  inset: -18px;
  border-radius: 50%;
  border: 3px dashed rgba(255, 236, 139, 0.5);
  animation: sun-spin 20s linear infinite;
}

.sun::after {
  inset: -32px;
  animation-direction: reverse;
  animation-duration: 30s;
}

@keyframes sun-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@keyframes sun-spin {
  to { transform: rotate(360deg); }
}

.cloud {
  position: absolute;
  background: #fff;
  border-radius: 50px;
  opacity: 0.92;
  animation: cloud-drift linear infinite;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  background: #fff;
  border-radius: 50%;
}

.cloud-1 {
  width: 80px;
  height: 28px;
  top: 12%;
  left: -100px;
  animation-duration: 45s;
}

.cloud-1::before { width: 36px; height: 36px; top: -18px; left: 12px; }
.cloud-1::after { width: 44px; height: 44px; top: -22px; left: 36px; }

.cloud-2 {
  width: 100px;
  height: 32px;
  top: 22%;
  left: -120px;
  animation-duration: 60s;
  animation-delay: -20s;
}

.cloud-2::before { width: 40px; height: 40px; top: -20px; left: 16px; }
.cloud-2::after { width: 50px; height: 50px; top: -26px; left: 44px; }

.cloud-3 {
  width: 60px;
  height: 22px;
  top: 8%;
  left: -80px;
  animation-duration: 35s;
  animation-delay: -10s;
}

.cloud-3::before { width: 28px; height: 28px; top: -14px; left: 8px; }
.cloud-3::after { width: 32px; height: 32px; top: -16px; left: 26px; }

@keyframes cloud-drift {
  from { transform: translateX(0); }
  to { transform: translateX(calc(100vw + 200px)); }
}

.hill {
  position: absolute;
  bottom: 0;
  left: -10%;
  width: 120%;
  border-radius: 50% 50% 0 0;
}

.hill-back {
  height: 28vh;
  background: var(--hill-back);
  bottom: 0;
}

.hill-front {
  height: 18vh;
  background: var(--hill-front);
  bottom: 0;
  box-shadow: inset 0 8px 0 rgba(255, 255, 255, 0.15);
}

.flowers {
  position: absolute;
  bottom: 14vh;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  padding: 0 5%;
  font-size: 1.5rem;
  opacity: 0.9;
}

.flower {
  animation: flower-sway 3s ease-in-out infinite;
}

.flower:nth-child(2) { animation-delay: 0.5s; }
.flower:nth-child(3) { animation-delay: 1s; }
.flower:nth-child(4) { animation-delay: 1.5s; }

@keyframes flower-sway {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

/* ===== Confetti ===== */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confetti-fall 2.5s ease-in forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* ===== App ===== */
.app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 1.25rem 1rem 6rem;
}

.header {
  text-align: center;
  margin-bottom: 1rem;
}

.doll-guide {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem;
  border: 3px solid #ffcc80;
  border-radius: 16px;
  background: #fff8e1;
  margin-bottom: 0.9rem;
}

.doll-avatar {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #ffe0b2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
}

.doll-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #bf360c;
}

.doll-message {
  font-size: 0.92rem;
  font-weight: 600;
  color: #6d4c41;
}

.doll-guide.robot-mode {
  background: linear-gradient(135deg, #eceff1 0%, #cfd8dc 100%);
  border-color: #90a4ae;
}

.doll-guide.robot-mode .doll-avatar {
  background: #b0bec5;
  animation: robot-bob 1.2s ease-in-out infinite;
}

@keyframes robot-bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(-3deg); }
}

.challenge-robot-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, #eceff1 0%, #b0bec5 100%);
  border: 3px solid #78909c;
  border-radius: 16px;
  box-shadow: 0 4px 0 #546e7a;
}

.challenge-robot {
  font-size: 2.75rem;
  line-height: 1;
  flex-shrink: 0;
}

.robot-side {
  flex: 1;
  min-width: 0;
}

.robot-speech {
  font-size: 0.9rem;
  font-weight: 700;
  color: #37474f;
  margin-bottom: 0.5rem;
}

.vs-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: #fff;
  border-radius: 12px;
  padding: 0.45rem 0.65rem;
  border: 2px solid #90a4ae;
}

.vs-player,
.vs-robot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.vs-player strong {
  color: #2e7d32;
  font-size: 1.35rem;
}

.vs-robot strong {
  color: #1565c0;
  font-size: 1.35rem;
}

.vs-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
}

.vs-divider {
  font-weight: 800;
  font-size: 0.85rem;
  color: #ff9800;
}

.vs-result-banner {
  text-align: center;
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 14px;
  font-weight: 700;
  font-size: 1.05rem;
  border: 3px solid #90a4ae;
  background: linear-gradient(135deg, #eceff1, #cfd8dc);
}

.vs-result-banner.you-win {
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  border-color: var(--success);
  color: #2e7d32;
}

.vs-result-banner.robot-win {
  background: linear-gradient(135deg, #e3f2fd, #bbdefb);
  border-color: #1976d2;
  color: #1565c0;
}

.vs-result-banner.tie {
  background: linear-gradient(135deg, #fff8e1, #ffecb3);
  border-color: #ffa000;
  color: #e65100;
}

.mascot {
  font-size: 3rem;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.bounce {
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.header h1 {
  font-size: 1.65rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 2px 2px 0 var(--grass-dark), 0 2px 12px rgba(0, 0, 0, 0.15);
  margin-top: 0.25rem;
}

.tagline {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 500;
  text-shadow: 1px 1px 3px rgba(46, 74, 46, 0.4);
  margin-top: 0.15rem;
}

.game-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  border: 4px solid var(--card-border);
}

.game-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1rem;
  color: var(--primary-dark);
}

.hidden {
  display: none !important;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

/* ===== Level ladder ===== */
.level-ladder {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 0.5rem;
}

.level-step {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  position: relative;
}

.level-step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 21px;
  top: 44px;
  width: 4px;
  height: 14px;
  background: #c5e1a5;
  border-radius: 2px;
}

.level-step:not(:last-child).completed::after {
  background: #ffca28;
}

.level-step-btn {
  font-family: inherit;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border: 3px solid #e0e0e0;
  border-radius: 12px;
  background: #fafafa;
  color: #9e9e9e;
  cursor: not-allowed;
  text-align: left;
  transition: all 0.15s ease;
}

.level-step.unlocked .level-step-btn {
  cursor: pointer;
  background: #f1f8e9;
  border-color: #c5e1a5;
  color: var(--text);
}

.level-step.unlocked .level-step-btn:hover {
  transform: translateX(4px);
  border-color: var(--primary);
}

.level-step.selected .level-step-btn {
  background: #fff3e0;
  border-color: var(--primary);
  box-shadow: 0 4px 0 var(--primary-dark);
  color: var(--primary-dark);
}

.level-step.completed .level-step-num {
  background: #ffca28;
  border-color: #ffa000;
}

.level-step.locked .level-step-num::after {
  content: "🔒";
  font-size: 0.65rem;
  position: absolute;
  bottom: -4px;
  right: -4px;
}

.level-step-num {
  position: relative;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  background: #e0e0e0;
  border: 3px solid #bdbdbd;
  border-radius: 50%;
  color: #fff;
}

.level-step-info {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.level-step-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.level-step-range {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  opacity: 0.85;
}

.level-step.selected .level-step-range {
  color: var(--primary-dark);
}

.level-desc {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-dark);
  text-align: center;
  padding: 0.5rem 0.75rem;
  background: #fff8e1;
  border-radius: 10px;
  border: 2px dashed #ffca28;
  margin-bottom: 0.5rem;
}

.unlock-all-label {
  font-size: 0.8rem;
  margin-top: 0.25rem;
  color: var(--muted);
}

.question-count-fixed {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-dark);
  padding: 0.6rem 0.75rem;
  background: #e3f2fd;
  border: 2px solid #90caf9;
  border-radius: 12px;
  margin-bottom: 1rem;
}

.level-badge-quiz {
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.35rem 0.75rem;
  background: #fff3e0;
  border: 2px solid var(--primary);
  border-radius: 20px;
  margin-bottom: 0.5rem;
  color: var(--primary-dark);
}

.level-up-msg {
  text-align: center;
  padding: 0.85rem;
  background: linear-gradient(180deg, #e8f5e9, #c8e6c9);
  border: 3px solid var(--success);
  border-radius: 14px;
  font-weight: 700;
  font-size: 1rem;
  color: #2e7d32;
  margin-bottom: 0.75rem;
  animation: pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#next-level-btn {
  margin-bottom: 0.5rem;
  background: linear-gradient(180deg, #81c784, #43a047);
  border-color: #2e7d32;
  box-shadow: 0 6px 0 #2e7d32;
}

.ops-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.op-btn {
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.85rem 0.5rem;
  border: 3px solid #c5e1a5;
  border-radius: 14px;
  background: #f1f8e9;
  color: var(--muted);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.op-btn .op-emoji {
  font-size: 1.5rem;
}

.op-btn:hover {
  transform: scale(1.03);
  border-color: var(--primary);
}

.op-btn.active {
  border-color: var(--primary);
  background: #fff3e0;
  color: var(--primary-dark);
  box-shadow: 0 4px 0 var(--primary-dark);
}

.op-btn:active {
  transform: scale(0.97);
  box-shadow: none;
}

select {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  padding: 0.7rem 0.75rem;
  border: 3px solid #c5e1a5;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

select:focus {
  outline: none;
  border-color: var(--primary);
}

.checkbox-field {
  margin-bottom: 0.5rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

.checkbox-label input {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--primary);
}

.btn {
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 1rem 1.25rem;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  width: 100%;
  position: relative;
  overflow: hidden;
  transition: transform 0.1s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-play {
  background: linear-gradient(180deg, #ffb74d 0%, var(--primary) 100%);
  color: #fff;
  border: 3px solid var(--primary-dark);
  box-shadow: 0 6px 0 var(--primary-dark);
  margin-top: 0.5rem;
}

.btn-play:hover {
  filter: brightness(1.05);
}

.lessons-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
}

.lesson-open-btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.65rem 0.35rem;
  border: 2px solid #ce93d8;
  border-radius: 12px;
  background: #f3e5f5;
  color: #6a1b9a;
  cursor: pointer;
}

.lesson-open-btn:hover {
  background: #e1bee7;
}

.lesson-learn {
  margin-bottom: 1rem;
}

.lesson-card {
  background: #fff;
  border: 2px solid #e1bee7;
  border-radius: 14px;
  padding: 1rem;
}

.lesson-card h3 {
  text-align: center;
  color: #6a1b9a;
  margin-bottom: 0.5rem;
}

.lesson-card p {
  font-size: 0.9rem;
  text-align: center;
  margin-bottom: 0.75rem;
}

.lesson-example {
  font-weight: 600;
  color: var(--primary-dark);
}

.question-visual {
  margin-bottom: 1rem;
}

.tally-display {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  padding: 0.5rem;
}

.tally-group {
  display: inline-flex;
  gap: 3px;
  position: relative;
  padding: 0.25rem;
}

.tally-mark {
  display: inline-block;
  width: 4px;
  height: 28px;
  background: #37474f;
  border-radius: 2px;
}

.tally-mark.strike {
  position: relative;
}

.tally-group:has(.strike)::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 50%;
  width: 28px;
  height: 4px;
  background: #37474f;
  transform: rotate(-65deg) translateY(-50%);
  border-radius: 2px;
}

.clock-face {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 0.5rem;
  border: 4px solid #37474f;
  border-radius: 50%;
  background: #fff;
}

.clock-center {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #37474f;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
}

.clock-hand {
  position: absolute;
  bottom: 50%;
  left: 50%;
  transform-origin: bottom center;
  border-radius: 4px;
}

.hour-hand {
  width: 5px;
  height: 32px;
  background: #1565c0;
  margin-left: -2.5px;
  z-index: 2;
}

.minute-hand {
  width: 3px;
  height: 44px;
  background: #e53935;
  margin-left: -1.5px;
  z-index: 1;
}

.clock-num {
  position: absolute;
  font-size: 0.7rem;
  font-weight: 700;
  color: #37474f;
}

.clock-num.n12 { top: 4px; left: 50%; transform: translateX(-50%); }
.clock-num.n3 { right: 6px; top: 50%; transform: translateY(-50%); }
.clock-num.n6 { bottom: 4px; left: 50%; transform: translateX(-50%); }
.clock-num.n9 { left: 6px; top: 50%; transform: translateY(-50%); }

.coins-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 0.5rem 0;
}

.coin-chip {
  background: #fff8e1;
  border: 2px solid #ffca28;
  border-radius: 20px;
  padding: 0.35rem 0.65rem;
  font-weight: 700;
  font-size: 0.95rem;
}

.question-visual .question {
  font-size: 1.25rem;
}

.btn-secondary-tables {
  background: linear-gradient(180deg, #81d4fa 0%, #29b6f6 100%);
  color: #fff;
  border: 3px solid #0288d1;
  box-shadow: 0 5px 0 #0288d1;
  margin-bottom: 0.5rem;
}

.tables-hint {
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.table-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.table-pick-btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.55rem;
  border: 2px solid #90caf9;
  border-radius: 10px;
  background: #e3f2fd;
  color: #1565c0;
  cursor: pointer;
}

.table-pick-btn:hover {
  background: #bbdefb;
}

.table-pick-btn.active {
  background: #fff3e0;
  border-color: var(--primary);
  color: var(--primary-dark);
  box-shadow: 0 3px 0 var(--primary-dark);
}

.single-table-box {
  background: #fff8e1;
  border: 2px dashed #ffca28;
  border-radius: 14px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.single-table-box h3 {
  font-size: 1rem;
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
  text-align: center;
}

.single-table-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.75rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.single-table-list span {
  padding: 0.25rem 0.4rem;
  background: #fff;
  border-radius: 8px;
  text-align: center;
}

.full-table-wrap {
  margin-bottom: 1rem;
}

.full-table-heading {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
  text-align: center;
}

.times-table-grid {
  overflow-x: auto;
  border: 2px solid #c5e1a5;
  border-radius: 12px;
  background: #fff;
}

.times-table-grid table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  min-width: 320px;
}

.times-table-grid th,
.times-table-grid td {
  border: 1px solid #e0e0e0;
  padding: 0.35rem 0.25rem;
  text-align: center;
  font-weight: 600;
}

.times-table-grid th {
  background: #e8f5e9;
  color: #2e7d32;
}

.times-table-grid td.highlight {
  background: #fff3e0;
  color: var(--primary-dark);
}

.times-table-grid tr.highlight-row td:first-child {
  background: #fff8e1;
  font-weight: 700;
}

@media (max-width: 400px) {
  .table-picker {
    grid-template-columns: repeat(4, 1fr);
  }

  .single-table-list {
    grid-template-columns: 1fr;
  }
}

.btn-check {
  background: var(--success);
  color: #fff;
  border: 3px solid #2e7d32;
  box-shadow: 0 4px 0 #2e7d32;
}

.btn-next {
  background: linear-gradient(180deg, #81d4fa, #29b6f6);
  color: #fff;
  border: 3px solid #0288d1;
  box-shadow: 0 4px 0 #0288d1;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  font-size: 0.95rem;
  padding: 0.6rem;
  margin-top: 0.35rem;
}

/* ===== Quiz ===== */
.game-hud {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.stars-hud {
  background: #fff8e1;
  padding: 0.35rem 0.65rem;
  border-radius: 20px;
  border: 2px solid #ffca28;
  font-weight: 700;
  font-size: 1.1rem;
}

.path-hud {
  flex: 1;
  min-width: 80px;
}

.path-dots {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.path-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e0e0e0;
  border: 2px solid #bdbdbd;
  transition: all 0.3s;
}

.path-dot.done {
  background: #ffca28;
  border-color: #ffa000;
  transform: scale(1.1);
}

.path-dot.current {
  background: var(--primary);
  border-color: var(--primary-dark);
  animation: dot-pulse 1s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.score-hud {
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.timer-hud {
  background: #e3f2fd;
  padding: 0.35rem 0.65rem;
  border-radius: 20px;
  border: 2px solid #64b5f6;
  font-weight: 700;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}

.timer-hud.warning {
  background: #fff3e0;
  border-color: #ff9800;
  color: #e65100;
  animation: timer-pulse 1s ease-in-out infinite;
}

.timer-hud.danger {
  background: #ffebee;
  border-color: #e53935;
  color: #c62828;
  animation: timer-pulse 0.6s ease-in-out infinite;
}

@keyframes timer-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.cheer-line {
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 0.75rem;
  min-height: 1.5rem;
}

.question-cloud {
  background: linear-gradient(180deg, #fff 0%, #e3f2fd 100%);
  border: 3px solid #90caf9;
  border-radius: 24px;
  padding: 1.5rem 1rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 6px 0 #64b5f6;
  position: relative;
}

.question-cloud::after {
  content: "";
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  border: 14px solid transparent;
  border-top-color: #64b5f6;
}

.question {
  font-size: 2.5rem;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  letter-spacing: 0.03em;
}

.choices-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.choice-btn {
  font-family: inherit;
  font-size: 1.75rem;
  font-weight: 700;
  padding: 1.1rem;
  border: 3px solid #a5d6a7;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff 0%, #e8f5e9 100%);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 5px 0 #81c784;
}

.choice-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 7px 0 #66bb6a;
}

.choice-btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #66bb6a;
}

.choice-btn:disabled {
  cursor: default;
  opacity: 0.85;
}

.choice-btn.correct-pick {
  background: var(--success-light);
  border-color: var(--success);
  box-shadow: 0 4px 0 #2e7d32;
  animation: wiggle 0.4s ease;
}

.choice-btn.wrong-pick {
  background: var(--error-light);
  border-color: var(--error);
  box-shadow: 0 4px 0 #c62828;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}

.type-area {
  margin-bottom: 0.75rem;
}

.answer-input {
  width: 100%;
  font-family: inherit;
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  padding: 0.85rem;
  border: 3px solid #90caf9;
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 4px 0 #64b5f6;
}

.answer-input:focus {
  outline: none;
  border-color: var(--primary);
}

.answer-input.correct {
  border-color: var(--success);
  background: var(--success-light);
}

.answer-input.wrong {
  border-color: var(--error);
  background: var(--error-light);
}

.feedback {
  text-align: center;
  min-height: 1.75rem;
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.feedback.success {
  color: var(--success);
}

.feedback.error {
  color: var(--error);
}

.streak {
  text-align: center;
  font-weight: 700;
  color: #ff8f00;
  font-size: 0.95rem;
  min-height: 1.25rem;
}

.quiz-actions {
  margin-top: 0.5rem;
}

.pop-in {
  animation: pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pop-in {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ===== Results ===== */
.results-banner {
  text-align: center;
  margin-bottom: 1.25rem;
}

.results-mascot {
  font-size: 4rem;
  line-height: 1;
}

#results-screen h2 {
  font-size: 1.5rem;
  color: var(--primary-dark);
  margin: 0.5rem 0;
}

.results-summary {
  color: var(--muted);
  font-size: 1rem;
}

.trophy-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.trophy-box {
  text-align: center;
  padding: 0.85rem 0.35rem;
  background: linear-gradient(180deg, #fff8e1, #ffecb3);
  border-radius: 14px;
  border: 2px solid #ffca28;
}

.trophy-emoji {
  font-size: 1.5rem;
  display: block;
}

.trophy-num {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.trophy-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}

.badge-earned {
  text-align: center;
  padding: 0.75rem;
  background: #e8f5e9;
  border: 2px dashed var(--success);
  border-radius: 12px;
  font-weight: 600;
  margin-bottom: 1rem;
  font-size: 1rem;
}

.review-list {
  max-height: 160px;
  overflow-y: auto;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}

.review-item {
  display: flex;
  justify-content: space-between;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  margin-bottom: 0.3rem;
}

.review-item.correct {
  background: var(--success-light);
  color: #2e7d32;
}

.review-item.wrong {
  background: var(--error-light);
  color: #c62828;
}

@media (max-width: 400px) {
  .question {
    font-size: 2rem;
  }

  .choice-btn {
    font-size: 1.5rem;
    padding: 0.9rem;
  }
}
