/* Kids Daily Learning — polished rough v1 */
:root {
  --bg: #f0f7ff;
  --card: #ffffff;
  --ink: #1a2b4a;
  --muted: #5a6f8a;
  --accent: #4f7cff;
  --accent-dark: #3a5fd4;
  --green: #22a06b;
  --green-bg: #e3f8ef;
  --red: #e24b4a;
  --red-bg: #fde8e8;
  --yellow: #f5a623;
  --yellow-bg: #fff6e0;
  --purple: #7c5cbf;
  --pink: #e85d8a;
  --alex: #4f7cff;
  --sam: #e85d8a;
  --shadow: 0 8px 24px rgba(26, 43, 74, 0.1);
  --radius: 20px;
  --tap: 52px;
  font-size: 18px;
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-image:
    radial-gradient(circle at 10% 10%, #d6e8ff 0%, transparent 40%),
    radial-gradient(circle at 90% 20%, #ffe4f0 0%, transparent 35%),
    radial-gradient(circle at 50% 100%, #e8fff4 0%, transparent 40%);
  background-attachment: fixed;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px 48px;
  min-height: 100vh;
}

/* Typography */
h1 { font-size: 1.75rem; margin: 0 0 8px; letter-spacing: -0.02em; }
h2 { font-size: 1.35rem; margin: 0 0 12px; }
h3 { font-size: 1.1rem; margin: 0 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* Screens */
.screen { display: none; animation: fadeIn 0.25s ease; }
.screen.active { display: block; }

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

@keyframes pop {
  0% { transform: scale(0.9); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

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

/* Cards & layout */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.hero {
  text-align: center;
  padding: 28px 16px 8px;
}

.hero .emoji {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 8px;
}

.logo-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}

/* Buttons */
button, .btn {
  appearance: none;
  border: none;
  font: inherit;
  cursor: pointer;
  border-radius: 14px;
  min-height: var(--tap);
  padding: 12px 20px;
  font-weight: 700;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  text-decoration: none;
  color: inherit;
}

button:active, .btn:active { transform: scale(0.97); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 14px rgba(79, 124, 255, 0.35);
}
.btn-primary:hover { background: var(--accent-dark); }

.btn-secondary {
  background: #e8eef8;
  color: var(--ink);
}
.btn-secondary:hover { background: #d8e2f2; }

.btn-success {
  background: var(--green);
  color: white;
  box-shadow: 0 4px 14px rgba(34, 160, 107, 0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  min-height: 40px;
  font-weight: 600;
}
.btn-ghost:hover { color: var(--ink); background: rgba(0,0,0,0.04); }

.btn-block { width: 100%; }
.btn-lg { min-height: 64px; font-size: 1.15rem; padding: 16px 24px; }

.btn-alex {
  background: linear-gradient(135deg, #4f7cff, #6b9aff);
  color: white;
  box-shadow: 0 6px 18px rgba(79, 124, 255, 0.35);
}
.btn-sam {
  background: linear-gradient(135deg, #e85d8a, #f08ab0);
  color: white;
  box-shadow: 0 6px 18px rgba(232, 93, 138, 0.35);
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn-row > * { flex: 1; min-width: 120px; }

.kid-pick {
  display: grid;
  gap: 12px;
  margin: 20px 0;
}

/* Progress */
.progress-wrap {
  margin: 12px 0 4px;
}
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.progress-bar {
  height: 14px;
  background: #e2eaf5;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #7c9fff);
  border-radius: 999px;
  transition: width 0.35s ease;
  min-width: 0;
}
.progress-fill.math { background: linear-gradient(90deg, #4f7cff, #7c9fff); }
.progress-fill.spell { background: linear-gradient(90deg, #7c5cbf, #b08cff); }
.progress-fill.green { background: linear-gradient(90deg, var(--green), #4fd4a0); }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}
.stat {
  background: #f4f8ff;
  border-radius: 14px;
  padding: 14px;
  text-align: center;
}
.stat .num {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
}
.stat .label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}

/* Session UI */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.session-title {
  font-weight: 800;
  font-size: 1.05rem;
}

.question-card {
  text-align: center;
  padding: 28px 20px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.question-text {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 8px 0 4px;
  word-break: break-word;
}
.question-text.word-problem {
  font-size: 1.35rem;
  font-weight: 700;
  text-align: left;
  width: 100%;
}

.hint {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 8px;
}

.answer-area {
  margin-top: 8px;
}

.answer-input {
  width: 100%;
  font: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  padding: 16px;
  border: 3px solid #d0dcef;
  border-radius: 16px;
  outline: none;
  background: #fafcff;
  color: var(--ink);
  min-height: var(--tap);
  transition: border-color 0.15s;
}
.answer-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(79, 124, 255, 0.15);
}
.answer-input.wrong {
  border-color: var(--red);
  animation: shake 0.35s ease;
}
.answer-input.right {
  border-color: var(--green);
}

.feedback {
  margin: 14px 0;
  padding: 14px 16px;
  border-radius: 14px;
  font-weight: 700;
  text-align: center;
  display: none;
  animation: pop 0.3s ease;
}
.feedback.show { display: block; }
.feedback.good {
  background: var(--green-bg);
  color: var(--green);
}
.feedback.ok {
  background: var(--yellow-bg);
  color: #b07800;
}
.feedback.bad {
  background: var(--red-bg);
  color: var(--red);
}

.points-pop {
  font-size: 0.95rem;
  opacity: 0.9;
  margin-top: 4px;
}

/* Spelling specific */
.hear-btn {
  background: linear-gradient(135deg, var(--purple), #9b7fd9);
  color: white;
  box-shadow: 0 4px 14px rgba(124, 92, 191, 0.35);
  margin: 8px 0 16px;
  font-size: 1.1rem;
}
.spell-fallback {
  background: var(--yellow-bg);
  color: #8a6500;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  margin-bottom: 12px;
  display: none;
}
.spell-fallback.show { display: block; }
.flash-word {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin: 8px 0;
}

/* Parent */
.scoreboard-kid {
  border-left: 5px solid var(--accent);
  padding-left: 14px;
  margin-bottom: 20px;
}
.scoreboard-kid.sam { border-left-color: var(--sam); }

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.form-row label {
  font-weight: 700;
  font-size: 0.9rem;
}
.form-row input[type="number"],
.form-row input[type="text"] {
  font: inherit;
  padding: 12px 14px;
  border: 2px solid #d0dcef;
  border-radius: 12px;
  min-height: 48px;
  outline: none;
}
.form-row input:focus { border-color: var(--accent); }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.note-box {
  background: var(--yellow-bg);
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 600;
  color: #8a6500;
  margin: 12px 0;
}

.done-banner {
  background: linear-gradient(135deg, #e3f8ef, #e8f4ff);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  margin-bottom: 16px;
}
.done-banner .emoji { font-size: 2.5rem; }

.chip {
  display: inline-block;
  background: #e8eef8;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

.level-chip {
  background: #efe8ff;
  color: var(--purple);
}

footer.tiny {
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 24px;
  padding-bottom: 8px;
}

@media (min-width: 600px) {
  :root { font-size: 19px; }
  #app { padding: 24px 20px 56px; }
  .question-text { font-size: 2.4rem; }
}
