/* ==========================================================================
   Prana — design tokens
   ========================================================================== */
:root {
  --bg: #f5f4fa;
  --surface: #ffffff;
  --surface-2: #efedf7;
  --surface-3: #e6e3f2;
  --text: #1b1930;
  --muted: #6c6984;
  --line: rgba(27, 25, 48, .09);

  --breathe: #12a594;
  --move: #ee5f38;
  --yoga: #8a63f0;
  --mind: #4776e6;
  --challenge: #e08e0b;
  --accent: var(--breathe);

  --fig: #2a2740;
  --fig-far: #b3afc9;
  --fig-eye: #ffffff;
  --floor: rgba(27, 25, 48, .16);

  --shadow: 0 1px 2px rgba(27, 25, 48, .05), 0 8px 24px rgba(27, 25, 48, .06);
  --r: 20px;
  --r-sm: 12px;
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tabbar-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0e17;
    --surface: #1a1925;
    --surface-2: #232232;
    --surface-3: #2c2b3d;
    --text: #f1f0f8;
    --muted: #a3a0b8;
    --line: rgba(255, 255, 255, .08);
    --fig: #eceaf8;
    --fig-far: #6b6884;
    --fig-eye: #1a1925;
    --floor: rgba(255, 255, 255, .18);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0e17;
  --surface: #1a1925;
  --surface-2: #232232;
  --surface-3: #2c2b3d;
  --text: #f1f0f8;
  --muted: #a3a0b8;
  --line: rgba(255, 255, 255, .08);
  --fig: #eceaf8;
  --fig-far: #6b6884;
  --fig-eye: #1a1925;
  --floor: rgba(255, 255, 255, .18);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
body.playing { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
p { margin: 0; }
svg { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; border-radius: 10px; }

#app { max-width: 720px; margin: 0 auto; min-height: 100vh; }

/* Top bar ---------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: -.02em; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 10px;
  background: conic-gradient(from 210deg, var(--breathe), var(--mind), var(--yoga), var(--move), var(--breathe));
  position: relative;
}
.brand-mark::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--bg); opacity: .92; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent;
  display: inline-grid; place-items: center; color: var(--text);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }

/* Main view --------------------------------------------------------------- */
#view { padding: 4px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px); outline: none; }
.view-enter { animation: viewIn .28s ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Tab bar ----------------------------------------------------------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  max-width: 720px; margin: 0 auto;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11.5px; font-weight: 600; color: var(--muted);
}
.tabbar a .ti svg { width: 24px; height: 24px; }
.tabbar a.active { color: var(--tab-color, var(--accent)); }
.tabbar a[data-tab="today"] { --tab-color: var(--text); }
.tabbar a[data-tab="breathe"] { --tab-color: var(--breathe); }
.tabbar a[data-tab="move"] { --tab-color: var(--move); }
.tabbar a[data-tab="yoga"] { --tab-color: var(--yoga); }
.tabbar a[data-tab="mind"] { --tab-color: var(--mind); }

/* ==========================================================================
   Components
   ========================================================================== */
.page-head { margin: 8px 0 18px; }
.page-head h1 { font-size: 30px; font-weight: 750; letter-spacing: -.025em; }
.page-head p { color: var(--muted); margin-top: 4px; }
.eyebrow { font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }

.section { margin: 26px 0 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section h2 { font-size: 19px; font-weight: 700; }
.section a, .section .link { font-size: 14px; color: var(--muted); font-weight: 600; background: none; border: 0; padding: 0; }

.card {
  background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 16px; position: relative; overflow: hidden;
}
.card + .card { margin-top: 12px; }
.card.flat { box-shadow: none; background: var(--surface-2); }

.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 560px) { .grid-auto { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 559px) { .grid-auto { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.tiny { font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.spacer { flex: 1; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 22px; border-radius: 14px; border: 0;
  background: var(--surface-2); color: var(--text); font-weight: 650; font-size: 16px;
  transition: transform .12s ease, filter .12s ease;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 20px; height: 20px; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-block { width: 100%; }
.btn-sm { height: 36px; padding: 0 14px; border-radius: 11px; font-size: 14px; }
.btn-ghost { background: transparent; }
.btn-danger { background: color-mix(in srgb, #e5484d 14%, transparent); color: #e5484d; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 6px; margin: 0 -16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip.active { background: var(--accent); border-color: transparent; color: #fff; }
.chip svg { width: 16px; height: 16px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); padding: 4px; border-radius: 14px; gap: 4px; margin-bottom: 16px; }
.seg button { height: 38px; border: 0; border-radius: 11px; background: transparent; font-weight: 650; color: var(--muted); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.pill svg { width: 13px; height: 13px; }
.pill.accent { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }

/* Session cards (lists) */
.s-card {
  display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: var(--r);
  background: var(--surface); box-shadow: var(--shadow); position: relative;
}
.s-card + .s-card { margin-top: 10px; }
.s-card .s-icon {
  flex: none; width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent);
}
.s-card .s-icon svg { width: 26px; height: 26px; }
.s-card .s-icon.fig { background: var(--surface-2); overflow: hidden; }
.s-card .s-icon.fig svg { width: 100%; height: 100%; }
.s-card h3 { font-size: 16.5px; font-weight: 700; }
.s-card .s-sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.s-card .s-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.s-card .chev { color: var(--muted); flex: none; }
.s-card .chev svg { width: 18px; height: 18px; }
.s-card .done-mark { position: absolute; top: 10px; right: 10px; width: 22px; height: 22px; border-radius: 50%; background: var(--breathe); color: #fff; display: grid; place-items: center; }
.s-card .done-mark svg { width: 13px; height: 13px; }
.s-card.is-done { opacity: .75; }

/* Hero banner cards */
.hero {
  border-radius: 24px; padding: 20px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--c1, #12a594), var(--c2, #4776e6));
  box-shadow: 0 10px 30px color-mix(in srgb, var(--c1, #12a594) 30%, transparent);
}
.hero h2 { font-size: 22px; font-weight: 750; }
.hero p { opacity: .92; margin-top: 4px; }
.hero .btn { background: rgba(255, 255, 255, .95); color: #1b1930; margin-top: 16px; }
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .25), transparent 70%);
}

/* Figure cards (exercise / pose library) */
.fig-card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.fig-card .fig-thumb { aspect-ratio: 5 / 4; background: var(--surface-2); padding: 6px 4px 0; }
.fig-card .fig-thumb svg { width: 100%; height: 100%; }
.fig-card .fig-body { padding: 10px 12px 12px; }
.fig-card h3 { font-size: 14.5px; font-weight: 700; }
.fig-card .sk { font-size: 12.5px; color: var(--muted); font-style: italic; }

/* Figure SVG */
.fig-svg { width: 100%; height: 100%; overflow: visible; }
.fig-svg .limb, .fig-svg .torso { fill: none; stroke: var(--fig); stroke-linecap: round; stroke-linejoin: round; }
.fig-svg .limb { stroke-width: 9; }
.fig-svg .limb.far { stroke: var(--fig-far); }
.fig-svg .torso { stroke-width: 13; }
.fig-svg .head { fill: var(--fig); }
.fig-svg .eye { fill: var(--fig-eye); }
.fig-svg .fig-floor { stroke: var(--floor); stroke-width: 3; stroke-linecap: round; }
.fig-svg .fig-mat { fill: color-mix(in srgb, var(--accent) 22%, transparent); }
.fig-svg .fig-prop { fill: var(--floor); }

/* Detail pages */
.detail-stage {
  border-radius: 24px; background: var(--surface-2); aspect-ratio: 4 / 3; padding: 16px 12px 8px; margin-bottom: 16px;
  position: relative; overflow: hidden;
}
.detail-stage::before { content: ""; position: absolute; inset: auto -20% -60% -20%; height: 80%; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 20%, transparent), transparent); }
.detail-stage > div { position: relative; width: 100%; height: 100%; }
.detail-title h1 { font-size: 28px; font-weight: 760; letter-spacing: -.02em; }
.detail-title .sk { color: var(--accent); font-weight: 650; font-style: italic; margin-top: 2px; }
.detail-title p { color: var(--muted); margin-top: 8px; }
.facts { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 4px; }
.list-steps { counter-reset: s; list-style: none; margin: 0; padding: 0; }
.list-steps li { counter-increment: s; position: relative; padding: 8px 0 8px 40px; }
.list-steps li::before {
  content: counter(s); position: absolute; left: 0; top: 7px; width: 28px; height: 28px; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-weight: 750; font-size: 14px;
  display: grid; place-items: center;
}
.list-dots { margin: 0; padding-left: 20px; }
.list-dots li { padding: 3px 0; }
.caution {
  display: flex; gap: 10px; padding: 12px 14px; border-radius: 14px; font-size: 14px;
  background: color-mix(in srgb, var(--challenge) 13%, transparent); color: var(--text);
}
.caution svg { flex: none; width: 20px; height: 20px; color: var(--challenge); margin-top: 1px; }
.sticky-cta {
  position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); z-index: 5; margin-top: 18px;
}
.sticky-cta .btn { width: 100%; height: 54px; font-size: 17px; }

.pattern { display: flex; gap: 6px; flex-wrap: wrap; }
.pattern span { padding: 6px 11px; border-radius: 10px; background: var(--surface-2); font-weight: 650; font-size: 14px; }
.pattern span b { color: var(--accent); }

.picker { display: flex; gap: 8px; flex-wrap: wrap; }
.picker button { min-width: 56px; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 650; }
.picker button.active { background: var(--accent); color: #fff; border-color: transparent; }

.ex-list .ex-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ex-list .ex-row:last-child { border-bottom: 0; }
.ex-row .ex-fig { width: 64px; height: 52px; flex: none; border-radius: 12px; background: var(--surface-2); padding: 3px; }
.ex-row .ex-fig svg { width: 100%; height: 100%; }
.ex-row .ex-name { font-weight: 650; }
.ex-row .ex-time { margin-left: auto; color: var(--muted); font-weight: 600; font-size: 14px; }

/* Today ------------------------------------------------------------------- */
.today-top { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.goal-ring { width: 118px; height: 118px; position: relative; }
.goal-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.goal-ring .track { stroke: var(--surface-3); }
.goal-ring .val { stroke: url(#goalGrad); transition: stroke-dashoffset .8s ease; }
.goal-ring .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.goal-ring .center b { font-size: 26px; font-weight: 780; display: block; line-height: 1; }
.goal-ring .center span { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-inline { display: flex; gap: 18px; margin-top: 10px; }
.stat-inline div b { font-size: 20px; font-weight: 760; display: flex; align-items: center; gap: 4px; }
.stat-inline div b svg { width: 18px; height: 18px; color: var(--move); }
.stat-inline div span { font-size: 12.5px; color: var(--muted); font-weight: 600; }

.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 18px; }
.week-strip .d { text-align: center; font-size: 12px; color: var(--muted); font-weight: 650; }
.week-strip .dot {
  width: 34px; height: 34px; margin: 5px auto 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 700;
}
.week-strip .dot.hit { background: linear-gradient(135deg, var(--breathe), var(--mind)); color: #fff; }
.week-strip .dot.today { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }
.week-strip .dot svg { width: 16px; height: 16px; }

.prog-bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.prog-bar > i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }

.quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick a {
  border-radius: 16px; padding: 14px; background: var(--surface); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px; font-weight: 700; font-size: 15px;
}
.quick a .qi { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.quick a .qi svg { width: 20px; height: 20px; }
.quick a small { display: block; font-weight: 600; color: var(--muted); font-size: 12.5px; margin-top: 1px; }

/* Program day grid */
.day-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
.day-grid .dg {
  aspect-ratio: 1; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center;
  font-weight: 700; font-size: 14px; color: var(--muted); position: relative;
}
.day-grid .dg.done { background: var(--accent); color: #fff; }
.day-grid .dg.next { box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent); }
.day-grid .dg svg { width: 16px; height: 16px; }

/* Progress ---------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--surface); border-radius: 16px; padding: 14px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 26px; font-weight: 780; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 600; }
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 150px; padding-top: 10px; }
.bars .bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bars .bar i { width: 100%; max-width: 34px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, var(--breathe), var(--mind)); min-height: 4px; }
.bars .bar i.zero { background: var(--surface-3); }
.bars .bar span { font-size: 12px; color: var(--muted); font-weight: 650; }
.bars .bar em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--muted); }
.goal-line { position: relative; }
.heat { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); grid-template-rows: repeat(7, auto); gap: 3px; }
.heat i { aspect-ratio: 1; max-width: 22px; border-radius: 4px; background: var(--surface-3); }
.row .heat { display: flex; }
.row .heat i { width: 12px; }
.heat i.l1 { background: color-mix(in srgb, var(--breathe) 35%, var(--surface-3)); }
.heat i.l2 { background: color-mix(in srgb, var(--breathe) 60%, var(--surface-3)); }
.heat i.l3 { background: color-mix(in srgb, var(--breathe) 85%, var(--surface-3)); }
.heat i.l4 { background: var(--breathe); }
.heat i.future { visibility: hidden; }
.split-row { display: grid; grid-template-columns: 90px 1fr 54px; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; font-weight: 600; }
.split-row .prog-bar { height: 10px; }
.split-row span:last-child { text-align: right; color: var(--muted); }
.badges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .badges { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.badge { text-align: center; padding: 14px 8px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.badge .bi { width: 46px; height: 46px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #f7c948, #f08c2b); color: #fff; }
.badge .bi svg { width: 22px; height: 22px; }
.badge b { font-size: 13px; display: block; }
.badge span { font-size: 11.5px; color: var(--muted); display: block; margin-top: 2px; }
.badge.locked { opacity: .5; }
.badge.locked .bi { background: var(--surface-3); color: var(--muted); }
.pb-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); }
.pb-row:last-child { border-bottom: 0; }
.pb-row b { font-size: 18px; }
.log-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.log-row:last-child { border-bottom: 0; }
.log-row .dotc { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* Forms / settings */
.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; }
.field label { font-weight: 600; }
.field .hint { font-size: 13px; color: var(--muted); font-weight: 500; }
.input, select.input {
  height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  padding: 0 12px; font: inherit; font-size: 15px; min-width: 0;
}
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3); transition: background .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + span { background: var(--breathe); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--breathe) 50%, transparent); }

/* Onboarding */
.onboard { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; padding: 20px 4px; }
.onboard .orb-demo { width: 150px; height: 150px; margin: 0 auto 26px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #7ee2d4, var(--breathe) 55%, #0c6e63); animation: breathe 8s ease-in-out infinite; box-shadow: 0 0 60px color-mix(in srgb, var(--breathe) 45%, transparent); }
@keyframes breathe { 0%, 100% { transform: scale(.7); } 50% { transform: scale(1); } }

/* Install sheet & update bar */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 90; background: rgba(10, 9, 20, .45);
  display: flex; align-items: flex-end; justify-content: center; animation: plIn .2s ease both;
}
.sheet {
  width: 100%; max-width: 520px; background: var(--surface); color: var(--text);
  border-radius: 24px 24px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .2); animation: sheetUp .28s cubic-bezier(.2, .9, .3, 1) both;
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.share-glyph { display: inline-grid; vertical-align: -4px; color: #0a84ff; }
.share-glyph svg { width: 18px; height: 18px; }
.install-card { border: 1px solid color-mix(in srgb, var(--breathe) 30%, transparent); }
.update-bar {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 85;
  top: calc(env(safe-area-inset-top) + 10px); width: calc(100% - 24px); max-width: 520px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 10px 10px 16px; border-radius: 16px; background: var(--text); color: var(--bg);
  font-weight: 650; font-size: 14.5px; box-shadow: var(--shadow); animation: plIn .3s ease both;
}
.update-bar span { display: flex; align-items: center; gap: 8px; }
.update-bar svg { width: 18px; height: 18px; }
.update-bar .btn { background: var(--breathe); color: #fff; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px); z-index: 80;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 14px; font-weight: 650; font-size: 14.5px;
  transition: opacity .25s, transform .25s; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
   Player (immersive session overlay)
   ========================================================================== */
.player {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column;
  color: #fff;
  background:
    radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--accent) 40%, transparent), transparent 70%),
    radial-gradient(100% 60% at 50% 110%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    #0d0c16;
  --fig: #f4f3fb; --fig-far: rgba(255, 255, 255, .38); --fig-eye: #0d0c16; --floor: rgba(255, 255, 255, .22);
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  animation: plIn .3s ease both;
}
@keyframes plIn { from { opacity: 0; } to { opacity: 1; } }
.player .icon-btn { color: #fff; }
.player .icon-btn:hover { background: rgba(255, 255, 255, .1); }
.pl-top { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.pl-title { flex: 1; text-align: center; font-weight: 700; font-size: 16px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-progress { height: 4px; margin: 0 20px; border-radius: 99px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.pl-progress > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .3s linear; }
.pl-segs { display: flex; gap: 3px; margin: 0 20px; }
.pl-segs i { flex: 1; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, .16); overflow: hidden; position: relative; }
.pl-segs i.done { background: var(--accent); }
.pl-segs i b { position: absolute; inset: 0; width: 0; background: var(--accent); }
.pl-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px 20px; min-height: 0; max-width: 720px; width: 100%; margin: 0 auto; }
.pl-controls { display: flex; align-items: center; justify-content: center; gap: 22px; padding: 16px 20px 24px; }
.pl-btn { width: 56px; height: 56px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .12); color: #fff; display: grid; place-items: center; }
.pl-btn svg { width: 24px; height: 24px; }
.pl-btn.main { width: 76px; height: 76px; background: #fff; color: #0d0c16; }
.pl-btn.main svg { width: 30px; height: 30px; }
.pl-btn:disabled { opacity: .3; }
.pl-btn:active { transform: scale(.95); }

/* Breath orb */
.orb-wrap { position: relative; width: min(78vw, 46vh, 360px); aspect-ratio: 1; display: grid; place-items: center; }
.orb-ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.orb-ring circle { fill: none; stroke-width: 3; }
.orb-ring .bg { stroke: rgba(255, 255, 255, .12); }
.orb-ring .fg { stroke: rgba(255, 255, 255, .85); stroke-linecap: round; }
.orb {
  position: absolute; inset: 9%; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 35%, #fff), var(--accent) 52%, color-mix(in srgb, var(--accent) 50%, #000));
  box-shadow: 0 0 80px color-mix(in srgb, var(--accent) 55%, transparent), inset 0 -10px 40px rgba(0, 0, 0, .25);
  transform: scale(.45); transition: transform 1s ease-in-out;
}
.orb.rest { animation: orbRest 6s ease-in-out infinite; }
@keyframes orbRest { 0%, 100% { transform: scale(.55); } 50% { transform: scale(.66); } }
.orb-center { position: relative; text-align: center; text-shadow: 0 2px 12px rgba(0, 0, 0, .3); pointer-events: none; }
.b-label { font-size: clamp(20px, 5vw, 28px); font-weight: 750; letter-spacing: -.01em; }
.b-count { font-size: clamp(44px, 12vw, 68px); font-weight: 800; line-height: 1; margin-top: 4px; font-variant-numeric: tabular-nums; }
.b-sub { margin-top: 22px; min-height: 48px; text-align: center; opacity: .82; max-width: 420px; font-size: 15.5px; }
.b-meta { display: flex; justify-content: center; gap: 22px; font-size: 14px; opacity: .75; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.b-tap { margin-top: 14px; }
.btn-light { background: #fff; color: #0d0c16; height: 56px; padding: 0 28px; border-radius: 16px; font-size: 17px; }

/* Timed (workout / yoga) */
.tm-stage { position: relative; width: 100%; flex: 1; min-height: 200px; max-height: 46vh; display: flex; }
.tm-stage .fig-box { width: 100%; height: 100%; }
.tm-badge { position: absolute; top: 4px; left: 50%; transform: translateX(-50%); padding: 5px 12px; border-radius: 99px; background: rgba(255, 255, 255, .14); font-size: 12px; font-weight: 800; letter-spacing: .1em; }
.tm-info { text-align: center; margin-top: 6px; }
.tm-name { font-size: clamp(22px, 6vw, 30px); font-weight: 780; letter-spacing: -.02em; }
.tm-sub { opacity: .75; font-weight: 600; margin-top: 2px; font-style: italic; }
.tm-row { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 12px; }
.tm-timer { position: relative; width: 96px; height: 96px; display: grid; place-items: center; }
.tm-timer svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.tm-timer circle { fill: none; stroke-width: 6; }
.tm-timer .bg { stroke: rgba(255, 255, 255, .14); }
.tm-timer .fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .2s linear; }
.tm-time { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tm-reps { text-align: center; }
.tm-reps b { font-size: 40px; font-weight: 800; display: block; line-height: 1; }
.tm-cue { margin-top: 12px; text-align: center; min-height: 44px; opacity: .85; max-width: 460px; font-size: 15px; }
.tm-next { margin-top: 6px; font-size: 13.5px; opacity: .6; font-weight: 600; }
.tm-breath { display: inline-block; margin-top: 8px; padding: 4px 14px; border-radius: 99px; background: color-mix(in srgb, var(--accent) 40%, transparent); font-weight: 750; letter-spacing: .04em; }

/* Meditation */
.med-orb { width: min(64vw, 40vh, 300px); aspect-ratio: 1; border-radius: 50%; position: relative; }
.med-orb::before, .med-orb::after { content: ""; position: absolute; inset: 0; border-radius: 50%; }
.med-orb::before { background: radial-gradient(circle at 40% 35%, color-mix(in srgb, var(--accent) 45%, #fff), var(--accent) 50%, transparent 72%); filter: blur(2px); animation: medPulse 10s ease-in-out infinite; }
.med-orb::after { inset: -18%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 30%, transparent), transparent 65%); animation: medPulse 10s ease-in-out infinite reverse; }
.med-orb.paused::before, .med-orb.paused::after { animation-play-state: paused; }
@keyframes medPulse { 0%, 100% { transform: scale(.82); opacity: .8; } 50% { transform: scale(1); opacity: 1; } }
.med-line { margin-top: 30px; min-height: 90px; text-align: center; font-size: clamp(17px, 4.6vw, 21px); line-height: 1.5; max-width: 480px; transition: opacity .8s ease; font-weight: 500; }
.med-line.fade { opacity: 0; }
.med-time { font-size: 15px; opacity: .7; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 10px; }

/* Summary */
.summary { text-align: center; max-width: 420px; }
.summary .check { width: 92px; height: 92px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); box-shadow: 0 0 60px color-mix(in srgb, var(--accent) 60%, transparent); animation: pop .5s cubic-bezier(.2, 1.6, .4, 1) both; }
.summary .check svg { width: 44px; height: 44px; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }
.summary h2 { font-size: 28px; font-weight: 800; }
.summary p { opacity: .8; margin-top: 6px; }
.summary .sum-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 22px 0; }
.summary .sum-stats div { background: rgba(255, 255, 255, .08); border-radius: 16px; padding: 14px; }
.summary .sum-stats b { font-size: 24px; display: block; font-weight: 800; }
.summary .sum-stats span { font-size: 12.5px; opacity: .7; font-weight: 600; }
.summary .results { text-align: left; background: rgba(255, 255, 255, .08); border-radius: 16px; padding: 6px 16px; margin-bottom: 18px; }
.summary .results .pb-row { border-color: rgba(255, 255, 255, .1); }
.summary .new-pb { color: #ffd166; font-weight: 800; font-size: 12px; letter-spacing: .06em; }

.countdown { font-size: 120px; font-weight: 850; animation: pop .5s ease both; }

@media (prefers-reduced-motion: reduce) {
  .view-enter, .player, .summary .check { animation: none; }
  .orb.rest, .med-orb::before, .med-orb::after, .onboard .orb-demo { animation-duration: 20s; }
}
@media (max-height: 640px) {
  .pl-controls { padding: 8px 20px 12px; gap: 16px; }
  .pl-btn.main { width: 64px; height: 64px; }
  .tm-timer { width: 80px; height: 80px; }
}
