:root {
  --bg-1: #fff4d8;
  --bg-2: #d9f5ff;
  --card: #ffffff;
  --ink: #1f2a44;
  --soft-ink: #4a5672;
  --accent: #ff8a5b;
  --accent-2: #2e9cca;
  --ok: #2f9e44;
  --warn: #f08c00;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Baloo 2", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, #ffffffaa 0%, #ffffff00 45%),
    radial-gradient(circle at 90% 85%, #ffd8a855 0%, #ffffff00 38%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
}

.app-shell {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.app-card {
  max-width: 980px;
  border-radius: 24px;
  overflow: hidden;
  background: var(--card);
}

.app-header {
  background: linear-gradient(120deg, #1f6cb0, #2e9cca);
  color: #fff;
}

.app-title {
  font-size: clamp(2rem, 3vw, 2.6rem);
  line-height: 1;
}

.app-subtitle {
  font-size: 1.15rem;
  opacity: 0.95;
}

.score-badge {
  background-color: #fff;
  color: #1f6cb0;
  padding: 0.5rem 0.85rem;
}

#fullscreenBtn {
  min-width: 60px;
  font-size: 1.3rem;
  font-weight: 700;
  color: #1f6cb0;
}

.mode-btn {
  background: #f4f7ff;
  border: 2px solid #d9e2ff;
  color: #1f2a44;
  font-size: 1.35rem;
  font-weight: 700;
  padding: 0.9rem;
  border-radius: 16px;
}

.mode-btn.active {
  background: #ffd9c9;
  border-color: #ffb390;
}

.status-card {
  border-radius: 18px;
  background: #f6faff;
  border: 2px dashed #b8dbf0;
}

.status-text {
  font-size: 1.25rem;
  color: var(--soft-ink);
}

.progress-chip {
  background: #fff3bf;
  border-radius: 999px;
  padding: 0.35rem 0.95rem;
  font-size: 1rem;
}

.exercise-card {
  border-radius: 22px;
  background: #fffef7;
  border: 2px solid #ffe8b0;
}

.visual-row {
  min-height: 78px;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.fruit {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  opacity: 0;
  transform: translateY(12px);
  animation: fruit-pop 380ms ease forwards;
}

.fruit.remove {
  filter: grayscale(1);
  opacity: 0.65;
}

.equation {
  font-size: clamp(2.1rem, 5vw, 3.2rem);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.answer-slot {
  display: inline-block;
  min-width: 1.5ch;
  color: var(--accent);
}

.form-control {
  border-width: 2px;
  border-color: #ced9ef;
  border-radius: 14px;
  font-size: 1.6rem;
}

.hint-btn {
  background: #ffe8a1;
  border: 2px solid #ffd166;
  color: #5f4b00;
  font-size: 1.2rem;
  font-weight: 700;
}

.speak-btn {
  background: #d9f2ff;
  border: 2px solid #8ecdf2;
  color: #004f75;
  font-size: 1.2rem;
  font-weight: 700;
}

.keypad-card {
  border-radius: 22px;
  background: #eef7ff;
  border: 2px solid #c6e6ff;
}

.keypad-title {
  font-size: 1.5rem;
  color: #245985;
}

.keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(56px, 1fr));
  gap: 0.6rem;
}

.keypad-key {
  min-height: 64px;
  background: #ffffff;
  border: 2px solid #bad8ee;
  border-radius: 14px;
  font-size: 1.8rem;
  font-weight: 700;
  color: #1f2a44;
}

.keypad-key:active {
  transform: scale(0.97);
}

.keypad-clear {
  background: #fff4c2;
  border-color: #ffdf70;
}

.keypad-delete {
  background: #ffd8d8;
  border-color: #ffb5b5;
}

.success-state {
  border-color: #8ce99a;
  background: #ebfbee;
}

.error-state {
  border-color: #ffa8a8;
  background: #fff5f5;
}

@keyframes fruit-pop {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .app-card {
    border-radius: 18px;
  }

  .status-text {
    font-size: 1.1rem;
  }

  .equation {
    font-size: 2.2rem;
  }
}
