@font-face {
  font-family: "Figtree";
  src: url("fonts/figtree-var.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}

/* Deep sea. One stepped, blue-black tonal ramp carries every neutral. */
:root {
  --r0: #010309;
  --r1: #03060F;
  --r2: #08101F;
  --r3: #0D182E;
  --r4: #17243F;
  --r5: #2B3C60;
  --r6: #8293B8;
  --r7: #B7C4E0;
  --r8: #E8EFFF;

  --bg: var(--r1);
  --surface: var(--r2);
  --surface-2: var(--r3);
  --line: var(--r4);
  --line-strong: var(--r5);
  --muted: var(--r6);
  --soft: var(--r7);
  --text: var(--r8);

  /* Bioluminescent hues, one per exercise (token names kept from the first world) */
  --seafoam: #5AB0FF;
  --cobalt: #A08CFF;
  --amber: #E9B262;
  --frost: #9EE4FF;
  --lilac: #E39CF0;
  --sage: #7FDAB6;
  --coral: #FF8F7C;
  --sky: #7CCBFF;

  /* Phase semantics, shared by every guide */
  --ph-in: var(--seafoam);
  --ph-out: color-mix(in srgb, var(--seafoam) 58%, black);
  --ph-hold: color-mix(in srgb, var(--seafoam) 40%, var(--muted));
  --now: #F2F8FF;

  --on-accent: #021029;
  --pebble-radius: 26px 30px 24px 32px / 30px 24px 32px 26px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --font: "Figtree", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --r0: #DCE4F2;
  --r1: #EEF2FA;
  --r2: #FFFFFF;
  --r3: #E4EAF5;
  --r4: #CED8EA;
  --r5: #A6B6D2;
  --r6: #536583;
  --r7: #34445F;
  --r8: #0C1830;
  --seafoam: #2563D9;
  --cobalt: #5B48D6;
  --amber: #A86F1E;
  --frost: #2C88B5;
  --lilac: #9B3FB0;
  --sage: #2E8A63;
  --coral: #B4472F;
  --sky: #1F7FC4;
  --now: #0C1830;
  --on-accent: #FFFFFF;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; background: var(--bg); }
a, button, input, label { touch-action: manipulation; }
::selection { background: color-mix(in srgb, var(--seafoam) 35%, transparent); color: var(--text); }
:focus-visible { outline: 2px solid var(--seafoam); outline-offset: 3px; border-radius: 12px; }
body {
  margin: 0;
  background:
    radial-gradient(120% 55% at 50% -12%, color-mix(in srgb, var(--seafoam) 10%, transparent), transparent 62%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  caret-color: var(--seafoam);
}
body { overflow-x: clip; }
.topbar { position: relative; z-index: 2; }
body.playing { overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
main { flex: 1; outline: none; }
a { color: var(--seafoam); text-underline-offset: 3px; text-decoration-thickness: 1px; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.02em; font-weight: 720; text-wrap: balance; }
h1 { font-size: clamp(1.75rem, 7.4vw, 2.3rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; letter-spacing: -.01em; }
p { margin: 0 0 1em; text-wrap: pretty; }
.wrap { max-width: 600px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

/* Icons (Lucide) */
.lu { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Page header: no bar. Large titles scroll with the content; inner screens get a floating round back button. */
.topbar { position: relative; z-index: 2; max-width: 600px; margin: 0 auto; width: 100%; padding: max(32px, calc(env(safe-area-inset-top) + 20px)) 20px 6px; min-height: 82px; }
.page-title { font-size: 1.7rem; margin: 14px 0 4px; display: flex; align-items: center; gap: 12px; }
.page-title.root { font-size: 2.1rem; margin: 4px 64px 8px 0; letter-spacing: -.03em; }
.page-title .dot { width: 16px; height: 14px; border-radius: 52% 48% 44% 56% / 60% 52% 48% 40%; background: var(--hue); flex: none; }
.brand { min-height: 44px; color: var(--text); }
.mark-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--frost); box-shadow: 0 0 6px 1px var(--seafoam), 0 0 18px 4px color-mix(in srgb, var(--seafoam) 55%, transparent); margin: 0 4px 0 2px; }
.help-fab {
  position: fixed; z-index: 40; top: max(30px, calc(env(safe-area-inset-top) + 18px)); right: max(16px, calc((100vw - 600px) / 2 + 16px));
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--coral);
  background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid color-mix(in srgb, var(--coral) 45%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  transition: transform .7s cubic-bezier(.22, 1, .36, 1);
}
.help-fab:active { transform: scale(.92); transition-duration: .16s; }
.help-fab .lu { width: 22px; height: 22px; }
body.playing .help-fab { display: none; }
.brand .mark { width: 30px; height: 26px; }
.mk-bell { fill: var(--seafoam); }
.mk-tent { fill: none; stroke: var(--seafoam); stroke-width: 1.8; stroke-linecap: round; opacity: .8; }

/* Bottom tabs */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px max(8px, calc((100% - 600px) / 2)) max(8px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
  border-top: 1px solid var(--line);
}
.tabbar[hidden] { display: none; }
.tabbar a {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0 2px; min-height: 54px;
  text-decoration: none; color: var(--muted); font-size: .74rem; font-weight: 650;
}
.tabbar a::before {
  content: ""; position: absolute; top: 3px; left: 50%; width: 58px; height: 32px; margin-left: -29px; border-radius: 999px;
  background: color-mix(in srgb, var(--seafoam) 18%, transparent); transform: scale(.4); opacity: 0;
  transition: transform .5s var(--ease-out), opacity .35s ease;
}
.tabbar a .lu { position: relative; margin-top: 1px; }
.tabbar a.on { color: var(--seafoam); }
.tabbar a.on::before { transform: none; opacity: 1; }
body:not(.task):not(.playing) { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 750; font-size: 1.1rem; letter-spacing: -.01em; }
.topnav { display: flex; align-items: center; gap: 18px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 15px; display: grid; place-items: center;
  color: var(--soft); background: var(--surface); border: 1px solid var(--line);
}
.icon-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* Buttons */
.btn {
  appearance: none; cursor: pointer; font: inherit; font-weight: 700; letter-spacing: -.005em;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 22px; border-radius: 999px; text-decoration: none;
  background: var(--surface); color: var(--text); border: 1px solid var(--line);
  transition: transform .7s cubic-bezier(.22, 1, .36, 1), background-color .3s ease, box-shadow .7s ease;
}
/* Press = breathe out (a quick soft sink); release = breathe in (a slow rise back) */
.btn:active { transform: scale(.955); transition-duration: .16s, .3s, .16s; }
.btn-primary:active { box-shadow: 0 4px 14px -10px color-mix(in srgb, var(--accent, var(--seafoam)) 60%, transparent), inset 0 1px 0 rgba(255,255,255,.25); }
.btn-primary {
  background: var(--accent, var(--seafoam)); color: var(--on-accent); border-color: transparent;
  box-shadow: 0 12px 28px -12px color-mix(in srgb, var(--accent, var(--seafoam)) 75%, transparent), inset 0 1px 0 rgba(255,255,255,.35);
}
.btn-big { width: 100%; min-height: 64px; font-size: 1.2rem; }
.btn-alert { background: var(--coral); color: #2A0D06; border-color: transparent; }
.btn-danger { width: 100%; color: var(--coral); border-color: color-mix(in srgb, var(--coral) 40%, var(--line)); background: transparent; }
.start-over { border-bottom: 0; margin-top: 12px; }
.confirm { padding: 16px; border-radius: var(--pebble-radius); background: color-mix(in srgb, var(--coral) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--coral) 35%, var(--line)); animation: vt-in .45s var(--ease-out) both; }
.confirm[hidden], .btn-danger[hidden] { display: none; }
.confirm p { margin: 0 0 12px; color: var(--soft); }
.confirm strong { color: var(--text); }
.btn-alert-soft { background: color-mix(in srgb, var(--coral) 16%, transparent); color: var(--coral); border-color: transparent; width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 140px; }

/* Home */
.hero { text-align: center; padding: 0 0 4px; scroll-margin-top: 72px; position: relative; isolation: isolate; --hs: min(50vw, 210px); }

/* Night sea behind the hero: canvas scene, the pebble hangs over the horizon like a moon */
.scene {
  position: absolute; z-index: -1; left: 50%; width: 100vw; margin-left: -50vw; top: -110px; pointer-events: none;
  height: calc(110px + var(--hs) * 1.25 + 90px);
  -webkit-mask-image: linear-gradient(to bottom, #000 62%, transparent); mask-image: linear-gradient(to bottom, #000 62%, transparent);
}
.scene canvas { width: 100%; height: 100%; display: block; }

/* Onboarding */
.ob { min-height: calc(100dvh - 120px); display: flex; flex-direction: column; justify-content: center; text-align: center; padding-bottom: 24px; }
.ob h1 { margin-bottom: 10px; }
.ob-sub { color: var(--soft); max-width: 30ch; margin: 0 auto; }
.ob-stage { position: relative; width: min(40vw, 160px); aspect-ratio: 0.62; margin: 0 auto 6px; }
.ob-actions { display: grid; gap: 14px; margin-top: 28px; justify-items: center; }
.ob-actions .btn { width: 100%; }
.ob-dots { display: flex; justify-content: center; gap: 8px; margin-top: 28px; }
.ob-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); transition: width .4s var(--ease-out), background-color .3s ease; }
.ob-dots span.on { width: 22px; border-radius: 99px; background: var(--seafoam); }
/* Onboarding motion: each element breathes in on a stagger; each step breathes out before the next */
.ob .st { animation: ob-in 1s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(var(--i, 0) * 110ms + 80ms); }
.ob .rise { animation: jelly-rise 1.8s cubic-bezier(.16, 1, .3, 1) both; }
.ob.ob-out { animation: ob-out .34s ease-in both; }
.ob .ob-ic { animation: ic-pop .9s cubic-bezier(.34, 1.4, .64, 1) both; animation-delay: calc(var(--i, 0) * 110ms + 260ms); }
.ob li.st:nth-child(1) .ob-ic { --i: 2; } .ob li.st:nth-child(2) .ob-ic { --i: 3; } .ob li.st:nth-child(3) .ob-ic { --i: 4; }
.ob .field.st:focus { animation: none; }
@keyframes ob-in { from { opacity: 0; transform: translateY(16px); filter: blur(6px); } }
@keyframes ob-out { to { opacity: 0; transform: translateY(-12px) scale(.985); filter: blur(5px); } }
@keyframes jelly-rise { from { opacity: 0; transform: translateY(46px) scale(.92); filter: blur(8px); } }
@keyframes ic-pop { from { transform: scale(.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ob .st, .ob .rise, .ob .ob-ic, .ob.ob-out { animation: none; } }
.ob-list { list-style: none; padding: 0; margin: 18px 0 0; text-align: left; display: grid; gap: 18px; }
.ob-list li { display: flex; gap: 14px; align-items: flex-start; }
.ob-list p { margin: 0; color: var(--soft); }
.ob-list strong { color: var(--text); }
.ob-ic { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: var(--seafoam); background: color-mix(in srgb, var(--seafoam) 14%, transparent); }
.ob-ic.help { color: var(--coral); background: color-mix(in srgb, var(--coral) 14%, transparent); }
.field {
  width: 100%; min-height: 56px; margin-top: 22px; padding: 0 18px; border-radius: 16px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 1.15rem;
}
.field::placeholder { color: var(--muted); }
.field:focus { outline: none; border-color: var(--seafoam); box-shadow: 0 0 0 3px color-mix(in srgb, var(--seafoam) 25%, transparent); }
.link-btn { border: 0; background: none; color: var(--soft); font: inherit; font-weight: 650; padding: 10px 16px; border-radius: 999px; cursor: pointer; }
.greet { color: var(--seafoam) !important; font-weight: 650; margin: 0 0 4px !important; }

/* Onboarding bridge + breathe along */
.ob-links { display: flex; justify-content: center; gap: 18px; align-items: center; flex-wrap: wrap; }
.ob-links .again { margin-top: 0; }
.bridge-wave { width: min(70vw, 260px); margin: 0 auto 18px; }
.bridge-wave svg { width: 100%; height: auto; overflow: visible; }
.bridge-wave path { fill: none; stroke: var(--seafoam); stroke-width: 4; stroke-linecap: round; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--seafoam) 60%, transparent)); stroke-dasharray: 420; animation: draw-wave 2.4s cubic-bezier(.16, 1, .3, 1) .2s both; }
.bridge-wave circle { fill: var(--now); filter: drop-shadow(0 0 8px var(--seafoam)); }
@keyframes draw-wave { from { stroke-dashoffset: 420; } }
.bridge-note { justify-content: center; text-align: left; max-width: 34ch; margin: 18px auto 0; padding: 12px 14px; border-radius: 16px; background: color-mix(in srgb, var(--frost) 8%, transparent); }
.ob-time { color: var(--muted); font-size: .92rem; margin: 12px 0 0; }
.pf .pf-guide { width: 100%; height: clamp(150px, 26dvh, 230px); margin-top: 10px; display: grid; place-items: center; }
.pf .pf-guide > * { grid-area: 1 / 1; }
.pf .pf-guide .canvas-box { min-height: 0; height: 100%; }
@media (prefers-reduced-motion: reduce) { .bridge-wave path { animation: none; } }

/* Breath length control: Shorter, dots, Longer. No numbers. */
.len { display: flex; align-items: center; gap: 10px; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.len-btn { flex: none; min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--text); font: inherit; font-weight: 700; font-size: .92rem; cursor: pointer; transition: transform .6s cubic-bezier(.22, 1, .36, 1), opacity .3s ease; }
.len-btn:active { transform: scale(.94); transition-duration: .14s; }
.len-btn:disabled { opacity: .35; cursor: default; }
.len-dots { flex: 1; display: flex; justify-content: center; align-items: center; gap: 6px; }
.len-dots i { width: 6px; height: 6px; border-radius: 99px; background: var(--line-strong); transition: width .45s cubic-bezier(.16, 1, .3, 1), background-color .3s ease; }
.len-dots i.on { width: 18px; background: var(--hue, var(--seafoam)); box-shadow: 0 0 8px color-mix(in srgb, var(--hue, var(--seafoam)) 60%, transparent); }
.len-dots.big { margin: 10px 0 20px; gap: 8px; } .len-dots.big i { width: 9px; height: 9px; } .len-dots.big i.on { width: 28px; }
.player .len { margin: 0 0 12px; }

/* Choose a pace by feel */
.pf .pf-stage { position: relative; width: min(34vw, 140px, 18dvh); aspect-ratio: .62; margin: 10px auto 0; }
.pf-word { font-size: 2.4rem; font-weight: 760; letter-spacing: -.04em; margin: 4px 0 14px; min-height: 1.2em; }
.pf-row { display: flex; gap: 10px; }
.pf-btn { flex: 1; }
.pf-btn:disabled { opacity: .35; }
.pf .ob-actions { margin-top: 16px; }
@media (max-height: 640px) {
  .pf .pf-guide { height: 130px; }
  .pf-word { font-size: 1.8rem; margin: 0 0 8px; }
  .pf .ob-sub { font-size: .92rem; }
  .pf .ob-actions { gap: 4px; margin-top: 10px; }
  .ob { min-height: auto; padding-top: 4px; }
}
.learn-card { display: flex; gap: 12px; align-items: flex-start; padding: 16px; margin: 0 0 14px; border-radius: var(--pebble-radius); background: color-mix(in srgb, var(--seafoam) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--seafoam) 30%, var(--line)); }
.learn-card > .lu { color: var(--seafoam); margin-top: 2px; }
.learn-card p { margin: 0 0 12px; }
.learn-card .btn { min-height: 46px; flex: 1 1 auto; font-size: .95rem; }

/* Episodes */
.episodes { margin: 30px 0 0; }
.ep-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.ep-all { font-size: .95rem; font-weight: 650; text-decoration: none; }
.ep-sum { color: var(--soft); font-size: .95rem; margin: 0 0 12px; }
.ep-log { width: 100%; }
.ep-log .lu { width: 20px; height: 20px; color: var(--seafoam); }
.ep-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.ep-list li { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 6px 4px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; font-weight: 600; }
.ep-del { width: 44px; height: 44px; border: 0; background: none; color: var(--muted); border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.ep-del .lu { width: 20px; height: 20px; }
.toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 50; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 16px; max-width: min(calc(100vw - 32px), 420px); padding: 12px 12px 12px 18px; border-radius: 22px;
  background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--text); font-weight: 600; font-size: .95rem; width: max-content; line-height: 1.35;
  box-shadow: 0 12px 30px -12px rgba(0,0,0,.6); transition: transform .5s cubic-bezier(.22, 1, .36, 1), opacity .3s ease;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast button { border: 0; background: none; color: var(--seafoam); font: inherit; font-weight: 750; padding: 8px 10px; border-radius: 999px; cursor: pointer; }
body.task .toast, body.playing .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }

/* Session history */
.hist { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.hist li { display: flex; align-items: center; gap: 14px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.h-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--hue); box-shadow: 0 0 8px color-mix(in srgb, var(--hue) 70%, transparent); flex: none; }
.h-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.h-main strong { font-weight: 700; }
.h-main span { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.chip-kind { font-size: .78rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; flex: none; }
.chip-kind.practice { color: var(--seafoam); background: color-mix(in srgb, var(--seafoam) 14%, transparent); }
.chip-kind.relief { color: var(--soft); background: var(--surface-2); }
.ep-used { display: block; font-size: .85rem; font-weight: 500; color: var(--muted); }

/* Practice this week */
.week { margin: 28px 0 0; }
.week .ep-head { margin-bottom: 14px; }
.week ol { list-style: none; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; padding: 0; margin: 0 0 12px; }
.week li { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.week .peb svg { width: 34px; height: 30px; display: block; }
.week .peb .o { fill: transparent; stroke: var(--line-strong); stroke-width: 1.5; }
.week .peb .f { fill: var(--seafoam); display: none; }
.week li.done .peb .o { stroke: var(--seafoam); }
.week li.done .peb svg { filter: drop-shadow(0 0 5px color-mix(in srgb, var(--seafoam) 80%, transparent)); }
.week li.done .peb .f { display: inline; }
.week li.today .peb .o { stroke: var(--seafoam); }
.week li.future .peb .o { stroke-dasharray: 3 4; }
.week .wk-fill { transform-box: fill-box; }
.week li.earn .wk-fill { animation: fill-up 1.8s cubic-bezier(.45, 0, .2, 1) .5s both; }
.week li.earn .peb svg { animation: earn-glow 2.6s ease .5s both; }
@keyframes fill-up { from { transform: translateY(100%); } }
@keyframes earn-glow { 50% { filter: drop-shadow(0 0 8px color-mix(in srgb, var(--seafoam) 70%, transparent)); } }
.week .dl { font-size: .8rem; font-weight: 650; color: var(--muted); }
.week li.today .dl { color: var(--text); }
.week p { margin: 0; color: var(--soft); font-size: .95rem; }
.hero-stage { will-change: transform; transform-origin: 50% 30%; position: relative; width: var(--hs); aspect-ratio: 0.64; margin: 0 auto; }
.jelly-wrap { position: relative; width: min(56vw, 210px, 26dvh); aspect-ratio: 0.62; }
.stage .jelly-gl, .jelly-gl { position: absolute; left: 50%; top: -3%; width: 118%; height: auto; transform: translateX(-50%); pointer-events: none; }
.hero-stage svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.hero p { color: var(--soft); margin: 0 auto 22px; max-width: 30ch; }
.again { display: inline-block; margin-top: 14px; font-size: .95rem; color: var(--soft); }
.reassure {
  display: flex; gap: 14px; align-items: flex-start;
  color: var(--soft); font-size: .98rem; margin: 30px 0 8px; padding: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--pebble-radius);
}
.reassure .lu { flex: none; width: 22px; height: 22px; margin-top: 2px; color: var(--frost); }
.reassure p { margin: 0; }
.section-title { font-size: 1.15rem; margin: 36px 0 14px; }
.chips { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.chip {
  position: relative; display: flex; flex-direction: column; text-decoration: none; color: var(--text);
  background:
    radial-gradient(90% 70% at 18% 0%, color-mix(in srgb, var(--hue) 16%, transparent), transparent 70%),
    linear-gradient(160deg, color-mix(in srgb, var(--hue) 8%, var(--surface)), var(--surface) 62%);
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 7%, transparent), 0 10px 24px -18px rgba(0,0,0,.7);
  border: 1px solid color-mix(in srgb, var(--hue) 20%, var(--line));
  border-radius: var(--pebble-radius); padding: 16px 14px; min-height: 150px;
  transition: transform .7s cubic-bezier(.22, 1, .36, 1), border-color .3s ease;
}
.chip:nth-child(2n) { border-radius: 30px 24px 32px 26px / 26px 32px 24px 30px; }
.chip:nth-child(3n) { border-radius: 24px 32px 28px 26px / 32px 26px 30px 24px; }
.chip:active { transform: scale(.965); transition-duration: .16s; }
.chip-icon { width: 46px; height: 46px; border-radius: 15px 17px 14px 18px; display: grid; place-items: center; margin-bottom: 14px; color: var(--hue); background: color-mix(in srgb, var(--hue) 16%, transparent); }
.chip h3 { margin: 0 0 4px; font-size: clamp(.92rem, 4.2vw, 1.02rem); }
.chip p { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.35; }
.links { margin: 36px 0 8px; border-top: 1px solid var(--line); }
.link-row {
  display: flex; justify-content: space-between; align-items: center; text-decoration: none; color: var(--text);
  padding: 18px 4px; font-weight: 650; border-bottom: 1px solid var(--line);
}
.link-row { gap: 14px; }
.link-row > span:nth-child(2) { flex: 1; }
.lr-icon { color: var(--soft); display: grid; }
.link-row .chev { width: 20px; height: 20px; color: var(--muted); }
.help-block { margin: 48px 0 0; padding: 20px; border-radius: var(--pebble-radius); background: color-mix(in srgb, var(--coral) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--coral) 22%, var(--line)); }
.help-block h3 { color: var(--coral); }
.help-block p { color: var(--soft); font-size: .95rem; margin-bottom: 14px; }
.help-block .btn { width: 100%; }

/* Player */
.player { display: flex; flex-direction: column; min-height: 100dvh; padding-bottom: max(16px, env(safe-area-inset-bottom)); padding-top: max(12px, env(safe-area-inset-top)); }
body:not(.playing) .player { min-height: calc(100dvh - 190px); padding-top: 0; }
.player-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; }
.player-head h1 { font-size: 1.22rem; margin: 0; flex: 1; display: flex; align-items: center; gap: 10px; }
.player-head h1 .dot { width: 15px; height: 13px; border-radius: 52% 48% 44% 56% / 60% 52% 48% 40%; background: var(--hue, var(--seafoam)); flex: none; }
.back {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--surface); border: 1px solid var(--line); color: var(--soft);
}
.back svg { width: 22px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.guides { display: flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.guides button {
  flex: 1; min-width: 0; appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: .78rem; font-weight: 650;
  min-height: 48px; border-radius: 12px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  transition: background-color .3s ease, color .3s ease;
}
.guides button svg { width: 24px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.guides button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); box-shadow: 0 2px 8px -3px rgba(0,0,0,.5); }

.stage { flex: 1; display: grid; place-items: center; min-height: 250px; position: relative; }
.stage > * { grid-area: 1 / 1; }
.stage canvas { width: 100%; height: 100%; display: block; }
.canvas-box { position: relative; width: 100%; height: 100%; min-height: 250px; }
.canvas-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.canvas-box.fade-edges { -webkit-mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent); mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent); }
.stage::before { content: ""; position: absolute; inset: -6% -12%; pointer-events: none; background: radial-gradient(closest-side, color-mix(in srgb, var(--hue, var(--seafoam)) 13%, transparent), transparent); }

.phase { text-align: center; min-height: 128px; padding-top: 4px; }
.phase-word { font-size: clamp(3.2rem, 17vw, 4.4rem); font-weight: 760; margin: 0; letter-spacing: -.045em; line-height: 1; }
.phase-label { font-size: clamp(1.5rem, 7vw, 2rem); font-weight: 740; margin: 0; letter-spacing: -.02em; }
.phase-sub { color: var(--soft); margin: 4px 0 0; min-height: 1.5em; }
.phase-count { font-size: 1rem; font-weight: 650; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 4px; }
.progress { position: relative; height: 4px; background: var(--line); border-radius: 99px; margin: 14px 0 16px; }
.progress > div { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--hue, var(--seafoam)); border-radius: 99px; }
.controls { display: flex; gap: 10px; }
.shorter { display: block; margin: -4px auto 10px; font-size: .92rem; }
.phase-count[hidden] { display: none; }
.ease-note { display: flex; gap: 12px; align-items: flex-start; color: var(--soft); font-size: .95rem; margin: 0 0 14px; }
.ease-note .lu { flex: none; width: 20px; height: 20px; color: var(--frost); margin-top: 2px; }
.ease-note strong { color: var(--text); }
.hold.own-pad, .hold { width: min(46vw, 180px, 26dvh); aspect-ratio: .62; border-radius: 40% 40% 30% 30%; }
.controls .btn { flex: 1; white-space: nowrap; padding: 0 12px; }

/* Rise guide: full-screen glass mound behind the player */
.player > * { position: relative; z-index: 1; }
.player > .rise-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.player.rise-on .phase { text-shadow: 0 1px 14px rgba(0, 0, 0, .35); }
.player.rise-on .phase-sub, .player.rise-on .phase-count { color: var(--text); }

/* Lungs guide */
.lungs svg .cap path { fill: none; stroke-width: 1.2; stroke-dasharray: 3 5; opacity: .6; }
.lungs svg .rim { fill: none; stroke-width: 2.2; }
.lungs svg .airway { fill: none; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.lungs svg .enough { fill: none; stroke-width: 1.2; stroke-dasharray: 2 4; opacity: .9; }
.lungs svg .enough-label { fill: var(--muted); font: 650 9px var(--font); }
.lungs svg .air { opacity: .92; }

/* Pebble guide */
.pebble-wrap { position: relative; width: min(80vw, 320px, 38dvh); aspect-ratio: 1; }
.pebble-wrap svg { width: 100%; height: 100%; overflow: visible; display: block; }
.big-count {
  position: absolute; inset: 0; display: grid; place-items: center; font-size: 3.2rem; font-weight: 760;
  color: rgba(3, 28, 23, .8); font-variant-numeric: tabular-nums; letter-spacing: -.03em; pointer-events: none;
}
.big-count.on-dark { color: var(--text); }
:root[data-theme="light"] .big-count { color: rgba(255,255,255,.95); }

/* Find your pace */
.cal-note { margin: 0 0 4px; font-size: .98rem; }
.hold {
  position: relative; width: min(72vw, 290px, 38dvh); aspect-ratio: 1; padding: 0; border: 0; background: none; cursor: pointer;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: none; border-radius: 50%;
}
.hold { overflow: visible; }
.hold .big-count { display: none; } /* no live counting during the pace test */
.tries { display: flex; justify-content: center; gap: 10px; margin-top: 12px; }
.tries span { width: 16px; height: 14px; border-radius: 52% 48% 44% 56% / 60% 52% 48% 40%; border: 1.5px solid var(--line-strong); transition: background-color .4s ease, border-color .4s ease; }
.tries span.on { background: var(--seafoam); border-color: var(--seafoam); }
.pace-result { display: flex; justify-content: center; gap: 22px; font-size: clamp(2.6rem, 13vw, 3.4rem); font-weight: 760; letter-spacing: -.04em; line-height: 1; margin: 6px 0 18px; }
.pace-result span:last-child { color: var(--seafoam); }

/* Body figure */
.bodyfig { width: min(84vw, 340px); }
.bodyfig svg { width: 100%; height: auto; display: block; overflow: visible; }
.bodyfig .hand { fill: var(--cobalt); }
.bodyfig .hand.chest { fill: color-mix(in srgb, var(--cobalt) 50%, white); }
.bodyfig text { fill: var(--soft); font: 650 11px var(--font); }
.bodyfig .arrow { stroke: var(--cobalt); stroke-width: 2.4; fill: none; stroke-linecap: round; stroke-linejoin: round; transition: opacity .4s ease; }

/* Steps guide */
.steps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; width: 100%; max-width: 380px; }
.step {
  position: relative; overflow: hidden; text-align: left; padding: 18px 16px; min-height: 108px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--pebble-radius);
  transition: transform .5s var(--ease-out), border-color .4s ease;
}
.step:not(.active) > svg { opacity: .45; }
.step:not(.active) > span:not(.n) { color: var(--muted); }
.step:nth-child(2) { border-radius: 30px 24px 32px 26px / 26px 32px 24px 30px; }
.step:nth-child(3) { border-radius: 24px 32px 28px 26px / 32px 26px 30px 24px; }
.step .rise { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(to top, color-mix(in srgb, var(--c) 36%, transparent), color-mix(in srgb, var(--c) 6%, transparent)); }
.step svg, .step span { position: relative; }
.step svg { width: 30px; height: 30px; fill: none; stroke: var(--c); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; margin-bottom: 10px; }
.step span { font-weight: 700; font-size: 1rem; }
.step .n { position: absolute; top: 14px; right: 16px; font-size: .8rem; color: var(--soft); font-variant-numeric: tabular-nums; }
.step.active { border-color: color-mix(in srgb, var(--c) 60%, var(--line)); transform: translateY(-3px); }

/* End of an exercise: one slow ripple outward, then the question settles in */
.end-ripple { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 0; }
.end-ripple svg { grid-area: 1 / 1; width: min(60vw, 260px); overflow: visible; opacity: 0; animation: ripple-out 2.2s cubic-bezier(.16, 1, .3, 1) both; }
.end-ripple svg + svg { animation-delay: .35s; }
.end-ripple path { fill: none; stroke: var(--hue); stroke-width: 2; vector-effect: non-scaling-stroke; }
@keyframes ripple-out { 0% { opacity: .7; transform: scale(.35); } 100% { opacity: 0; transform: scale(2.6); } }
.settle { position: relative; z-index: 1; animation: vt-in .9s cubic-bezier(.16, 1, .3, 1) .55s both; }

/* Check-in */
.center { text-align: center; }
.feel { display: grid; gap: 10px; margin: 24px 0; }
.note { background: var(--surface); border: 1px solid var(--line); border-radius: var(--pebble-radius); padding: 20px; margin: 16px 0; text-align: left; }
.note.alert { background: color-mix(in srgb, var(--coral) 10%, var(--surface)); border-color: color-mix(in srgb, var(--coral) 30%, var(--line)); }
.note.alert h2 { color: var(--coral); }
.note ul { margin: 8px 0 0; padding-left: 1.2em; }
.note li { margin: 5px 0; }
.intro-list { padding: 0; margin: 4px 0 18px; list-style: none; counter-reset: s; }
.intro-list li { position: relative; padding: 14px 0 14px 46px; border-bottom: 1px solid var(--line); counter-increment: s; color: var(--soft); }
.intro-list li::before {
  content: counter(s); position: absolute; left: 0; top: 13px; width: 30px; height: 27px;
  border-radius: 52% 48% 44% 56% / 60% 52% 48% 40%; background: color-mix(in srgb, var(--hue, var(--seafoam)) 20%, transparent);
  color: var(--hue, var(--seafoam)); font-weight: 750; font-size: .85rem; display: grid; place-items: center;
}
.intro-cta { position: sticky; bottom: 0; padding: 14px 0 max(16px, env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.intro-meta { color: var(--muted); font-size: .92rem; }

/* Grounding */
.ground-step { text-align: center; }
.ground-num { font-size: 5rem; font-weight: 780; color: var(--lilac); line-height: 1; letter-spacing: -.04em; }
.ground-dots { display: flex; justify-content: center; gap: 12px; margin: 26px 0 18px; flex-wrap: wrap; }
.ground-dot {
  width: 58px; height: 52px; border: 1.5px solid color-mix(in srgb, var(--lilac) 60%, transparent); background: transparent;
  border-radius: 52% 48% 44% 56% / 60% 52% 48% 40%; cursor: pointer; font: inherit; font-weight: 750; color: var(--lilac);
  transition: background-color .35s ease, transform .35s var(--ease-out), color .3s ease;
}
.ground-dot:nth-child(2n) { border-radius: 46% 54% 58% 42% / 50% 44% 56% 50%; }
.ground-dot.on { background: var(--lilac); color: var(--r0); transform: scale(1.06) rotate(-4deg); }

/* Positions */
.positions { display: grid; gap: 12px; }
.pos { display: grid; grid-template-columns: 112px 1fr; gap: 16px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--pebble-radius); padding: 14px; }
.pos svg { width: 112px; height: 112px; background: var(--surface-2); border-radius: 18px; }
.pos svg .p { fill: none; stroke: var(--sage); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.pos svg .f { fill: none; stroke: var(--line-strong); stroke-width: 4; stroke-linecap: round; }
.pos svg .h { fill: var(--sage); }
.pos h3 { margin-bottom: 4px; }
.pos p { margin: 0; font-size: .93rem; color: var(--soft); }
@media (max-width: 360px) { .pos { grid-template-columns: 1fr; } .pos svg { margin: 0 auto; } }

/* Settings */
.setting { padding: 18px 0; border-bottom: 1px solid var(--line); }
.setting h3 { margin-bottom: 10px; }
.seg { display: flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.seg button {
  flex: 1 1 0; min-height: 50px; border-radius: 12px; border: 0; background: transparent;
  font: inherit; font-weight: 700; color: var(--soft); cursor: pointer; padding: 6px 4px; font-size: .95rem;
}
.seg button small { display: block; font-weight: 500; color: var(--muted); font-size: .74rem; }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); box-shadow: 0 2px 8px -3px rgba(0,0,0,.5); }
.toggle { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.switch { position: relative; width: 54px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--line-strong); border-radius: 99px; transition: background-color .3s ease; }
.switch span::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: var(--text); transition: transform .35s var(--ease-out); }
.switch input:checked + span { background: var(--seafoam); }
.switch input:checked + span::after { transform: translateX(22px); background: var(--on-accent); }
.switch input:focus-visible + span { outline: 2px solid var(--seafoam); outline-offset: 3px; }

/* Article pages */
.article h2 { margin-top: 1.6em; }
.article ul { padding-left: 1.2em; }
.article li { margin: 7px 0; color: var(--soft); }
.article li strong { color: var(--text); }
.article > p { color: var(--soft); }
.loop { display: grid; margin: 16px 0; counter-reset: loop; }
.loop div { position: relative; padding: 12px 0 12px 46px; color: var(--soft); }
.loop div::before {
  counter-increment: loop; content: counter(loop); position: absolute; left: 0; top: 10px; width: 30px; height: 28px;
  border-radius: 52% 48% 44% 56% / 60% 52% 48% 40%; background: color-mix(in srgb, var(--seafoam) 18%, transparent);
  color: var(--seafoam); display: grid; place-items: center; font-weight: 750; font-size: .85rem;
}
.loop div:not(:last-child)::after { content: ""; position: absolute; left: 15px; top: 40px; bottom: -8px; width: 1px; background: var(--line-strong); }

/* Install hint */
.install { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--pebble-radius); padding: 12px 14px; margin: 24px 0 0; font-size: .93rem; color: var(--soft); }
.install p { margin: 0; flex: 1; }
.install button { flex: none; }
.install .x { background: none; border: 0; color: var(--muted); width: 40px; height: 40px; cursor: pointer; display: grid; place-items: center; }
.install .x svg, .share-glyph { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.share-glyph { display: inline-block; vertical-align: -0.2em; }

.foot { max-width: 600px; margin: 36px auto 0; padding: 18px 20px max(22px, env(safe-area-inset-bottom)); font-size: .8rem; color: var(--muted); text-align: center; }
body.playing .foot, body.playing .topbar { display: none; }

@media (max-height: 640px) {
  .pebble-wrap { width: min(62vw, 230px); }
  .bodyfig { width: min(66vw, 250px); }
  .phase { min-height: 100px; }
  .phase-label { font-size: 1.4rem; }
  .phase-word { font-size: 2.8rem; }
  .hold { width: min(56vw, 210px); }
  .btn { min-height: 52px; }
  .hero { --hs: min(40vw, 150px); }
  .guides button { min-height: 44px; font-size: .74rem; }
  .canvas-box { min-height: 200px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  body.playing .player { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto 1fr auto auto; column-gap: 24px; max-width: 900px; }
  body.playing .player-head, body.playing .guides { grid-column: 1 / -1; }
  body.playing .stage { grid-row: 3 / 6; min-height: 0; }
  body.playing .pebble-wrap { width: min(40vw, 54vh); }
  body.playing .phase { align-self: end; }
}

/* Route transitions */
::view-transition-old(root) { animation: vt-out .2s ease both; }
::view-transition-new(root) { animation: vt-in .45s var(--ease-out) both; }
@keyframes vt-out { to { opacity: 0; filter: blur(4px); } }
@keyframes vt-in { from { opacity: 0; filter: blur(6px); transform: translateY(8px); } }
.fade-in { animation: vt-in .45s var(--ease-out) both; }
@media (prefers-reduced-motion: reduce) {
  .end-ripple { display: none; }
  .settle { animation: none; }
  .fade-in, ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
