:root {
  /* Shared design tokens. Age themes may override accents, not component behavior. */
  --ink: #202844;
  --muted: #6c748a;
  --primary: #5854d8;
  --primary-dark: #403bb3;
  --on-primary: #ffffff;
  --surface: #ffffff;
  --wash: #f7f8ff;
  --canvas: #ffffff;
  --line: #e8eaf2;
  --focus-ring: #403bb3;
  --space-section: clamp(2rem, 5vw, 3.5rem);
  --radius-card: 1.15rem;
  --radius-control: .85rem;
  --content-reading: 72ch;
  --lavender: #efedff;
  --coral: #ff9478;
  --mint: #c9f0df;
  --sunshine: #ffe292;
  --shadow-soft: 0 18px 50px rgba(39, 43, 94, .08);
}

html { overflow-x: clip; scroll-behavior: smooth; }
body { color: var(--ink); background: #fff; font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--primary-dark); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--focus-ring) !important; outline-offset: 3px; }
.skip-link { position: absolute; top: -5rem; left: 1rem; z-index: 1100; padding: .75rem 1rem; color: #fff; background: var(--ink); border-radius: .75rem; }
.skip-link:focus { top: 1rem; color: #fff; }
.site-header { position: relative; z-index: 5; background: rgba(255,255,255,.94); border-bottom: 1px solid rgba(232,234,242,.7); }
.site-header .navbar { padding-inline: calc(var(--bs-gutter-x, 1.5rem) * .5); }
.site-header .navbar-toggler[hidden] { display: none; }
.site-header .navbar-nav .nav-link { display: flex; align-items: center; min-height: 2.75rem; }
.brand-lockup { display: inline-flex; align-items: center; gap: .65rem; color: var(--ink); font-size: 1.15rem; font-weight: 800; letter-spacing: -.04em; }
.brand-lockup:hover { color: var(--ink); }
.brand-mark { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; color: white; background: var(--primary); border-radius: .8rem; transform: rotate(-5deg); }
.brand-accent { color: var(--primary); }
.navbar .nav-link { color: #565f78; font-weight: 550; }
.navbar .nav-link:hover { color: var(--primary-dark); }
.site-header a[aria-current] { text-decoration: underline !important; text-underline-offset: .3em; text-decoration-thickness: 2px !important; font-weight: 750; }
.site-header .nav-link[aria-current] { color: var(--primary-dark); }
.user-greeting { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Brand buttons share one state palette across Bootstrap and the admin CoreUI
   layer. Semantic danger/success/warning buttons retain their vendor meanings. */
.btn-primary {
  --bs-btn-color: var(--on-primary);
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-color: var(--on-primary);
  --bs-btn-hover-bg: var(--primary-dark);
  --bs-btn-hover-border-color: var(--primary-dark);
  --bs-btn-active-color: var(--on-primary);
  --bs-btn-active-bg: var(--primary-dark);
  --bs-btn-active-border-color: var(--primary-dark);
  --bs-btn-disabled-color: var(--on-primary);
  --bs-btn-disabled-bg: var(--primary);
  --bs-btn-disabled-border-color: var(--primary);
}
.btn-outline-primary {
  --bs-btn-color: var(--primary-dark);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-color: var(--on-primary);
  --bs-btn-hover-bg: var(--primary-dark);
  --bs-btn-hover-border-color: var(--primary-dark);
  --bs-btn-active-color: var(--on-primary);
  --bs-btn-active-bg: var(--primary-dark);
  --bs-btn-active-border-color: var(--primary-dark);
  --bs-btn-disabled-color: var(--primary-dark);
  --bs-btn-disabled-bg: transparent;
  --bs-btn-disabled-border-color: var(--primary);
}
.btn-link {
  --bs-btn-color: var(--primary-dark);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--primary-dark);
  --bs-btn-hover-bg: transparent;
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: var(--primary-dark);
  --bs-btn-active-bg: transparent;
  --bs-btn-active-border-color: transparent;
  --bs-btn-disabled-color: var(--primary-dark);
  --bs-btn-disabled-bg: transparent;
  --bs-btn-disabled-border-color: transparent;
}
.btn-primary, .btn-outline-primary, .btn-link {
  /* The opaque shared outline is the focus indicator, not a vendor-color halo. */
  --bs-btn-focus-box-shadow: none;
  --cui-btn-color: var(--bs-btn-color);
  --cui-btn-bg: var(--bs-btn-bg);
  --cui-btn-border-color: var(--bs-btn-border-color);
  --cui-btn-hover-color: var(--bs-btn-hover-color);
  --cui-btn-hover-bg: var(--bs-btn-hover-bg);
  --cui-btn-hover-border-color: var(--bs-btn-hover-border-color);
  --cui-btn-active-color: var(--bs-btn-active-color);
  --cui-btn-active-bg: var(--bs-btn-active-bg);
  --cui-btn-active-border-color: var(--bs-btn-active-border-color);
  --cui-btn-disabled-color: var(--bs-btn-disabled-color);
  --cui-btn-disabled-bg: var(--bs-btn-disabled-bg);
  --cui-btn-disabled-border-color: var(--bs-btn-disabled-border-color);
  --cui-btn-focus-box-shadow: var(--bs-btn-focus-box-shadow);
}
.btn-check:focus-visible + .btn { outline: 3px solid var(--focus-ring) !important; outline-offset: 3px; }
.btn-lg { --bs-btn-padding-y: .78rem; --bs-btn-font-size: 1rem; font-weight: 700; }
.hero-section { overflow: hidden; background: radial-gradient(circle at 82% 14%, rgba(226,222,255,.62), transparent 29%), linear-gradient(180deg, #fbfbff 0%, #fff 100%); }
.py-lg-6 { padding-top: 6rem !important; padding-bottom: 6rem !important; }
.eyebrow { display: flex; align-items: center; gap: .55rem; margin-bottom: 1rem; color: var(--primary-dark); font-size: .76rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.eyebrow-dot { width: .5rem; height: .5rem; background: var(--coral); border-radius: 50%; box-shadow: 0 0 0 .25rem #ff947829; }
.hero-title { max-width: 47rem; margin: 0; font-size: clamp(2.65rem, 6vw, 5rem); font-weight: 820; letter-spacing: -.065em; line-height: 1.04; }
.text-gradient { color: var(--primary); background: linear-gradient(100deg, #5854d8, #9c6bdc 65%, #e7839f); background-clip: text; -webkit-text-fill-color: transparent; }
.hero-copy { max-width: 39rem; margin-top: 1.4rem; color: var(--muted); font-size: 1.15rem; line-height: 1.75; }
.hero-trust { color: #606a7f; font-size: .9rem; }
.hero-trust i { color: #289c78; }
.learning-art { position: relative; display: grid; place-items: center; max-width: 100%; min-height: 25rem; overflow: clip; isolation: isolate; }
.art-sun { position: absolute; z-index: -2; width: 20rem; height: 20rem; background: linear-gradient(145deg, #f1edff, #e8fbf2); border-radius: 47% 53% 55% 45% / 42% 47% 53% 58%; transform: rotate(-15deg); }
.art-orbit { position: absolute; z-index: -1; border: 1px solid rgba(88,84,216,.13); border-radius: 50%; }
.orbit-one { width: 24rem; height: 18rem; transform: rotate(32deg); }
.orbit-two { width: 18rem; height: 25rem; transform: rotate(45deg); }
.art-card { position: absolute; display: flex; align-items: center; gap: .9rem; padding: 1rem 1.15rem; background: rgba(255,255,255,.96); border: 1px solid #ffffff; border-radius: 1.2rem; box-shadow: var(--shadow-soft); }
.art-card-main { display: flex; flex-direction: column; align-items: flex-start; width: 15.5rem; padding: 1.35rem; transform: translateY(-.65rem) rotate(-3deg); }
.art-card-main strong { margin: .25rem 0; font-size: 1.35rem; letter-spacing: -.04em; }
.art-label, .art-card small { color: var(--muted); font-size: .78rem; }
.art-progress { width: 100%; height: .48rem; margin: .65rem 0; overflow: hidden; background: #eeedf7; border-radius: 1rem; }
.art-progress span { display: block; width: 66%; height: 100%; background: linear-gradient(90deg, #7b76ed, #70d7ad); border-radius: inherit; }
.art-icon { display: grid; place-items: center; flex: 0 0 auto; width: 2.65rem; height: 2.65rem; border-radius: .9rem; font-size: 1.2rem; }
.art-icon-purple { color: #655ee0; background: var(--lavender); }
.art-icon-yellow { color: #946800; background: var(--sunshine); }
.art-card-note { right: 0; bottom: 2.25rem; transform: rotate(4deg); }
.art-card-note strong, .art-card-note small { display: block; }
.spark-one, .spark-two, .spark-three { position: absolute; color: #9d7fea; font-size: 2rem; }
.spark-one { top: 2.3rem; left: 12%; }.spark-two { top: 5.5rem; right: 8%; color: #f8ad56; }.spark-three { bottom: 2.1rem; left: 13%; color: #70cba1; }
.section-heading { max-width: 43rem; }
.section-heading h2, .family-band h2 { font-size: clamp(1.8rem, 4vw, 2.7rem); font-weight: 780; letter-spacing: -.05em; }
.section-heading > p:last-child { font-size: 1.05rem; }
.feature-card { padding: 1.8rem; border: 1px solid var(--line); border-radius: 1.4rem; transition: transform .2s ease, box-shadow .2s ease; }
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-soft); }
.feature-card h3 { margin-top: 1.25rem; font-size: 1.18rem; font-weight: 750; }
.feature-card p { margin: 0; color: var(--muted); line-height: 1.65; }
.feature-icon { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 1rem; font-size: 1.35rem; }
.feature-purple { color: #625adf; background: var(--lavender); }
.feature-coral { color: #c45d43; background: #fff0ea; }
.feature-green { color: #238660; background: #e2f7ed; }
.family-band { background: #f4f5ff; }
.family-band h2 { max-width: 48rem; }
.site-footer { border-top: 1px solid var(--line); background: #fbfbfd; }
.auth-shell { min-height: 65vh; }
.auth-card { width: min(100%, 30rem); padding: clamp(1.4rem, 4vw, 2.5rem); background: #fff; border: 1px solid var(--line); border-radius: 1.5rem; box-shadow: var(--shadow-soft); }
.auth-card-wide { width: min(100%, 43rem); }
.auth-card .form-control { border-color: #dfe2eb; border-radius: .85rem; }
.auth-card .form-control:focus { border-color: #8984ed; box-shadow: 0 0 0 .22rem rgba(88,84,216,.13); }
.field-error { margin-top: .35rem; color: #b02a37; font-size: .875rem; }
.choice-card { display: flex; align-items: flex-start; gap: .75rem; height: 100%; padding: 1rem; border: 1px solid var(--line); border-radius: 1rem; cursor: pointer; }
.choice-card:has(input:checked) { border-color: var(--primary); background: #f8f7ff; box-shadow: inset 0 0 0 1px var(--primary); }
.choice-card input { margin-top: .25rem; accent-color: var(--primary); }
.choice-card strong, .choice-card small { display: block; }
.choice-card small { margin-top: .25rem; color: var(--muted); }
.page-section { padding-top: 3.5rem; padding-bottom: 2rem; }
.dashboard-welcome, .page-heading { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: 1.75rem; background: linear-gradient(110deg, #f2f0ff, #f3fcf7); border-radius: 1.4rem; }
.dashboard-welcome h1 { font-weight: 780; letter-spacing: -.045em; }
.welcome-mark { display: grid; place-items: center; flex: 0 0 auto; width: 4rem; height: 4rem; color: #9a6c0a; background: var(--sunshine); border-radius: 1.25rem; font-size: 1.8rem; transform: rotate(5deg); }
.empty-card { padding: clamp(1.5rem, 5vw, 3rem); text-align: center; background: #fbfbfe; border: 1px dashed #d7d9e7; border-radius: 1.35rem; }
.empty-icon { display: grid; place-items: center; width: 3.75rem; height: 3.75rem; margin: 0 auto 1rem; color: var(--primary); background: var(--lavender); border-radius: 1.2rem; font-size: 1.65rem; }
.empty-card p { max-width: 34rem; margin-right: auto; margin-left: auto; }
.child-card, .stat-card { display: flex; align-items: center; gap: 1rem; padding: 1.2rem; background: var(--surface); border: 1px solid var(--line); border-radius: 1.15rem; }
.child-card .min-w-0 { min-width: 0; }
.child-avatar { display: grid; place-items: center; flex: 0 0 auto; width: 3rem; height: 3rem; color: #c45d43; background: #fff0ea; border-radius: 1rem; font-size: 1.25rem; }
.stat-card { height: 100%; }
.stat-icon { display: grid; place-items: center; width: 2.8rem; height: 2.8rem; border-radius: .9rem; font-size: 1.2rem; }
.stat-purple { color: #625adf; background: var(--lavender); }.stat-coral { color: #c45d43; background: #fff0ea; }.stat-green { color: #238660; background: #e2f7ed; }
.stat-label, .stat-card strong { display: block; }.stat-label { color: var(--muted); font-size: .78rem; }.stat-card strong { margin-top: .15rem; font-size: 1.2rem; }
.page-heading { margin-bottom: 1.5rem; background: #f7f7ff; }
.page-heading h1 { font-weight: 780; letter-spacing: -.045em; }
.back-link { text-decoration: none; font-weight: 650; }

/* Shared interaction and responsive patterns; keep labels/states visible without color alone. */
button, .btn, .form-control, .form-select { min-height: 2.75rem; }
.form-control, .form-select { border-color: #dfe2eb; border-radius: var(--radius-control); }
.form-control:focus, .form-select:focus { border-color: #8984ed; box-shadow: 0 0 0 .22rem rgba(88,84,216,.13); }
.table-responsive { border: 1px solid var(--line); border-radius: var(--radius-card); }
.table-responsive > .table { margin-bottom: 0; }
.admin-course-card { min-width: 0; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); }
.admin-course-card h2 { overflow-wrap: anywhere; }
.lesson-reading { max-width: var(--content-reading); }
.lesson-image { max-width: 100%; overflow-wrap: anywhere; }
.lesson-image img { display: block; max-width: 100%; height: auto; margin-inline: auto; border: 1px solid var(--line); border-radius: var(--radius-control); }
.lesson-image figcaption p + p { margin-top: .5rem; }
.lesson-image-review { max-width: 28rem; }
.lesson-media-editor { overflow-wrap: anywhere; }
.page-section { scroll-margin-top: 1rem; }
@media (max-width: 575.98px) {
  .container { --bs-gutter-x: 1.5rem; }
  .page-section { padding-top: 2.25rem; }
  .dashboard-welcome, .page-heading { padding: 1.25rem; }
  .table-responsive { font-size: .9375rem; }
}
@media (max-width: 767.98px) {
  .py-lg-6 { padding-top: 3.5rem !important; padding-bottom: 3.5rem !important; }
  .hero-section .col-lg-7 { min-width: 0; }
  .hero-title { max-width: 100%; font-size: clamp(2.25rem, 10vw, 3.6rem); overflow-wrap: break-word; }
  .hero-copy { max-width: 100%; overflow-wrap: break-word; }
  .learning-art { min-height: 21rem; }
  .art-sun { width: 16rem; height: 16rem; }
  .orbit-one { width: 18rem; height: 15rem; }.orbit-two { width: 15rem; height: 20rem; }
  .art-card-note { right: 0; bottom: .25rem; }
  .user-greeting { max-width: 100%; }
  .page-heading { align-items: flex-start; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
.lesson-reading{font-size:1.075rem;line-height:1.85;overflow-wrap:anywhere}
.flashcard-card{padding:1.25rem;border:1px solid var(--line);border-radius:var(--radius-card);background:linear-gradient(145deg,var(--surface),var(--wash));box-shadow:var(--shadow-soft);overflow-wrap:anywhere}
.flashcard-hint{padding:.7rem .85rem;border-left:3px solid var(--coral);border-radius:.4rem;background:var(--lavender)}
.flashcard-answer{padding:.8rem 1rem;border:1px dashed #b7b9dc;border-radius:var(--radius-control);background:var(--surface)}
.flashcard-answer summary{min-height:2.75rem;display:flex;align-items:center;color:var(--primary-dark);font-weight:700;cursor:pointer}
.flashcard-answer[open] summary{border-bottom:1px solid var(--line)}

/* Same components, age-aware visual tone; no exact birth date is collected. */
body.theme-child-early { --primary:#bd531b; --primary-dark:#8d3b12; --lavender:#fff0d2; --coral:#ffc36b; --mint:#dff5dc; }
body.theme-child-primary { --primary:#247d65; --primary-dark:#175b49; --lavender:#e3f6eb; --coral:#ffbd70; --mint:#c9f0df; }
body.theme-child-secondary { --primary:#3f5ab2; --primary-dark:#2c428a; --lavender:#e9edff; --coral:#e9a3a0; --mint:#d8f0e8; }
body.theme-child-early .dashboard-welcome { background:radial-gradient(circle at 90% 12%,#ffe2a8,transparent 30%),linear-gradient(110deg,#fff5df,#effaf0); }
body.theme-child-primary .dashboard-welcome { background:radial-gradient(circle at 90% 12%,#cdeed9,transparent 30%),linear-gradient(110deg,#ecf8f1,#f2f5ff); }
body.theme-child-secondary .dashboard-welcome { background:linear-gradient(110deg,#edf0ff,#f0f8ff); }
body.theme-child-early, body.theme-child-primary, body.theme-child-secondary { --focus-ring: #8a4b00; }
.practice-question { overflow-wrap: anywhere; min-width: 0; }
.practice-option { display: flex; align-items: flex-start; gap: .75rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-control); min-height: 52px; }
.practice-option input { flex: 0 0 auto; width: 20px; height: 20px; margin-top: .15rem; accent-color: var(--primary); }
.practice-option:focus-within { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.practice-option:has(input:checked) { border-color: var(--primary); background: var(--lavender); }
.matching-game { background: linear-gradient(145deg,var(--surface),var(--lavender)); }
.matching-columns { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 1rem; }
.matching-choices { display: grid; gap: .75rem; }
.matching-choice { width: 100%; min-height: 5.5rem; padding: .85rem; border: 2px solid var(--line); border-radius: var(--radius-control); background: var(--surface); color: var(--ink); font: inherit; overflow-wrap: anywhere; text-align: center; box-shadow: var(--shadow-soft); }
.matching-choice[aria-pressed="true"] { border-color: var(--primary); background: var(--lavender); outline: 2px solid var(--primary); outline-offset: 2px; }
.matching-choice.is-matched { background: var(--mint); border-color: var(--primary); color: var(--primary-dark); opacity: 1; animation: matching-pop .2s ease-out; }
.matching-message { min-height: 3rem; font-weight: 600; }
.matching-game progress { accent-color: var(--primary); height: 1.25rem; }
.matching-fieldset { min-width: 0; }
.saved-matching-choice { display: flex; align-items: center; gap: .5rem; text-align: left; cursor: pointer; }
.saved-matching-choice input { flex: 0 0 auto; width: 20px; height: 20px; accent-color: var(--primary); }
.saved-matching-choice:has(input:checked) { border-color: var(--primary); background: var(--lavender); }
.saved-matching-choice:focus-within { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
@keyframes matching-pop { from { transform: scale(.97); } to { transform: scale(1); } }
@media (max-width: 575.98px) { .matching-columns { gap: .65rem; } .matching-choice { padding: .65rem; } }
