/* Empathia design system ---------------------------------------------------------------------- */
:root {
  --c-primary: #14857a;
  --c-primary-600: #0f6e65;
  --c-primary-700: #0b5750;
  --c-primary-50: #e6f4f1;
  --c-primary-100: #c9e9e2;
  --c-coral: #e07a5f;
  --c-coral-50: #fbece7;
  --c-sun: #f2b84b;
  --c-sun-50: #fdf3dc;
  --c-sky: #2f7fbf;
  --c-ink: #22302e;
  --c-ink-2: #4a5856;
  --c-muted: #64716f;
  --c-line: #e3e7e2;
  --c-bg: #f8f6f1;
  --c-surface: #ffffff;
  --c-surface-2: #f3f1ea;
  --c-success: #2e7d4f;
  --c-success-50: #e5f4ea;
  --c-warning: #946200;
  --c-warning-50: #fdf3dc;
  --c-danger: #b3403a;
  --c-danger-50: #fbe9e7;
  --accent: var(--c-primary);

  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Sans Devanagari", "Nirmala UI", "Mangal", sans-serif;
  --font-hi: "Noto Sans Devanagari", "Nirmala UI", "Mangal", "Kohinoor Devanagari", "Segoe UI", system-ui, sans-serif;
  --fs-0: 0.875rem;
  --fs-1: 1rem;
  --fs-2: 1.125rem;
  --fs-3: 1.375rem;
  --fs-4: 1.75rem;
  --fs-5: 2.25rem;
  --lh: 1.6;

  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;

  --r-sm: 8px;
  --r: 14px;
  --r-lg: 22px;
  --r-pill: 999px;

  --shadow-1: 0 1px 2px rgba(34, 48, 46, 0.06), 0 1px 3px rgba(34, 48, 46, 0.05);
  --shadow-2: 0 6px 20px rgba(34, 48, 46, 0.08);
  --focus: 0 0 0 3px #fff, 0 0 0 6px #1a6fd1;
  --tap: 44px;
  --container: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-1);
  line-height: var(--lh);
  color: var(--c-ink);
  background: var(--c-bg);
  overflow-x: hidden;
}
body.lang-hi, [lang="hi"] { font-family: var(--font-hi); line-height: 1.75; }
img, svg { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 var(--sp-3); color: var(--c-ink); overflow-wrap: anywhere; }
h1 { font-size: var(--fs-4); }
h2 { font-size: var(--fs-3); }
h3, .h3 { font-size: var(--fs-2); }
p { margin: 0 0 var(--sp-3); overflow-wrap: anywhere; }
a { color: var(--c-primary-700); text-underline-offset: 3px; }
a:hover { color: var(--c-primary); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
[hidden] { display: none !important; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--c-ink); color: #fff; padding: var(--sp-2) var(--sp-4); z-index: 100; }
.skip-link:focus { left: var(--sp-4); top: var(--sp-2); }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--sp-4); }
.site-main { padding: var(--sp-5) 0 calc(var(--sp-7) + 64px); min-height: 60vh; }
.site-main:focus { outline: none; }
/* Headings receive focus programmatically (tabindex=-1) to announce new content; they are not interactive. */
[tabindex="-1"]:focus { outline: none; box-shadow: none; }
.section { margin: var(--sp-7) 0; }
.section-sub { margin-top: var(--sp-5); }
.page-head { margin-bottom: var(--sp-5); }
.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }

/* Layout utilities */
.row { display: flex; flex-wrap: wrap; align-items: center; }
.gap { gap: var(--sp-3); }
.space-between { justify-content: space-between; gap: var(--sp-3); }
.align-center { align-items: center; }
.align-start { align-items: start; }
.center { text-align: center; justify-content: center; }
.left { text-align: left; }
.stack > * + * { margin-top: var(--sp-4); }
.stack-sm > * + * { margin-top: var(--sp-2); }
.grid { display: grid; gap: var(--sp-4); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.muted { color: var(--c-muted); }
.small { font-size: var(--fs-0); }
.lead { font-size: var(--fs-2); color: var(--c-ink-2); }
.eyebrow { font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--c-primary-700); margin-bottom: var(--sp-1); }
.lang-hi .eyebrow { text-transform: none; letter-spacing: 0; }
.plain-list { list-style: none; padding: 0; margin: 0 0 var(--sp-3); }
.plain-list li + li { margin-top: var(--sp-3); }

/* Cards */
.card { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-lg); padding: var(--sp-5); box-shadow: var(--shadow-1); min-width: 0; }
.card.soft, .alert-soft { background: var(--c-primary-50); border-color: var(--c-primary-100); box-shadow: none; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--tap); padding: 0.55rem 1.15rem; border-radius: var(--r-pill); border: 2px solid transparent;
  font: inherit; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-600); color: #fff; }
.btn-soft { background: var(--c-primary-50); color: var(--c-primary-700); border-color: var(--c-primary-100); }
.btn-soft:hover { background: var(--c-primary-100); }
.btn-ghost { background: transparent; color: var(--c-primary-700); border-color: var(--c-line); }
.btn-ghost:hover { background: var(--c-surface-2); }
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--c-danger); border-color: var(--c-danger-50); }
.btn-lg { min-height: 52px; padding: 0.75rem 1.6rem; font-size: var(--fs-2); }
.btn-sm { min-height: 36px; padding: 0.35rem 0.85rem; font-size: var(--fs-0); }
.btn-block { width: 100%; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(255,255,255,.6); border-top-color: transparent; animation: spin .8s linear infinite; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--c-primary-700); text-decoration: underline; cursor: pointer; min-height: 0; }
.icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); border-radius: 50%; color: var(--c-ink-2); }
.icon-btn:hover { background: var(--c-surface-2); }
.icon-btn .dot { position: absolute; top: 4px; right: 2px; background: var(--c-coral); color: #fff; font-size: 0.65rem; font-weight: 700; border-radius: var(--r-pill); padding: 0 5px; line-height: 16px; }

/* Chips & badges */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: var(--r-pill); background: var(--c-surface-2); color: var(--c-ink-2); font-size: 0.8rem; font-weight: 600; line-height: 1.6; }
.chip .icon { width: 14px; height: 14px; }
.chip-done { background: var(--c-success-50); color: var(--c-success); }
.chip-progress { background: var(--c-sun-50); color: var(--c-warning); }
.chip-locked { background: var(--c-surface-2); color: var(--c-muted); }
.chip-skill { background: var(--c-primary-50); color: var(--c-primary-700); }
.badge { display: inline-block; padding: 0 8px; border-radius: var(--r-pill); background: var(--c-coral-50); color: #8f3b26; font-size: 0.75rem; font-weight: 700; }

/* Alerts & toasts */
.alert { border-radius: var(--r); padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4); border: 1px solid transparent; }
.alert-success { background: var(--c-success-50); color: #1d5434; border-color: #c9e6d3; }
.alert-error { background: var(--c-danger-50); color: #7e2a25; border-color: #f2c9c4; }
.alert-info { background: #e8f1fa; color: #1d4a72; border-color: #cfe1f2; }
.alert-warning { background: var(--c-warning-50); color: #6b4700; border-color: #f2dfae; }
.toast-region { position: fixed; z-index: 60; right: var(--sp-4); bottom: calc(var(--sp-4) + 72px); display: flex; flex-direction: column; gap: var(--sp-2); max-width: min(92vw, 380px); }
.toast { background: var(--c-ink); color: #fff; padding: var(--sp-3) var(--sp-4); border-radius: var(--r); box-shadow: var(--shadow-2); animation: toast-in .25s ease; }
.toast-success { background: var(--c-success); }
.toast-error { background: var(--c-danger); }
.toast.is-leaving { opacity: 0; transition: opacity .4s ease; }

/* Forms */
.form-field { display: flex; flex-direction: column; gap: var(--sp-1); }
label, legend { font-weight: 600; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.input, .select, .textarea {
  width: 100%; min-height: var(--tap); padding: 0.6rem 0.8rem; border: 1.5px solid #cdd5d0; border-radius: var(--r-sm);
  background: #fff; color: var(--c-ink); font: inherit;
}
.textarea { resize: vertical; min-height: 96px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--c-primary); }
.hint { font-size: var(--fs-0); color: var(--c-muted); margin: 0; }
.field-error { color: var(--c-danger); font-size: var(--fs-0); font-weight: 600; margin: 0; }
.check { display: flex; align-items: flex-start; gap: var(--sp-2); font-weight: 400; cursor: pointer; min-height: var(--tap); padding: 0.4rem 0; }
.check input { width: 20px; height: 20px; margin-top: 0.15rem; flex-shrink: 0; accent-color: var(--c-primary); }
.check-card { border: 1.5px solid var(--c-line); border-radius: var(--r); padding: var(--sp-3); background: #fff; }
.check-list { display: grid; gap: var(--sp-2); }
.divider { display: flex; align-items: center; gap: var(--sp-3); color: var(--c-muted); font-size: var(--fs-0); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--c-line); }
.guardian-box { border: 1.5px dashed var(--c-sun); border-radius: var(--r); padding: var(--sp-4); background: var(--c-sun-50); }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.filter-bar .select { width: auto; min-width: 200px; }

/* Header & navigation */
.site-header { background: rgba(255,255,255,.92); backdrop-filter: saturate(140%) blur(6px); border-bottom: 1px solid var(--c-line); position: sticky; top: 0; z-index: 40; }
.header-inner { display: flex; align-items: center; gap: var(--sp-4); min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: var(--sp-2); text-decoration: none; color: var(--c-ink); font-weight: 800; font-size: 1.15rem; }
.main-nav { display: flex; gap: var(--sp-1); margin-left: var(--sp-4); }
.main-nav a { display: inline-flex; align-items: center; gap: 6px; padding: 0.45rem 0.8rem; border-radius: var(--r-pill); text-decoration: none; color: var(--c-ink-2); font-weight: 600; }
.main-nav a:hover { background: var(--c-surface-2); color: var(--c-ink); }
.main-nav a.is-active { background: var(--c-primary-50); color: var(--c-primary-700); }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }
.lang-switch { display: inline-flex; border: 1.5px solid var(--c-line); border-radius: var(--r-pill); overflow: hidden; }
.lang-switch button { border: 0; background: transparent; padding: 0.3rem 0.7rem; min-height: 36px; font: inherit; font-weight: 600; color: var(--c-ink-2); cursor: pointer; }
.lang-switch button.is-active { background: var(--c-primary); color: #fff; }
.account-menu { position: relative; }
.account-menu summary { list-style: none; cursor: pointer; border-radius: 50%; }
.account-menu summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; background: #fff; border: 1px solid var(--c-line); border-radius: var(--r); box-shadow: var(--shadow-2); padding: var(--sp-2); display: flex; flex-direction: column; z-index: 50; }
.menu-panel a, .menu-panel .link-btn { display: block; padding: 0.55rem 0.75rem; border-radius: var(--r-sm); text-decoration: none; color: var(--c-ink); text-align: left; width: 100%; }
.menu-panel a:hover, .menu-panel .link-btn:hover { background: var(--c-surface-2); }
.menu-panel .menu-name { padding: 0.4rem 0.75rem; margin: 0; font-weight: 700; border-bottom: 1px solid var(--c-line); margin-bottom: 4px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: var(--c-primary-50); font-size: 1.4rem; }
.avatar-sm { width: 38px; height: 38px; font-size: 1.15rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 2rem; }
.announcement { background: var(--c-sun-50); border-bottom: 1px solid #f2dfae; padding: var(--sp-2) 0; font-weight: 600; }
.bottom-nav { display: none; }
.icon { flex-shrink: 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--c-line); background: var(--c-surface); padding: var(--sp-5) 0 calc(var(--sp-5) + 64px); }
.footer-inner { display: flex; flex-direction: column; gap: var(--sp-2); }
.footer-inner nav { display: flex; flex-wrap: wrap; gap: var(--sp-4); }
.footer-brand { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin: 0; }

/* Hero / landing */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: var(--sp-6); padding: var(--sp-6) 0; }
.hero h1 { font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -0.01em; }
.hero-svg { width: 100%; max-width: 460px; display: block; margin: 0 auto; }
.feature-icon { display: inline-flex; width: 48px; height: 48px; align-items: center; justify-content: center; border-radius: 14px; background: var(--c-primary-50); color: var(--c-primary-700); margin-bottom: var(--sp-3); }
.level-strip { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: var(--sp-3); }
.level-pill { background: #fff; border: 1px solid var(--c-line); border-top: 5px solid var(--accent); border-radius: var(--r); padding: var(--sp-4); display: flex; flex-direction: column; gap: 4px; }
.level-num { font-size: 0.8rem; font-weight: 800; color: var(--accent); }
.level-emoji, .path-emoji { font-size: 1.8rem; }
.checklist { list-style: none; padding: 0; margin: 0 0 var(--sp-4); display: grid; gap: var(--sp-2); }
.checklist li { display: flex; gap: var(--sp-2); align-items: flex-start; }
.checklist .icon { color: var(--c-success); margin-top: 2px; }
.safety h2 { display: flex; align-items: center; gap: var(--sp-2); }
.cta { text-align: center; }

/* Onboarding */
.stepper { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 var(--sp-5); }
.stepper li { flex: 1; height: 6px; border-radius: var(--r-pill); background: var(--c-line); }
.stepper li.is-done { background: var(--c-primary-100); }
.stepper li.is-current { background: var(--c-primary); }
.onboard-art { font-size: 3rem; }
.choice-grid { display: grid; gap: var(--sp-3); }
.choice-grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.big-choice { position: relative; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left; width: 100%; padding: var(--sp-4); border: 2px solid var(--c-line); border-radius: var(--r); background: #fff; cursor: pointer; font: inherit; min-height: 64px; }
.big-choice:hover { border-color: var(--c-primary-100); background: var(--c-primary-50); }
.big-choice input { position: absolute; opacity: 0; pointer-events: none; }
.big-choice:has(input:checked), .big-choice.is-selected { border-color: var(--c-primary); background: var(--c-primary-50); }
.big-choice:has(input:focus-visible) { box-shadow: var(--focus); }
.big-choice-title { font-weight: 700; font-size: var(--fs-2); }
.big-choice.compact { min-height: 0; padding: var(--sp-3); }
.avatar-picker { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.avatar-option { cursor: pointer; }
.avatar-option input { position: absolute; opacity: 0; }
.avatar-option .avatar { width: 52px; height: 52px; border: 3px solid transparent; }
.avatar-option input:checked + .avatar { border-color: var(--c-primary); }
.avatar-option input:focus-visible + .avatar { box-shadow: var(--focus); }

/* Dashboard */
.dash-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-5); }
.dash-head h1 { margin: 0; }
.xp-box { min-width: min(100%, 300px); padding: var(--sp-4); }
.xp-total { font-size: var(--fs-3); margin: 0 0 var(--sp-2); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: var(--sp-4); }
.continue-card { border-left: 6px solid var(--c-primary); }
.daily { border-left: 6px solid var(--c-sun); }
.hero-card { margin-bottom: var(--sp-5); background: linear-gradient(180deg, var(--c-primary-50), #fff); }
.empty-icon { font-size: 3rem; line-height: 1; margin-bottom: var(--sp-2); }
.stat-list { list-style: none; padding: 0; margin: 0 0 var(--sp-3); display: flex; flex-wrap: wrap; gap: var(--sp-4); }
.stat-list strong { display: block; font-size: var(--fs-3); color: var(--c-primary-700); }
.stat-cards { list-style: none; padding: 0; margin: 0 0 var(--sp-5); display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--sp-3); }
.stat-cards .card { padding: var(--sp-4); display: flex; flex-direction: column; }
.stat-cards strong { font-size: var(--fs-4); color: var(--c-primary-700); line-height: 1.1; }
.badge-row { list-style: none; padding: 0; margin: 0 0 var(--sp-3); display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.badge-item { display: inline-flex; align-items: center; gap: 6px; background: var(--c-sun-50); border-radius: var(--r-pill); padding: 4px 12px 4px 6px; font-weight: 600; font-size: var(--fs-0); }
.badge-item span:first-child { font-size: 1.3rem; }
.quick-links { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-5); padding: var(--sp-3); }
.quick-links a { display: inline-flex; gap: 6px; align-items: center; padding: 0.5rem 0.9rem; border-radius: var(--r-pill); background: var(--c-surface-2); text-decoration: none; color: var(--c-ink); font-weight: 600; min-height: var(--tap); }
.quick-links a:hover { background: var(--c-primary-50); }

/* Progress bar */
.progress { height: 10px; background: var(--c-surface-2); border-radius: var(--r-pill); overflow: hidden; margin: var(--sp-2) 0; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--c-primary), #3fb0a1); border-radius: inherit; transition: width .6s ease; }
.path-progress { margin-bottom: var(--sp-3); }

/* Item cards */
.item-card { position: relative; display: flex; gap: var(--sp-3); background: #fff; border: 1px solid var(--c-line); border-radius: var(--r); padding: var(--sp-4); box-shadow: var(--shadow-1); transition: border-color .15s ease, box-shadow .15s ease; min-width: 0; }
.item-card:hover { border-color: var(--c-primary-100); box-shadow: var(--shadow-2); }
.item-card:focus-within { box-shadow: var(--focus); }
.item-card.state-completed { border-left: 5px solid var(--c-success); }
.item-card.state-in_progress { border-left: 5px solid var(--c-sun); }
.item-card.is-locked { background: var(--c-surface-2); opacity: .85; }
.item-icon { font-size: 2rem; line-height: 1; width: 52px; height: 52px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--c-primary-50); border-radius: 16px; }
/* Cards with a scene illustration: a decorative banner across the top, the emoji as a badge. */
.item-card.has-art { flex-direction: column; gap: var(--sp-2); padding-top: 0; overflow: hidden; }
.item-icon.has-art { position: relative; width: calc(100% + 2 * var(--sp-4)); height: auto; aspect-ratio: 8 / 3; margin: 0 calc(-1 * var(--sp-4)) var(--sp-2); border-radius: 0; background-size: cover; background-position: center; font-size: 1.15rem; }
.item-icon.has-art .item-emoji { position: absolute; left: var(--sp-4); bottom: -16px; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 50%; box-shadow: var(--shadow-1); }
.item-card.has-art.state-completed, .item-card.has-art.state-in_progress { border-left-width: 1px; border-top: 5px solid; border-top-color: var(--c-success); }
.item-card.has-art.state-in_progress { border-top-color: var(--c-sun); }
.art-school { background-image: url("../images/scenes/school.svg"); }
.art-home { background-image: url("../images/scenes/home.svg"); }
.art-friends { background-image: url("../images/scenes/friends.svg"); }
.art-online { background-image: url("../images/scenes/online.svg"); }
.art-work { background-image: url("../images/scenes/work.svg"); }
.art-play { background-image: url("../images/scenes/play.svg"); }
.art-community { background-image: url("../images/scenes/community.svg"); }
.art-quiet { background-image: url("../images/scenes/quiet.svg"); }
.art-detective { background-image: url("../images/scenes/detective.svg"); }
.art-journey { background-image: url("../images/scenes/journey.svg"); }
.item-body { min-width: 0; flex: 1; }
.item-title { font-size: var(--fs-2); margin-bottom: var(--sp-1); }
.item-title a { text-decoration: none; color: var(--c-ink); }
.stretched::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.item-title a:focus-visible { box-shadow: none; }
.item-blurb { color: var(--c-ink-2); font-size: var(--fs-0); }
.item-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }

/* Journey map */
.journey-map { list-style: none; padding: 0; margin: 0; position: relative; }
.journey-map::before { content: ""; position: absolute; left: 33px; top: 10px; bottom: 10px; width: 4px; background: repeating-linear-gradient(to bottom, var(--c-primary-100) 0 10px, transparent 10px 18px); border-radius: 2px; }
.level-node { position: relative; margin-bottom: var(--sp-4); }
.level-node > details > summary, .level-summary { list-style: none; display: flex; gap: var(--sp-4); align-items: center; cursor: pointer; padding: var(--sp-3); border-radius: var(--r-lg); background: #fff; border: 1px solid var(--c-line); box-shadow: var(--shadow-1); }
.level-node > details > summary::-webkit-details-marker { display: none; }
.level-badge { position: relative; z-index: 1; flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; background: var(--accent); color: #fff; border: 4px solid #fff; box-shadow: 0 0 0 2px var(--accent); }
.level-text { display: flex; flex-direction: column; min-width: 0; }
.level-name { font-size: var(--fs-2); }
.level-node.is-locked .level-badge { background: #b9c1bd; box-shadow: 0 0 0 2px #b9c1bd; }
.level-node.is-locked summary { background: var(--c-surface-2); }
.level-node.is-completed .level-badge { background: var(--c-success); box-shadow: 0 0 0 2px var(--c-success); }
.level-body { padding: var(--sp-4) 0 var(--sp-2) 64px; }
.req-list { list-style: none; padding: 0; margin: 0 0 var(--sp-4); display: grid; gap: var(--sp-3); }
.req-list li { display: grid; gap: 6px; color: var(--c-ink-2); }
.req-list li.is-met { color: var(--c-success); }
.req-head { display: flex; gap: var(--sp-2); align-items: center; }
.req-text { flex: 1; min-width: 0; }
.req-value { font-variant-numeric: tabular-nums; font-weight: 700; font-size: var(--fs-0); }
.req-list .progress { height: 8px; }
.req-list li.is-met .progress-bar { background: var(--c-success); }
/* Journey overview: where you are, the next step and what unlocks the next level */
.journey-overview { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); margin-bottom: var(--sp-5); align-items: start; }
.journey-overview h2 { margin: var(--sp-1) 0; }
.journey-overview .btn { margin-top: var(--sp-3); white-space: normal; text-align: left; }
.journey-overview-next { border-left: 1px solid var(--c-line); padding-left: var(--sp-5); }
.h-small { font-size: var(--fs-1); margin: 0 0 var(--sp-2); }
.level-learn { display: grid; grid-template-columns: 1.2fr 1fr; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.learn-list { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; }
.level-example { background: var(--c-primary-50); border-radius: var(--r); padding: var(--sp-3) var(--sp-4); }
.level-example p { margin: 0; }
.chip-start { background: var(--c-primary); color: #fff; font-weight: 700; }
.chip-helps { background: #fff3d6; color: #8a5a00; }
.item-card.is-start-here { border-color: var(--c-primary); box-shadow: 0 0 0 2px var(--c-primary-100), var(--shadow-1); }

/* Tabs */
.tabs { display: flex; gap: var(--sp-2); overflow-x: auto; padding-bottom: var(--sp-2); margin-bottom: var(--sp-4); scrollbar-width: thin; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 0.5rem 1rem; border-radius: var(--r-pill); background: #fff; border: 1.5px solid var(--c-line); text-decoration: none; color: var(--c-ink-2); font-weight: 600; white-space: nowrap; min-height: var(--tap); }
.tabs a.is-active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }

/* Player */
.player-wrap { max-width: 760px; margin: 0 auto; }
.player-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-3); gap: var(--sp-3); }
.save-status { font-size: var(--fs-0); color: var(--c-muted); min-height: 1.5em; display: inline-flex; gap: 6px; align-items: center; }
.save-status[data-state="saving"]::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c-sun); animation: pulse 1s ease infinite; }
.save-status[data-state="saved"]::before { content: "✓"; color: var(--c-success); font-weight: 700; }
.save-status[data-state="failed"] { color: var(--c-danger); font-weight: 600; }
.player { padding: var(--sp-5); min-height: 320px; }
.player-loading { display: flex; gap: var(--sp-2); align-items: center; color: var(--c-muted); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--c-primary-100); border-top-color: var(--c-primary); animation: spin .8s linear infinite; display: inline-block; }
.player-header { margin-bottom: var(--sp-4); }
.scene-art { display: block; width: 100%; height: auto; aspect-ratio: 8 / 3; max-height: 220px; object-fit: cover; border-radius: var(--r); margin-bottom: var(--sp-4); background: var(--c-primary-50); }
.player-title { font-size: var(--fs-4); }
.scene { background: var(--c-surface-2); border-radius: var(--r-lg); padding: var(--sp-5); margin: var(--sp-4) 0; border-left: 6px solid var(--c-primary); }
.scene.kind-dialogue { border-left-color: var(--c-sky); }
.scene.kind-story { border-left-color: var(--c-sun); background: #fffaf0; }
.scene.is-ending { border-left-color: var(--c-success); }
.speaker { font-weight: 800; color: var(--c-primary-700); margin-bottom: var(--sp-1); }
.scene-text, .step-text { font-size: var(--fs-2); }
.scene-image { width: 100%; max-height: 320px; object-fit: cover; border-radius: var(--r); margin-bottom: var(--sp-3); }
.listen { margin-top: var(--sp-2); }
.choices { display: grid; gap: var(--sp-3); margin: var(--sp-4) 0; }
.choice-btn { text-align: left; width: 100%; min-height: 56px; padding: var(--sp-3) var(--sp-4); border-radius: var(--r); border: 2px solid var(--c-line); background: #fff; font: inherit; font-size: var(--fs-1); color: var(--c-ink); cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.choice-btn:hover:not([disabled]) { border-color: var(--c-primary); background: var(--c-primary-50); }
.choice-btn.is-selected { border-color: var(--c-primary); background: var(--c-primary-50); font-weight: 600; }
.choice-btn[disabled] { opacity: .6; cursor: progress; }
.feedback { border-radius: var(--r); padding: var(--sp-4); margin: var(--sp-4) 0; border: 1.5px solid; animation: rise .3s ease; }
.feedback.q-strong { background: var(--c-success-50); border-color: #bfe0cb; }
.feedback.q-okay { background: var(--c-sun-50); border-color: #f2dfae; }
.feedback.q-rethink { background: #eef2fb; border-color: #d3dcf2; }
.feedback-tone { font-weight: 800; margin-bottom: var(--sp-2); }
.feedback-list { padding-left: var(--sp-4); margin: var(--sp-2) 0 0; display: grid; gap: var(--sp-2); }
.feedback-list li.is-different strong { text-decoration: underline wavy var(--c-coral); }
.transcript { padding-left: var(--sp-5); display: grid; gap: var(--sp-3); }
.story-so-far { margin-bottom: var(--sp-3); }
.story-so-far summary { cursor: pointer; font-weight: 600; color: var(--c-primary-700); min-height: var(--tap); display: flex; align-items: center; }
.step-progress { margin: var(--sp-3) 0; }
.step { margin: var(--sp-4) 0; }
.step-nav { margin-top: var(--sp-5); border-top: 1px solid var(--c-line); padding-top: var(--sp-4); }
.lesson-intro { background: var(--c-primary-50); border-radius: var(--r); padding: var(--sp-4); }
.sort-item { border: 1.5px solid var(--c-line); border-radius: var(--r); padding: var(--sp-3); display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.sort-item legend { font-weight: 600; padding: 0 4px; float: left; width: 100%; margin-bottom: var(--sp-2); }
.pill-radio { position: relative; cursor: pointer; }
.pill-radio input { position: absolute; opacity: 0; }
.pill-radio span { display: inline-flex; align-items: center; min-height: 40px; padding: 0.35rem 1rem; border-radius: var(--r-pill); border: 2px solid var(--c-line); font-weight: 600; background: #fff; }
.pill-radio input:checked + span { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.pill-radio input:focus-visible + span { box-shadow: var(--focus); }
.completion .celebrate { font-size: 3.5rem; animation: pop .6s ease; }
.achievement-pop { display: flex; flex-direction: column; align-items: center; gap: 2px; background: var(--c-sun-50); border-radius: var(--r); padding: var(--sp-3) var(--sp-4); animation: pop .5s ease; }
.achievement-pop span:first-child { font-size: 2rem; }
.takeaway { text-align: left; }
.report-box { margin-top: var(--sp-4); font-size: var(--fs-0); }
.report-box summary { cursor: pointer; color: var(--c-muted); display: inline-flex; gap: 6px; align-items: center; min-height: var(--tap); }
.report-box form { margin-top: var(--sp-3); background: #fff; border: 1px solid var(--c-line); border-radius: var(--r); padding: var(--sp-4); }

/* Missions */
.mission.is-done { border-left: 5px solid var(--c-success); }
.mission.is-daily { box-shadow: 0 0 0 3px var(--c-sun-50), var(--shadow-1); border-color: var(--c-sun); }
.mission details summary { cursor: pointer; color: var(--c-primary-700); font-weight: 600; min-height: var(--tap); display: flex; align-items: center; }
.mission-form { margin-top: var(--sp-3); border-top: 1px solid var(--c-line); padding-top: var(--sp-3); }
.mission-result { font-weight: 600; color: var(--c-success); margin: 0; }

/* Garden */
.garden { background: linear-gradient(180deg, #e6f4f9 0%, #f3fbf6 55%, #dcefe2 56%, #cfe8d6 100%); padding: var(--sp-5); overflow: hidden; position: relative; }
.garden-sky { display: flex; justify-content: space-between; font-size: 2rem; margin-bottom: var(--sp-3); }
.garden-beds { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--sp-3); }
.bed { display: flex; flex-direction: column; align-items: center; text-align: center; padding: var(--sp-3); background: rgba(255,255,255,.7); border-radius: var(--r); }
.plant { font-size: 2rem; line-height: 1.2; transition: transform .4s ease; }
.bed.stage-2 .plant { font-size: 2.6rem; }
.bed.stage-3 .plant { font-size: 3.1rem; }
.bed.stage-4 .plant { font-size: 3.6rem; }
.bed-label { font-weight: 700; font-size: var(--fs-0); }
.garden-flowers { font-size: 1.8rem; text-align: center; margin: var(--sp-4) 0 0; letter-spacing: 6px; }
.achievement { text-align: center; }
.achievement-icon { font-size: 2.4rem; display: block; }
.achievement.is-locked { opacity: .6; filter: grayscale(.8); }

/* Lists, tables, timeline */
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--sp-2); }
.timeline li { padding: var(--sp-2) 0; border-bottom: 1px solid var(--c-line); display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--c-line); border-radius: var(--r); background: #fff; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-0); }
.table th, .table td { padding: 0.65rem 0.8rem; text-align: left; border-bottom: 1px solid var(--c-line); vertical-align: top; }
.table th { background: var(--c-surface-2); font-weight: 700; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.notification-list, .journal-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--sp-3); }
.notification-list li { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-4); }
.notification-list li.is-unread { border-left: 5px solid var(--c-coral); }
.notification-type { font-size: 1.5rem; }
.journal-body { white-space: normal; }
.danger-zone { border-color: #f2c9c4; }
.prose { max-width: 760px; margin: 0 auto; }
.prose h2 { margin-top: var(--sp-5); }
/* Privacy notice and terms */
.legal .legal-header h1 { margin-bottom: var(--sp-1); }
.legal .lead { margin-top: var(--sp-3); }
.legal-summary { margin: var(--sp-4) 0; padding: var(--sp-4) var(--sp-5); }
.legal-summary h2, .legal-toc h2 { margin-top: 0; font-size: var(--fs-2); }
.legal-summary ul { margin: 0; padding-left: 1.2em; display: grid; gap: var(--sp-2); }
.legal-toc { margin: var(--sp-4) 0; padding: var(--sp-4) var(--sp-5); border: 1px solid var(--c-line); border-radius: var(--r); }
.legal-toc ol { margin: 0; padding-left: 1.4em; columns: 2 220px; column-gap: var(--sp-5); }
.legal-toc li { margin-bottom: var(--sp-1); break-inside: avoid; }
.legal-section { scroll-margin-top: 80px; }
.legal-section ul { padding-left: 1.2em; display: grid; gap: var(--sp-1); }
.legal-table { table-layout: auto; }
.legal-table th, .legal-table td { white-space: normal; vertical-align: top; min-width: 8rem; line-height: 1.5; }
.legal-table th[scope="row"] { font-weight: 600; text-align: left; background: #fff; width: 38%; }
.legal-table thead th { background: var(--c-surface-2); }
.legal-footer { margin-top: var(--sp-6); padding-top: var(--sp-3); border-top: 1px solid var(--c-line); }
.error-list { text-align: left; }

/* Motion */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
.pref-reduced-motion *, .pref-reduced-motion *::before, .pref-reduced-motion *::after { animation: none !important; transition: none !important; }

/* Learner preferences & age bands */
.pref-large-text { font-size: 1.15rem; }
.pref-large-text .choice-btn, .pref-large-text .scene-text, .pref-large-text .step-text { font-size: 1.3rem; }
.pref-high-contrast { --c-bg: #ffffff; --c-ink: #000000; --c-ink-2: #111111; --c-muted: #333333; --c-line: #5d6b68; --c-primary: #00594f; --c-primary-700: #003d36; }
.pref-high-contrast .card, .pref-high-contrast .item-card, .pref-high-contrast .choice-btn { border-width: 2px; }
.band-little_hearts .choice-btn { min-height: 68px; font-size: 1.2rem; font-weight: 600; border-radius: var(--r-lg); }
.band-little_hearts .scene-text { font-size: 1.35rem; }
.band-little_hearts .btn { min-height: 52px; }

/* Responsive */
@media (max-width: 960px) {
  .main-nav { display: none; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: #fff; border-top: 1px solid var(--c-line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; min-height: 56px; text-decoration: none; color: var(--c-muted); font-size: 0.72rem; font-weight: 600; border-radius: var(--r-sm); text-align: center; }
  .bottom-nav a.is-active { color: var(--c-primary-700); background: var(--c-primary-50); }
  .hero { grid-template-columns: 1fr; padding-top: var(--sp-4); }
  .hero-art { order: -1; max-width: 360px; margin: 0 auto; }
}
@media (max-width: 600px) {
  :root { --fs-4: 1.5rem; --fs-3: 1.25rem; }
  .card { padding: var(--sp-4); border-radius: var(--r); }
  .player { padding: var(--sp-4); }
  .scene { padding: var(--sp-4); }
  .brand-name { display: none; }
  .level-body { padding-left: 0; }
  .journey-overview, .level-learn { grid-template-columns: 1fr; }
  .journey-overview-next { border-left: 0; padding-left: 0; border-top: 1px solid var(--c-line); padding-top: var(--sp-4); }
  .journey-map::before { left: 30px; }
  .lang-switch button { padding: 0.3rem 0.55rem; }
  .filter-bar .select { min-width: 0; width: 100%; }
  .toast-region { left: var(--sp-3); right: var(--sp-3); max-width: none; }
  .scene-art { aspect-ratio: 2 / 1; }
  /* Legal tables become one card per row, with each cell labelled by its column. */
  .legal .table-wrap { border: 0; background: none; overflow: visible; }
  .legal-table, .legal-table tbody, .legal-table tr, .legal-table th, .legal-table td { display: block; width: auto; min-width: 0; }
  .legal-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .legal-table tr { border: 1px solid var(--c-line); border-radius: var(--r); background: #fff; margin-bottom: var(--sp-3); }
  .legal-table th[scope="row"] { width: auto; border-bottom: 1px solid var(--c-line); background: var(--c-surface-2); border-radius: var(--r) var(--r) 0 0; }
  .legal-table td { border-bottom: 0; padding-top: 0.35rem; }
  .legal-table td::before { content: attr(data-label); display: block; font-size: 0.8em; font-weight: 700; color: var(--c-muted); text-transform: uppercase; letter-spacing: .03em; }
}
@media print {
  .site-header, .bottom-nav, .site-footer, .toast-region { display: none; }
}
