/* =========================================================================
   Ritmo — stile
   ========================================================================= */
:root {
  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --surface-2: #EEF1F6;
  --border: #E1E5EE;
  --text: #182032;
  --muted: #687089;
  --primary: #1FB57A;
  --primary-d: #168A5C;
  --primary-soft: #DDF5EA;
  --on-primary: #FFFFFF;
  --gold: #FFB020;
  --gold-d: #D98E00;
  --danger: #EE4B6A;
  --danger-d: #C2304E;
  --danger-soft: #FDE6EB;
  --ok-soft: #DDF5EA;

  --c-breath: #2D9CFF;
  --c-pelvic: #FF8A3D;
  --c-mind: #8B5CF6;
  --c-control: #EF476F;
  --c-couple: #E54BA5;

  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 20px rgba(16, 24, 40, .06);
  --radius: 20px;
  --radius-s: 14px;
  --tabbar-h: 72px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E131F;
    --surface: #161C2B;
    --surface-2: #1E2537;
    --border: #283149;
    --text: #EDF0F7;
    --muted: #98A1B8;
    --primary: #2BCB8A;
    --primary-d: #1C9765;
    --primary-soft: rgba(43, 203, 138, .14);
    --on-primary: #06120D;
    --danger-soft: rgba(238, 75, 106, .16);
    --ok-soft: rgba(43, 203, 138, .16);
    --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: #0E131F;
  --surface: #161C2B;
  --surface-2: #1E2537;
  --border: #283149;
  --text: #EDF0F7;
  --muted: #98A1B8;
  --primary: #2BCB8A;
  --primary-d: #1C9765;
  --primary-soft: rgba(43, 203, 138, .14);
  --on-primary: #06120D;
  --danger-soft: rgba(238, 75, 106, .16);
  --ok-soft: rgba(43, 203, 138, .16);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--primary); }
svg.ic { width: 1.25em; height: 1.25em; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ----------------------------------------------------------------- layout */
.app { max-width: 600px; margin: 0 auto; min-height: 100dvh; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); }
.view { padding: 8px 16px 24px; outline: none; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 1.25rem; letter-spacing: -.02em; margin-right: auto; }
.brand-logo { width: 32px; height: 32px; border-radius: 10px; background: var(--primary); display: grid; place-items: center; color: #fff; }
.brand-logo svg { width: 20px; height: 20px; stroke-width: 2.8; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-size: .95rem; padding: 6px 10px; border-radius: 999px; background: var(--surface); border: 2px solid var(--border); }
.pill.flame { color: #FF7A1A; }
.pill.flame.off { color: var(--muted); }
.pill.xp { color: var(--gold-d); }
:root[data-theme="dark"] .pill.xp { color: var(--gold); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.xp { color: var(--gold); } }
.pill.lvl { color: var(--c-mind); }

.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); z-index: 30;
  width: 100%; max-width: 600px;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 2px solid var(--border);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; border: 2px solid transparent; background: none; border-radius: 14px; color: var(--muted); font-size: .72rem; font-weight: 800; }
.tab svg.ic { width: 24px; height: 24px; }
.tab.active { color: var(--primary); background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 35%, transparent); }

/* ------------------------------------------------------------ typography */
h1, h2, h3 { margin: 0; letter-spacing: -.02em; line-height: 1.2; }
.h1 { font-size: 1.6rem; font-weight: 900; }
.h2 { font-size: 1.2rem; font-weight: 900; }
.h3 { font-size: 1.02rem; font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.xs { font-size: .78rem; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 26px 2px 12px; font-size: 1.1rem; font-weight: 900; }
.section-title .muted { font-size: .85rem; font-weight: 700; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 12px; }
.card.soft { background: var(--surface-2); border-color: transparent; }

/* --------------------------------------------------------------- buttons */
.btn {
  --b: var(--primary); --bd: var(--primary-d); --fg: var(--on-primary);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px; border: none; border-radius: 16px;
  background: var(--b); color: var(--fg);
  font-weight: 900; font-size: .95rem; text-transform: uppercase; letter-spacing: .04em;
  box-shadow: 0 4px 0 var(--bd);
  transition: transform .08s, box-shadow .08s, filter .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--bd); }
.btn:disabled { --b: var(--surface-2); --bd: var(--border); --fg: var(--muted); cursor: not-allowed; }
.btn:focus-visible, .tab:focus-visible, .node:focus-visible, .ex-card:focus-visible, .opt:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 60%, transparent); outline-offset: 2px; }
.btn-block { width: 100%; }
.btn-lg { min-height: 56px; font-size: 1.02rem; }
.btn-ghost { --b: var(--surface); --bd: var(--border); --fg: var(--text); border: 2px solid var(--border); box-shadow: 0 3px 0 var(--border); }
.btn-ghost:active { box-shadow: none; transform: translateY(3px); }
.btn-gold { --b: var(--gold); --bd: var(--gold-d); --fg: #2B1B00; }
.btn-danger { --b: var(--danger); --bd: var(--danger-d); --fg: #fff; }
.btn-cat { --b: var(--cat); --bd: color-mix(in srgb, var(--cat) 70%, #000); --fg: #fff; }
.btn-sm { min-height: 38px; padding: 6px 12px; font-size: .8rem; border-radius: 12px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; border: 2px solid var(--border); background: var(--surface); color: var(--muted); }
.icon-btn.plain { border-color: transparent; background: none; }
.link-btn { background: none; border: none; padding: 6px; color: var(--muted); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------------------ chips/tags */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 8px 14px; border-radius: 999px; border: 2px solid var(--border); background: var(--surface); font-weight: 800; font-size: .88rem; color: var(--muted); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 8px; font-size: .74rem; font-weight: 800; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag.cat { background: color-mix(in srgb, var(--cat) 15%, transparent); color: var(--cat); }
.tag.warn { background: color-mix(in srgb, var(--c-control) 14%, transparent); color: var(--c-control); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* ------------------------------------------------------------------ hero */
.hero { position: relative; overflow: hidden; border-radius: 24px; padding: 18px; color: #fff;
  background: linear-gradient(135deg, #17A06B 0%, #1FB57A 45%, #3BC9A0 100%); box-shadow: 0 6px 0 #138358; }
.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,.1); }
.hero-top { display: flex; gap: 16px; align-items: center; position: relative; z-index: 1; }
.hero-kicker { font-size: .78rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; opacity: .9; }
.hero h1 { font-size: 1.45rem; font-weight: 900; margin: 2px 0 4px; }
.hero p { margin: 0; opacity: .92; font-size: .9rem; font-weight: 600; }
.hero .btn { --b: #fff; --bd: rgba(0,0,0,.18); --fg: #138358; margin-top: 16px; position: relative; z-index: 1; }
.hero-bar { height: 8px; background: rgba(255,255,255,.25); border-radius: 99px; overflow: hidden; margin-top: 14px; position: relative; z-index: 1; }
.hero-bar > i { display: block; height: 100%; background: #fff; border-radius: 99px; }
.hero-meta { display: flex; justify-content: space-between; font-size: .78rem; font-weight: 800; margin-top: 6px; opacity: .9; position: relative; z-index: 1; }

.ring { flex: none; position: relative; width: 88px; height: 88px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.ring .bg { stroke: rgba(255,255,255,.25); }
.ring .fg { stroke: #fff; transition: stroke-dashoffset .8s cubic-bezier(.2,.8,.2,1); }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-weight: 900; font-size: 1.25rem; line-height: 1; }
.ring-label small { display: block; font-size: .66rem; font-weight: 800; opacity: .85; margin-top: 2px; }

/* ------------------------------------------------------------ week strip */
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 14px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: .72rem; font-weight: 800; color: var(--muted); }
.wd-dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 2px solid var(--border); color: var(--muted); }
.wd-dot svg.ic { width: 18px; height: 18px; stroke-width: 3; }
.wd.full .wd-dot { background: var(--primary); border-color: var(--primary-d); color: #fff; }
.wd.part .wd-dot { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.wd.today { color: var(--text); }
.wd.today .wd-dot { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--primary); }

/* ---------------------------------------------------------- routine path */
.path { position: relative; display: flex; flex-direction: column; gap: 10px; }
.path::before { content: ""; position: absolute; left: 31px; top: 24px; bottom: 24px; width: 4px; border-radius: 4px; background: var(--border); }
.node { position: relative; display: flex; align-items: center; gap: 14px; text-align: left; width: 100%; padding: 10px 12px 10px 6px; border: none; background: none; border-radius: 18px; -webkit-tap-highlight-color: transparent; }
.node:hover .node-body { border-color: color-mix(in srgb, var(--cat) 45%, var(--border)); }
.node-icon { position: relative; z-index: 1; flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--cat); color: #fff; box-shadow: 0 4px 0 color-mix(in srgb, var(--cat) 65%, #000), 0 0 0 5px var(--bg); }
.node-icon svg.ic { width: 24px; height: 24px; }
.node.done .node-icon { background: var(--gold); box-shadow: 0 4px 0 var(--gold-d), 0 0 0 5px var(--bg); }
.node.next .node-icon { animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 4px 0 color-mix(in srgb, var(--cat) 65%, #000), 0 0 0 5px var(--bg), 0 0 0 5px color-mix(in srgb, var(--cat) 0%, transparent); } 50% { box-shadow: 0 4px 0 color-mix(in srgb, var(--cat) 65%, #000), 0 0 0 5px var(--bg), 0 0 0 11px color-mix(in srgb, var(--cat) 25%, transparent); } }
.node-body { flex: 1; min-width: 0; background: var(--surface); border: 2px solid var(--border); border-radius: 18px; padding: 12px 14px; transition: border-color .15s; }
.node-title { font-weight: 900; font-size: 1rem; line-height: 1.25; }
.node-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; font-size: .8rem; color: var(--muted); font-weight: 700; }
.node.done .node-title { color: var(--muted); }
.node-check { flex: none; color: var(--gold-d); }

/* ---------------------------------------------------------- feature cards */
.sos { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px 16px; border-radius: var(--radius); border: 2px solid color-mix(in srgb, var(--c-breath) 40%, var(--border)); background: color-mix(in srgb, var(--c-breath) 9%, var(--surface)); }
.sos-ic { width: 46px; height: 46px; flex: none; border-radius: 14px; display: grid; place-items: center; background: var(--c-breath); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--c-breath) 65%, #000); }
.tip { display: flex; gap: 12px; align-items: flex-start; }
.tip-ic { flex: none; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--gold) 22%, transparent); color: var(--gold-d); }
.checkin-card { border-color: color-mix(in srgb, var(--c-mind) 40%, var(--border)); background: color-mix(in srgb, var(--c-mind) 8%, var(--surface)); }

/* --------------------------------------------------------- exercise grid */
.ex-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 520px) { .ex-grid { grid-template-columns: 1fr 1fr; } }
.ex-card { display: flex; flex-direction: column; gap: 8px; text-align: left; padding: 14px; border-radius: var(--radius); border: 2px solid var(--border); background: var(--surface); box-shadow: 0 4px 0 var(--border); transition: transform .08s, box-shadow .08s; }
.ex-card:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--border); }
.ex-head { display: flex; align-items: center; gap: 10px; }
.ex-ic { width: 42px; height: 42px; flex: none; border-radius: 13px; display: grid; place-items: center; background: color-mix(in srgb, var(--cat) 16%, transparent); color: var(--cat); }
.ex-title { font-weight: 900; line-height: 1.2; }
.ex-short { font-size: .87rem; color: var(--muted); font-weight: 600; margin: 0; }
.ex-count { margin-left: auto; font-size: .75rem; font-weight: 900; color: var(--muted); }

/* --------------------------------------------------------------- lessons */
.lesson-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px; text-align: left; border-radius: var(--radius); border: 2px solid var(--border); background: var(--surface); box-shadow: 0 4px 0 var(--border); }
.lesson-row + .lesson-row { margin-top: 12px; }
.lesson-num { width: 48px; height: 48px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 900; background: var(--c-mind); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--c-mind) 65%, #000); }
.lesson-row.done .lesson-num { background: var(--gold); box-shadow: 0 3px 0 var(--gold-d); }
.stars { color: var(--gold); letter-spacing: 1px; font-size: .9rem; }

/* -------------------------------------------------------------- progress */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 16px; border: 2px solid var(--border); background: var(--surface); }
.stat-ic { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 11px; }
.stat b { display: block; font-size: 1.2rem; font-weight: 900; line-height: 1.1; }
.stat span { font-size: .76rem; color: var(--muted); font-weight: 800; }
.bar { height: 12px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--gold); transition: width .6s; }
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 4px; }
.heatmap i { aspect-ratio: 1; border-radius: 4px; background: var(--surface-2); }
.heatmap i.l1 { background: color-mix(in srgb, var(--primary) 35%, var(--surface-2)); }
.heatmap i.l2 { background: color-mix(in srgb, var(--primary) 65%, var(--surface-2)); }
.heatmap i.l3 { background: var(--primary); }
.heatmap i.t { outline: 2px solid var(--text); outline-offset: 1px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: .8rem; font-weight: 700; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 4px; border-radius: 2px; background: var(--k); }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 10px; font-weight: 700; font-family: inherit; }
.cat-bars { display: flex; flex-direction: column; gap: 10px; }
.cat-bar { display: grid; grid-template-columns: 110px 1fr 32px; align-items: center; gap: 10px; font-size: .85rem; font-weight: 800; }
.cat-bar .bar > i { background: var(--cat); }
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 16px; border: 2px solid var(--border); background: var(--surface); text-align: center; }
.badge-ic { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: #fff; box-shadow: 0 3px 0 var(--gold-d); }
.badge b { font-size: .78rem; line-height: 1.2; }
.badge small { font-size: .68rem; color: var(--muted); font-weight: 700; line-height: 1.2; }
.badge.off { opacity: .55; }
.badge.off .badge-ic { background: var(--surface-2); color: var(--muted); box-shadow: 0 3px 0 var(--border); }
.journal-entry { border-left: 4px solid var(--c-mind); padding: 4px 0 4px 12px; }
.journal-entry + .journal-entry { margin-top: 14px; }
.journal-entry p { margin: 2px 0; font-size: .9rem; }

/* -------------------------------------------------------------- settings */
.list { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; width: 100%; border: none; background: none; text-align: left; }
.list-row + .list-row { border-top: 2px solid var(--border); }
.list-row .ic-wrap { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.list-row .lbl { flex: 1; font-weight: 800; }
.list-row .lbl small { display: block; font-weight: 600; color: var(--muted); font-size: .8rem; }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-2); border: 2px solid var(--border); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch input:checked + i { background: var(--primary); border-color: var(--primary-d); }
.switch input:checked + i::after { transform: translateX(22px); }
.switch input:focus-visible + i { outline: 3px solid color-mix(in srgb, var(--primary) 60%, transparent); outline-offset: 2px; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); }
.seg button { border: none; background: none; padding: 6px 10px; border-radius: 9px; font-weight: 800; font-size: .82rem; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
select.sel { padding: 8px 10px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface); font-weight: 800; }
.prose { font-size: .93rem; }
.prose p { margin: 0 0 10px; }
.prose ul { margin: 0 0 10px; padding-left: 20px; }
.prose li { margin-bottom: 4px; }
.sources li { margin-bottom: 8px; font-size: .84rem; color: var(--muted); }
.sources a { font-weight: 800; }
.disclaimer { font-size: .82rem; color: var(--muted); text-align: center; margin: 24px 8px 0; }

/* ================================================================ PLAYER */
.player { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; animation: slideUp .28s cubic-bezier(.2,.8,.2,1); }
.player[hidden], .modal[hidden] { display: none; }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.pl-inner { width: 100%; max-width: 600px; margin: 0 auto; height: 100%; display: flex; flex-direction: column; }
.pl-head { display: flex; align-items: center; gap: 12px; padding: calc(12px + env(safe-area-inset-top)) 16px 8px; }
.pl-progress { flex: 1; height: 14px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.pl-progress > i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--cat, var(--primary)); transition: width .3s; position: relative; }
.pl-progress > i::after { content: ""; position: absolute; left: 8px; right: 8px; top: 3px; height: 3px; border-radius: 2px; background: rgba(255,255,255,.35); }
.pl-body { flex: 1; overflow-y: auto; padding: 8px 16px 20px; }
.pl-foot { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 2px solid var(--border); background: var(--bg); display: flex; flex-direction: column; gap: 10px; }
.pl-foot .row .btn { flex: 1; }

.intro-hero { text-align: center; padding: 10px 0 6px; }
.intro-ic { width: 84px; height: 84px; margin: 0 auto 12px; border-radius: 26px; display: grid; place-items: center; background: var(--cat); color: #fff; box-shadow: 0 5px 0 color-mix(in srgb, var(--cat) 65%, #000); }
.intro-ic svg.ic { width: 40px; height: 40px; }
.intro-hero h2 { font-size: 1.5rem; font-weight: 900; }
.intro-hero .tags { justify-content: center; margin-top: 10px; }
.intro-sec { margin-top: 18px; }
.intro-sec h3 { font-size: .8rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.intro-sec p { margin: 0; }
.how { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.how li { counter-increment: s; position: relative; padding: 8px 0 8px 42px; }
.how li::before { content: counter(s); position: absolute; left: 0; top: 6px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: .85rem; background: color-mix(in srgb, var(--cat) 16%, transparent); color: var(--cat); }
.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: 14px; font-size: .9rem; font-weight: 600; }
.callout.science { background: color-mix(in srgb, var(--c-breath) 10%, transparent); }
.callout.warn { background: var(--danger-soft); }
.callout.tip { background: color-mix(in srgb, var(--gold) 14%, transparent); }
.callout svg.ic { margin-top: 2px; }

/* visual engine */
.stage { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 100%; gap: 18px; padding: 10px 0; }
.viz { position: relative; width: min(72vw, 300px); aspect-ratio: 1; display: grid; place-items: center; }
.viz-halo { position: absolute; inset: 0; border-radius: 50%; background: color-mix(in srgb, var(--cat) 10%, transparent); border: 3px dashed color-mix(in srgb, var(--cat) 30%, transparent); }
.viz-core { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--cat) 70%, #fff), var(--cat)); box-shadow: 0 10px 40px color-mix(in srgb, var(--cat) 40%, transparent); transform: scale(.35); will-change: transform; }
.viz-kegel .viz-core { transform: none; background: var(--surface-2); overflow: hidden; border: 4px solid color-mix(in srgb, var(--cat) 40%, var(--border)); box-shadow: inset 0 4px 16px rgba(0,0,0,.08); }
.viz-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0%; background: linear-gradient(180deg, color-mix(in srgb, var(--cat) 75%, #fff), var(--cat)); will-change: height; }
.viz-fill::before { content: ""; position: absolute; left: -10%; right: -10%; top: -8px; height: 16px; border-radius: 50%; background: color-mix(in srgb, var(--cat) 60%, #fff); }
.viz-kegel.relax .viz-core { border-color: color-mix(in srgb, var(--c-breath) 50%, var(--border)); }
.viz-text { position: relative; z-index: 2; color: var(--text); min-width: 140px; padding: 10px 20px; border-radius: 22px; background: color-mix(in srgb, var(--surface) 90%, transparent); box-shadow: var(--shadow); }
.btn.next { animation: nudge 1.2s ease-in-out infinite; }
@keyframes nudge { 0%,100% { transform: none; } 50% { transform: translateY(-3px); } }
.viz-label { font-size: 1.35rem; font-weight: 900; line-height: 1.1; }
.viz-count { font-size: 3.2rem; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; margin-top: 4px; }
.stage-sub { font-weight: 700; color: var(--muted); min-height: 1.5em; }
.counters { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.counter { padding: 6px 14px; border-radius: 99px; background: var(--surface); border: 2px solid var(--border); font-weight: 900; font-size: .9rem; font-variant-numeric: tabular-nums; }
.ctrl-row { display: flex; gap: 12px; justify-content: center; align-items: center; }
.round-btn { width: 72px; height: 72px; border-radius: 50%; border: none; display: grid; place-items: center; background: var(--cat, var(--primary)); color: #fff; box-shadow: 0 5px 0 color-mix(in srgb, var(--cat, var(--primary)) 65%, #000); }
.round-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 color-mix(in srgb, var(--cat, var(--primary)) 65%, #000); }
.round-btn svg.ic { width: 30px; height: 30px; fill: currentColor; }
.round-btn.sm { width: 52px; height: 52px; background: var(--surface); color: var(--muted); border: 2px solid var(--border); box-shadow: 0 3px 0 var(--border); }
.round-btn.sm svg.ic { width: 22px; height: 22px; fill: none; }

/* guided */
.g-step { display: flex; flex-direction: column; gap: 16px; padding-top: 6px; }
.g-kicker { font-size: .8rem; font-weight: 900; color: var(--cat); text-transform: uppercase; letter-spacing: .08em; }
.g-title { font-size: 1.5rem; font-weight: 900; }
.g-text { font-size: 1.08rem; font-weight: 600; white-space: pre-line; }
.timer { position: relative; width: 150px; height: 150px; margin: 6px auto 0; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.timer .bg { stroke: var(--surface-2); }
.timer .fg { stroke: var(--cat); transition: stroke-dashoffset .25s linear; }
.timer-label { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.timer-btn { position: absolute; inset: 0; border: none; background: none; border-radius: 50%; }
.rate { background: var(--surface); border: 2px solid var(--border); border-radius: 16px; padding: 14px; }
.rate-head { display: flex; justify-content: space-between; font-weight: 800; margin-bottom: 8px; }
.rate-head b { color: var(--cat); font-size: 1.2rem; }
input[type=range] { width: 100%; accent-color: var(--cat, var(--primary)); height: 28px; }

/* arousal */
.ar-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ar-stat { text-align: center; padding: 10px 4px; border-radius: 14px; background: var(--surface); border: 2px solid var(--border); }
.ar-stat b { display: block; font-size: 1.35rem; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.1; }
.ar-stat span { font-size: .72rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.ar-msg { margin: 14px 0; padding: 14px; border-radius: 16px; background: var(--surface); border: 2px solid var(--border); font-weight: 700; text-align: center; }
.ar-scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.lv { position: relative; aspect-ratio: 1.15; border-radius: 16px; border: none; font-size: 1.4rem; font-weight: 900; color: #fff; background: var(--lv); box-shadow: 0 4px 0 color-mix(in srgb, var(--lv) 65%, #000); -webkit-tap-highlight-color: transparent; }
.lv:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--lv) 65%, #000); }
.lv.cur { outline: 4px solid var(--text); outline-offset: 2px; }
.lv.limit::after { content: "STOP"; position: absolute; left: 0; right: 0; bottom: 4px; font-size: .55rem; letter-spacing: .08em; }
.ar-legend { display: flex; justify-content: space-between; font-size: .75rem; font-weight: 800; color: var(--muted); margin-top: 8px; }
.ar-pause { margin-top: 14px; padding: 18px; border-radius: 22px; text-align: center; color: #fff; background: linear-gradient(135deg, #F0476A, #FF8A3D); box-shadow: 0 5px 0 #B9314F; animation: pop .3s cubic-bezier(.2,1.4,.4,1); }
.ar-pause h2 { font-size: 2.2rem; font-weight: 900; letter-spacing: .06em; }
.ar-pause p { margin: 8px 0 12px; font-weight: 700; }
.ar-pause .btn { --b: #fff; --bd: rgba(0,0,0,.2); --fg: #B9314F; }
.mini-breath { width: 90px; height: 90px; margin: 4px auto 6px; position: relative; display: grid; place-items: center; }
.mini-breath i { position: absolute; inset: 0; border-radius: 50%; background: rgba(255,255,255,.3); animation: breathe 10s ease-in-out infinite; }
.mini-breath span { position: relative; font-weight: 900; font-size: .8rem; }
@keyframes breathe { 0% { transform: scale(.45); } 40% { transform: scale(1); } 100% { transform: scale(.45); } }
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.ar-final { margin-top: 14px; padding: 16px; border-radius: 18px; background: var(--ok-soft); border: 2px solid var(--primary); text-align: center; font-weight: 700; }

/* journal */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 16px; }
.field label { font-weight: 900; }
.field textarea { min-height: 76px; resize: vertical; padding: 12px; border-radius: 14px; border: 2px solid var(--border); background: var(--surface); line-height: 1.4; }
.field textarea:focus { outline: none; border-color: var(--cat); }
.chip-sel { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-sel button { padding: 8px 12px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface); font-weight: 800; font-size: .85rem; }
.chip-sel button.on { border-color: var(--cat); background: color-mix(in srgb, var(--cat) 14%, transparent); color: var(--cat); }

/* done */
.done { text-align: center; padding: 20px 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.done-badge { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: #fff; box-shadow: 0 6px 0 var(--gold-d); animation: pop .5s cubic-bezier(.2,1.6,.4,1); }
.done-badge svg.ic { width: 60px; height: 60px; stroke-width: 3; }
.done h2 { font-size: 1.7rem; font-weight: 900; }
.done-stats { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.done-stat { min-width: 96px; border-radius: 16px; border: 2px solid var(--border); overflow: hidden; background: var(--surface); }
.done-stat .h { background: var(--k); color: #fff; font-size: .7rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; padding: 4px 8px; }
.done-stat b { display: block; padding: 8px; font-size: 1.25rem; font-weight: 900; color: var(--k); }
.feel { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.feel button { padding: 12px 6px; border-radius: 14px; border: 2px solid var(--border); background: var(--surface); font-weight: 800; font-size: .88rem; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.feel button .e { font-size: 1.5rem; line-height: 1; }
.feel button.on { border-color: var(--primary); background: var(--primary-soft); }

/* lesson / quiz */
.l-card { padding-top: 10px; }
.l-card h2 { font-size: 1.45rem; font-weight: 900; margin-bottom: 14px; }
.l-card .body { font-size: 1.08rem; font-weight: 600; }
.l-art { width: 96px; height: 96px; border-radius: 28px; display: grid; place-items: center; background: color-mix(in srgb, var(--c-mind) 16%, transparent); color: var(--c-mind); margin-bottom: 18px; }
.l-art svg.ic { width: 46px; height: 46px; }
.q-title { font-size: 1.3rem; font-weight: 900; margin: 10px 0 18px; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { text-align: left; padding: 14px 16px; border-radius: 16px; border: 2px solid var(--border); background: var(--surface); box-shadow: 0 4px 0 var(--border); font-weight: 800; transition: transform .08s; }
.opt:active { transform: translateY(2px); }
.opt.sel { border-color: var(--c-breath); background: color-mix(in srgb, var(--c-breath) 12%, var(--surface)); box-shadow: 0 4px 0 color-mix(in srgb, var(--c-breath) 60%, transparent); }
.opt.right { border-color: var(--primary); background: var(--ok-soft); box-shadow: 0 4px 0 var(--primary); }
.opt.wrong { border-color: var(--danger); background: var(--danger-soft); box-shadow: 0 4px 0 var(--danger); }
.feedback { border-top: none; }
.feedback.ok { background: var(--ok-soft); }
.feedback.ko { background: var(--danger-soft); }
.fb-title { display: flex; align-items: center; gap: 8px; font-size: 1.2rem; font-weight: 900; }
.feedback.ok .fb-title { color: var(--primary-d); }
.feedback.ko .fb-title { color: var(--danger); }
.fb-text { font-weight: 700; font-size: .95rem; }

/* ================================================================= MODAL */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(8, 12, 20, .55); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-width: 600px; max-height: 92dvh; overflow-y: auto; background: var(--surface); border-radius: 26px 26px 0 0; padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); animation: slideUp .28s cubic-bezier(.2,.8,.2,1); }
@media (min-width: 640px) { .modal { align-items: center; } .sheet { border-radius: 26px; } }
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sheet-head h2 { flex: 1; font-size: 1.25rem; font-weight: 900; }
.dots { display: flex; gap: 6px; justify-content: center; margin: 18px 0; }
.dots i { width: 8px; height: 8px; border-radius: 99px; background: var(--border); transition: width .2s; }
.dots i.on { width: 24px; background: var(--primary); }
.welcome-art { width: 110px; height: 110px; margin: 6px auto 16px; border-radius: 32px; display: grid; place-items: center; background: var(--primary); color: #fff; box-shadow: 0 6px 0 var(--primary-d); }
.welcome-art svg.ic { width: 54px; height: 54px; }
.pillars { display: grid; gap: 10px; margin-top: 14px; }
.pillar { display: flex; align-items: center; gap: 12px; font-weight: 800; }
.pillar i { width: 38px; height: 38px; flex: none; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--cat) 16%, transparent); color: var(--cat); }
.choice { display: grid; gap: 10px; margin-top: 14px; }
.choice button { padding: 14px; border-radius: 16px; border: 2px solid var(--border); background: var(--surface); font-weight: 800; text-align: left; box-shadow: 0 3px 0 var(--border); }
.choice button.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 3px 0 var(--primary); }
.pedt-result { text-align: center; padding: 10px 0; }
.pedt-score { font-size: 3.2rem; font-weight: 900; line-height: 1; }

/* ================================================================= TOAST */
.toast { display: flex; align-items: center; gap: 8px; width: max-content; position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 22px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 80; padding: 12px 18px; border-radius: 16px; background: var(--text); color: var(--bg); font-weight: 800; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

.empty { text-align: center; padding: 18px 8px; color: var(--muted); font-weight: 700; }

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