/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: 'Fredoka', 'Segoe UI', sans-serif;
  background-color: var(--bg-primary, #2d5016);
  color: var(--text-primary, #fff);
  transition: background-color 0.4s, color 0.4s;
  min-height: 100vh;
}

/* ─── Screens ──────────────────────────────────────────────── */
.screen {
  display: none;
  min-height: 100vh;
  padding: 20px;
}

.screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.screen-content {
  max-width: 700px;
  width: 100%;
  text-align: center;
  padding: 20px;
}

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

/* ─── Typography ───────────────────────────────────────────── */
.main-title {
  font-size: 2.8rem;
  font-weight: 700;
  margin-bottom: 10px;
  text-shadow: 3px 3px 0 rgba(0,0,0,0.2);
}

.subtitle {
  font-size: 1.3rem;
  margin-bottom: 30px;
  opacity: 0.9;
}

.screen-title {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 25px;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.2);
}

/* ─── Theme Picker ─────────────────────────────────────────── */
.theme-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 500px;
  margin: 0 auto;
}

.theme-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 16px;
  border: 4px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  background: var(--btn-bg, rgba(255,255,255,0.15));
  color: var(--text-primary, #fff);
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.theme-btn:hover {
  transform: scale(1.05);
  border-color: rgba(255,255,255,0.6);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.theme-btn:active {
  transform: scale(0.98);
}

.theme-mascot {
  font-size: 3rem;
}

.theme-name {
  font-size: 1rem;
}

/* Theme button colors */
.theme-btn-jungle { background: linear-gradient(135deg, #2d5016, #4a7c23); }
.theme-btn-farm { background: linear-gradient(135deg, #8b4513, #d2691e); }
.theme-btn-space { background: linear-gradient(135deg, #1a0533, #4b0082); }
.theme-btn-ocean { background: linear-gradient(135deg, #005b96, #0288d1); }

/* ─── Level Select ─────────────────────────────────────────── */
.level-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 500px;
  margin: 0 auto 20px;
}

.level-btn {
  padding: 18px 20px;
  border: 3px solid var(--btn-border, rgba(255,255,255,0.3));
  border-radius: 16px;
  background: var(--btn-bg, rgba(255,255,255,0.15));
  color: var(--text-primary, #fff);
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  text-align: left;
  transition: transform 0.2s, box-shadow 0.2s;
}

.level-btn:hover:not(.locked) {
  transform: translateX(5px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.level-btn.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.level-number {
  font-size: 1.3rem;
  font-weight: 700;
}

.level-desc {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-top: 2px;
}

.level-best {
  font-size: 0.85rem;
  margin-top: 6px;
  opacity: 0.9;
}

.level-locked {
  font-size: 0.8rem;
  margin-top: 4px;
  opacity: 0.7;
}

.level-nav {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.nav-btn {
  padding: 10px 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 12px;
  background: rgba(255,255,255,0.1);
  color: var(--text-primary, #fff);
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
}

.nav-btn:hover {
  background: rgba(255,255,255,0.2);
}

/* ─── Gameplay ─────────────────────────────────────────────── */
.gameplay-content {
  max-width: 600px;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 1rem;
  font-weight: 600;
}

.game-mascot {
  font-size: 2rem;
}

.timer-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 28px;
  background: rgba(0,0,0,0.15);
  border-radius: 0;
  overflow: hidden;
  z-index: 100;
  opacity: 0.4;
}

.timer-bar-fill {
  height: 100%;
  background: var(--accent-color, #4caf50);
  border-radius: 0;
  transition: width 0.05s linear;
}

.timer-bar-fill.warning {
  background: #ff9800;
}

.timer-bar-fill.danger {
  background: #f44336;
  animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.timer-text {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.game-problem {
  font-size: 3rem;
  font-weight: 700;
  margin: 20px 0 30px;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.2);
  min-height: 4rem;
}

.game-answers {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.game-answers.choices {
  grid-template-columns: repeat(2, 1fr);
}

.answer-btn {
  padding: 18px;
  border: 3px solid var(--btn-border, rgba(255,255,255,0.4));
  border-radius: 16px;
  background: var(--btn-bg, rgba(255,255,255,0.15));
  color: var(--text-primary, #fff);
  font-family: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
}

.answer-btn:hover:not(:disabled) {
  transform: scale(1.05);
  background: rgba(255,255,255,0.25);
}

.answer-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.answer-btn:disabled {
  cursor: default;
}

.answer-btn.correct-answer {
  background: #4caf50 !important;
  border-color: #388e3c !important;
  animation: bounceIn 0.3s ease;
}

.answer-btn.wrong-answer {
  background: #f44336 !important;
  border-color: #d32f2f !important;
  animation: shake 0.4s ease;
}

@keyframes bounceIn {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.game-answers.input-mode {
  grid-template-columns: 1fr auto;
  max-width: 300px;
  margin: 0 auto 20px;
}

.answer-input {
  padding: 16px;
  border: 3px solid var(--btn-border, rgba(255,255,255,0.4));
  border-radius: 14px;
  background: rgba(255,255,255,0.15);
  color: var(--text-primary, #fff);
  font-family: inherit;
  font-size: 1.8rem;
  font-weight: 700;
  text-align: center;
  width: 100%;
  outline: none;
}

.answer-input::placeholder {
  color: rgba(255,255,255,0.4);
}

.answer-input:focus {
  border-color: var(--accent-color, #4caf50);
  box-shadow: 0 0 10px rgba(76,175,80,0.3);
}

.answer-submit-btn {
  padding: 16px 24px;
  border: 3px solid var(--btn-border, rgba(255,255,255,0.4));
  border-radius: 14px;
  background: var(--accent-color, #4caf50);
  color: #fff;
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s;
}

.answer-submit-btn:hover {
  transform: scale(1.05);
}

/* ─── Feedback ─────────────────────────────────────────────── */
.game-feedback {
  font-size: 1.2rem;
  font-weight: 600;
  min-height: 2rem;
  padding: 8px;
  border-radius: 12px;
  margin-bottom: 16px;
  transition: all 0.3s;
}

.game-feedback.correct {
  color: #a5d6a7;
  animation: bounceIn 0.3s ease;
}

.game-feedback.wrong {
  color: #ef9a9a;
  animation: shake 0.4s ease;
}

.game-feedback.timeout {
  color: #ffcc80;
}

.next-btn {
  padding: 14px 32px;
  border: 3px solid var(--btn-border, rgba(255,255,255,0.4));
  border-radius: 14px;
  background: var(--accent-color, #4caf50);
  color: #fff;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s;
}

.next-btn:hover {
  transform: scale(1.05);
}

/* ─── Results ──────────────────────────────────────────────── */
.results-mascot {
  font-size: 4rem;
  margin-bottom: 10px;
}

.results-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.results-stars {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.results-score {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.results-message {
  font-size: 1.1rem;
  margin-bottom: 20px;
  opacity: 0.9;
}

.results-missed {
  text-align: left;
  background: rgba(0,0,0,0.15);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 20px;
}

.results-missed h3 {
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.missed-fact {
  padding: 6px 0;
  font-size: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.missed-fact:last-child {
  border-bottom: none;
}

.results-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

/* ─── Action Buttons ───────────────────────────────────────── */
.action-btn {
  padding: 14px 28px;
  border: 3px solid var(--btn-border, rgba(255,255,255,0.3));
  border-radius: 14px;
  background: var(--accent-color, #4caf50);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s;
  min-width: 250px;
}

.action-btn:hover {
  transform: scale(1.03);
}

.secondary-btn {
  background: rgba(255,255,255,0.15);
}

.review-btn {
  background: var(--review-btn, #ff9800);
}

.danger-btn {
  background: rgba(244, 67, 54, 0.6);
  border-color: rgba(244, 67, 54, 0.5);
  font-size: 0.9rem;
  min-width: auto;
  padding: 10px 20px;
}

/* ─── Progress Dashboard ───────────────────────────────────── */
.mastery-grid {
  display: inline-block;
  margin: 16px auto;
  background: rgba(0,0,0,0.15);
  border-radius: 12px;
  padding: 8px;
  overflow-x: auto;
  max-width: 100%;
}

.grid-row {
  display: flex;
}

.grid-cell {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  border-radius: 4px;
  margin: 1px;
}

.grid-cell.header {
  background: rgba(255,255,255,0.15);
  font-weight: 700;
  font-size: 0.7rem;
}

.grid-cell.corner {
  background: rgba(255,255,255,0.1);
  font-weight: 700;
}

.grid-cell.fact.mastered {
  background: #4caf50;
  color: #fff;
}

.grid-cell.fact.learning {
  background: #ff9800;
  color: #fff;
}

.grid-cell.fact.missed {
  background: #f44336;
  color: #fff;
}

.grid-cell.fact.not-attempted {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.4);
}

.legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
}

.legend-dot.mastered { background: #4caf50; }
.legend-dot.learning { background: #ff9800; }
.legend-dot.missed { background: #f44336; }
.legend-dot.not-attempted { background: rgba(255,255,255,0.15); }

.progress-info {
  margin: 12px 0;
  font-size: 1rem;
}

.progress-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

/* ─── Pause ────────────────────────────────────────────────── */
.pause-btn {
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 10px;
  color: var(--text-primary, #fff);
  padding: 6px 10px;
  cursor: pointer;
  transition: background 0.2s;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pause-btn .material-icons {
  font-size: 1.4rem;
}

.pause-btn:hover {
  background: rgba(255,255,255,0.25);
}

.pause-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 500;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
}

.pause-overlay.visible {
  display: flex;
}

.pause-message {
  text-align: center;
  color: #fff;
}

.pause-icon {
  font-size: 5rem !important;
  display: block;
  margin-bottom: 10px;
  opacity: 0.9;
}

.pause-message h2 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 24px;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.3);
}

.pause-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.btn-icon {
  font-size: 1.2rem !important;
  vertical-align: middle;
  margin-right: 4px;
  position: relative;
  top: -1px;
}

.lock-icon {
  font-size: 0.85rem !important;
  vertical-align: middle;
  margin-right: 2px;
  position: relative;
  top: -1px;
}

/* ─── Confetti ─────────────────────────────────────────────── */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -10px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confettiFall 2.5s ease-out forwards;
}

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

.celebration-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 8rem;
  transform: translate(-50%, -50%);
  animation: iconDance 3s ease-out forwards;
  pointer-events: none;
  z-index: 1001;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

@keyframes iconDance {
  0% {
    transform: translate(-50%, -50%) scale(0) rotate(0deg);
    opacity: 1;
  }
  15% {
    transform: translate(-50%, -50%) scale(1.4) rotate(-15deg);
    opacity: 1;
  }
  30% {
    transform: translate(-50%, -50%) scale(1.2) rotate(15deg);
  }
  45% {
    transform: translate(-50%, -50%) scale(1.3) rotate(-10deg);
  }
  60% {
    transform: translate(-50%, -50%) scale(1.2) rotate(10deg);
  }
  75% {
    transform: translate(-50%, -50%) scale(1.1) rotate(-5deg);
  }
  90% {
    transform: translate(-50%, -70%) scale(1.3) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -120%) scale(0.8) rotate(15deg);
    opacity: 0;
  }
}

/* ─── Dialog ───────────────────────────────────────────────── */
.dialog-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 600;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
}

.dialog-overlay.visible {
  display: flex;
}

.dialog {
  background: #1e1e2e;
  border-radius: 20px;
  padding: 32px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  animation: fadeIn 0.2s ease;
}

.dialog-icon {
  font-size: 3rem !important;
  color: #f44336;
  display: block;
  margin-bottom: 12px;
}

.dialog-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
}

.dialog-message {
  font-size: 0.95rem;
  color: rgba(255,255,255,0.7);
  margin-bottom: 24px;
  line-height: 1.5;
}

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

.dialog-buttons .action-btn {
  min-width: 120px;
  padding: 12px 20px;
}

/* ─── Streak Celebrations ──────────────────────────────────── */
.streak-icon {
  top: auto !important;
  bottom: 20%;
  animation: streakDance 2.5s ease-out forwards !important;
}

@keyframes streakDance {
  0% {
    transform: translateX(-50%) scale(0) rotate(0deg);
    opacity: 1;
  }
  10% {
    transform: translateX(-50%) scale(1.3) rotate(-20deg);
  }
  20% {
    transform: translateX(-50%) scale(1.1) rotate(20deg);
  }
  30% {
    transform: translateX(-50%) scale(1.2) rotate(-15deg);
  }
  40% {
    transform: translateX(-50%) scale(1.0) rotate(15deg);
  }
  50% {
    transform: translateX(-50%) scale(1.1) rotate(-10deg);
  }
  60% {
    transform: translateX(-50%) scale(1.0) rotate(10deg);
  }
  80% {
    transform: translateX(-50%) scale(1.1) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateX(-50%) translateY(-80px) scale(0.6) rotate(20deg);
    opacity: 0;
  }
}

.firework-burst {
  position: absolute;
  width: 0;
  height: 0;
  animation: burstAppear 0.1s ease forwards;
}

@keyframes burstAppear {
  to { opacity: 1; }
}

.firework-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: fireworkExplode 1s ease-out forwards;
  animation-delay: inherit;
}

@keyframes fireworkExplode {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(
      calc(cos(var(--angle)) * var(--distance)),
      calc(sin(var(--angle)) * var(--distance))
    ) scale(0);
    opacity: 0;
  }
}

.streak-banner {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.4);
  white-space: nowrap;
  animation: bannerPop 3s ease-out forwards;
  z-index: 1002;
  pointer-events: none;
}

.streak-level-1 { font-size: 1.8rem; }
.streak-level-2 { font-size: 2.2rem; }
.streak-level-3 { font-size: 2.8rem; }
.streak-level-4 { font-size: 3.2rem; }
.streak-level-5 { font-size: 3.8rem; }

@keyframes bannerPop {
  0% {
    transform: translateX(-50%) scale(0);
    opacity: 0;
  }
  15% {
    transform: translateX(-50%) scale(1.3);
    opacity: 1;
  }
  25% {
    transform: translateX(-50%) scale(1);
  }
  80% {
    transform: translateX(-50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateX(-50%) scale(0.8) translateY(-30px);
    opacity: 0;
  }
}

/* ─── Streak Badge ─────────────────────────────────────────── */
.streak-badge {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #ff6b35, #f7c948);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  padding: 4px 10px;
  border-radius: 20px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
  box-shadow: 0 2px 8px rgba(255,107,53,0.4);
  transition: transform 0.2s;
}

.streak-badge-pop {
  animation: badgePop 0.3s ease;
}

@keyframes badgePop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ─── Mascot Reactions ─────────────────────────────────────── */
.mascot-bounce {
  animation: mascotBounce 0.5s ease;
}

.mascot-shake {
  animation: mascotShake 0.4s ease;
}

@keyframes mascotBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  25% { transform: translateY(-12px) scale(1.2); }
  50% { transform: translateY(-4px) scale(1.1); }
  75% { transform: translateY(-8px) scale(1.15); }
}

@keyframes mascotShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px) rotate(-5deg); }
  40% { transform: translateX(6px) rotate(5deg); }
  60% { transform: translateX(-4px) rotate(-3deg); }
  80% { transform: translateX(4px) rotate(3deg); }
}

/* ─── Fun Fact (Results) ──────────────────────────────────── */
.results-fun-fact {
  background: rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 0.95rem;
  line-height: 1.5;
  border-left: 4px solid var(--accent-color, #4caf50);
}

.fun-fact-icon {
  font-size: 1.3rem;
  margin-right: 6px;
}

/* ─── Achievement Toast ───────────────────────────────────── */
.achievement-toast {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.achievement-toast-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(30,30,46,0.95);
  border: 2px solid #f7c948;
  border-radius: 14px;
  padding: 12px 16px;
  color: #fff;
  font-size: 0.9rem;
  box-shadow: 0 6px 24px rgba(0,0,0,0.4);
  animation: toastSlideIn 0.4s ease;
  pointer-events: auto;
}

.achievement-toast-item.fade-out {
  animation: toastFadeOut 0.5s ease forwards;
}

.achievement-toast-icon {
  font-size: 2rem;
}

@keyframes toastSlideIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastFadeOut {
  to { transform: translateX(120%); opacity: 0; }
}

/* ─── Achievements Screen ──────────────────────────────────── */
.achievements-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 500px;
  margin: 0 auto 20px;
}

.achievement-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(255,255,255,0.15);
  text-align: left;
  transition: transform 0.2s;
}

.achievement-card.unlocked {
  border-color: #f7c948;
  background: rgba(247,201,72,0.12);
}

.achievement-card.locked {
  opacity: 0.5;
}

.achievement-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.achievement-info {
  min-width: 0;
}

.achievement-info strong {
  display: block;
  font-size: 0.9rem;
}

.achievement-info small {
  font-size: 0.75rem;
  opacity: 0.7;
}

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .main-title { font-size: 2.2rem; }
  .game-problem { font-size: 2.4rem; }
  .grid-cell { width: 28px; height: 28px; font-size: 0.55rem; }
  .answer-btn { padding: 20px; min-height: 60px; }
  .action-btn { min-width: 200px; padding: 16px 24px; }
}

@media (max-width: 480px) {
  .screen { padding: 12px; }
  .screen-content { padding: 12px; }
  .main-title { font-size: 1.8rem; }
  .screen-title { font-size: 1.6rem; }
  .game-problem { font-size: 2rem; margin: 14px 0 20px; }
  .theme-buttons { grid-template-columns: 1fr 1fr; max-width: 320px; gap: 10px; }
  .theme-btn { padding: 16px 10px; }
  .game-answers.choices { grid-template-columns: 1fr 1fr; gap: 10px; }
  .answer-btn { font-size: 1.4rem; padding: 18px 12px; min-height: 56px; }
  .answer-input { font-size: 1.5rem; padding: 14px; }
  .answer-submit-btn { padding: 14px 18px; font-size: 1.1rem; }
  .grid-cell { width: 24px; height: 24px; font-size: 0.5rem; }
  .game-header { font-size: 0.85rem; gap: 6px; }
  .game-mascot { font-size: 1.5rem; }
  .timer-bar { height: 22px; }
  .results-score { font-size: 2.2rem; }
  .results-missed { padding: 12px; }
  .level-btn { padding: 14px 16px; }
  .next-btn { padding: 14px 24px; width: 100%; }
  .action-btn { min-width: 0; width: 100%; }
  .pause-btn { padding: 4px 10px; font-size: 1rem; }
  .achievements-grid { grid-template-columns: 1fr; }
  .achievement-toast { top: 8px; right: 8px; left: 8px; }
  .achievement-toast-item { font-size: 0.8rem; padding: 10px 12px; }
}

/* Ensure touch targets are at least 48px */
@media (pointer: coarse) {
  .answer-btn, .action-btn, .next-btn, .level-btn, .theme-btn, .nav-btn, .pause-btn {
    min-height: 48px;
  }
}
