:root {
  --ink: #1f2041;
  --muted: #67677f;
  --paper: #fffdf8;
  --surface: #ffffff;
  --surface-soft: #f5f3ff;
  --primary: #5b4bdb;
  --primary-dark: #3f34a8;
  --primary-soft: #ece9ff;
  --secondary: #00a896;
  --secondary-soft: #dff9f4;
  --sun: #ffcb47;
  --coral: #ff7b69;
  --pink: #f39bd3;
  --sky: #7bc8f6;
  --green: #57c785;
  --border: #dedbea;
  --danger: #bd3c4b;
  --shadow: 0 18px 55px rgba(41, 35, 92, 0.12);
  --shadow-soft: 0 8px 25px rgba(41, 35, 92, 0.09);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 9px;
  --max-width: 1240px;
  --focus: 0 0 0 4px rgba(91, 75, 219, 0.22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 4%, rgba(123, 200, 246, 0.17), transparent 28rem),
    radial-gradient(circle at 95% 8%, rgba(243, 155, 211, 0.14), transparent 25rem),
    #fbfaf7;
  font-family: Inter, ui-rounded, "Nunito Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  min-height: 100vh;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--primary-dark); text-decoration-thickness: 0.08em; text-underline-offset: 0.16em; }
a:hover { color: var(--primary); }
img, svg { max-width: 100%; }

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.12; letter-spacing: -0.025em; }
h1 { font-size: clamp(2.15rem, 5vw, 4.55rem); margin-bottom: 1rem; }
h2 { font-size: clamp(1.7rem, 3.1vw, 2.75rem); margin-bottom: 0.8rem; }
h3 { font-size: 1.2rem; margin-bottom: 0.55rem; }
small { color: var(--muted); }
code { background: #efedf7; border-radius: 6px; padding: 0.12rem 0.35rem; }

.skip-link {
  position: fixed; left: 1rem; top: -5rem; z-index: 9999;
  background: var(--ink); color: white; padding: 0.7rem 1rem; border-radius: 0 0 10px 10px;
}
.skip-link:focus { top: 0; }

.site-header {
  min-height: 76px; padding: 0.85rem max(1rem, calc((100vw - var(--max-width)) / 2));
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: rgba(255, 253, 248, 0.91); backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(222, 219, 234, 0.75); position: sticky; top: 0; z-index: 100;
}
.brand { display: inline-flex; align-items: center; gap: 0.75rem; color: var(--ink); text-decoration: none; }
.brand-mark { width: 44px; height: 44px; display: block; flex: 0 0 auto; border-radius: 14px; box-shadow: 0 8px 18px rgba(91, 75, 219, 0.22); }
.brand strong { display: block; font-size: 1.08rem; }
.brand small { display: block; font-size: 0.72rem; line-height: 1.15; }
.site-nav { display: flex; align-items: center; gap: 1.1rem; font-weight: 750; font-size: 0.92rem; }
.site-nav a, .link-button { color: var(--ink); text-decoration: none; }
.site-nav > a, .site-nav .link-button { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: .55rem .35rem; }
.site-nav [aria-current="page"]:not(.nav-cta) { color: var(--primary-dark); text-decoration: underline; text-decoration-thickness: 0.16em; text-underline-offset: 0.38em; }
.nav-cta { background: var(--primary); color: white !important; border-radius: 999px; padding: 0.62rem 0.95rem; }
.inline-form { display: inline-flex; margin: 0; }
.link-button { border: 0; background: transparent; cursor: pointer; font-weight: inherit; }
.link-button:hover { color: var(--primary); }

.page-shell { width: min(var(--max-width), calc(100% - 2rem)); margin: 0 auto; padding: 3.1rem 0 5rem; min-height: calc(100vh - 160px); }
.site-footer { width: min(var(--max-width), calc(100% - 2rem)); margin: 0 auto; padding: 2rem 0 2.6rem; border-top: 1px solid var(--border); display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 1.1rem 2rem; color: var(--muted); font-size: 0.86rem; }
.footer-brand { display: grid; gap: .25rem; }
.footer-brand strong { color: var(--ink); }
.footer-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .65rem 1.2rem; }
.site-footer a { margin-left: 0; }

.flash-stack { position: fixed; top: 88px; right: max(1rem, calc((100vw - var(--max-width)) / 2)); width: min(430px, calc(100vw - 2rem)); z-index: 200; display: grid; gap: 0.6rem; }
.flash { padding: 0.9rem 1rem; border-radius: 14px; box-shadow: var(--shadow-soft); background: white; border: 1px solid var(--border); font-weight: 700; }
.flash-success { border-left: 6px solid var(--green); }
.flash-error { border-left: 6px solid var(--danger); }
.flash-info { border-left: 6px solid var(--sky); }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; min-height: 44px; padding: 0.72rem 1.05rem; border-radius: 12px; border: 2px solid transparent; text-decoration: none; font-weight: 850; cursor: pointer; transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease; }
.button:hover { transform: translateY(-1px); text-decoration: none; }
.button:active { transform: translateY(0); }
.button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, button:focus-visible { outline: none; box-shadow: var(--focus); }
.button-primary { color: white; background: linear-gradient(135deg, var(--primary), #7968ed); box-shadow: 0 10px 22px rgba(91, 75, 219, 0.23); }
.button-primary:hover { color: white; box-shadow: 0 13px 28px rgba(91, 75, 219, 0.3); }
.button-secondary { color: var(--primary-dark); background: var(--primary-soft); border-color: rgba(91, 75, 219, 0.18); }
.button-dark { color: white; background: var(--ink); }
.button-dark:hover { color: white; }
.button-outline { color: var(--danger); border-color: rgba(189, 60, 75, 0.35); background: white; }
.button-large { min-height: 52px; padding: 0.9rem 1.3rem; font-size: 1rem; }
.button-full { width: 100%; }

.eyebrow { margin: 0 0 0.65rem; font-size: 0.78rem; letter-spacing: 0.13em; text-transform: uppercase; font-weight: 900; color: var(--primary); }
.muted { color: var(--muted); }
.section-block { margin-top: 4.5rem; }
.compact-section { margin-top: 3.25rem; }
.section-heading { margin-bottom: 1.5rem; max-width: 780px; }
.row-heading { display: flex; justify-content: space-between; gap: 1rem; align-items: end; max-width: none; }
.row-heading h2 { margin-bottom: 0; }

.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(400px, 0.95fr); align-items: center; gap: clamp(2rem, 6vw, 6rem); min-height: 650px; }
.hero-copy h1 { max-width: 770px; }
.hero-lead { font-size: clamp(1.05rem, 1.7vw, 1.26rem); color: #4e4d68; max-width: 720px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin: 1.7rem 0 1.4rem; }
.trust-row { display: flex; flex-wrap: wrap; gap: 0.7rem 1.2rem; color: #55536c; font-size: 0.86rem; font-weight: 750; }
.hero-scene { min-height: 550px; border-radius: 46% 54% 44% 56% / 52% 43% 57% 48%; position: relative; background: linear-gradient(155deg, #d8d2ff 0%, #b8e7ff 48%, #ffdf99 100%); box-shadow: var(--shadow); overflow: hidden; }
.hero-scene::before, .hero-scene::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,0.45); }
.hero-scene::before { width: 220px; height: 220px; top: -70px; right: -20px; }
.hero-scene::after { width: 120px; height: 120px; bottom: 40px; left: -40px; }
.moon-orb { position: absolute; top: 8%; right: 14%; font-size: 4.5rem; filter: drop-shadow(0 10px 18px rgba(62, 47, 121, 0.22)); }
.scene-card { position: absolute; z-index: 2; background: rgba(255,255,255,0.93); border: 1px solid rgba(255,255,255,0.8); box-shadow: var(--shadow-soft); border-radius: 20px; padding: 1.15rem; }
.scene-card-story { width: 72%; left: 8%; top: 23%; transform: rotate(-3deg); }
.scene-card-math { width: 72%; right: 7%; bottom: 8%; transform: rotate(3deg); }
.scene-icon { display: block; font-size: 1.55rem; margin-bottom: 0.45rem; }
.demo-word { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border: 0; border-bottom: 3px dotted var(--primary); background: var(--primary-soft); color: var(--ink); border-radius: 7px; padding: 0.42rem 0.55rem; margin-top: 0.65rem; cursor: pointer; font-weight: 850; }
.buddy-figure { position: absolute; left: 14%; bottom: 28%; z-index: 3; display: flex; align-items: center; gap: 0.55rem; }
.buddy-face { font-size: 5.5rem; filter: drop-shadow(0 14px 18px rgba(50, 40, 93, 0.18)); }
.buddy-bubble { background: white; border-radius: 18px 18px 18px 5px; padding: 0.75rem 0.9rem; box-shadow: var(--shadow-soft); font-size: 0.85rem; font-weight: 850; }
.mini-groups { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.35rem; margin-top: 0.6rem; font-size: 0.77rem; }
.mini-groups span { background: var(--secondary-soft); padding: 0.3rem; border-radius: 8px; text-align: center; }

.metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 1.5rem 0 0; background: white; border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-soft); padding: 1.1rem; }
.metric-strip > div { min-height: 90px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border-right: 1px solid var(--border); }
.metric-strip > div:last-child { border-right: 0; }
.metric-strip strong { font-size: 1.75rem; color: var(--primary-dark); }
.metric-strip span { color: var(--muted); font-size: 0.82rem; }
.feature-grid { display: grid; gap: 1rem; }
.feature-grid.three { grid-template-columns: repeat(3, 1fr); }
.feature-card { background: white; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; box-shadow: var(--shadow-soft); }
.feature-emoji { display: inline-grid; place-items: center; width: 52px; height: 52px; font-size: 1.7rem; border-radius: 16px; background: var(--primary-soft); margin-bottom: 1rem; }
.feature-card p { color: var(--muted); margin-bottom: 0; }
.split-panel { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 2rem; align-items: center; background: #252449; color: white; padding: clamp(1.5rem, 4vw, 3.2rem); border-radius: var(--radius-xl); overflow: hidden; position: relative; }
.split-panel .eyebrow { color: #b9afff; }
.mode-list { display: grid; gap: 0.75rem; }
.mode-list > div { display: grid; grid-template-columns: 38px 1fr; gap: 0.1rem 0.75rem; align-items: center; }
.mode-list > div > span { grid-row: 1 / span 2; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #464377; font-weight: 900; }
.mode-list small { color: #c9c7d9; }
.quote-card { min-height: 280px; display: grid; place-items: center; padding: 2rem; border-radius: var(--radius-lg); background: linear-gradient(145deg, #ffd977, #ff9f87); color: #3a2948; position: relative; }
.quote-card p { font-size: clamp(1.25rem, 2.4vw, 2rem); font-weight: 750; margin: 0; }
.quote-mark { position: absolute; left: 1.2rem; top: 0.2rem; font-size: 5.5rem; opacity: 0.3; }

.auth-heading { text-align: center; max-width: 720px; margin: 1rem auto 2rem; }
.auth-heading h1 { font-size: clamp(2.1rem, 5vw, 3.7rem); }
.auth-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; max-width: 940px; margin: 0 auto; }
.auth-single { max-width: 700px; margin: 0 auto; }
.auth-card { background: white; border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow); padding: clamp(1.3rem, 3vw, 2.3rem); }
.child-auth-card { background: linear-gradient(165deg, #fff 0%, #effaff 100%); }
.adult-auth-card { background: linear-gradient(165deg, #fff 0%, #f5f2ff 100%); }
.auth-emoji { font-size: 2.25rem; display: block; margin-bottom: 0.6rem; }
.auth-card h2 { font-size: 1.8rem; }
.wide-auth-card h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
.form-footnote { margin: 1rem 0 0; color: var(--muted); font-size: 0.9rem; }

.stack-form { display: grid; gap: 1rem; }
.stack-form label, .stack-form fieldset { min-width: 0; }
.stack-form label { display: grid; gap: 0.38rem; font-weight: 800; }
.stack-form label small { font-weight: 500; }
fieldset { margin: 0; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1rem; }
legend { padding: 0 0.35rem; font-weight: 900; color: #44415e; }
input, select, textarea { width: 100%; color: var(--ink); background: white; border: 1.5px solid #cfcbdc; border-radius: 11px; padding: 0.73rem 0.8rem; }
input:hover, select:hover, textarea:hover { border-color: #a9a3c1; }
textarea { resize: vertical; line-height: 1.5; }
.check-row { display: flex !important; grid-template-columns: none !important; flex-direction: row; align-items: flex-start; gap: 0.7rem !important; font-weight: 550 !important; }
.check-row input { width: 19px; height: 19px; flex: 0 0 auto; margin-top: 0.15rem; accent-color: var(--primary); }
.segmented-field { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.55rem; border: 0; padding: 0; }
.segmented-field legend { grid-column: 1 / -1; padding: 0; margin-bottom: 0.15rem; }
.segmented-field label { position: relative; }
.segmented-field input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-field span { display: grid; place-items: center; min-height: 44px; border: 1.5px solid var(--border); border-radius: 11px; background: white; }
.segmented-field input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.notice { border-radius: var(--radius-md); padding: 1rem; }
.notice.warning { background: #fff5d5; border: 1px solid #f5d779; }

.dashboard-hero { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: clamp(1.5rem, 4vw, 3rem); border-radius: var(--radius-xl); background: linear-gradient(130deg, #ece9ff, #e6f8ff); border: 1px solid rgba(91,75,219,.12); }
.dashboard-hero h1 { font-size: clamp(2rem, 4vw, 3.7rem); }
.dashboard-hero p:last-child { max-width: 700px; color: #53516b; }
.dashboard-badge { flex: 0 0 auto; width: 190px; min-height: 170px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; border-radius: 30px; background: white; box-shadow: var(--shadow-soft); transform: rotate(2deg); }
.dashboard-badge span { font-size: 3.5rem; }
.dashboard-badge small { display: block; }
.child-profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.child-profile-card { padding: 1.25rem; border: 1px solid var(--border); background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); }
.child-card-top { display: grid; grid-template-columns: auto 1fr auto; gap: 0.8rem; align-items: center; }
.child-avatar { width: 54px; height: 54px; border-radius: 17px; display: grid; place-items: center; font-size: 2.1rem; background: var(--primary-soft); }
.child-card-top h3 { margin: 0; }
.child-card-top p { margin: 0.12rem 0 0; color: var(--muted); font-size: 0.84rem; }
.status-pill { display: inline-flex; align-items: center; justify-content: center; min-height: 26px; padding: 0.25rem 0.55rem; border-radius: 999px; font-size: 0.72rem; font-weight: 900; white-space: nowrap; }
.status-pill.active { background: #ddf8e8; color: #207744; }
.status-pill.inactive { background: #f7e4e7; color: #973544; }
.child-code-box { display: flex; align-items: center; gap: 0.7rem; margin: 1rem 0; padding: 0.85rem; background: #f7f6fb; border-radius: 12px; }
.child-code-box small { margin-right: auto; }
.child-code-box strong { letter-spacing: 0.08em; }
.copy-button { border: 0; background: white; color: var(--primary-dark); border-radius: 8px; padding: 0.4rem 0.6rem; font-weight: 850; cursor: pointer; }
.mini-stats { display: grid; gap: 0.45rem; }
.mini-stats.four { grid-template-columns: repeat(4, 1fr); }
.mini-stats > div { background: #fbfafc; border: 1px solid #efedf4; border-radius: 10px; padding: 0.55rem 0.3rem; text-align: center; }
.mini-stats strong { display: block; font-size: 1.15rem; }
.mini-stats span { display: block; color: var(--muted); font-size: 0.68rem; }
.setting-summary { display: flex; justify-content: space-between; gap: 0.6rem; margin: 0.9rem 0; font-size: 0.78rem; color: var(--muted); }
.setting-summary span { min-width: 0; }
.form-panel { display: grid; grid-template-columns: 0.75fr 1.25fr; gap: 2rem; align-items: start; background: white; border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-soft); padding: clamp(1.2rem, 4vw, 2.5rem); }
.form-panel-copy { position: sticky; top: 105px; }
.safety-note { display: flex; gap: 0.7rem; background: var(--secondary-soft); border-radius: 14px; padding: 0.9rem; margin-top: 1.3rem; }
.safety-note span { font-size: 1.4rem; }
.safety-note p { margin: 0; font-size: 0.88rem; }
.form-row { display: grid; gap: 0.9rem; }
.form-row.two { grid-template-columns: repeat(2, 1fr); }
.form-row.three { grid-template-columns: repeat(3, 1fr); }
.choice-grid { display: grid; gap: 0.6rem; }
.choice-grid.three { grid-template-columns: repeat(3, 1fr); }
.buddy-choices { grid-template-columns: repeat(3, 1fr); }
.visual-choice, .text-choice { position: relative; cursor: pointer; }
.visual-choice input[type=radio], .text-choice input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.visual-choice { display: flex !important; flex-direction: column; align-items: center; justify-content: center; min-height: 100px; border: 2px solid var(--border); border-radius: 14px; background: white; }
.visual-choice:has(input:checked), .text-choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px rgba(91,75,219,.10); }
.visual-choice-icon { font-size: 2.1rem; }
.text-choice { display: flex !important; min-height: 92px; padding: 0.85rem; border: 2px solid var(--border); border-radius: 13px; background: white; }
.text-choice span { display: flex; flex-direction: column; gap: 0.2rem; }
.chip-checks { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip-checks label { position: relative; display: inline-flex !important; }
.chip-checks input { position: absolute; opacity: 0; }
.chip-checks span { display: inline-flex; padding: 0.48rem 0.7rem; border-radius: 999px; border: 1.5px solid var(--border); background: white; font-size: 0.82rem; cursor: pointer; }
.chip-checks input:checked + span { background: var(--primary-soft); color: var(--primary-dark); border-color: var(--primary); }
.empty-state { grid-column: 1 / -1; text-align: center; padding: 2.4rem; border: 2px dashed var(--border); border-radius: var(--radius-lg); background: rgba(255,255,255,.7); }
.large-empty { max-width: 650px; margin: 4rem auto; }
.small-empty { padding: 1.4rem; }
.empty-emoji { display: block; font-size: 3rem; margin-bottom: 0.8rem; }
.hero-person { display: flex; align-items: center; gap: 1.1rem; }
.large-avatar { width: 100px; height: 100px; border-radius: 30px; background: white; display: grid; place-items: center; font-size: 4rem; box-shadow: var(--shadow-soft); }
.parent-metrics { grid-template-columns: repeat(4, 1fr); }
.dashboard-columns { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 1.2rem; }
.settings-card, .progress-card, .admin-panel { background: white; border: 1px solid var(--border); border-radius: var(--radius-xl); padding: clamp(1.2rem, 3vw, 2rem); box-shadow: var(--shadow-soft); }
.radio-row { display: flex !important; flex-direction: row; gap: 0.65rem !important; align-items: flex-start; padding: 0.55rem; border-radius: 10px; }
.radio-row:hover { background: #f7f6fb; }
.radio-row input { width: 19px; height: 19px; margin-top: 0.1rem; accent-color: var(--primary); }
.radio-row span { display: flex; flex-direction: column; }
.danger-zone { margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid var(--border); }
.activity-list { display: grid; gap: 0.65rem; }
.activity-list article { display: flex; align-items: center; gap: 0.75rem; padding: 0.8rem; border-radius: 12px; background: #f9f8fc; }
.activity-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: white; font-size: 1.35rem; }
.activity-list small { display: block; }

.child-world { background: radial-gradient(circle at 20% 0, rgba(255,203,71,.19), transparent 27rem), radial-gradient(circle at 90% 20%, rgba(123,200,246,.18), transparent 26rem), #fbfaf7; }
.child-welcome { display: grid; grid-template-columns: 1.1fr 0.9fr; align-items: center; gap: 2rem; padding: clamp(1.5rem, 4vw, 3.2rem); background: linear-gradient(135deg, #fff2bd, #dfeaff 70%, #efe7ff); border-radius: 34px; min-height: 320px; overflow: hidden; }
.child-welcome h1 { font-size: clamp(2.2rem, 5vw, 4.1rem); }
.buddy-welcome-card { display: flex; align-items: center; justify-content: center; gap: 0.3rem; }
.buddy-big { font-size: clamp(5.5rem, 12vw, 9.5rem); filter: drop-shadow(0 15px 17px rgba(52,45,96,.18)); }
.speech-card { max-width: 240px; background: white; padding: 1rem; border-radius: 20px 20px 20px 6px; box-shadow: var(--shadow-soft); }
.speech-card p { margin: 0.25rem 0 0; font-size: 0.9rem; }
.journey-choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-top: 1rem; }
.journey-choice { min-height: 180px; display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; padding: 1.35rem; border-radius: var(--radius-xl); text-decoration: none; color: var(--ink); box-shadow: var(--shadow-soft); transition: transform .18s ease; }
.journey-choice:hover { transform: translateY(-3px); color: var(--ink); }
.story-choice { background: linear-gradient(145deg, #ede8ff, #f9eaff); }
.math-choice { background: linear-gradient(145deg, #dff9f4, #e8f5ff); }
.journey-emoji { font-size: 4.3rem; }
.journey-choice strong { display: block; font-size: 1.55rem; margin: .1rem 0 .35rem; }
.journey-choice p { margin: 0; color: #55536c; }
.journey-arrow { font-size: 2rem; }
.child-progress-ribbon { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 1rem; background: #26234c; color: white; border-radius: var(--radius-lg); overflow: hidden; }
.child-progress-ribbon div { padding: 1rem; text-align: center; border-right: 1px solid rgba(255,255,255,.15); }
.child-progress-ribbon div:last-child { border-right: 0; }
.child-progress-ribbon strong { display: block; font-size: 1.45rem; }
.child-progress-ribbon span { font-size: .78rem; color: #d7d3f5; }
.content-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.content-card { display: flex; flex-direction: column; min-width: 0; background: white; color: var(--ink); text-decoration: none; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-soft); transition: transform .18s ease, box-shadow .18s ease; }
.content-card:hover { transform: translateY(-4px); color: var(--ink); box-shadow: var(--shadow); }
.content-cover { min-height: 155px; position: relative; display: grid; place-items: center; background: linear-gradient(145deg, #ece9ff, #dfeeff); overflow: hidden; }
.content-cover::before { content: ""; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.42); position: absolute; top: -35px; right: -25px; }
.content-cover > span { font-size: 4.8rem; filter: drop-shadow(0 12px 15px rgba(50,43,95,.16)); z-index: 1; }
.category-fantasy .content-cover { background: linear-gradient(145deg, #e7dcff, #ffdff4); }
.category-mystery .content-cover { background: linear-gradient(145deg, #d9e8f5, #e1e0f6); }
.category-funny .content-cover { background: linear-gradient(145deg, #fff0a9, #ffc7a7); }
.category-animals .content-cover { background: linear-gradient(145deg, #dff4cd, #d2f2ed); }
.category-space .content-cover { background: linear-gradient(145deg, #28264e, #4e64a8); }
.category-dinosaurs .content-cover { background: linear-gradient(145deg, #cce9c2, #f1e5ad); }
.category-friendship .content-cover { background: linear-gradient(145deg, #ffd8e6, #dcd9ff); }
.category-adventure .content-cover { background: linear-gradient(145deg, #ffe5b8, #cfe7da); }
.category-ocean .content-cover { background: linear-gradient(145deg, #c9f1ff, #b8d8ff); }
.category-nature .content-cover { background: linear-gradient(145deg, #d9f2ca, #fff0b8); }
.category-science .content-cover { background: linear-gradient(145deg, #dce8ff, #e7dcff); }
.category-sports .content-cover { background: linear-gradient(145deg, #d8f2d2, #fff0b9); }
.category-school .content-cover { background: linear-gradient(145deg, #ffe2c7, #dce7ff); }
.category-vehicles .content-cover { background: linear-gradient(145deg, #d6e0e8, #ffddb6); }
.completed-badge, .started-badge { position: absolute; top: .7rem; right: .7rem; z-index: 2; padding: .35rem .55rem; border-radius: 999px; font-size: .69rem; }
.completed-badge { background: #dff8e8; color: #1d6c3b; }
.started-badge { background: #fff; color: var(--primary-dark); }
.reading-level-badge { position: absolute; top: .7rem; left: .7rem; z-index: 2; padding: .35rem .55rem; border-radius: 999px; background: rgba(255,255,255,.92); color: var(--ink); box-shadow: 0 4px 12px rgba(38,35,76,.1); font-size: .69rem; font-weight: 900; }
.reading-level-badge.stretch { background: #fff1b8; color: #705500; }
.content-card-body { padding: 1rem; }
.content-card-body small { text-transform: uppercase; letter-spacing: .08em; font-weight: 850; font-size: .68rem; }
.content-card-body h3 { margin-top: .35rem; }
.content-card-body p { margin: 0; color: var(--muted); font-size: .86rem; }
.library-hero { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: clamp(1.5rem, 4vw, 3rem); border-radius: var(--radius-xl); min-height: 260px; }
.story-library-hero { background: linear-gradient(135deg, #ece7ff, #ffe5f5); }
.math-library-hero { background: linear-gradient(135deg, #dff9f4, #e5f1ff); }
.library-hero h1 { font-size: clamp(2.2rem, 5vw, 4rem); }
.library-hero-emoji { font-size: clamp(5rem, 13vw, 9rem); }
.filter-chips { display: flex; gap: .55rem; overflow-x: auto; padding: 1rem .15rem 1.25rem; scrollbar-width: thin; }
.filter-chips a { white-space: nowrap; padding: .55rem .75rem; border-radius: 999px; border: 1.5px solid var(--border); background: white; color: var(--ink); text-decoration: none; font-weight: 800; font-size: .84rem; }
.filter-chips a.selected { background: var(--ink); color: white; border-color: var(--ink); }
.filter-chips a small { margin-left: .25rem; opacity: .72; font-size: .68rem; }
.library-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.story-finder { margin-top: 1rem; padding: 1rem 1.1rem; border: 1px solid var(--border); border-radius: var(--radius-xl); background: rgba(255,255,255,.9); box-shadow: var(--shadow-soft); }
.story-filter-group + .story-filter-group { border-top: 1px solid #eceaf2; padding-top: .55rem; }
.filter-label { margin: .3rem 0 -.35rem; color: var(--muted); font-size: .76rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.story-search { display: grid; gap: .45rem; padding: .75rem 0 .2rem; border-top: 1px solid #eceaf2; }
.story-search > label { font-weight: 900; }
.story-search > div { display: flex; gap: .55rem; align-items: stretch; }
.story-search input { flex: 1; min-width: 0; }
.library-result-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; padding: 1.2rem .15rem .8rem; }
.library-result-heading h2 { margin: .1rem 0 0; }
.challenge-note { flex: 0 0 auto; padding: .55rem .7rem; border-radius: 999px; background: #fff1b8; color: #705500; font-size: .8rem; font-weight: 900; }
.library-pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .8rem; margin: 1.35rem 0 .5rem; }
.library-pagination > :first-child { justify-self: start; }
.library-pagination > :last-child { justify-self: end; }
.stretch-section { background: linear-gradient(180deg, rgba(255,241,184,.3), transparent); border-radius: var(--radius-xl); padding: 1rem; }

.reader-page .page-shell, .math-play-page .page-shell { width: min(1100px, calc(100% - 1.2rem)); padding-top: 1.1rem; }
.reader-shell, .math-play-shell { min-height: 75vh; }
.reader-toolbar { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; margin-bottom: .7rem; }
.reader-title-wrap { text-align: center; min-width: 0; }
.reader-title-wrap small { text-transform: uppercase; letter-spacing: .09em; font-weight: 850; }
.reader-title-wrap h1 { font-size: clamp(1.2rem, 3vw, 2rem); margin: .12rem 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-tools { display: flex; gap: .45rem; }
.round-tool { width: 45px; height: 45px; display: grid; place-items: center; border-radius: 50%; border: 1.5px solid var(--border); background: white; color: var(--ink); text-decoration: none; font-weight: 900; cursor: pointer; box-shadow: var(--shadow-soft); }
.round-tool:hover { color: var(--primary); }
.story-progress { height: 8px; border-radius: 999px; background: #eae7f0; overflow: hidden; margin-bottom: 1rem; }
.story-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--secondary)); transition: width .25s ease; }
.opening-card, .finish-card { text-align: center; max-width: 780px; margin: 3rem auto; background: white; border: 1px solid var(--border); border-radius: 32px; padding: clamp(1.5rem, 5vw, 3.5rem); box-shadow: var(--shadow); }
.opening-cover { font-size: clamp(5rem, 15vw, 9rem); margin-bottom: 1rem; }
.opening-card h2 { font-size: clamp(1.7rem, 4vw, 2.8rem); }
.opening-help { color: var(--muted); }
.story-stage { position: relative; }
.story-illustration { height: 210px; position: relative; display: grid; place-items: center; overflow: hidden; border-radius: 30px 30px 0 0; background: linear-gradient(160deg, #dfeaff, #efddff 52%, #ffe0a5); }
.story-illustration > span { font-size: 7rem; filter: drop-shadow(0 15px 20px rgba(54,45,99,.2)); }
.story-sky-dot { position: absolute; border-radius: 50%; background: rgba(255,255,255,.55); }
.story-sky-dot.one { width: 90px; height: 90px; left: 8%; top: 20%; }
.story-sky-dot.two { width: 45px; height: 45px; right: 15%; bottom: 15%; }
.story-paper { min-height: 340px; position: relative; display: grid; align-items: center; padding: clamp(1.5rem, 5vw, 4rem); background: var(--paper); border: 1px solid var(--border); border-top: 0; border-radius: 0 0 30px 30px; box-shadow: var(--shadow); }
.story-text { max-width: 900px; margin: 0 auto; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.7rem, 4vw, 2.75rem); line-height: 1.72; text-align: left; color: #26243e; }
.story-word { display: inline; appearance: none; border: 0; background: transparent; color: inherit; font: inherit; line-height: inherit; padding: 0 .03em; margin: 0; border-radius: .2em; cursor: pointer; }
.story-word:hover, .story-word:focus-visible { background: #fff0a8; box-shadow: 0 0 0 3px rgba(255,203,71,.24); }
.story-word.word-active { background: #ffdf65; }
.word-help-bubble { position: absolute; left: 50%; bottom: 1rem; transform: translateX(-50%); max-width: calc(100% - 2rem); padding: .6rem .9rem; border-radius: 999px; background: #26234c; color: white; font-weight: 850; box-shadow: var(--shadow-soft); text-align: center; }
.buddy-comment { display: flex; align-items: center; gap: .6rem; width: fit-content; max-width: min(520px, 90%); margin: -1.3rem auto 0; position: relative; z-index: 3; }
.buddy-comment-face { font-size: 3.7rem; filter: drop-shadow(0 8px 10px rgba(44,36,92,.15)); }
.buddy-comment p { margin: 0; background: white; border-radius: 18px 18px 18px 5px; padding: .75rem 1rem; box-shadow: var(--shadow-soft); font-weight: 850; }
.reaction-box { margin-top: 1.4rem; padding: 1rem; border-radius: 16px; background: #f0f8ff; text-align: center; }
.reaction-box p { font-family: inherit; font-size: 1rem; font-weight: 850; }
.reaction-options { display: flex; flex-wrap: wrap; justify-content: center; gap: .55rem; }
.reaction-options button { border: 1.5px solid #b8cce0; background: white; padding: .55rem .75rem; border-radius: 999px; cursor: pointer; font-weight: 800; }
.reader-pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .8rem; margin-top: 1.2rem; }
.reader-pagination .button:first-child { justify-self: start; }
.reader-pagination .button:last-child { justify-self: end; }
#page-counter { color: var(--muted); font-weight: 800; }
.finish-emoji { display: block; font-size: 5.5rem; }
.finish-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: .7rem; margin-top: 1.3rem; }
.settings-dialog { width: min(560px, calc(100% - 1.5rem)); border: 0; border-radius: 24px; padding: 0; box-shadow: 0 28px 90px rgba(27,22,66,.25); }
.settings-dialog::backdrop { background: rgba(30,27,57,.5); backdrop-filter: blur(4px); }
.settings-dialog form { padding: 1.3rem; display: grid; gap: .65rem; }
.settings-dialog header { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.settings-dialog h2 { font-size: 1.7rem; }

.math-intro-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1.3rem; background: linear-gradient(135deg, #e1faf6, #e9edff); border-radius: var(--radius-xl); padding: 1.4rem; }
.math-intro-emoji { font-size: 5.5rem; }
.math-intro-card h2 { font-size: clamp(1.4rem, 3vw, 2.3rem); }
.math-intro-card p:last-child { margin-bottom: 0; }
.math-workbench { margin-top: 1rem; background: white; border: 1px solid var(--border); border-radius: 30px; padding: clamp(1rem, 4vw, 2rem); box-shadow: var(--shadow); }
.math-topline { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font-weight: 850; font-size: .82rem; }
.math-prompt { text-align: center; font-size: clamp(1.35rem, 3vw, 2.1rem); font-weight: 900; margin: 1rem 0; }
.math-visual { min-height: 260px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 1rem; padding: 1.2rem; border-radius: 22px; background: #f8fbff; border: 2px dashed #d6e2ef; overflow: hidden; }
.math-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: .65rem; margin-top: 1rem; }
.math-choice-button { min-width: 76px; min-height: 54px; border: 2px solid var(--border); border-radius: 13px; background: white; color: var(--ink); font-weight: 900; font-size: 1.15rem; cursor: pointer; }
.math-choice-button:hover { border-color: var(--primary); background: var(--primary-soft); }
.math-choice-button.selected { border-color: var(--primary); background: var(--primary-soft); }
.math-input { max-width: 180px; text-align: center; font-size: 1.5rem; font-weight: 900; }
.math-feedback { min-height: 56px; display: flex; align-items: center; justify-content: center; text-align: center; margin-top: .8rem; font-weight: 850; border-radius: 14px; }
.math-feedback.good { background: #dff8e8; color: #1c6d3b; }
.math-feedback.try { background: #fff3cf; color: #7d5910; }
.math-actions { display: flex; justify-content: space-between; gap: .7rem; margin-top: .9rem; }
.real-life-card { display: flex; gap: .9rem; align-items: flex-start; max-width: 850px; margin: 1rem auto 0; padding: 1rem; border-radius: 16px; background: #fff8df; border: 1px solid #f3d878; }
.real-life-card > span { font-size: 1.7rem; }
.real-life-card p { margin: .15rem 0 0; }
.object-group { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem; padding: .8rem; min-width: 120px; min-height: 90px; border-radius: 18px; background: white; border: 2px solid #d9e4ef; }
.math-object { display: inline-grid; place-items: center; font-size: clamp(1.6rem, 4vw, 2.5rem); }
.operator-symbol { font-size: 2.4rem; font-weight: 900; }
.number-card { min-width: 110px; padding: 1rem; text-align: center; border-radius: 18px; background: white; border: 2px solid #d9e4ef; font-size: 2.1rem; font-weight: 900; }
.ten-blocks { display: flex; align-items: end; justify-content: center; gap: 1rem; }
.tens-stack, .ones-stack { display: flex; flex-wrap: wrap; gap: .2rem; max-width: 250px; }
.ten-rod { width: 28px; height: 120px; border-radius: 5px; background: repeating-linear-gradient(to bottom, #7161e8 0 10px, #9488f0 10px 12px); border: 1px solid #5646c3; }
.one-cube { width: 26px; height: 26px; border-radius: 5px; background: #ffca47; border: 1px solid #dda819; }
.array-grid { display: grid; gap: .35rem; padding: 1rem; background: white; border-radius: 18px; border: 2px solid #d9e4ef; }
.share-trays { display: flex; flex-wrap: wrap; justify-content: center; gap: .7rem; }
.share-tray { min-width: 100px; min-height: 95px; border: 3px solid #98cbd4; border-radius: 0 0 25px 25px; background: #e9fbfd; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: .2rem; padding: .5rem; }
.fraction-circle { width: 220px; height: 220px; border-radius: 50%; border: 4px solid #5b4bdb; background: conic-gradient(var(--sun) 0 var(--fraction-fill), #fff var(--fraction-fill) 100%); position: relative; }
.fraction-circle::after { content: attr(data-label); position: absolute; inset: 0; display: grid; place-items: center; font-size: 2rem; font-weight: 900; text-shadow: 0 2px 0 white; }
.shape-display { width: 190px; height: 190px; display: grid; place-items: center; }
.css-shape { width: 140px; height: 140px; background: #7bc8f6; border: 4px solid #3e87b5; }
.css-shape.circle { border-radius: 50%; }
.css-shape.triangle { width: 0; height: 0; background: transparent; border-left: 80px solid transparent; border-right: 80px solid transparent; border-bottom: 145px solid #ff8c79; border-top: 0; }
.css-shape.rectangle { width: 180px; height: 110px; }
.css-shape.pentagon { clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0 38%); }
.css-shape.hexagon { clip-path: polygon(25% 6%, 75% 6%, 100% 50%, 75% 94%, 25% 94%, 0 50%); }
.pattern-row { display: flex; gap: .55rem; align-items: center; font-size: 2.5rem; flex-wrap: wrap; justify-content: center; }
.measure-bars { display: flex; align-items: end; gap: 2rem; height: 200px; }
.measure-bar { width: 65px; border-radius: 12px 12px 3px 3px; background: linear-gradient(#7bc8f6, #5b4bdb); display: grid; place-items: end center; padding-bottom: .4rem; color: white; font-weight: 900; }
.data-chart { display: flex; align-items: end; gap: 1rem; min-height: 220px; padding: 1rem; }
.data-bar-wrap { display: grid; grid-template-rows: 1fr auto; align-items: end; gap: .4rem; height: 210px; text-align: center; }
.data-bar { min-width: 55px; border-radius: 10px 10px 0 0; background: linear-gradient(#75dac5, #2aa997); display: flex; align-items: start; justify-content: center; color: #153e38; font-weight: 900; padding-top: .3rem; }
.clock-face { width: 230px; height: 230px; border-radius: 50%; background: white; border: 8px solid #5b4bdb; position: relative; box-shadow: inset 0 0 0 4px #e5e1ff; }
.clock-number { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-88px) rotate(calc(-1 * var(--angle))); font-weight: 900; }
.clock-hand { position: absolute; left: 50%; bottom: 50%; transform-origin: 50% 100%; border-radius: 999px; }
.clock-hand.hour { width: 7px; height: 62px; background: #26234c; transform: translateX(-50%) rotate(var(--hour-angle)); }
.clock-hand.minute { width: 5px; height: 87px; background: #ff7b69; transform: translateX(-50%) rotate(var(--minute-angle)); }
.clock-pin { position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #ffcb47; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.coin-tray { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.coin { width: 58px; height: 58px; border: 3px solid #d29a12; border-radius: 50%; background: #ffd65b; display: grid; place-items: center; font-weight: 900; box-shadow: inset 0 0 0 4px #ffe99c; }
.rectangle-model { display: grid; grid-template-columns: repeat(var(--cols), 34px); grid-template-rows: repeat(var(--rows), 34px); gap: 2px; padding: 4px; border: 4px solid #5b4bdb; background: white; }
.rectangle-model span { background: #bde5f9; border: 1px solid #82bfdc; }
.number-line { width: min(760px, 90%); height: 100px; position: relative; border-bottom: 5px solid #353253; }
.number-line-tick { position: absolute; bottom: -13px; width: 3px; height: 24px; background: #353253; transform: translateX(-50%); }
.number-line-tick span { position: absolute; top: 25px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-weight: 800; }
.spinner { width: 240px; height: 240px; border-radius: 50%; border: 7px solid white; outline: 4px solid #373353; position: relative; background: conic-gradient(#ff7b69 0 20%, #7bc8f6 20% 40%, #57c785 40% 60%, #ffcb47 60% 80%, #9c8ef2 80% 100%); }
.spinner::after { content: "▼"; position: absolute; left: 50%; top: -26px; transform: translateX(-50%); color: #272342; font-size: 2rem; }
.angle-visual { width: 260px; height: 210px; position: relative; }
.angle-ray { position: absolute; width: 170px; height: 8px; left: 45px; bottom: 40px; background: #5b4bdb; transform-origin: 0 50%; border-radius: 999px; }
.angle-ray.base { transform: rotate(0deg); }
.angle-ray.moving { transform: rotate(calc(-1 * var(--degrees))); background: #ff7b69; }
.angle-dot { position: absolute; width: 18px; height: 18px; left: 37px; bottom: 35px; border-radius: 50%; background: #26234c; }
.symmetry-grid { display: grid; grid-template-columns: repeat(var(--grid-size), 32px); gap: 2px; border: 3px solid #5b4bdb; padding: 3px; background: white; }
.symmetry-cell { width: 32px; height: 32px; border: 1px solid #e0ddec; background: #fafaff; }
.symmetry-cell.filled { background: #ffcb47; }

.admin-hero { background: linear-gradient(135deg, #252449, #49427e); color: white; }
.admin-hero p:last-child { color: #d4d0ea; }
.admin-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.admin-metrics { grid-template-columns: repeat(5, 1fr); }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.admin-panel { margin-top: 0; }
.wide-panel { grid-column: 1 / -1; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { padding: .72rem .6rem; text-align: left; border-bottom: 1px solid #eceaf2; }
th { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; }
.table-action { border: 0; color: var(--primary-dark); background: var(--primary-soft); border-radius: 8px; padding: .35rem .55rem; font-weight: 800; cursor: pointer; }
.compact-list { display: grid; gap: .55rem; }
.compact-list article { display: grid; grid-template-columns: auto 1fr auto; gap: .65rem; align-items: center; padding: .65rem; background: #f9f8fc; border-radius: 12px; }
.compact-list article > span:first-child { font-size: 1.55rem; }
.compact-list small { display: block; }
.status-dot { width: 11px; height: 11px; border-radius: 50%; background: #c8c4d2; }
.status-dot.on { background: var(--green); box-shadow: 0 0 0 4px rgba(87,199,133,.15); }
.editor-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; }
.editor-heading h1 { font-size: clamp(2rem, 4.5vw, 3.5rem); }
.editor-panel { max-width: 950px; margin-left: auto; margin-right: auto; background: white; border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow); padding: clamp(1.2rem, 4vw, 2.5rem); }
.legal-copy { max-width: 760px; margin: 0 auto; }
.legal-copy h1 { font-size: clamp(2.1rem, 5vw, 3.7rem); }
.legal-copy h2 { margin-top: 2rem; font-size: 1.45rem; }



@media (max-width: 1050px) {
  .hero-grid { grid-template-columns: 1fr; min-height: 0; }
  .hero-scene { min-height: 500px; max-width: 650px; width: 100%; margin: 0 auto; }
  .library-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .content-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-metrics { grid-template-columns: repeat(3, 1fr); }
  .admin-metrics > div:nth-child(3) { border-right: 0; }
}

@media (max-width: 780px) {
  .site-header { align-items: center; flex-wrap: wrap; }
  .brand small { display: none; }
  .site-nav { width: 100%; gap: .55rem 1rem; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; padding: .2rem .1rem .35rem; font-size: .85rem; scrollbar-width: thin; }
  .site-nav a, .site-nav .inline-form { flex: 0 0 auto; }
  .page-shell { width: min(100% - 1rem, var(--max-width)); padding-top: 1.4rem; }
  .hero-grid { gap: 2rem; }
  .hero-scene { min-height: 430px; border-radius: 30px; }
  .scene-card-story, .scene-card-math { width: 80%; }
  .buddy-face { font-size: 4.3rem; }
  .metric-strip, .parent-metrics { grid-template-columns: repeat(2, 1fr); }
  .metric-strip > div:nth-child(2) { border-right: 0; }
  .metric-strip > div:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .feature-grid.three, .split-panel, .auth-grid, .form-panel, .dashboard-columns, .child-welcome, .journey-choice-grid, .admin-grid { grid-template-columns: 1fr; }
  .quote-card { min-height: 210px; }
  .child-profile-grid { grid-template-columns: 1fr; }
  .form-panel-copy { position: static; }
  .choice-grid.three, .buddy-choices { grid-template-columns: 1fr; }
  .form-row.two, .form-row.three { grid-template-columns: 1fr; }
  .dashboard-hero, .library-hero, .editor-heading { align-items: flex-start; flex-direction: column; }
  .dashboard-badge { width: 100%; min-height: 110px; transform: none; }
  .child-welcome { text-align: center; }
  .buddy-welcome-card { flex-direction: column; }
  .speech-card { border-radius: 18px; }
  .journey-choice { min-height: 150px; }
  .content-card-grid, .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .library-hero-emoji { align-self: center; }
  .library-result-heading { align-items: flex-start; flex-direction: column; }
  .admin-grid .wide-panel { grid-column: auto; }
  .admin-metrics { grid-template-columns: repeat(2, 1fr); }
  .admin-metrics > div { border-right: 1px solid var(--border) !important; border-bottom: 1px solid var(--border); }
  .admin-metrics > div:nth-child(2n) { border-right: 0 !important; }
  .reader-title-wrap h1 { max-width: 52vw; }
  .story-illustration { height: 165px; }
  .story-paper { min-height: 300px; padding-bottom: 4.2rem; }
  .story-text { font-size: clamp(1.55rem, 6.5vw, 2.1rem); line-height: 1.68; }
  .math-intro-card { grid-template-columns: auto 1fr; }
  .math-intro-card .button { grid-column: 1 / -1; }
  .math-visual { min-height: 230px; }
}

@media (max-width: 520px) {
  .site-header { min-height: 68px; padding: .65rem .75rem; }
  .brand-mark { width: 39px; height: 39px; }
  .nav-cta { padding: .52rem .7rem; }
  .hero-copy h1 { font-size: 2.45rem; }
  .hero-scene { min-height: 390px; }
  .moon-orb { font-size: 3.7rem; }
  .scene-card { padding: .85rem; }
  .scene-card-story { top: 19%; }
  .buddy-figure { left: 8%; bottom: 31%; }
  .buddy-bubble { font-size: .72rem; }
  .scene-card-math { bottom: 5%; }
  .metric-strip { padding: .6rem; }
  .metric-strip > div { min-height: 76px; }
  .feature-grid.three { grid-template-columns: 1fr; }
  .dashboard-hero, .child-welcome, .library-hero { border-radius: 24px; padding: 1.25rem; }
  .child-card-top { grid-template-columns: auto 1fr; }
  .child-card-top .status-pill { grid-column: 1 / -1; justify-self: start; }
  .child-code-box { flex-wrap: wrap; }
  .child-code-box small { width: 100%; }
  .mini-stats.four { grid-template-columns: repeat(2, 1fr); }
  .setting-summary { flex-direction: column; }
  .journey-choice { grid-template-columns: auto 1fr; }
  .journey-arrow { display: none; }
  .journey-emoji { font-size: 3.2rem; }
  .journey-choice strong { font-size: 1.25rem; }
  .child-progress-ribbon { grid-template-columns: 1fr; }
  .child-progress-ribbon div { border-right: 0; border-bottom: 1px solid rgba(255,255,255,.15); }
  .child-progress-ribbon div:last-child { border-bottom: 0; }
  .content-card-grid, .library-grid { grid-template-columns: 1fr; }
  .content-cover { min-height: 135px; }
  .story-search > div { flex-direction: column; }
  .library-pagination { grid-template-columns: 1fr 1fr; }
  .library-pagination strong { grid-column: 1 / -1; grid-row: 1; text-align: center; }
  .library-pagination > :first-child { grid-column: 1; grid-row: 2; }
  .library-pagination > :last-child { grid-column: 2; grid-row: 2; }
  .reader-toolbar { grid-template-columns: auto minmax(0,1fr) auto; gap: .45rem; }
  .reader-tools { gap: .25rem; }
  .round-tool { width: 40px; height: 40px; }
  .reader-title-wrap h1 { max-width: 45vw; font-size: 1rem; }
  .story-illustration > span { font-size: 5.6rem; }
  .reader-pagination { grid-template-columns: 1fr 1fr; }
  #page-counter { grid-column: 1 / -1; grid-row: 1; text-align: center; }
  .reader-pagination .button:first-child { grid-column: 1; grid-row: 2; }
  .reader-pagination .button:last-child { grid-column: 2; grid-row: 2; }
  .math-intro-card { grid-template-columns: 1fr; text-align: center; }
  .math-intro-emoji { font-size: 4rem; }
  .math-actions { flex-direction: column; }
  .measure-bars { gap: 1rem; }
  .clock-face { width: 200px; height: 200px; }
  .clock-number { transform: translate(-50%, -50%) rotate(var(--angle)) translateY(-74px) rotate(calc(-1 * var(--angle))); }
  .data-chart { gap: .45rem; }
  .data-bar { min-width: 38px; }
  .fraction-circle, .spinner { width: 190px; height: 190px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Interactive reader and reusable visual-math engine details */
.reaction-response { margin: 0; color: var(--primary-dark); }
.visual-labelled-group, .block-label, .rectangle-labelled, .measure-bar-wrap { display: grid; justify-items: center; gap: .45rem; text-align: center; }
.math-object-away { opacity: .22; filter: grayscale(1); text-decoration: line-through; transform: translateY(-5px); }
.number-line-marker { position: absolute; bottom: 0; transform: translate(-50%, 55%); font-size: 2.1rem; color: var(--secondary); line-height: 1; z-index: 2; text-shadow: 0 2px 0 white; }
.pattern-missing { display: inline-grid; place-items: center; min-width: 52px; min-height: 52px; border: 3px dashed #8d84bb; border-radius: 12px; color: var(--primary-dark); font-size: 1.7rem; }
.answer-reveal { border-color: var(--green) !important; background: #dff8e8 !important; box-shadow: 0 0 0 4px rgba(87,199,133,.17); }
.sorting-scene { display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap; }
.sorting-target { font-size: 5rem; }
.sort-tray { min-width: 130px; min-height: 110px; display: grid; place-items: center; border: 4px solid #89c7d2; border-radius: 10px 10px 30px 30px; background: #e9fbfd; font-size: 4rem; }
.measurement-scene { display: flex; align-items: center; gap: 1.5rem; padding: 1.2rem; background: white; border: 2px solid #d9e4ef; border-radius: 20px; }
.measurement-object { font-size: clamp(5rem, 13vw, 8rem); }
.measurement-tool { font-size: clamp(3.4rem, 8vw, 5.5rem); }
.elapsed-scene { display: flex; align-items: center; justify-content: center; gap: 1.2rem; flex-wrap: wrap; }
.rectangle-dimensions { margin: 0; font-weight: 850; color: var(--muted); }
.vertical-equation { min-width: 210px; display: grid; justify-items: end; gap: .25rem; padding: 1rem 1.4rem; border-radius: 16px; background: white; border: 2px solid #d9e4ef; font-size: 2.2rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.vertical-equation .operation-line { width: 100%; text-align: right; padding-bottom: .35rem; border-bottom: 4px solid #393659; }
.vertical-equation .answer-line { color: var(--primary); }
.remainder-scene { display: flex; flex-wrap: wrap; justify-content: center; gap: .45rem; max-width: 720px; }
.price-tag-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: .8rem; }
.price-tag { min-width: 125px; display: grid; justify-items: center; gap: .35rem; padding: .85rem; border-radius: 15px; background: white; border: 2px solid #d9e4ef; }
.price-tag span { font-size: 3rem; }
.price-tag strong { font-size: 1.25rem; }
.angle-label { position: absolute; left: 80px; bottom: 68px; padding: .25rem .45rem; border-radius: 8px; background: white; color: var(--primary-dark); }
.symmetry-divider { border-right: 4px dashed var(--secondary); }
.block-label > strong, .measure-bar-wrap > small { color: var(--muted); font-size: .82rem; }
.flash-fading { opacity: 0; transform: translateY(-8px); transition: opacity .45s ease, transform .45s ease; }

@media (max-width: 640px) {
  .story-paper { min-height: 300px; padding: 1.2rem; }
  .story-text { font-size: clamp(1.45rem, 7vw, 2rem); line-height: 1.65; }
  .math-visual { min-height: 230px; padding: .75rem; }
  .rectangle-model { grid-template-columns: repeat(var(--cols), min(25px, 5.2vw)); grid-template-rows: repeat(var(--rows), min(25px, 5.2vw)); }
  .symmetry-grid { grid-template-columns: repeat(var(--grid-size), min(28px, 9vw)); }
  .symmetry-cell { width: min(28px, 9vw); height: min(28px, 9vw); }
  .math-actions { align-items: stretch; }
  .math-actions .button { flex: 1; }
}

/* Session choices and child-interest prompt */
.opening-help-picker {
  max-width: 760px;
  margin: 1.25rem auto 1.35rem;
  padding: 0;
  border: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .55rem;
}
.opening-help-picker legend {
  width: 100%;
  margin-bottom: .65rem;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 850;
}
.opening-help-picker label { cursor: pointer; }
.opening-help-picker input { position: absolute; opacity: 0; pointer-events: none; }
.opening-help-picker span {
  min-height: 48px;
  display: grid;
  place-items: center;
  padding: .55rem .7rem;
  border: 2px solid var(--border);
  border-radius: 13px;
  background: white;
  font-size: .84rem;
  font-weight: 850;
}
.opening-help-picker input:checked + span {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
  box-shadow: var(--focus);
}
.opening-help-picker input:focus-visible + span { box-shadow: var(--focus); }

.story-interest-prompt {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1.4rem;
  padding: 1.2rem 1.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow-soft);
}
.story-interest-prompt h2 { margin-bottom: .8rem; font-size: clamp(1.35rem, 2.6vw, 2rem); }
.story-interest-buddy { font-size: clamp(3.4rem, 7vw, 5rem); filter: drop-shadow(0 8px 12px rgba(41, 35, 92, .14)); }
.interest-link-grid { display: flex; flex-wrap: wrap; gap: .5rem; }
.interest-link-grid a {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: .48rem .72rem;
  border: 1px solid rgba(91, 75, 219, .2);
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  text-decoration: none;
  font-size: .84rem;
  font-weight: 850;
}
.interest-link-grid a:hover { transform: translateY(-1px); background: #e1ddff; }
.demo-word.word-active { background: var(--sun); }

@media (max-width: 640px) {
  .opening-help-picker { grid-template-columns: 1fr; }
  .opening-help-picker span { min-height: 44px; }
  .story-interest-prompt { grid-template-columns: 1fr; text-align: center; }
  .interest-link-grid { justify-content: center; }
}

/* V6: neural character media, one-screen illustrated reader, expanded library, and optional Live Buddy */
.v3-welcome { align-items: stretch; }
.buddy-voice-button { border: 0; color: inherit; font: inherit; cursor: pointer; text-align: left; position: relative; overflow: hidden; min-width: min(100%, 390px); }
.buddy-voice-button:hover, .buddy-voice-button:focus-visible { transform: translateY(-3px); box-shadow: 0 18px 45px rgba(55, 45, 126, .2); }
.buddy-voice-button .speech-card { display: grid; gap: .25rem; }
.buddy-voice-button .speech-card span { line-height: 1.35; }
.buddy-voice-button .speech-card small { color: var(--muted); font-weight: 650; }
.voice-wave { display: flex; gap: 4px; align-items: center; height: 28px; margin-left: auto; }
.voice-wave i { width: 4px; height: 10px; border-radius: 999px; background: currentColor; opacity: .45; }
.buddy-speaking .voice-wave i { animation: voiceBounce .62s ease-in-out infinite alternate; }
.buddy-speaking .voice-wave i:nth-child(2) { animation-delay: .12s; }
.buddy-speaking .voice-wave i:nth-child(3) { animation-delay: .24s; }
@keyframes voiceBounce { to { height: 28px; opacity: 1; } }
.ai-voice-note { margin: .45rem 0 1rem; color: var(--muted); font-size: .82rem; }
.small-voice-button { border: 1px solid rgba(91, 75, 219, .2); background: rgba(255,255,255,.82); color: var(--primary); border-radius: 999px; padding: .58rem .9rem; font: inherit; font-weight: 800; cursor: pointer; }
.small-voice-button:hover { background: #fff; transform: translateY(-1px); }

.v3-library-hero { background: radial-gradient(circle at 80% 18%, rgba(255,255,255,.55), transparent 22%), linear-gradient(125deg, #5b4bdb, #9474e8 54%, #f198b7); color: white; }
.v3-library-hero .eyebrow, .v3-library-hero p { color: rgba(255,255,255,.91); }
.collection-chips a { position: relative; }
.collection-badge { position: absolute; left: .7rem; bottom: .7rem; border-radius: 999px; padding: .28rem .58rem; background: rgba(30, 26, 67, .78); color: #fff; font-size: .7rem; backdrop-filter: blur(8px); }
.story-length { display: inline-block; margin-top: .5rem; color: var(--muted); font-size: .78rem; font-weight: 750; }
.library-source-link { text-align: center; color: var(--muted); margin: 2rem auto .5rem; }
.library-source-link a { font-weight: 800; }
.collection-classic .content-cover { background-image: radial-gradient(circle at 30% 20%, rgba(255,255,255,.75), transparent 18%), linear-gradient(145deg, #e7c88a, #a56f45); }
.collection-fable .content-cover { background-image: radial-gradient(circle at 72% 20%, rgba(255,255,255,.6), transparent 20%), linear-gradient(145deg, #a9d99c, #56865c); }

.v3-opening-card { position: relative; overflow: hidden; }
.v3-opening-card::before, .v3-opening-card::after { content: ""; position: absolute; border-radius: 50%; background: rgba(91,75,219,.08); pointer-events: none; }
.v3-opening-card::before { width: 220px; height: 220px; top: -110px; right: -70px; }
.v3-opening-card::after { width: 150px; height: 150px; bottom: -85px; left: -55px; }
.v3-story-stage { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(330px, .95fr); gap: 1rem; align-items: start; }
.v3-story-stage[hidden] { display: none; }
.story-visual-frame { position: sticky; top: 1rem; min-height: 390px; margin: 0; border-radius: 30px; overflow: hidden; box-shadow: 0 22px 55px rgba(32, 39, 82, .18); background: #dfeeff; isolation: isolate; }
.story-visual-canvas, .story-ai-image { display: block; width: 100%; aspect-ratio: 5 / 3; object-fit: cover; }
.story-visual-canvas { min-height: 330px; }
.story-ai-image { position: absolute; inset: 0 0 auto; z-index: 2; opacity: 0; transition: opacity .5s ease; }
.story-ai-image.image-arrived { opacity: 1; }
.story-visual-frame figcaption { position: absolute; z-index: 3; left: .75rem; right: .75rem; bottom: .75rem; padding: .48rem .7rem; border-radius: 14px; background: rgba(20, 23, 45, .68); color: white; font-size: .72rem; line-height: 1.3; backdrop-filter: blur(10px); max-height: 3.5em; overflow: hidden; }
.scene-actor { animation: sceneFloat 3.2s ease-in-out infinite; transform-origin: center; filter: drop-shadow(0 14px 8px rgba(20,30,55,.2)); }
.scene-sparkle { animation: sceneTwinkle 1.7s ease-in-out infinite alternate; }
.scene-star:nth-of-type(3n) { animation: sceneTwinkle 1.3s ease-in-out infinite alternate; }
.scene-cloud { animation: cloudDrift 12s ease-in-out infinite alternate; }
.cloud-2 { animation-delay: -4s; }
.cloud-3 { animation-delay: -7s; }
.scene-wave { animation: waveMove 3s ease-in-out infinite alternate; }
.wave-two { animation-delay: -1.3s; }
@keyframes sceneFloat { 50% { transform: translateY(-12px) rotate(-1deg); } }
@keyframes sceneTwinkle { to { opacity: .35; transform: scale(.82); } }
@keyframes cloudDrift { to { transform: translate(26px, 3px); } }
@keyframes waveMove { to { transform: translateY(8px); } }
.v3-story-stage .story-paper { min-height: 390px; margin: 0; }
.story-text p { margin: 0 0 1.1rem; }
.story-text p:last-child { margin-bottom: 0; }
.story-word { display: inline; border: 0; background: transparent; color: inherit; font: inherit; line-height: inherit; padding: 0 .02em; border-radius: .24em; cursor: pointer; text-align: left; }
.story-word:hover, .story-word:focus-visible { background: #fff0a8; outline: 2px solid rgba(227, 163, 39, .3); }
.story-word.word-active { background: #ffd765; transform: translateY(-1px); }
.buddy-comment { grid-column: 1 / -1; max-width: 620px; justify-self: center; }
.buddy-comment > div { display: grid; gap: .1rem; }
.buddy-comment p { margin: 0; }
.reader-pagination { grid-column: 1 / -1; }
.source-note { margin-top: 1.5rem; padding: 1rem 1.2rem; border: 1px solid rgba(91,75,219,.15); background: rgba(255,255,255,.76); border-radius: 18px; color: var(--muted); font-size: .85rem; }
.source-note p { margin: .35rem 0; }
.source-note strong { color: var(--ink); }

.narrow-intro { max-width: 850px; }
.source-register { display: grid; gap: 1rem; margin-top: 1.5rem; }
.source-register-card { display: grid; grid-template-columns: 70px 1fr; gap: 1rem; padding: 1.25rem; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.source-book { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; background: #f1e8ff; font-size: 2rem; }
.source-register-card h2 { margin: .1rem 0 .35rem; }
.source-register-card p { margin: .35rem 0; }

@media (max-width: 900px) {
  .v3-story-stage { grid-template-columns: 1fr; }
  .story-visual-frame { position: relative; top: auto; min-height: 0; }
  .story-visual-canvas { min-height: 0; }
}
@media (max-width: 600px) {
  .buddy-voice-button { min-width: 100%; }
  .story-visual-frame { border-radius: 22px; }
  .story-visual-frame figcaption { display: none; }
  .v3-story-stage .story-paper { min-height: 0; }
  .source-register-card { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .scene-actor, .scene-sparkle, .scene-star, .scene-cloud, .scene-wave, .buddy-speaking .voice-wave i { animation: none !important; }
  .story-ai-image { transition: none; }
}

/* V6: secure, parent-controlled Realtime voice */
.live-buddy-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  margin: 1.35rem 0 2rem;
  padding: 1.15rem 1.25rem;
  border: 1px solid rgba(91, 75, 219, .2);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 92% 8%, rgba(255, 203, 71, .22), transparent 9rem),
    linear-gradient(135deg, rgba(255,255,255,.98), rgba(236,233,255,.88));
  box-shadow: var(--shadow-soft);
}
.live-buddy-unavailable { background: rgba(255,255,255,.78); }
.live-buddy-avatar {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: linear-gradient(145deg, #fff4c7, #ffd86f);
  font-size: 2.65rem;
  box-shadow: 0 10px 24px rgba(121, 96, 35, .14);
}
.live-buddy-main { min-width: 0; }
.live-buddy-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.live-buddy-heading h2 { margin: 0 0 .45rem; font-size: clamp(1.35rem, 2.4vw, 2rem); }
.live-buddy-copy { max-width: 760px; margin: 0 0 .8rem; color: #50506b; }
.live-ready-pill {
  flex: none;
  padding: .35rem .65rem;
  border-radius: 999px;
  background: #e7f8ef;
  color: #21684f;
  font-size: .74rem;
  font-weight: 850;
}
.live-buddy-actions, .live-buddy-session-controls { display: flex; align-items: center; flex-wrap: wrap; gap: .7rem; }
.live-buddy-actions[hidden], .live-buddy-session-controls[hidden] { display: none; }
.live-buddy-status { margin: .75rem 0 .25rem; color: var(--muted); font-weight: 750; }
.live-buddy-status.ready { color: #25765b; }
.live-buddy-status.listening { color: var(--primary-dark); }
.live-buddy-status.thinking { color: #8a5d12; }
.live-buddy-status.error { color: var(--danger); }
.live-buddy-disclosure, .live-buddy-limit { margin: .35rem 0 0; color: var(--muted); font-size: .78rem; }
.live-buddy-timer {
  flex: none;
  min-width: 62px;
  padding: .4rem .65rem;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}
.live-buddy-talk {
  min-width: min(100%, 260px);
  min-height: 82px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: .75rem;
  padding: .75rem 1rem;
  border: 2px solid rgba(91,75,219,.32);
  border-radius: 18px;
  background: white;
  color: var(--primary-dark);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  box-shadow: var(--shadow-soft);
}
.live-buddy-talk > span { grid-row: 1 / 3; font-size: 2rem; }
.live-buddy-talk strong { align-self: end; text-align: left; }
.live-buddy-talk small { align-self: start; text-align: left; }
.live-buddy-talk.is-listening {
  background: linear-gradient(135deg, #6655df, #8d72ef);
  color: white;
  border-color: transparent;
  transform: scale(.985);
  box-shadow: 0 0 0 6px rgba(91,75,219,.14), 0 14px 30px rgba(91,75,219,.26);
}
.live-buddy-talk.is-listening small { color: rgba(255,255,255,.84); }
.live-buddy-read-note {
  flex: 1 1 320px;
  margin: 0;
  padding: .75rem .9rem;
  border-radius: 14px;
  background: var(--secondary-soft);
  color: #235f56;
  font-weight: 750;
}
.live-buddy-safety-message {
  display: grid;
  gap: .2rem;
  margin-top: .8rem;
  padding: .85rem 1rem;
  border: 2px solid rgba(189,60,75,.25);
  border-radius: 14px;
  background: #fff0f2;
  color: #872c3a;
}
.live-buddy-safety-message[hidden] { display: none; }
.button-danger-soft { color: var(--danger); background: #fff0f2; border-color: rgba(189,60,75,.2); }
.parent-live-voice-fieldset { border-color: rgba(91,75,219,.22); background: rgba(245,243,255,.52); }
.realtime-consent-row { margin-top: .8rem; padding: .75rem; border: 1px solid rgba(91,75,219,.18); border-radius: 14px; background: white; }
.small-copy { font-size: .82rem; }
.live-usage-summary {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  margin-top: .75rem;
  padding: .7rem .85rem;
  border-radius: 12px;
  background: white;
  border: 1px solid var(--border);
  font-size: .85rem;
}
.live-usage-summary span { color: var(--muted); }

@media (max-width: 640px) {
  .live-buddy-panel { grid-template-columns: 1fr; padding: 1rem; }
  .live-buddy-avatar { width: 58px; height: 58px; border-radius: 18px; font-size: 2.1rem; }
  .live-buddy-heading { display: block; }
  .live-ready-pill { display: inline-block; margin-bottom: .65rem; }
  .live-buddy-actions .button, .live-buddy-session-controls .button { width: 100%; }
  .live-buddy-talk { width: 100%; }
  .live-usage-summary { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .live-buddy-talk { transition: none; }
}

/* V6 child-controlled character selector */
.child-buddy-switcher {
  margin: 1rem 0 1.5rem;
  border: 1px solid rgba(93, 76, 143, .18);
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 12px 30px rgba(62, 45, 97, .08);
  overflow: hidden;
}
.child-buddy-switcher > summary {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: center;
  padding: 1rem 1.15rem;
  font-weight: 800;
  list-style: none;
}
.child-buddy-switcher > summary::-webkit-details-marker { display: none; }
.child-buddy-switcher > summary small { color: var(--muted); font-weight: 600; }
.child-buddy-form { padding: 0 1.1rem 1.1rem; }
.child-buddy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
  margin-bottom: .75rem;
}
.child-buddy-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .5rem;
  padding: .7rem;
  border: 2px solid transparent;
  border-radius: 1rem;
  background: rgba(245, 242, 255, .84);
}
.child-buddy-option:has(input:checked), .child-buddy-option.is-current {
  border-color: rgba(102, 76, 190, .55);
  background: rgba(237, 230, 255, .95);
}
.child-buddy-option label {
  cursor: pointer;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  column-gap: .55rem;
  align-items: center;
}
.child-buddy-option input { grid-row: 1 / span 3; }
.child-buddy-avatar { font-size: 1.8rem; grid-row: 1 / span 3; }
.child-buddy-option label strong, .child-buddy-option label small { grid-column: 3; }
.child-buddy-option label small { color: var(--muted); line-height: 1.2; }
.buddy-preview-button {
  border: 0;
  border-radius: 999px;
  padding: .45rem .65rem;
  background: white;
  font-weight: 800;
  cursor: pointer;
}
.buddy-preview-button:disabled { opacity: .55; cursor: wait; }
@media (max-width: 800px) {
  .child-buddy-grid { grid-template-columns: 1fr 1fr; }
  .child-buddy-switcher > summary { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 520px) {
  .child-buddy-grid { grid-template-columns: 1fr; }
}

/* V6: one-screen reader, story preparation, and no device-voice fallback */
.reader-page-v6 .site-header,
.reader-page-v6 .site-footer { display: none; }
.reader-page-v6 { overflow: hidden; }
.reader-page-v6 .page-shell {
  width: min(1440px, calc(100% - 1rem));
  height: 100dvh;
  min-height: 0;
  padding: .45rem 0;
  overflow: hidden;
}
.reader-shell-v6 {
  position: relative;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 6px minmax(0, 1fr);
  gap: .35rem;
}
.reader-shell-v6 .reader-toolbar { margin: 0; min-height: 48px; }
.reader-shell-v6 .story-progress { margin: 0; height: 6px; }
.reader-shell-v6 .reader-tools { align-items: center; }
.reader-live-buddy-wrap {
  position: absolute;
  top: 55px;
  left: 50%;
  z-index: 30;
  width: min(960px, calc(100% - 1.5rem));
  transform: translateX(-50%);
}
.reader-live-buddy-wrap > summary {
  width: fit-content;
  margin: 0 auto;
  padding: .35rem .7rem;
  border-radius: 999px;
  background: rgba(255,255,255,.88);
  border: 1px solid var(--border);
  color: var(--primary-dark);
  font-size: .78rem;
  font-weight: 850;
  cursor: pointer;
  list-style: none;
}
.reader-live-buddy-wrap > summary::-webkit-details-marker { display: none; }
.reader-live-buddy-wrap > summary small { margin-left: .25rem; }
.reader-live-buddy-wrap .live-buddy-panel {
  max-height: calc(100dvh - 120px);
  margin: .4rem 0 .6rem;
  overflow: auto;
  box-shadow: 0 20px 54px rgba(30, 24, 70, .24);
}

.v6-opening-card,
.finish-card-v6,
.story-preparation,
.story-stage-v6 {
  grid-row: 3;
}
.v6-opening-card,
.finish-card-v6,
.story-preparation {
  align-self: center;
  justify-self: center;
  width: min(780px, 96%);
  max-height: calc(100dvh - 72px);
  overflow: auto;
  margin: .2rem auto;
}
.v6-opening-card {
  padding: clamp(1rem, 2.4vh, 1.7rem) clamp(1.1rem, 4vw, 2.4rem);
}
.v6-opening-card .opening-cover { font-size: clamp(3.4rem, 9vh, 5.3rem); }
.v6-opening-card h2 { font-size: clamp(1.45rem, 3.2vw, 2.25rem); margin-bottom: .55rem; }
.v6-opening-card .opening-help { margin: .65rem 0 .25rem; }
.v6-opening-card .opening-help-picker { margin: .7rem auto .8rem; }
.v6-opening-card .ai-voice-note { margin: .55rem 0 0; font-size: .72rem; }

.story-preparation {
  text-align: center;
  background: white;
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: clamp(1.5rem, 5vw, 3rem);
  box-shadow: var(--shadow);
}
.story-preparation[hidden] { display: none; }
.preparation-buddy { font-size: clamp(4.5rem, 10vw, 7rem); animation: sceneFloat 2.3s ease-in-out infinite; }
.story-preparation h2 { font-size: clamp(1.5rem, 3.4vw, 2.35rem); }
.story-preparation p { color: var(--muted); }
.preparation-track {
  width: min(520px, 100%);
  height: 12px;
  margin: 1rem auto;
  overflow: hidden;
  border-radius: 999px;
  background: #ece9f5;
}
.preparation-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width .2s ease;
}

.story-stage-v6 {
  position: relative;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr);
  grid-template-rows: minmax(0, 1fr) 52px;
  gap: .55rem .7rem;
}
.story-stage-v6[hidden] { display: none; }
.story-stage-v6 .story-visual-frame,
.story-stage-v6 .story-paper {
  min-width: 0;
  min-height: 0;
  height: 100%;
  margin: 0;
  border-radius: 24px;
  overflow: hidden;
}
.story-stage-v6 .story-visual-frame {
  position: relative;
  top: auto;
  display: grid;
  place-items: stretch;
  background: #e8e2ff;
  border: 1px solid rgba(91,75,219,.2);
  box-shadow: var(--shadow-soft);
}
.story-stage-v6 .story-visual-canvas,
.story-stage-v6 .story-ai-image {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
}
.story-stage-v6 .story-visual-frame figcaption {
  position: absolute;
  left: .65rem;
  right: .65rem;
  bottom: .55rem;
  z-index: 3;
  max-height: 2.9em;
  overflow: hidden;
  margin: 0;
  padding: .38rem .6rem;
  border-radius: 11px;
  background: rgba(22, 26, 48, .7);
  color: white;
  font-size: .72rem;
  backdrop-filter: blur(8px);
}
.story-stage-v6 .story-paper {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: stretch;
  padding: clamp(.9rem, 2.2vw, 1.55rem);
  border: 1px solid var(--border);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}
.story-stage-v6 .story-text {
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.28rem, 2.05vw, 1.9rem);
  line-height: 1.43;
  letter-spacing: .003em;
  text-wrap: pretty;
}
.story-stage-v6 .story-text.text-fitted-small { line-height: 1.36; }
.story-stage-v6 .story-text p { margin: 0 0 .72em; }
.story-stage-v6 .story-text p:last-child { margin-bottom: 0; }
.story-stage-v6 .reaction-box {
  max-height: 92px;
  overflow: auto;
  margin-top: .45rem;
  padding: .55rem .65rem;
}
.story-stage-v6 .reader-pagination {
  grid-column: 1 / -1;
  grid-row: 2;
  height: 52px;
  margin: 0;
  padding: 0 .15rem;
}
.story-stage-v6 .reader-pagination .button { min-height: 46px; }
.story-stage-v6 .word-help-bubble {
  z-index: 12;
  max-width: min(92%, 430px);
  font-size: .92rem;
}
.buddy-comment-v6 {
  position: absolute;
  left: 50%;
  bottom: 59px;
  z-index: 14;
  grid-column: auto;
  width: min(560px, calc(100% - 2rem));
  transform: translateX(-50%);
  box-shadow: 0 15px 34px rgba(33,29,76,.22);
}
.story-word.word-loading::after {
  content: "";
  display: inline-block;
  width: .38em;
  height: .38em;
  margin-left: .12em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: wordSpin .6s linear infinite;
}
@keyframes wordSpin { to { transform: rotate(360deg); } }
.source-dialog p { color: var(--muted); }

@media (max-width: 899px), (max-height: 620px) {
  .reader-page-v6 { overflow: auto; }
  .reader-page-v6 .page-shell { height: auto; min-height: 100dvh; overflow: visible; padding: .4rem 0 1rem; }
 .reader-shell-v6 { min-height: 100dvh; height: auto; display: block; }
  .reader-shell-v6 .story-progress { margin-bottom: .4rem; }
  .story-stage-v6 {
    height: auto;
    min-height: calc(100dvh - 80px);
    grid-template-columns: 1fr;
    grid-template-rows: minmax(230px, 42vh) minmax(300px, auto) auto;
  }
  .story-stage-v6 .story-visual-frame { grid-row: 1; }
  .story-stage-v6 .story-paper { grid-row: 2; min-height: 300px; }
  .story-stage-v6 .reader-pagination { grid-column: 1; grid-row: 3; height: auto; }
  .story-stage-v6 .story-text { min-height: 260px; font-size: clamp(1.28rem, 4.7vw, 1.85rem); overflow: visible; }
  .buddy-comment-v6 { position: fixed; bottom: 70px; }
  .v6-opening-card, .finish-card-v6, .story-preparation { max-height: none; }
}

@media (max-width: 520px) {
  .reader-page-v6 .page-shell { width: calc(100% - .5rem); }
  .reader-shell-v6 .reader-toolbar { min-height: 44px; }
  .reader-title-wrap small { font-size: .62rem; }
  .story-stage-v6 { grid-template-rows: minmax(190px, 34vh) minmax(320px, auto) auto; }
  .story-stage-v6 .story-paper { padding: .9rem; }
  .story-stage-v6 .story-text { font-size: clamp(1.22rem, 5.8vw, 1.65rem); line-height: 1.48; }
  .story-stage-v6 .story-visual-frame figcaption { display: none; }
  .v6-opening-card .opening-help-picker { grid-template-columns: 1fr; }
}

/* V7: server-backed story bookmarks and variable-length reading */
.story-bookmark-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  width: min(520px, 100%);
  margin: .7rem auto;
  padding: .65rem .85rem;
  border: 1px solid rgba(91,75,219,.22);
  border-radius: 18px;
  background: rgba(245,243,255,.92);
  text-align: left;
}
.story-bookmark-card strong { display: block; color: var(--primary-dark); }
.story-bookmark-card p { margin: .1rem 0 0; color: var(--muted); font-size: .9rem; }
.story-bookmark-icon { font-size: 1.8rem; }
.opening-actions-v7 {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .55rem;
}
.opening-actions-v7 .button { margin: 0; }
.reader-page-v7 .finish-actions { flex-wrap: wrap; }

@media (max-height: 720px) and (min-width: 700px) {
  .reader-page-v7 .story-bookmark-card { margin: .35rem auto; padding: .45rem .7rem; }
  .reader-page-v7 .opening-actions-v7 { gap: .35rem; }
}

/* V7.1: scene-balanced art, reliable child choices, and quieter buddy overlays */
.reader-page-v71 .story-stage-v6 .reaction-box {
  display: grid;
  gap: .55rem;
  max-height: 190px;
  overflow: auto;
  margin-top: .55rem;
  padding: .7rem .75rem;
  border: 1px solid rgba(91, 75, 219, .18);
  background: linear-gradient(135deg, #f7f4ff, #edf8ff);
  text-align: left;
}
.reader-page-v71 .story-stage-v6 .reaction-box[hidden],
.reader-page-v71 .reaction-feedback[hidden] { display: none; }
.reader-page-v71 .reaction-prompt {
  display: block;
  color: var(--ink);
  font-size: .94rem;
  line-height: 1.25;
}
.reader-page-v71 .reaction-choices {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}
.reader-page-v71 .reaction-choice {
  min-height: 38px;
  border: 1.5px solid rgba(91, 75, 219, .32);
  border-radius: 999px;
  padding: .45rem .75rem;
  background: white;
  color: var(--primary-dark);
  font: inherit;
  font-size: .85rem;
  font-weight: 850;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.reader-page-v71 .reaction-choice:hover:not(:disabled),
.reader-page-v71 .reaction-choice:focus-visible:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--primary);
}
.reader-page-v71 .reaction-choice.is-selected {
  border-color: var(--primary);
  background: #e9e4ff;
  color: var(--primary-dark);
}
.reader-page-v71 .reaction-choice:disabled:not(.is-selected) { opacity: .48; }
.reader-page-v71 .reaction-feedback {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 48px;
  padding: .5rem .65rem;
  border-radius: 15px;
  background: white;
  box-shadow: 0 7px 20px rgba(44, 36, 92, .1);
}
.reader-page-v71 .reaction-feedback-face { font-size: 2rem; line-height: 1; }
.reader-page-v71 .reaction-feedback strong {
  display: block;
  color: var(--primary-dark);
  font-size: .76rem;
}
.reader-page-v71 .reaction-feedback p {
  margin: .08rem 0 0;
  color: var(--ink);
  font-family: inherit;
  font-size: .88rem;
  font-weight: 800;
  line-height: 1.25;
}
.reader-page-v71 .buddy-comment-v6 {
  left: 0;
  width: calc(54% - .35rem);
  max-width: none;
  padding: 0 .75rem;
  transform: none;
  justify-content: center;
  cursor: pointer;
}
.reader-page-v71 .buddy-comment-v6:focus-visible {
  outline: 3px solid rgba(91, 75, 219, .42);
  outline-offset: 3px;
  border-radius: 18px;
}
.reader-page-v71 .story-ai-image[data-image-source="fallback"] {
  filter: saturate(.96) brightness(.99);
}

@media (max-width: 899px), (max-height: 620px) {
  .reader-page-v71 .buddy-comment-v6 {
    left: 50%;
    width: min(560px, calc(100% - 1rem));
    padding: 0;
    transform: translateX(-50%);
  }
  .reader-page-v71 .story-stage-v6 .reaction-box { max-height: none; }
}


/* V7.2: non-blocking reader controls and no repeated image caption */
.reader-page-v72 .story-stage-v6 .story-visual-frame figcaption { display: none !important; }
.reader-page-v72 .story-stage-v6 .story-paper {
  grid-template-rows: minmax(0, 1fr) auto auto auto;
  grid-auto-rows: auto;
}
.reader-page-v72 .buddy-comment-v6 {
  position: static;
  left: auto;
  bottom: auto;
  z-index: 1;
  width: 100%;
  max-width: none;
  margin-top: .55rem;
  padding: .55rem .7rem;
  transform: none;
  justify-self: stretch;
  border: 1px solid rgba(91, 75, 219, .18);
  border-radius: 16px;
  background: linear-gradient(135deg, #fff8df, #fff);
  box-shadow: 0 7px 20px rgba(44, 36, 92, .1);
}
.reader-page-v72 .buddy-comment-v6[hidden] { display: none; }
.reader-page-v72 .buddy-comment-v6 .buddy-comment-face { flex: 0 0 auto; }
.reader-page-v72 .buddy-comment-v6 p { line-height: 1.28; }
@media (max-width: 899px), (max-height: 620px) {
  .reader-page-v72 .buddy-comment-v6 {
    position: static;
    left: auto;
    bottom: auto;
    width: 100%;
    transform: none;
  }
}


.reader-page-v72 .reader-tools .reader-live-buddy-tool {
  position: relative;
  inset: auto;
  width: auto;
  transform: none;
  z-index: 40;
}
.reader-page-v72 .reader-tools .reader-live-buddy-tool > summary {
  display: grid;
  width: 42px;
  height: 42px;
  min-height: 42px;
  margin: 0;
  padding: 0;
  place-items: center;
  list-style: none;
}
.reader-page-v72 .reader-tools .reader-live-buddy-tool > summary small { display: none; }
.reader-page-v72 .reader-tools .reader-live-buddy-tool .live-buddy-panel {
  position: fixed;
  top: 62px;
  left: 50%;
  width: min(960px, calc(100% - 1.5rem));
  max-height: calc(100dvh - 76px);
  margin: 0;
  transform: translateX(-50%);
  overflow: auto;
}

/* BrightSteps-X public-site, legal, support, and accessibility refinements. */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

#main-content:focus { outline: none; }
.legal-meta { color: var(--muted); font-size: .93rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.legal-copy ul { padding-left: 1.25rem; }
.legal-copy li + li { margin-top: .65rem; }
.legal-copy abbr { text-decoration-thickness: .08em; text-underline-offset: .16em; }
.legal-note, .emergency-note {
  margin-top: 2rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid rgba(91, 75, 219, .22);
  border-radius: var(--radius-md);
  background: var(--primary-soft);
}
.public-trust-panel, .support-safety {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: clamp(1.3rem, 4vw, 2.25rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, #fff, #f2f0ff);
  box-shadow: var(--shadow-soft);
}
.public-trust-panel > div:first-child, .support-safety > div:first-child { max-width: 760px; }
.public-trust-panel .hero-actions { justify-content: flex-end; }
.support-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}
.support-card {
  padding: 1.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.support-card > span { display: block; font-size: 2rem; margin-bottom: .55rem; }
.support-card h2 { font-size: 1.35rem; }
.support-card p { margin-bottom: 0; }
.emergency-note { background: #fff8ed; border-color: rgba(227, 163, 39, .34); }
.emergency-note h2 { margin-top: 0; }
.source-register-card a .visually-hidden { text-decoration: none; }

@media (max-width: 780px) {
  .site-header { padding-bottom: .5rem; }
  .site-nav .nav-cta { padding: .52rem .78rem; }
  .site-footer { flex-direction: column; }
  .footer-links { justify-content: flex-start; }
  .public-trust-panel, .support-safety { align-items: flex-start; flex-direction: column; }
  .public-trust-panel .hero-actions { justify-content: flex-start; }
}

@media (max-width: 640px) {
  .support-grid { grid-template-columns: 1fr; }
  .footer-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
}

@media (max-width: 420px) {
  .site-header { gap: .55rem; }
  .brand strong { font-size: 1rem; }
  .footer-links { grid-template-columns: 1fr; }
}
.analytics-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.analytics-summary > div { padding: .9rem; border-radius: var(--radius-md); background: var(--surface-soft); display: grid; }
.analytics-summary strong { font-size: 1.65rem; }
.analytics-summary span { color: var(--muted); font-size: .82rem; }
.analytics-page-list article { align-items: center; }

/* V7.3.5 dynamic greetings, durable Listening Mode, and AI custom stories */
.custom-story-panel { margin-top: 2rem; }
.custom-story-grid {
  display: grid;
  grid-template-columns: minmax(260px, .85fr) minmax(0, 1.15fr);
  gap: 1rem;
  align-items: start;
}
.hero-photo-card,
.custom-story-list-card,
.custom-story-builder {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 1.2rem;
  box-shadow: var(--shadow-soft);
}
.hero-photo-card h3,
.custom-story-list-card h3 { margin-top: 0; }
.hero-photo-preview {
  width: min(220px, 100%);
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  border-radius: 1.2rem;
  border: 3px solid rgba(91, 75, 219, .2);
  box-shadow: var(--shadow-soft);
  margin-bottom: .9rem;
}
.hero-photo-preview.compact { width: 132px; margin-top: -.25rem; }
.empty-portrait {
  display: grid;
  place-items: center;
  width: min(220px, 100%);
  aspect-ratio: 1;
  border-radius: 1.2rem;
  border: 1px dashed rgba(91, 75, 219, .35);
  background: var(--primary-soft);
  font-size: 3rem;
  margin-bottom: .9rem;
}
.hero-photo-form { margin-top: 1rem; }
.custom-story-form { max-width: 760px; }
.custom-story-mini-list article { background: var(--surface-soft); border-radius: var(--radius-md); }
.story-hero-photo {
  position: absolute;
  right: clamp(.65rem, 2vw, 1rem);
  bottom: clamp(.65rem, 2vw, 1rem);
  width: clamp(76px, 18vw, 132px);
  height: clamp(76px, 18vw, 132px);
  object-fit: cover;
  border-radius: 999px;
  border: 4px solid rgba(255,255,255,.92);
  box-shadow: 0 16px 32px rgba(37, 32, 90, .22);
  background: #fff;
  z-index: 4;
}
.listen-tool.is-listening {
  background: #fff2d6;
  color: #6f4500;
  box-shadow: inset 0 0 0 2px rgba(245, 176, 65, .45), var(--shadow-soft);
}
.listening-status {
  width: min(820px, 100%);
  margin: .35rem auto 0;
  padding: .75rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(91, 75, 219, .24);
  background: rgba(255,255,255,.9);
  color: var(--text);
  text-align: center;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
}
.reader-shell.listening-mode-active .story-paper { box-shadow: 0 0 0 4px rgba(91, 75, 219, .11), var(--shadow-soft); }
.reader-shell.listening-mode-active .story-text p { animation: gentle-reading-pulse 3.4s ease-in-out infinite; }
.marketing-download-note { margin-top: 1rem; color: var(--muted); font-size: .94rem; }
@keyframes gentle-reading-pulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1px); }
}
@media (max-width: 820px) {
  .custom-story-grid { grid-template-columns: 1fr; }
  .hero-photo-preview, .empty-portrait { width: min(180px, 100%); }
  .story-hero-photo { width: 82px; height: 82px; border-width: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  .reader-shell.listening-mode-active .story-text p { animation: none; }
}


/* V7.3.5 custom-story controls */
.custom-story-mini-item { align-items: center; gap: .75rem; }
.custom-story-mini-copy { flex: 1; min-width: 0; }
.custom-story-mini-item form { margin-left: auto; }
.button-small { min-height: 44px; padding: .55rem .8rem; }
.photo-story-options { border: 1px solid var(--line, #d8e2ea); border-radius: 1rem; padding: 1rem; }
.strong-consent small { display: block; margin-top: .25rem; }
@media (max-width: 640px) { .custom-story-mini-item { align-items: flex-start; flex-wrap: wrap; } .custom-story-mini-item form { width: 100%; margin-left: 0; } }

/* V7.3.5 child-inspired custom-story art */
.hero-art-choice {
  display: grid;
  grid-template-columns: minmax(110px, 150px) 1fr;
  align-items: start;
  gap: 1rem;
}
.hero-art-choice .hero-photo-preview { margin: 0; }
.story-visual-options { display: grid; gap: .35rem; }
.story-visual-option { border: 1px solid transparent; }
.story-visual-option:has(input:checked) { border-color: var(--primary); background: #f4f1ff; }
.story-visual-option.is-disabled { opacity: .58; }
.compact-consent { margin-top: .7rem; }
.story-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: .35rem;
  padding: .28rem .58rem;
  border-radius: 999px;
  font-size: .79rem;
  font-weight: 800;
  line-height: 1.25;
  border: 1px solid rgba(91, 75, 219, .2);
  background: var(--primary-soft);
}
.status-working { animation: status-soft-pulse 2s ease-in-out infinite; }
.status-ready { background: rgba(69, 176, 124, .14); border-color: rgba(36, 132, 87, .3); }
.status-partial { background: rgba(245, 176, 65, .16); border-color: rgba(167, 108, 8, .3); }
.status-failed { background: rgba(208, 74, 74, .11); border-color: rgba(166, 48, 48, .25); }
.status-photo { background: rgba(73, 149, 210, .12); border-color: rgba(44, 112, 169, .25); }
@keyframes status-soft-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .7; }
}
@media (max-width: 640px) {
  .hero-art-choice { grid-template-columns: 1fr; }
  .hero-art-choice .hero-photo-preview { width: 132px; }
}
@media (prefers-reduced-motion: reduce) {
  .status-working { animation: none; }
}

/* V7.3.9 retains the parent-facing custom-story quota presentation */
.custom-story-quota-card {
  margin: 1rem 0 1.35rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(91, 75, 219, .2);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(248,247,255,.98), rgba(239,248,255,.94));
  box-shadow: var(--shadow-soft);
}
.custom-story-quota-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .85rem;
}
.custom-story-quota-heading h3 { margin: .12rem 0 0; font-size: 1.2rem; }
.quota-reset-badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: .35rem .65rem;
  border: 1px solid rgba(91, 75, 219, .2);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 800;
  white-space: nowrap;
}
.custom-story-quota-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .7rem;
}
.quota-metric {
  min-width: 0;
  padding: .8rem;
  border: 1px solid rgba(91, 75, 219, .14);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.94);
  display: grid;
  gap: .15rem;
}
.quota-metric strong { color: var(--primary-dark); font-size: 1.55rem; line-height: 1; }
.quota-metric span { color: var(--ink); font-size: .84rem; font-weight: 800; }
.quota-metric small { color: var(--muted); font-size: .74rem; line-height: 1.35; }
.quota-metric.quota-daily_limit,
.quota-metric.quota-service_paused { background: #fff4f4; border-color: rgba(166, 48, 48, .22); }
.quota-metric.quota-low { background: #fff9e9; border-color: rgba(167, 108, 8, .22); }
.quota-metric.quota-in_progress { background: #fff9e9; border-color: rgba(167, 108, 8, .22); }
.quota-note { margin: .75rem 0 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.quota-scope-details {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .8rem;
  margin-top: .75rem;
  color: #4c4963;
  font-size: .78rem;
}
.quota-scope-details span {
  padding: .35rem .55rem;
  border-radius: 9px;
  background: rgba(255, 255, 255, .78);
}
.quota-service-note,
.quota-warning {
  margin: .8rem 0 1rem;
  padding: .75rem .85rem;
  border: 1px solid rgba(167, 108, 8, .28);
  border-radius: var(--radius-md);
  background: #fff8e8;
  color: #6d4a0d;
}
.custom-story-quota-card.quota-unavailable { background: #fff8e8; border-color: rgba(167, 108, 8, .25); }
.custom-story-quota-card.compact {
  margin: .85rem 0;
  padding: .75rem;
  box-shadow: none;
}
.custom-story-quota-card.compact .custom-story-quota-heading { margin-bottom: .6rem; }
.custom-story-quota-card.compact .custom-story-quota-heading h3 { font-size: 1rem; }
.custom-story-quota-card.compact .quota-reset-badge { display: none; }
.custom-story-quota-card.compact .custom-story-quota-metrics { gap: .45rem; }
.custom-story-quota-card.compact .quota-metric { padding: .55rem .45rem; text-align: center; }
.custom-story-quota-card.compact .quota-metric strong { font-size: 1.25rem; }
.custom-story-quota-card.compact .quota-metric span { font-size: .7rem; }
.custom-story-quota-card.compact .quota-note { text-align: center; font-size: .7rem; }
@media (max-width: 720px) {
  .custom-story-quota-heading { flex-direction: column; gap: .45rem; }
  .custom-story-quota-metrics { grid-template-columns: 1fr; }
  .custom-story-quota-card.compact .custom-story-quota-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .custom-story-quota-card.compact .custom-story-quota-metrics { grid-template-columns: 1fr; }
}
