/* Busy Brains — companion to "Mindfulness for Busy Brains"
   Warm, rounded, playful without being babyish. Must not alienate a ten-year-old. */

:root {
  /* Life Changes 4 Good brand turquoise, carried through the app's chrome:
     the check, the primary buttons, progress, focus, the growing world. */
  --brand:       #3FB8E8;
  --brand-deep:  #16709B;
  --brand-light: #6FC6E8;
  --brand-tint:  #E4F4FB;

  /* A soft turquoise-white ground rather than flat white — it keeps the brand's
     clean feel while letting thirteen saturated practice cards sing against it. */
  --bg:       #F2FAFD;
  --card:     #FFFFFF;
  --ink:      #123A52;
  --ink-soft: #587D91;
  --line:     #D8ECF5;

  --practice: var(--brand);
  --r: 22px;
  --tap: 56px;
  --font: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

html.large-text body { font-size: 21px; }

#app {
  --pad-top: max(20px, env(safe-area-inset-top));
  --pad-bottom: calc(28px + env(safe-area-inset-bottom));
  max-width: 640px;
  margin: 0 auto;
  padding: var(--pad-top) 20px var(--pad-bottom);
  min-height: 100dvh;
}

h1 {
  font-size: clamp(2.1rem, 9vw, 2.8rem); font-weight: 800; line-height: 1.05;
  margin: 0 0 10px; letter-spacing: -0.025em; text-wrap: balance;
}
h2 { font-size: 1.35rem; font-weight: 800; margin: 30px 0 10px; letter-spacing: -0.01em; }
p { margin: 0 0 14px; }

.eyebrow {
  text-transform: uppercase; letter-spacing: 0.09em; font-size: 0.72rem;
  font-weight: 800; color: var(--ink-soft); margin: 0 0 4px;
}
.lede { color: var(--ink-soft); }
.fine { font-size: 0.82rem; color: var(--ink-soft); }

/* ---------- buttons ---------- */

button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }

.btn {
  display: block; width: 100%; min-height: var(--tap);
  border-radius: 999px; font-weight: 800; font-size: 1.05rem;
  padding: 14px 22px; margin: 10px 0; transition: transform .12s ease, filter .12s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--brand-deep); color: #fff; }
.btn-quiet { background: transparent; color: var(--ink-soft); border: 2px solid var(--line); }
.btn-danger { background: #fff; color: #B2312A; border: 2px solid #F3D6D3; }
.btn[disabled] { opacity: .35; pointer-events: none; }

.btn-start {
  background: var(--practice); color: var(--on-practice, #fff); font-size: 1.2rem; min-height: 66px; margin-top: 22px;
}

.back-link {
  color: var(--ink-soft); font-weight: 700; padding: 10px 0; margin-bottom: 6px; font-size: .95rem;
}

.icon-btn {
  width: 48px; height: 48px; border-radius: 50%; background: var(--card);
  border: 2px solid var(--line); font-size: 1.2rem; display: grid; place-items: center;
}

/* ---------- home ---------- */

.home-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 22px; }

/* Colour-field cards: the practice's own hue is the surface, its focal object the face. */
.big-card {
  position: relative; display: grid; grid-template-columns: 84px 1fr; align-items: center;
  gap: 16px; width: 100%; text-align: left; overflow: hidden;
  background: var(--practice); color: var(--on-practice, #fff);
  border-radius: 26px; padding: 20px 22px; margin-bottom: 14px; border: none;
  box-shadow: 0 10px 22px -14px color-mix(in srgb, var(--practice) 80%, black);
  transition: transform .14s ease, box-shadow .14s ease;
}
.big-card:active { transform: scale(0.98); box-shadow: 0 4px 12px -8px var(--practice); }

.big-card-art { display: block; }
.big-card-art .focal-svg { width: 84px; height: 84px; display: block; }
.big-card-text { display: block; min-width: 0; }
.big-card-eyebrow {
  display: block; text-transform: uppercase; letter-spacing: .1em; font-size: .66rem;
  font-weight: 800; opacity: .82; margin-bottom: 5px;
}
.big-card-title { display: block; font-size: 1.5rem; font-weight: 800; line-height: 1.12; letter-spacing: -0.02em; }
.big-card-sub { display: block; font-size: .9rem; margin-top: 6px; opacity: .85; line-height: 1.35; }

/* The check is the brand's own card — the logo turquoise, bright with dark text.
   Light against the deep-blue Anchor card below it, so the two don't merge. */
.card-assess {
  --practice: var(--brand); --on-practice: var(--ink);
  grid-template-columns: 1fr;
}

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.tile {
  background: var(--card); border: 2px solid var(--line); border-radius: var(--r);
  padding: 20px 14px; font-weight: 800; display: grid; gap: 6px; justify-items: center;
  position: relative; min-height: 116px; align-content: center; text-align: center;
}
.tile-emoji { font-size: 1.8rem; }

/* All thirteen practice colours, so the home screen shows the world inside. */
.tile-dots { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; width: 100%; padding: 0 4px; }
.tile-dots span { aspect-ratio: 1; border-radius: 50%; }

.badge {
  background: var(--brand-deep); color: #fff; border-radius: 999px;
  font-size: .68rem; font-weight: 800; padding: 3px 9px;
}
.badge-new {
  justify-self: start; background: var(--on-practice, #fff); color: var(--practice);
  letter-spacing: .06em; text-transform: uppercase; margin-bottom: 2px;
}

/* Card art is the practice's own focal object, drawn in white on its colour field.
   It stays STILL here — thirteen animating cards would be sensory noise for exactly
   the children this is built for. Only the practice itself moves. */
.card-art, .big-card-art { --practice: var(--on-practice, #fff); }
.card-art *, .big-card-art * { animation: none !important; }
/* The focal drawings are composed for a full screen, so they're scaled up to fill
   the small card slot rather than floating lost inside it. */
.card-art .focal-svg, .big-card-art .focal-svg { transform: scale(1.35); }

.world-strip {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(135deg, var(--brand-tint), var(--bg));
  border: 2px solid var(--line); border-radius: var(--r);
  padding: 18px 20px; font-weight: 800; margin-top: 6px;
}
.world-count { color: var(--ink-soft); font-weight: 700; font-size: .9rem; }

/* ---------- cards ---------- */

.cards { display: grid; gap: 14px; }
.card {
  position: relative; overflow: hidden; text-align: left;
  background: var(--practice); color: var(--on-practice, #fff); border: none; border-radius: 26px;
  padding: 16px 18px; display: grid; grid-template-columns: 96px 1fr;
  gap: 14px; align-items: center;
  box-shadow: 0 10px 22px -15px color-mix(in srgb, var(--practice) 80%, black);
  transition: transform .14s ease;
}
.card:active { transform: scale(0.98); }

.card-art { display: block; }
.card-art .focal-svg { width: 76px; height: 76px; display: block; }
/* The illustration is square-cropped so thirteen cards line up down the page. */
.card-art img {
  width: 96px; height: 96px; object-fit: cover; object-position: 50% 30%; display: block;
  border-radius: 18px; background: rgba(255,255,255,.15);
}
.card-body { display: grid; gap: 3px; min-width: 0; }

/* Track 14 in the Grown-up Corner. It carries the book's illustration like every other
   practice card; it just isn't in the .cards grid, so it needs its own width and spacing. */
.card-grown-ups { width: 100%; margin: 16px 0; }
/* The children's illustrations put their subject mid-frame, so the shared 50% 30% crop
   finds it. This one has the mother sitting left of centre, and the default crop lands
   on the steering wheel — which is not the bit worth recognising. */
.card-grown-ups .card-art img { object-position: 20% 34%; }

.card-track { font-size: .64rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; opacity: .78; }
.card-title { font-size: 1.28rem; font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; }
.card-helps { font-size: .9rem; opacity: .88; line-height: 1.35; }
.card-meta { font-size: .78rem; opacity: .72; margin-top: 2px; }

.marks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.mark {
  font-size: .7rem; font-weight: 700;
  background: color-mix(in srgb, var(--on-practice, #fff) 18%, transparent);
  border-radius: 999px; padding: 4px 9px; color: var(--on-practice, #fff);
}
.mark-props { background: color-mix(in srgb, var(--on-practice, #fff) 30%, transparent); }
.mark-safety { background: #FFF; color: #B2312A; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.chip { font-size: .82rem; font-weight: 700; background: var(--card); border: 2px solid var(--line); border-radius: 999px; padding: 6px 12px; }
.chip-props { background: #FFF0DE; border-color: #F2DDBE; color: #8A5A12; }

.safety {
  background: #FDE9E7; border: 2px solid #F3D6D3; border-radius: 16px;
  padding: 14px 16px; color: #8C2A24; font-size: .92rem;
}
.together-offer {
  background: #EEF3FD; border: 2px solid #DCE6FA; border-radius: 16px;
  padding: 14px 16px; color: #2C4C86; font-size: .92rem;
}
.slot-note { font-size: .85rem; color: var(--ink-soft); font-style: italic; }

/* ---------- player ---------- */

/* A practice must never require scrolling — everything fits the screen exactly. */
.player-running {
  min-height: calc(100dvh - var(--pad-top) - var(--pad-bottom));
  display: grid; grid-template-rows: auto 1fr auto auto;
  align-content: stretch; gap: 14px;
}
.player-top { display: flex; justify-content: space-between; align-items: center; gap: 14px; }

.ring { width: 62px; height: 62px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--line); stroke-width: 9; }
.ring-fill {
  fill: none; stroke: var(--practice); stroke-width: 9; stroke-linecap: round;
  transition: stroke-dashoffset .6s linear;
}

.btn-done {
  background: var(--card); border: 2px solid var(--line); border-radius: 999px;
  padding: 14px 26px; font-weight: 800; min-height: var(--tap);
}

.segment-text {
  font-size: 1.5rem; line-height: 1.45; font-weight: 700; text-align: center;
  margin: 0; min-height: 5em; display: grid; align-content: center;
}
html.large-text .segment-text { font-size: 1.7rem; }

.dots { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; padding-bottom: 8px; }
.dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--line); transition: background .3s; }
.dots span.is-on { background: var(--practice); }

/* ---------- focal objects ---------- */

.focal { display: grid; place-items: center; }
.focal-svg { width: min(58vw, 240px); height: min(58vw, 240px); }
.focal-svg * { transform-origin: 50% 50%; }

@keyframes breathe { 0%,100% { transform: scale(.78); } 50% { transform: scale(1.12); } }
@keyframes floatUp { 0% { transform: translateY(14px); opacity: .85; } 100% { transform: translateY(-16px); opacity: 1; } }
@keyframes rock { 0%,100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
@keyframes glowPulse { 0%,100% { opacity: .35; transform: scale(.92); } 50% { opacity: .8; transform: scale(1.06); } }
@keyframes spinSlow { to { transform: rotate(360deg); } }
@keyframes travelDown { 0% { transform: translateY(-10px); } 100% { transform: translateY(78px); } }
@keyframes ripple { 0% { transform: scale(.55); opacity: .75; } 100% { transform: scale(1.15); opacity: 0; } }
@keyframes sway { 0%,100% { transform: rotate(-3.5deg); } 50% { transform: rotate(3.5deg); } }

/* breath */
.f-breath-halo { fill: var(--practice); opacity: .13; animation: breathe 8s ease-in-out infinite; }
.f-breath-ball { fill: var(--practice); opacity: .28; animation: breathe 8s ease-in-out infinite; }
.f-breath-anchor { stroke: var(--practice); stroke-width: 7; fill: none; stroke-linecap: round; }
.f-breath-top { fill: var(--practice); }

/* balloon */
.f-balloon-rise { animation: floatUp 6s ease-in-out infinite alternate; }
.f-balloon-body { fill: var(--practice); opacity: .85; }
.f-balloon-knot { fill: var(--practice); }
.f-balloon-string { stroke: var(--practice); stroke-width: 3; fill: none; }
.f-balloon-shine { fill: #fff; opacity: .45; }

/* torch */
.f-torch-body { fill: var(--practice); opacity: .16; }
.f-torch-glow-group { animation: travelDown 9s ease-in-out infinite alternate; }
.f-torch-glow { fill: var(--practice); opacity: .3; }
.f-torch-core { fill: var(--practice); opacity: .8; }

/* den */
.f-den-roof, .f-den-walls { fill: var(--practice); opacity: .8; }
.f-den-door { fill: #fff; opacity: .5; }
.f-den-lamp { fill: #FFD98A; animation: glowPulse 5s ease-in-out infinite; }

/* sweet */
.f-sweet-turn { animation: spinSlow 22s linear infinite; }
.f-sweet-body { fill: var(--practice); opacity: .85; }
.f-sweet-shine { fill: #fff; opacity: .5; }
.f-sweet-wrinkle { stroke: #fff; stroke-width: 3; fill: none; opacity: .5; stroke-linecap: round; }
.f-sweet-sparkle { fill: #FFD98A; animation: glowPulse 3.5s ease-in-out infinite; }

/* thread */
.f-thread-aura { fill: var(--practice); opacity: .12; animation: breathe 7s ease-in-out infinite; }
.f-thread-heart { fill: var(--practice); opacity: .85; }
.f-thread-line { stroke: #FFD98A; stroke-width: 4; fill: none; stroke-linecap: round; animation: glowPulse 4s ease-in-out infinite; }

/* sunrise */
.f-sun-rays { stroke: var(--practice); stroke-width: 7; stroke-linecap: round; animation: spinSlow 40s linear infinite; opacity: .5; }
.f-sun-body { fill: var(--practice); animation: breathe 5s ease-in-out infinite; }
.f-sun-horizon { stroke: var(--ink); stroke-width: 5; opacity: .18; stroke-linecap: round; }

/* boat */
.f-boat-stars { fill: #FFD98A; animation: glowPulse 4s ease-in-out infinite; }
.f-boat-moon { fill: #FFF0C4; opacity: .9; }
.f-boat-rock { animation: rock 7s ease-in-out infinite; transform-origin: 100px 140px; }
.f-boat-hull { fill: var(--practice); }
.f-boat-sail { stroke: var(--practice); stroke-width: 5; fill: #fff; fill-opacity: .55; }
.f-boat-water { stroke: var(--practice); stroke-width: 5; fill: none; opacity: .35; stroke-linecap: round; }

/* backpack */
.f-pack-body { fill: var(--practice); opacity: .85; }
.f-pack-straps { stroke: var(--practice); stroke-width: 7; fill: none; }
.f-pack-pocket { fill: #fff; opacity: .35; }
.f-pack-item { fill: #FFD98A; animation: travelDown 4.5s ease-in-out infinite; }

/* tree */
.f-tree-sway { animation: sway 6s ease-in-out infinite; transform-origin: 100px 140px; }
.f-tree-canopy, .f-tree-canopy2, .f-tree-canopy3 { fill: var(--practice); opacity: .85; }
.f-tree-trunk { fill: #8A5A34; }
.f-tree-roots { stroke: #8A5A34; stroke-width: 5; fill: none; stroke-linecap: round; opacity: .7; }

/* volcano */
.f-volc-body { fill: var(--practice); opacity: .85; }
.f-volc-lava { fill: #FFB03A; }
.f-volc-steam { fill: #CFC7DA; opacity: .55; animation: floatUp 5s ease-in-out infinite alternate; }

/* pause */
.f-pause-ring { fill: var(--practice); opacity: .14; animation: ripple 3.4s ease-out infinite; }
.f-pause-disc { fill: var(--practice); opacity: .85; }
.f-pause-bar { fill: #fff; }

/* kind voice */
.f-kind-heart { fill: var(--practice); opacity: .9; }
.f-kind-waves circle { fill: none; stroke: var(--practice); stroke-width: 3; opacity: .4; }
.f-kind-w1 { animation: ripple 4s ease-out infinite; }
.f-kind-w2 { animation: ripple 4s ease-out infinite 1.4s; }

/* ---------- assessment ---------- */

.q-progress { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 16px 0 22px; }
.q-progress span { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .3s ease; }

.q { border: none; margin: 0 0 22px; padding: 0; }
.q legend { font-weight: 700; font-size: 1.02rem; padding: 0 0 12px; line-height: 1.4; }
.scale { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.scale-btn {
  background: var(--card); border: 2px solid var(--line); border-radius: 14px;
  padding: 13px 4px; font-weight: 700; font-size: .78rem; min-height: 58px;
}
.scale-btn.is-on { background: var(--brand-deep); color: #fff; border-color: var(--brand-deep); }

.q-nav { display: flex; gap: 12px; align-items: center; }
.q-nav .btn { margin: 0; }
.q-nav .btn-primary { flex: 2; }
.q-nav .btn-quiet { flex: 1; }

.scores { margin: 20px 0; }
.scores summary { font-weight: 800; cursor: pointer; padding: 12px 0; }
.bar-row { display: grid; grid-template-columns: 9rem 1fr; gap: 10px; align-items: center; margin-bottom: 9px; }
.bar-label { font-size: .84rem; color: var(--ink-soft); font-weight: 700; }
.bar { background: var(--line); border-radius: 999px; height: 12px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

/* ---------- landing ---------- */

.landing { text-align: center; display: grid; align-content: center; min-height: 82dvh; gap: 4px; }
.landing-glow {
  width: 150px; height: 150px; margin: 0 auto 18px; border-radius: 50%;
  background: radial-gradient(circle, var(--practice), transparent 68%);
  opacity: .34; animation: breathe 6s ease-in-out infinite;
}
.keepsake { font-weight: 800; color: #8A5A12; }
.grew { color: var(--ink-soft); }
.landing-actions { margin-top: 22px; }

/* ---------- world ---------- */

.garden {
  background: linear-gradient(180deg, #FFFFFF, var(--brand-tint));
  border: 2px solid var(--line); border-radius: var(--r);
  min-height: 220px; padding: 20px; display: flex; flex-wrap: wrap;
  gap: 10px; align-items: flex-end; align-content: flex-end;
}
.plant {
  width: var(--s); height: var(--s); background: var(--c); border-radius: 50% 50% 42% 42%;
  animation: sway 5s ease-in-out infinite; animation-delay: var(--d); opacity: .85;
}
.empty { color: var(--ink-soft); margin: auto; }

.keepsakes { display: flex; flex-wrap: wrap; gap: 9px; }
.keep {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--card); border: 2px solid var(--line); color: var(--line); font-size: 1.2rem;
}
.keep.is-got { background: var(--c); color: #fff; border-color: var(--c); }

/* ---------- parent ---------- */

.panel { background: var(--card); border: 2px solid var(--line); border-radius: var(--r); margin-bottom: 12px; overflow: hidden; }
.panel summary { font-weight: 800; padding: 18px 20px; cursor: pointer; list-style: none; }
.panel summary::-webkit-details-marker { display: none; }
.panel summary::after { content: '＋'; float: right; color: var(--ink-soft); }
.panel[open] summary::after { content: '−'; }
.panel-body { padding: 0 20px 18px; font-size: .94rem; }
.panel-body p { color: var(--ink-soft); }
.panel-body strong { color: var(--ink); }

/* A quiet heading that groups panels, e.g. the Documents cluster. */
.panel-group { font-size: .95rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-soft); margin: 22px 0 10px; }

/* ---------- documents (legal, child privacy, safety & scope) ---------- */

/* Long-form prose rendered from the legal pack. Used both full-screen (.doc) and
   inside a Grown-up Corner panel (.panel-body.doc-body). */
.doc-body { color: var(--ink-soft); }
.doc-body > *:first-child { margin-top: 0; }
.doc-body h2 { font-size: 1.15rem; margin: 24px 0 8px; color: var(--ink); }
.doc-body h3 { font-size: 1rem; margin: 18px 0 6px; color: var(--ink); }
.doc-body p { color: var(--ink-soft); }
.doc-body strong { color: var(--ink); }
.doc-body em { color: var(--ink-soft); }

.doc-body ul, .doc-body ol,
.panel-body ul, .panel-body ol { padding-left: 1.3em; margin: 0 0 14px; }
.doc-body li, .panel-body li { color: var(--ink-soft); margin-bottom: 7px; line-height: 1.5; }
.doc-body li strong, .panel-body li strong { color: var(--ink); }
.doc-body li::marker, .panel-body li::marker { color: var(--brand-deep); }

.doc-body a, .panel-body a { color: var(--brand-deep); font-weight: 700; }

/* The child's privacy screen leads with an italic note; give it a little room. */
.screen.doc .doc-body > p:first-child em { display: inline-block; margin-bottom: 6px; }

/* First-run safety prompt on a practice intro: a tappable version of the calm
   together-offer card, so it reuses that box's light and dark styling. */
.before-note { display: block; width: 100%; text-align: left; font-weight: 700; cursor: pointer; }
.safety-link { display: inline-block; margin: 2px 0 8px; }

.home-foot { text-align: center; margin-top: 20px; }

.log { list-style: none; padding: 0; margin: 0 0 12px; }
.log li { display: grid; gap: 2px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.log li span:first-child { font-weight: 700; }

.slots { list-style: none; padding: 0; margin: 0; }
.slots li { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.slots li span:first-child { flex: 1; font-weight: 700; }
.slot-real { color: #2F7D4F; font-weight: 700; font-size: .78rem; }
.slot-empty { color: var(--ink-soft); font-size: .78rem; }
.upload { background: var(--brand-tint); border: 2px solid var(--line); border-radius: 999px; padding: 7px 15px; font-weight: 700; font-size: .8rem; cursor: pointer; }

.setting { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); font-weight: 700; font-size: .94rem; }
.setting input[type=checkbox] { width: 26px; height: 26px; accent-color: var(--ink); flex: none; }
.setting-text { flex-direction: column; align-items: stretch; gap: 8px; }
.setting-text input { padding: 13px 15px; border: 2px solid var(--line); border-radius: 14px; font: inherit; background: var(--brand-tint); }

.pin {
  display: block; width: 100%; text-align: center; font-size: 2rem; letter-spacing: .5em;
  padding: 18px; border: 2px solid var(--line); border-radius: var(--r);
  background: var(--card); font-family: var(--font); margin-bottom: 8px;
}
.pin-error { color: #B2312A; font-weight: 700; text-align: center; }
.colophon { text-align: center; color: var(--ink-soft); font-size: .82rem; margin-top: 28px; }

/* ---------- accessibility ---------- */

:focus-visible { outline: 3px solid var(--brand-deep); outline-offset: 3px; border-radius: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
html.reduced-motion *, html.reduced-motion *::before, html.reduced-motion *::after {
  animation: none !important; transition: none !important;
}

/* Dark tokens live in one place and are applied from both signals: the OS
   preference, and an explicit data-theme set by a host page's theme toggle. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0C1F2B; --card: #14303F; --ink: #E8F4FA; --ink-soft: #93B4C4; --line: #1F4457;
    --brand: #4FB4E0; --brand-deep: #2E97CC; --brand-tint: #17384A;
  }
  .garden { background: linear-gradient(180deg, #14303F, #0C1F2B); }
  .world-strip { background: linear-gradient(135deg, #17384A, #0C1F2B); }
  .mark { background: rgba(255,255,255,.16); }
  .safety { background: #3A211F; border-color: #5A2E2A; color: #FFC9C3; }
  .together-offer { background: #1E2740; border-color: #2E3B5E; color: #C3D4FA; }
  .f-pause-bar, .f-den-door { fill: var(--card); }
}

/* An explicit theme choice wins over the OS preference, in both directions. */
:root[data-theme="dark"] {
  --bg: #0C1F2B; --card: #14303F; --ink: #E8F4FA; --ink-soft: #93B4C4; --line: #1F4457;
  --brand: #4FB4E0; --brand-deep: #2E97CC; --brand-tint: #17384A;
}
:root[data-theme="dark"] .garden { background: linear-gradient(180deg, #14303F, #0C1F2B); }
:root[data-theme="dark"] .world-strip { background: linear-gradient(135deg, #17384A, #0C1F2B); }
:root[data-theme="dark"] .mark { background: rgba(255,255,255,.16); }
:root[data-theme="dark"] .safety { background: #3A211F; border-color: #5A2E2A; color: #FFC9C3; }
:root[data-theme="dark"] .together-offer { background: #17384A; border-color: #24536B; color: #C3E4FA; }
:root[data-theme="dark"] .f-pause-bar, :root[data-theme="dark"] .f-den-door { fill: var(--card); }

:root[data-theme="light"] {
  --bg: #F2FAFD; --card: #FFFFFF; --ink: #123A52; --ink-soft: #587D91; --line: #D8ECF5;
  --brand: #3FB8E8; --brand-deep: #16709B; --brand-tint: #E4F4FB;
}
:root[data-theme="light"] .garden { background: linear-gradient(180deg, #FFFFFF, var(--brand-tint)); }
:root[data-theme="light"] .world-strip { background: linear-gradient(135deg, var(--brand-tint), var(--bg)); }
:root[data-theme="light"] .mark { background: color-mix(in srgb, var(--on-practice, #fff) 18%, transparent); }

/* ---------- the anchor song ---------- */

.song-strip {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--brand-deep); color: #fff; border-radius: var(--r);
  padding: 18px 20px; font-weight: 800; margin-bottom: 12px; text-align: left;
}
.song-note { font-weight: 700; font-size: .84rem; opacity: .8; }

.btn-song { margin-top: 10px; }
.link-btn { font-weight: 800; color: var(--brand-deep); text-decoration: underline; padding: 0; }

.song-audio { width: 100%; margin: 14px 0 4px; }
.song-shortcut { font-size: .9rem; color: var(--ink-soft); }

.song-body { display: grid; gap: 14px; margin-top: 18px; }

.song-part {
  background: var(--card); border: 2px solid var(--line);
  border-radius: 22px; padding: 18px 20px;
}
/* Intro, chorus and finale are tinted so the shape of the song is visible at a glance. */
.song-intro  { background: #FFF7E2; border-color: #F3E3BC; }
.song-chorus { background: #FDECEF; border-color: #F5D6DC; }
.song-final  { background: #EAF5EC; border-color: #CFE6D6; }

.song-head { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 1.1rem; }
.song-num {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  background: var(--practice); color: var(--on-practice, #fff);
  display: grid; place-items: center; font-size: .9rem; font-weight: 800;
}
.song-part-title em { font-style: italic; font-weight: 700; opacity: .7; margin-left: 8px; }

.song-line { margin: 0 0 6px; font-size: 1.08rem; line-height: 1.5; font-weight: 700; }
.song-action {
  display: inline-block; margin-left: 8px; font-size: .74rem; font-weight: 800;
  text-transform: lowercase; letter-spacing: .02em;
  background: var(--brand-tint); color: var(--brand-deep);
  border-radius: 999px; padding: 3px 10px; vertical-align: middle;
}

@media (prefers-color-scheme: dark) {
  .song-intro  { background: #33290F; border-color: #4A3B17; }
  .song-chorus { background: #331E24; border-color: #4A2C34; }
  .song-final  { background: #16301F; border-color: #21462D; }
}

/* ---------- welcome ---------- */

.welcome { display: grid; align-content: start; }
.welcome-body { margin: 4px 0 22px; }
.welcome-body p { line-height: 1.6; }
.welcome-flag {
  background: #FDE9E7; border: 2px solid #F3D6D3; border-radius: 16px;
  padding: 15px 17px; color: #8C2A24; font-size: .95rem;
}

.field { display: grid; gap: 7px; margin-bottom: 18px; }
.field span { font-weight: 800; font-size: .92rem; }
.field input {
  font: inherit; padding: 15px 16px; border-radius: 16px;
  border: 2px solid var(--line); background: var(--card); color: var(--ink);
  min-height: var(--tap);
}
.field input:focus-visible { border-color: var(--brand); }

@media (prefers-color-scheme: dark) {
  .welcome-flag { background: #3A211F; border-color: #5A2E2A; color: #FFC9C3; }
}
:root[data-theme="dark"] .welcome-flag { background: #3A211F; border-color: #5A2E2A; color: #FFC9C3; }

/* ---------- the ordered pathway ---------- */

.pathway { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 9px; counter-reset: step; }
.path-step button {
  width: 100%; display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 13px;
  text-align: left; background: var(--card); border: 2px solid var(--line);
  border-radius: 18px; padding: 13px 15px; min-height: var(--tap);
}
.path-step button:active { transform: scale(0.99); }
.path-num {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--practice); color: var(--on-practice, #fff); font-weight: 800; font-size: 1rem;
}
.path-text { display: grid; gap: 2px; min-width: 0; }
.path-title { font-weight: 800; font-size: 1.02rem; line-height: 1.2; }
.path-why { font-size: .8rem; color: var(--ink-soft); line-height: 1.3; }
.path-time { font-size: .8rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* Done is marked, never scored — nothing here is a streak. */
.path-step.is-done button { border-color: var(--brand); background: var(--brand-tint); }
.path-step.is-done .path-title::after { content: " ✓"; color: var(--brand-deep); }

/* ---------- the book's illustration on a practice screen ---------- */

/* Shown whole, at whatever shape it was drawn. Several of these illustrations are
   posters with headings and steps on them, and a fixed crop cuts the words off. */
.practice-hero {
  display: block; width: 100%; height: auto;
  border-radius: 24px; margin: 4px 0 18px;
  background: color-mix(in srgb, var(--practice) 18%, transparent);
}
