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

:root {
  --purple: #7C3AED;
  --purple-light: #EDE9FE;
  --teal: #0D9488;
  --yellow: #F59E0B;
  --pink: #EC4899;
  --text: #1F2937;
  --muted: #6B7280;
  --border: #E5E7EB;
  --bg: #F9FAFB;
  --white: #FFFFFF;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,.10);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Nunito, sans-serif; color: var(--text); background: var(--bg); }
a { color: inherit; text-decoration: none; }

/* ═══════════════════════════════════════════════════════════════════════════
   AUTH PAGE (login)
   ═══════════════════════════════════════════════════════════════════════════ */
.kid-auth-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #7C3AED 0%, #4F46E5 40%, #0D9488 100%);
  padding: 20px;
}
.kid-auth-card {
  background: var(--white); border-radius: 24px; padding: 44px 36px;
  width: 100%; max-width: 400px; box-shadow: 0 12px 48px rgba(0,0,0,.2);
  text-align: center;
}
.kid-owl { font-size: 64px; margin-bottom: 8px; display: block; }
.kid-auth-title { font-size: 28px; font-weight: 800; color: var(--purple); margin-bottom: 6px; }
.kid-auth-sub   { font-size: 15px; color: var(--muted); margin-bottom: 24px; }
.kid-flash {
  background: #FEF3C7; border: 1px solid #FCD34D; color: #92400E;
  padding: 10px 14px; border-radius: 10px; margin-bottom: 16px;
  font-size: 14px; font-weight: 500;
}
.kid-label { display: block; text-align: left; font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; margin-top: 14px; }
.kid-input {
  width: 100%; padding: 14px 16px; border: 2px solid var(--border);
  border-radius: 12px; font-size: 16px; outline: none; transition: border-color .15s;
  text-align: center; letter-spacing: .04em;
}
.kid-input:focus { border-color: var(--purple); }
.kid-btn-go {
  display: block; width: 100%; margin-top: 22px; padding: 16px;
  background: linear-gradient(135deg, #7C3AED, #4F46E5);
  color: #fff; border: none; border-radius: 14px;
  font-size: 18px; font-weight: 800; cursor: pointer;
  box-shadow: 0 4px 16px rgba(124,58,237,.4); transition: transform .15s, box-shadow .15s;
}
.kid-btn-go:hover  { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(124,58,237,.5); }
.kid-btn-go:active { transform: translateY(0); }
.kid-auth-back { display: block; margin-top: 20px; font-size: 13px; color: var(--muted); }
.kid-auth-back:hover { color: var(--purple); }

/* ═══════════════════════════════════════════════════════════════════════════
   KID HOME PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

/* Top bar */
.kid-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--white); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 8px rgba(0,0,0,.06);
}
.kid-topbar-brand { font-size: 18px; font-weight: 800; color: var(--purple); }
.kid-topbar-user  { display: flex; align-items: center; gap: 10px; }
.kid-topbar-name  { font-size: 15px; font-weight: 700; color: var(--text); }
.kid-topbar-avatar { font-size: 30px; }
.kid-topbar-logout {
  font-size: 12px; color: var(--muted); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 10px; transition: all .15s;
}
.kid-topbar-logout:hover { border-color: #F87171; color: #EF4444; }

/* Page wrapper */
.kid-page { padding: 28px 20px 64px; max-width: 900px; margin: 0 auto; }

/* Greeting */
.kid-greeting { margin-bottom: 32px; }
.kid-greeting h1 { font-size: 28px; font-weight: 800; color: #1E1B4B; }
.kid-greeting p  { font-size: 15px; color: var(--muted); margin-top: 4px; }

/* Section headings */
.kid-section-title {
  font-size: 17px; font-weight: 800; color: #1E1B4B;
  margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}

/* ── Skill category cards ─────────────────────────────────────────────────── */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 40px; }
.cat-card {
  background: var(--white); border-radius: var(--radius); padding: 22px;
  border: 2px solid var(--border); transition: transform .2s, box-shadow .2s, border-color .2s;
  cursor: default;
}
.cat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.cat-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cat-card-name   { font-size: 15px; font-weight: 800; }
.cat-card-badge  {
  font-size: 12px; font-weight: 700; padding: 3px 10px;
  border-radius: 20px; background: #F3F4F6; color: var(--muted);
}
.cat-card-badge.all-done { background: #D1FAE5; color: #065F46; }

/* Progress bar */
.cat-progress-bar { height: 10px; background: #F3F4F6; border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.cat-progress-fill { height: 100%; border-radius: 10px; transition: width .4s ease; }

/* Mini skill list inside category card */
.cat-skills { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.cat-skill-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.cat-skill-item .sk-icon { font-size: 16px; }
.cat-skill-item .sk-name { flex: 1; color: var(--text); }
.cat-skill-item .sk-name.locked { color: #D1D5DB; }
.cat-skill-item .sk-check { font-size: 14px; }

/* ── Practice tools ───────────────────────────────────────────────────────── */
.kid-tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 40px; }
.kid-tool-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 28px 20px;
  background: linear-gradient(135deg, var(--purple), #4F46E5);
  color: #fff; border-radius: var(--radius);
  font-weight: 700; font-size: 15px; text-align: center;
  box-shadow: 0 4px 16px rgba(124,58,237,.3);
  transition: transform .2s, box-shadow .2s;
}
.kid-tool-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(124,58,237,.4); }
.kid-tool-icon { font-size: 40px; }
.kid-tool-label { font-size: 15px; font-weight: 800; }
.kid-tool-sub   { font-size: 12px; opacity: .8; }

/* ── Recent activity ──────────────────────────────────────────────────────── */
.kid-activity-list { display: flex; flex-direction: column; gap: 10px; }
.kid-activity-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 18px;
}
.kid-activity-icon  { font-size: 26px; }
.kid-activity-body  { flex: 1; }
.kid-activity-type  { font-size: 14px; font-weight: 700; }
.kid-activity-notes { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kid-activity-time  { font-size: 11px; color: #D1D5DB; white-space: nowrap; }

.kid-empty { text-align: center; padding: 32px; color: var(--muted); font-size: 14px; }

/* ═══════════════════════════════════════════════════════════════════════════
   SIGHT READING PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

.sr-page { padding: 0; }

/* Back bar */
.sr-backbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 24px;
  background: var(--white); border-bottom: 1px solid var(--border);
}
.sr-back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--purple); font-weight: 700; font-size: 14px;
  padding: 8px 14px; border-radius: 8px; border: 1.5px solid var(--purple-light);
  background: var(--purple-light); transition: all .15s;
}
.sr-back:hover { background: var(--purple); color: #fff; }
.sr-backbar-title { font-size: 17px; font-weight: 800; color: #1E1B4B; }

/* Main layout */
.sr-body { max-width: 900px; margin: 0 auto; padding: 28px 20px 64px; }

/* Controls panel */
.sr-controls {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-bottom: 24px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 20px;
}
.sr-control-group { display: flex; flex-direction: column; gap: 6px; }
.sr-control-group label { font-size: 13px; font-weight: 700; color: var(--text); }
.sr-select, .sr-range-input {
  padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 14px; background: var(--bg);
  outline: none; transition: border-color .15s; cursor: pointer;
}
.sr-select:focus { border-color: var(--purple); }
.sr-range-input  { padding: 6px 0; background: transparent; border: none; width: 100%; accent-color: var(--purple); }
.sr-range-label  { font-size: 12px; color: var(--muted); text-align: right; }
.sr-generate-btn {
  align-self: flex-end; padding: 11px 20px;
  background: linear-gradient(135deg, var(--purple), #4F46E5);
  color: #fff; border: none; border-radius: 10px;
  font-size: 14px; font-weight: 800; cursor: pointer;
  box-shadow: 0 3px 12px rgba(124,58,237,.35); transition: transform .15s, box-shadow .15s;
  white-space: nowrap;
}
.sr-generate-btn:hover  { transform: translateY(-2px); box-shadow: 0 5px 16px rgba(124,58,237,.45); }
.sr-generate-btn:active { transform: translateY(0); }

/* Music display */
.sr-notation-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-bottom: 24px;
  min-height: 200px;
}
.sr-notation-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.sr-meta-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--purple-light); color: var(--purple);
  border-radius: 20px; padding: 4px 12px; font-size: 13px; font-weight: 600;
}
#sr-notation { width: 100%; overflow-x: auto; }
.sr-placeholder {
  text-align: center; padding: 40px; color: var(--muted);
}
.sr-placeholder .sr-placeholder-icon { font-size: 48px; margin-bottom: 12px; }
.sr-placeholder p { font-size: 15px; }

/* Done panel */
.sr-done-panel {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px;
}
.sr-counter { display: flex; align-items: center; gap: 12px; }
.sr-counter-label { font-size: 14px; font-weight: 700; color: var(--text); }
.sr-count-display { font-size: 28px; font-weight: 900; color: var(--purple); min-width: 40px; text-align: center; }
.sr-count-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--border);
  background: var(--bg); font-size: 20px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; line-height: 1;
}
.sr-count-btn:hover { border-color: var(--purple); background: var(--purple-light); color: var(--purple); }
.sr-done-btn {
  padding: 13px 28px; background: linear-gradient(135deg, #059669, #0D9488);
  color: #fff; border: none; border-radius: 12px;
  font-size: 15px; font-weight: 800; cursor: pointer;
  box-shadow: 0 3px 12px rgba(5,150,105,.35); transition: transform .15s;
}
.sr-done-btn:hover { transform: translateY(-2px); }

/* ═══════════════════════════════════════════════════════════════════════════
   OVERVIEW HERO (Stars / Goals / Gems pages — shared component)
   ═══════════════════════════════════════════════════════════════════════════ */
.overview-hero {
  display: flex; align-items: center; justify-content: center; gap: 0;
  border-radius: 20px; padding: 22px 28px; margin-bottom: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
}
.overview-hero-stars { background: linear-gradient(135deg,#FFFBEB,#FEF3C7); border: 2px solid #F59E0B; }
.overview-hero-goals { background: linear-gradient(135deg,#ECFDF5,#D1FAE5); border: 2px solid #6EE7B7; }
.overview-hero-gems  { background: linear-gradient(135deg,#FFF7ED,#FFEDD5); border: 2px solid #FCD34D; }

.overview-stat    { display: flex; align-items: center; gap: 14px; flex: 1; justify-content: center; }
.overview-icon    { font-size: 40px; }
.overview-num     { font-size: 42px; font-weight: 900; line-height: 1; }
.overview-label   { font-size: 13px; margin-top: 2px; }
.overview-divider { width: 1px; height: 60px; background: rgba(0,0,0,.1); margin: 0 8px; }

.overview-hero-stars .overview-num   { color: #92400E; }
.overview-hero-stars .overview-label { color: #B45309; }
.overview-hero-goals .overview-num   { color: #065F46; }
.overview-hero-goals .overview-label { color: #059669; }
.overview-hero-gems  .overview-num   { color: #92400E; }
.overview-hero-gems  .overview-label { color: #B45309; }

.overview-note {
  text-align: center; font-size: 13px; font-weight: 600;
  padding: 8px 16px; border-radius: 8px; margin-bottom: 20px;
}
.overview-note-stars { background: #FEF3C7; color: #92400E; }
.overview-note-goals { background: #D1FAE5; color: #065F46; }
.overview-note-gems  { background: #FFEDD5; color: #92400E; }

/* ── Star Banner ──────────────────────────────────────────────────────────── */
.star-banner {
  display: flex; align-items: center; justify-content: center;
  gap: 0; background: linear-gradient(135deg, #7C3AED, #4F46E5);
  border-radius: 20px; padding: 20px 28px; margin-bottom: 32px;
  box-shadow: 0 4px 20px rgba(124,58,237,.35); color: #fff;
}
.star-stat   { display: flex; align-items: center; gap: 14px; flex: 1; justify-content: center; }
.star-big    { font-size: 40px; }
.star-num    { font-size: 40px; font-weight: 900; line-height: 1; }
.star-label  { font-size: 13px; opacity: .8; margin-top: 2px; }
.star-divider{ width: 1px; height: 60px; background: rgba(255,255,255,.25); margin: 0 8px; }

/* ── MM skill level display (home page) ──────────────────────────────────── */
.cat-skill-mm { align-items: flex-start; padding: 8px 0; }
.sk-mm-body   { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sk-stars     { display: flex; gap: 2px; font-size: 14px; }
.sk-star-filled { color: #F59E0B; }
.sk-star-empty  { color: #D1D5DB; }

/* ── Skill action buttons (home page) ────────────────────────────────────── */
.sk-action      { margin-left: auto; display: flex; align-items: center; }
.sk-check       { font-size: 16px; }
.sk-locked-gate { font-size: 16px; opacity: .5; cursor: default; }
.sk-coming        { font-size: 14px; opacity: .4; }
.sk-parent-locked { font-size: 16px; opacity: .6; cursor: default; }
.dimmed           { opacity: .35; }
.sk-star-expired  { color: #9CA3AF; font-size: 15px; }
.sk-quiz-renew    { background: #F59E0B !important; }
.sk-quiz-renew:hover { background: #D97706 !important; }
.sk-quiz-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--purple); color: #fff;
  border-radius: 20px; padding: 3px 10px; font-size: 12px; font-weight: 700;
  white-space: nowrap; transition: background .15s;
}
.sk-quiz-btn:hover { background: #5B21B6; }

/* ═══════════════════════════════════════════════════════════════════════════
   QUIZ PAGE
   ═══════════════════════════════════════════════════════════════════════════ */
.quiz-page { max-width: 680px; margin: 0 auto; padding: 24px 20px 64px; }

/* Progress bar */
.quiz-progress-wrap { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.quiz-progress-bar  { flex: 1; height: 10px; background: #E5E7EB; border-radius: 10px; overflow: hidden; }
.quiz-progress-fill { height: 100%; background: linear-gradient(90deg, var(--purple), #4F46E5); border-radius: 10px; transition: width .4s; }
.quiz-progress-label { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }

/* Model header */
.quiz-model-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.quiz-model-icon { font-size: 32px; }
.quiz-model-name { font-size: 16px; font-weight: 800; color: #1E1B4B; }
.quiz-model-cat  { font-size: 12px; color: var(--muted); }
.quiz-type-badge {
  margin-left: auto; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 700;
}
.quiz-type-mcq      { background: #EDE9FE; color: #7C3AED; }
.quiz-type-truefalse{ background: #D1FAE5; color: #059669; }
.quiz-type-scenario { background: #DBEAFE; color: #2563EB; }

/* Question card */
.quiz-card {
  background: #fff; border: 2px solid #E5E7EB; border-radius: 20px;
  padding: 28px; box-shadow: 0 4px 24px rgba(0,0,0,.07);
}
.quiz-card-done { border-color: #A78BFA; }
.quiz-stem { font-size: 17px; line-height: 1.6; color: #1F2937; margin-bottom: 24px; font-weight: 500; }

/* True/False */
.quiz-tf-options { display: flex; gap: 14px; }
.quiz-tf-btn {
  flex: 1; padding: 18px; border: 2.5px solid #E5E7EB; border-radius: 14px;
  font-size: 18px; font-weight: 800; cursor: pointer; background: #fff;
  transition: all .15s;
}
.quiz-tf-true:hover  { border-color: #059669; background: #D1FAE5; color: #065F46; }
.quiz-tf-false:hover { border-color: #DC2626; background: #FEE2E2; color: #991B1B; }

/* MCQ */
.quiz-mcq-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.quiz-mcq-option  {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border: 2px solid #E5E7EB; border-radius: 12px;
  cursor: pointer; transition: all .12s;
}
.quiz-mcq-option:has(input:checked) { border-color: var(--purple); background: #EDE9FE; }
.quiz-mcq-option input { display: none; }
.quiz-mcq-letter {
  width: 32px; height: 32px; border-radius: 50%; background: #F3F4F6;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; flex-shrink: 0;
}
.quiz-mcq-option:has(input:checked) .quiz-mcq-letter { background: var(--purple); color: #fff; }
.quiz-mcq-text { font-size: 15px; font-weight: 500; }
.quiz-submit-btn {
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, var(--purple), #4F46E5);
  color: #fff; border: none; border-radius: 12px;
  font-size: 16px; font-weight: 800; cursor: pointer;
  box-shadow: 0 3px 12px rgba(124,58,237,.35); transition: transform .15s;
}
.quiz-submit-btn:hover { transform: translateY(-2px); }

/* Feedback */
.quiz-feedback {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-radius: 12px; margin-bottom: 16px; font-size: 16px; font-weight: 700;
}
.quiz-correct { background: #D1FAE5; color: #065F46; }
.quiz-wrong   { background: #FEE2E2; color: #991B1B; }
.quiz-feedback-icon { font-size: 22px; }
.quiz-answer-reveal {
  font-size: 14px; color: var(--muted); margin-bottom: 14px; padding: 10px 14px;
  background: #F9FAFB; border-radius: 8px;
}
.quiz-explanation {
  font-size: 14px; line-height: 1.6; color: #374151;
  background: #FFFBEB; border-left: 3px solid #F59E0B;
  padding: 12px 16px; border-radius: 0 8px 8px 0; margin-bottom: 20px;
}
.quiz-explanation-icon { margin-right: 6px; }
.quiz-next-btn {
  display: block; text-align: center; padding: 14px;
  background: linear-gradient(135deg, #059669, #0D9488);
  color: #fff; border-radius: 12px; font-size: 16px; font-weight: 800;
  box-shadow: 0 3px 12px rgba(5,150,105,.35); transition: transform .15s;
}
.quiz-next-btn:hover { transform: translateY(-2px); }

/* ── Quiz level indicator ─────────────────────────────────────────────────── */
.quiz-level-row   { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.quiz-level-badge {
  background: linear-gradient(135deg, var(--purple), #4F46E5);
  color: #fff; border-radius: 20px; padding: 5px 14px;
  font-size: 13px; font-weight: 800; white-space: nowrap;
}
.quiz-level-stars { display: flex; gap: 6px; font-size: 20px; }
.qlvl-done    { color: #F59E0B; }
.qlvl-current { color: #7C3AED; }
.qlvl-locked  { color: #E5E7EB; }

/* ── Quiz Done page ───────────────────────────────────────────────────────── */
.quiz-done-page { padding-top: 40px; }
.quiz-result-card {
  background: #fff; border-radius: 24px; padding: 40px 32px;
  text-align: center; border: 2px solid #E5E7EB;
  box-shadow: 0 8px 40px rgba(0,0,0,.1);
}
.quiz-result-pass { border-color: #6EE7B7; }
.quiz-result-fail { border-color: #FCA5A5; }
.quiz-result-trophy { font-size: 72px; margin-bottom: 12px; }
.quiz-result-title  { font-size: 28px; font-weight: 900; color: #1E1B4B; margin-bottom: 16px; }
.quiz-result-score  { display: flex; align-items: baseline; justify-content: center; gap: 4px; }
.quiz-result-num    { font-size: 64px; font-weight: 900; color: var(--purple); line-height: 1; }
.quiz-result-denom  { font-size: 28px; color: var(--muted); }
.quiz-result-pct    { font-size: 20px; font-weight: 700; color: var(--muted); margin-top: 4px; margin-bottom: 20px; }
.quiz-result-bar-wrap { margin: 0 auto 20px; max-width: 400px; }
.quiz-result-bar    { height: 14px; background: #F3F4F6; border-radius: 10px; overflow: hidden; position: relative; }
.quiz-result-bar-fill { height: 100%; background: linear-gradient(90deg, var(--purple), #0D9488); border-radius: 10px; transition: width .6s ease; }
.quiz-result-bar-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
.quiz-pass-line { color: var(--purple); font-weight: 700; }
.quiz-result-msg { margin: 16px 0 24px; padding: 14px 20px; border-radius: 12px; font-size: 15px; line-height: 1.5; }
.quiz-msg-pass   { background: #D1FAE5; color: #065F46; }
.quiz-msg-fail   { background: #FEE2E2; color: #991B1B; }
/* Star earned panel */
.quiz-star-earned {
  display: flex; align-items: center; gap: 16px;
  background: #FFFBEB; border: 2px solid #F59E0B; border-radius: 14px;
  padding: 16px 20px; margin: 16px 0; text-align: left;
}
.quiz-star-icon { font-size: 40px; animation: pop .4s ease; }
@keyframes pop { 0%{transform:scale(0)} 70%{transform:scale(1.2)} 100%{transform:scale(1)} }
.quiz-star-msg  { font-size: 16px; font-weight: 800; color: #92400E; }
.quiz-star-sub  { font-size: 13px; color: #B45309; margin-top: 3px; }

.quiz-star-totals {
  display: flex; gap: 0; background: var(--bg); border-radius: 12px;
  padding: 12px 20px; margin: 12px 0; justify-content: center;
}
.quiz-star-total-item  { display: flex; flex-direction: column; align-items: center; flex: 1; }
.quiz-star-total-num   { font-size: 28px; font-weight: 900; color: var(--purple); }
.quiz-star-total-label { font-size: 12px; color: var(--muted); }
.quiz-star-total-divider { width: 1px; background: var(--border); margin: 0 12px; }

.quiz-lvl-progress { display: flex; gap: 8px; justify-content: center; font-size: 24px; margin: 12px 0; }
.lvl-done      { color: #F59E0B; }
.lvl-just-done { color: #F59E0B; animation: pop .5s ease; }
.lvl-locked    { color: #E5E7EB; }

.quiz-result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.quiz-retry-btn, .quiz-home-btn {
  padding: 13px 24px; border-radius: 12px; font-size: 15px; font-weight: 800;
  transition: transform .15s;
}
.quiz-retry-btn { background: #EDE9FE; color: var(--purple); }
.quiz-home-btn  { background: linear-gradient(135deg, var(--purple), #4F46E5); color: #fff; box-shadow: 0 3px 12px rgba(124,58,237,.3); }
.quiz-retry-btn:hover, .quiz-home-btn:hover { transform: translateY(-2px); }

/* ═══════════════════════════════════════════════════════════════════════════
   LESSON PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

.lesson-page  { max-width: 700px; margin: 0 auto; padding: 20px 20px 80px; }
.lesson-back  {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--purple); font-weight: 700; font-size: 14px;
  padding: 8px 14px; border-radius: 8px; border: 1.5px solid var(--purple-light);
  background: var(--purple-light); margin-bottom: 20px; transition: all .15s;
}
.lesson-back:hover { background: var(--purple); color: #fff; }

/* Hero */
.lesson-hero       { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.lesson-hero-emoji { font-size: 56px; line-height: 1; flex-shrink: 0; }
.lesson-title      { font-size: 26px; font-weight: 900; color: #1E1B4B; line-height: 1.2; }
.lesson-tagline    { font-size: 15px; color: var(--muted); margin-top: 6px; line-height: 1.5; }

/* Level progress strip */
.lesson-progress   { display: flex; align-items: center; gap: 6px; margin-bottom: 24px; flex-wrap: wrap; }
.lesson-progress span { font-size: 22px; }
.lp-done  { color: #F59E0B; }
.lp-next  { color: var(--purple); animation: pulse 1.5s infinite; }
.lp-empty { color: #E5E7EB; }
.lp-label { font-size: 13px; color: var(--muted); margin-left: 6px; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }

/* Hook */
.lesson-hook {
  background: linear-gradient(135deg, #F5F3FF, #EDE9FE);
  border-left: 4px solid var(--purple); border-radius: 0 12px 12px 0;
  padding: 18px 20px; margin-bottom: 24px;
  font-size: 16px; line-height: 1.7; color: #1F2937;
}

/* Sections */
.lesson-section       { margin-bottom: 28px; }
.lesson-section-label {
  font-size: 13px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em; color: var(--purple); margin-bottom: 10px;
}
.lesson-body {
  font-size: 16px; line-height: 1.75; color: #1F2937;
}
.lesson-body p   { margin-bottom: 12px; }
.lesson-body p:last-child { margin-bottom: 0; }
.lesson-body ul, .lesson-body ol { padding-left: 22px; margin-bottom: 12px; }
.lesson-body li  { margin-bottom: 6px; }
.lesson-body strong { color: #1E1B4B; }

/* Key idea callout */
.lesson-key-idea {
  display: flex; align-items: flex-start; gap: 12px;
  background: #FFFBEB; border: 2px solid #F59E0B;
  border-radius: 14px; padding: 16px 20px; margin-bottom: 28px;
}
.lesson-key-icon { font-size: 24px; flex-shrink: 0; margin-top: 1px; }
.lesson-key-text { font-size: 17px; font-weight: 700; color: #78350F; line-height: 1.5; }

/* Examples */
.lesson-examples { display: flex; flex-direction: column; gap: 14px; }
.lesson-example  {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px 20px;
}
.lesson-ex-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.lesson-ex-emoji  { font-size: 26px; }
.lesson-ex-title  { font-size: 16px; color: #1E1B4B; }
.lesson-ex-story  { color: #374151; }

/* Remember */
.lesson-remember {
  background: #F0FDF4; border-left: 4px solid #059669;
  border-radius: 0 12px 12px 0; padding: 16px 20px;
}

/* Lesson empty state */
.lesson-empty {
  text-align: center; padding: 40px 20px; color: var(--muted);
  background: var(--bg); border-radius: 14px; margin: 24px 0;
}

/* Quiz launcher at the bottom */
.lesson-quiz-launcher {
  margin-top: 40px; padding-top: 28px;
  border-top: 2px dashed var(--border); text-align: center;
}
.lesson-quiz-intro { font-size: 16px; color: var(--muted); margin-bottom: 16px; }
.lesson-quiz-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 16px 32px; border-radius: 16px;
  background: linear-gradient(135deg, var(--purple), #4F46E5);
  color: #fff; font-size: 18px; font-weight: 800;
  box-shadow: 0 6px 24px rgba(124,58,237,.4); transition: transform .15s, box-shadow .15s;
}
.lesson-quiz-btn:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(124,58,237,.5); }
.lesson-retry-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: 12px;
  background: var(--purple-light); color: var(--purple);
  font-size: 15px; font-weight: 700; margin-top: 10px;
}
.lesson-mastered   { font-size: 20px; font-weight: 800; color: #F59E0B; margin-bottom: 12px; }
.lesson-locked-msg { font-size: 16px; color: var(--muted); padding: 20px; }
.lesson-no-quiz    { font-size: 15px; color: var(--muted); padding: 20px; }

/* Home page: MM skill as clickable lesson link */
.sk-mm-link {
  text-decoration: none; color: inherit; display: flex;
  flex-direction: column; gap: 4px; flex: 1; min-width: 0;
  transition: color .12s;
}
.sk-mm-link:hover .sk-name { color: var(--purple); }

/* ═══════════════════════════════════════════════════════════════════════════
   OVERVIEW STRIPS (home page — stars / goals / gems)
   ═══════════════════════════════════════════════════════════════════════════ */
.home-strips           { display: flex; gap: 10px; margin-bottom: 28px; flex-wrap: wrap; }
.home-strips-three .pts-strip { flex: 1; min-width: 110px; }
.pts-strip {
  display: flex; align-items: center; gap: 8px;
  border: 1.5px solid #F59E0B; border-radius: 14px;
  padding: 12px 14px; color: #78350F; transition: box-shadow .15s;
}
.pts-strip:hover        { box-shadow: 0 4px 16px rgba(245,158,11,.2); }
.pts-strip-icon         { font-size: 22px; flex-shrink: 0; }
.pts-strip-counts       { flex: 1; min-width: 0; }
.pts-strip-main         { display: block; font-size: 14px; }
.pts-strip-week         { display: block; font-size: 11px; opacity: .75; margin-top: 1px; }
.pts-strip-cta          { font-size: 12px; font-weight: 700; white-space: nowrap; opacity: .7; flex-shrink: 0; }
.pts-strip-stars        { background: linear-gradient(135deg,#FFFBEB,#FEF3C7); border-color: #F59E0B; color: #78350F; }
.pts-strip-goals        { background: linear-gradient(135deg,#ECFDF5,#D1FAE5); border-color: #6EE7B7; color: #065F46; }
.pts-strip-gems         { background: linear-gradient(135deg,#FFF7ED,#FFEDD5); border-color: #FCD34D; color: #78350F; }

/* ═══════════════════════════════════════════════════════════════════════════
   ACTIVITY LOG PAGE
   ═══════════════════════════════════════════════════════════════════════════ */
.act-header    { display: flex; align-items: flex-start; justify-content: space-between;
                 gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.act-title     { font-size: 24px; font-weight: 900; color: #1E1B4B; }
.act-sub       { font-size: 14px; color: var(--muted); margin-top: 4px; }
.act-pts-pill  {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
  border: 1.5px solid #F59E0B; border-radius: 20px;
  padding: 8px 16px; color: #78350F; font-size: 14px; font-weight: 700;
}
.act-pts-week  { font-size: 12px; color: #92400E; font-weight: 500; }
.act-flash {
  background: #D1FAE5; border: 1px solid #6EE7B7; color: #065F46;
  padding: 12px 16px; border-radius: 10px; margin-bottom: 20px;
  font-size: 15px; font-weight: 600;
}

/* Category block */
.act-category {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 16px; margin-bottom: 20px; overflow: hidden;
}
.act-cat-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.act-cat-icon { font-size: 22px; }
.act-cat-name { font-size: 15px; font-weight: 800; }

/* Activity grid */
.act-grid { display: flex; flex-direction: column; gap: 0; }

/* Each activity card using <details> */
.act-card { border-bottom: 1px solid var(--border); }
.act-card:last-child { border-bottom: none; }

.act-card-summary {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; cursor: pointer; list-style: none;
  transition: background .12s;
}
.act-card-summary:hover { background: var(--bg); }
.act-card-summary::-webkit-details-marker { display: none; }
.act-card-icon  { font-size: 22px; flex-shrink: 0; }
.act-card-body  { flex: 1; min-width: 0; }
.act-card-name  { display: block; font-size: 14px; font-weight: 700; color: var(--text); }
.act-card-desc  { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.act-log-arrow  {
  font-size: 12px; font-weight: 700; color: var(--purple);
  background: var(--purple-light); border-radius: 20px;
  padding: 4px 12px; white-space: nowrap; flex-shrink: 0;
}
details[open] .act-log-arrow { opacity: 0; }

/* Log form (shown when <details> is open) */
.act-log-form {
  padding: 0 20px 16px 54px;
  display: flex; flex-direction: column; gap: 10px;
}
.act-notes-input {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 14px; font-family: inherit; resize: vertical;
  outline: none; transition: border-color .15s;
}
.act-notes-input:focus { border-color: var(--purple); }
.act-save-btn {
  align-self: flex-start; padding: 10px 20px; border: none;
  border-radius: 10px; color: #fff; font-size: 14px; font-weight: 800;
  cursor: pointer; transition: opacity .15s, transform .15s;
}
.act-save-btn:hover  { opacity: .88; transform: translateY(-1px); }
.act-recent-title {
  font-size: 15px; font-weight: 800; color: #1E1B4B;
  margin: 28px 0 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   POINTS DASHBOARD PAGE
   ═══════════════════════════════════════════════════════════════════════════ */
.pts-hero {
  display: flex; align-items: center; justify-content: center;
  gap: 0; background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
  border: 2px solid #F59E0B; border-radius: 20px;
  padding: 20px 28px; margin-bottom: 24px;
}
.pts-hero-stat  { display: flex; align-items: center; gap: 14px; flex: 1; justify-content: center; }
.pts-hero-icon  { font-size: 40px; }
.pts-hero-num   { font-size: 42px; font-weight: 900; color: #92400E; line-height: 1; }
.pts-hero-label { font-size: 13px; color: #B45309; margin-top: 2px; }

/* Range selector */
.pts-range-row { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.pts-range-btn {
  padding: 8px 18px; border-radius: 20px; border: 1.5px solid var(--border);
  background: var(--bg); color: var(--muted); font-size: 13px; font-weight: 700;
  cursor: pointer; transition: all .15s;
}
.pts-range-btn:hover  { border-color: #F59E0B; color: #92400E; }
.pts-range-btn.active { background: #F59E0B; border-color: #F59E0B; color: #fff; }

/* Custom date row */
.pts-custom-row {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; margin-bottom: 12px;
}
.pts-custom-row label { font-size: 13px; font-weight: 600; color: var(--text);
                        display: flex; align-items: center; gap: 6px; }
.pts-date-input {
  padding: 8px 10px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 13px; outline: none;
}
.pts-date-input:focus { border-color: #F59E0B; }
.pts-apply-btn {
  padding: 8px 16px; background: #F59E0B; color: #fff; border: none;
  border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer;
}

/* Chart wrapper */
.pts-chart-wrap {
  background: var(--white); border: 1px solid var(--border);
  border-radius: 16px; padding: 20px; margin-bottom: 16px; position: relative;
}
.pts-no-data {
  text-align: center; padding: 40px; color: var(--muted); font-size: 15px;
}

/* Legend */
.pts-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.pts-legend-item { display: flex; align-items: center; gap: 6px;
                   font-size: 13px; color: var(--text); }
.pts-legend-dot  { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

/* (strip colours for stars/goals/gems defined in the OVERVIEW STRIPS section above) */

/* ═══════════════════════════════════════════════════════════════════════════
   BOOK LIBRARY & CARDS
   ═══════════════════════════════════════════════════════════════════════════ */
.book-filter-row   { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.book-filter-label { font-size: 14px; font-weight: 700; color: var(--text); flex-shrink: 0; }
.book-filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.book-filter-pill  {
  padding: 5px 12px; border-radius: 20px; font-size: 13px; font-weight: 600;
  border: 1.5px solid var(--border); background: var(--bg); color: var(--muted);
  transition: all .15s;
}
.book-filter-pill:hover { border-color: #D97706; color: #92400E; }
.book-filter-pill.active { background: #D97706; border-color: #D97706; color: #fff; }

.book-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 32px;
}
.book-card {
  display: flex; flex-direction: column; align-items: center;
  background: var(--white); border: 2px solid var(--border); border-radius: 16px;
  padding: 20px 16px; text-align: center; transition: all .2s; position: relative;
}
.book-card:hover       { border-color: #D97706; box-shadow: 0 4px 20px rgba(217,119,6,.2); transform: translateY(-3px); }
.book-card-done        { border-color: #6EE7B7; background: linear-gradient(135deg,#ECFDF5,#fff); }
.book-cover            { font-size: 56px; margin-bottom: 12px; position: relative; display: inline-block; }
.book-gem-badge        { position: absolute; top: -4px; right: -8px; font-size: 22px; }
.book-gem-badge-lg     { font-size: 36px; }
.book-info             { flex: 1; }
.book-title            { font-size: 15px; font-weight: 800; color: #1E1B4B; margin-bottom: 4px; }
.book-author           { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.book-age              { font-size: 12px; color: var(--muted); }
.book-q-count          { font-size: 12px; color: #D97706; font-weight: 600; margin-top: 4px; }
.book-status-badge     {
  margin-top: 12px; padding: 4px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 700;
  background: #FEF3C7; color: #92400E;
}
.book-status-tried { background: #DBEAFE; color: #1D4ED8; }
.book-status-new   { background: #F3F4F6; color: var(--muted); }

/* Book detail page */
.book-detail-hero   { display: flex; align-items: flex-start; gap: 20px; margin-bottom: 24px; }
.book-detail-cover  { font-size: 72px; position: relative; flex-shrink: 0; }
.book-detail-meta   { flex: 1; }
.book-detail-author { font-size: 15px; color: var(--muted); margin: 4px 0 12px; }
.book-detail-tags   { display: flex; gap: 8px; flex-wrap: wrap; }
.book-tag           {
  background: var(--bg); border: 1px solid var(--border);
  padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; color: var(--text);
}
.book-attempt-note  {
  background: #DBEAFE; border-radius: 10px; padding: 12px 16px;
  font-size: 14px; color: #1D4ED8; margin-bottom: 20px; font-weight: 600;
}

/* Book quiz page extras */
.book-gem-reminder  {
  text-align: center; font-size: 13px; font-weight: 700; color: #D97706;
  background: #FFFBEB; border-radius: 10px; padding: 8px 16px; margin-bottom: 14px;
}
.book-result-gem    { border-color: #6EE7B7; }

/* ═══════════════════════════════════════════════════════════════════════════
   KID PROFILE / AVATAR PICKER
   ═══════════════════════════════════════════════════════════════════════════ */
.kid-topbar-avatar-link { text-decoration: none; transition: transform .15s; }
.kid-topbar-avatar-link:hover { transform: scale(1.2); }

.kp-header      { display: flex; align-items: center; gap: 20px; margin-bottom: 24px; }
.kp-current     {
  font-size: 80px; line-height: 1;
  background: linear-gradient(135deg, #F5F3FF, #EDE9FE);
  border-radius: 24px; padding: 12px 20px;
  border: 3px solid var(--purple); transition: all .2s;
}
.kp-name        { font-size: 24px; font-weight: 900; color: #1E1B4B; }
.kp-hint        { font-size: 14px; color: var(--muted); margin-top: 4px; }

.kp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 8px;
  margin-bottom: 24px;
}
.kp-emoji-btn {
  font-size: 32px; line-height: 1;
  width: 56px; height: 56px;
  border-radius: 14px; border: 2.5px solid var(--border);
  background: var(--white); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .12s;
}
.kp-emoji-btn:hover   { border-color: var(--purple); background: var(--purple-light);
                         transform: scale(1.1); }
.kp-selected          { border-color: var(--purple) !important;
                         background: var(--purple-light) !important;
                         box-shadow: 0 0 0 3px rgba(124,58,237,.25); }

.kp-save-row { text-align: center; }
.kp-save-btn {
  padding: 14px 36px; border: none; border-radius: 14px;
  background: linear-gradient(135deg, var(--purple), #4F46E5);
  color: #fff; font-size: 17px; font-weight: 800; cursor: pointer;
  box-shadow: 0 4px 16px rgba(124,58,237,.35); transition: all .15s;
}
.kp-save-btn:hover:not(:disabled) { transform: translateY(-2px);
                                     box-shadow: 0 6px 20px rgba(124,58,237,.45); }
.kp-save-btn:disabled { opacity: .4; cursor: default; box-shadow: none; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .kid-page, .sr-body  { padding: 20px 16px 48px; }
  .kid-topbar { padding: 12px 16px; }
  .sr-backbar { padding: 12px 16px; }
  .sr-controls { grid-template-columns: 1fr 1fr; }
  .sr-done-panel { flex-direction: column; align-items: flex-start; }
}
