/* Shapeshift — plum dark / blush light, colour-coded by workout type */
:root {
  --bg: #fbf6f7;
  --bg-2: #f3eaee;
  --surface: #ffffff;
  --surface-2: #f6eff2;
  --ink: #2a1d2f;
  --ink-2: #6e5c72;
  --ink-3: #a294a6;
  --line: #eadfe4;
  --accent: #d6336c;
  --accent-ink: #ffffff;
  --accent-soft: #fde3ec;
  --strength: #d6336c;
  --strength-soft: #fde3ec;
  --cardio: #2a86c9;
  --cardio-soft: #dcefff;
  --mobility: #2f9e78;
  --mobility-soft: #daf3e8;
  --rest: #9a8a6c;
  --rest-soft: #f1ebde;
  --good: #2f9e78;
  --warn: #c98a1a;
  --shadow: 0 1px 2px rgba(60, 20, 50, .06), 0 8px 24px rgba(60, 20, 50, .06);
  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 10px;
  --font: "Avenir Next", "Avenir", "Segoe UI Variable Display", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --tab-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1d1626; --bg-2: #241b2f; --surface: #2a2036; --surface-2: #33283f;
    --ink: #f6eef7; --ink-2: #bba9c2; --ink-3: #7f6f88; --line: #3b2f48;
    --accent: #ff6b97; --accent-ink: #2a0d1a; --accent-soft: #4a2238;
    --strength: #ff6b97; --strength-soft: #48223a; --cardio: #6cc0ff; --cardio-soft: #1f3550;
    --mobility: #6fdcb0; --mobility-soft: #1f3e36; --rest: #d8c7a3; --rest-soft: #3b3328;
    --good: #6fdcb0; --warn: #f2c063;
    --shadow: 0 1px 2px rgba(0,0,0,.25), 0 10px 30px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1d1626; --bg-2: #241b2f; --surface: #2a2036; --surface-2: #33283f;
  --ink: #f6eef7; --ink-2: #bba9c2; --ink-3: #7f6f88; --line: #3b2f48;
  --accent: #ff6b97; --accent-ink: #2a0d1a; --accent-soft: #4a2238;
  --strength: #ff6b97; --strength-soft: #48223a; --cardio: #6cc0ff; --cardio-soft: #1f3550;
  --mobility: #6fdcb0; --mobility-soft: #1f3e36; --rest: #d8c7a3; --rest-soft: #3b3328;
  --good: #6fdcb0; --warn: #f2c063;
  --shadow: 0 1px 2px rgba(0,0,0,.25), 0 10px 30px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.45; }
body { min-height: 100dvh; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
svg { display: block; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

#app { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 18px) 16px calc(var(--tab-h) + env(safe-area-inset-bottom) + 28px); }
#app.fullscreen { padding-bottom: calc(env(safe-area-inset-bottom) + 24px); }

/* ---------- type ---------- */
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; line-height: 1.12; }
.display { font-size: 34px; font-weight: 800; letter-spacing: -0.035em; }
h2 { font-size: 21px; font-weight: 750; }
h3 { font-size: 17px; font-weight: 700; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }
p { margin: 0; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head .sub { color: var(--ink-2); font-size: 15px; margin-top: 4px; }
.section { margin-top: 26px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.inset { background: var(--surface-2); border-radius: var(--r-md); padding: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn { appearance: none; border: 0; border-radius: 999px; padding: 12px 18px; font-weight: 700; font-size: 15.5px; background: var(--surface-2); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; text-decoration: none; transition: transform .08s ease, background .15s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.danger { background: transparent; color: #d64545; }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 13px; min-height: 36px; font-size: 14px; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:disabled { opacity: .45; }
.icon-btn { appearance: none; border: 0; background: var(--surface-2); color: var(--ink); width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.plain { background: transparent; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 650; cursor: pointer; text-decoration: none; font-size: 15px; }

/* ---------- forms ---------- */
.field { display: block; }
.field > span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; font-weight: 600; }
.input, select.input, textarea.input { width: 100%; border: 1.5px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 11px 12px; font-size: 16px; outline: none; transition: border-color .15s; }
.input:focus { border-color: var(--accent); }
textarea.input { resize: vertical; min-height: 70px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); }
.seg { display: flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 2px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px 10px; border-radius: 999px; font-weight: 650; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ---------- tab bar ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { flex: 1; max-width: 112px; height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--ink-3); font-size: 11.5px; font-weight: 650; }
.tabbar svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.on { color: var(--accent); }

/* ---------- week strip ---------- */
.weekstrip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 0 -4px; }
.wday { appearance: none; border: 0; background: transparent; padding: 6px 0 8px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; color: var(--ink-2); }
.wday .dname { font-size: 12px; font-weight: 650; }
.wday .dnum { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 750; font-size: 16px; position: relative; }
.wday .dots { display: flex; gap: 3px; height: 6px; }
.wday .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--c, var(--ink-3)); }
.wday .dots i.done { box-shadow: 0 0 0 1.5px var(--bg), 0 0 0 3px var(--c); }
.wday.today .dnum { color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.wday.sel { background: var(--surface); box-shadow: var(--shadow); color: var(--ink); }
.wday.sel .dnum { background: var(--ink); color: var(--bg); box-shadow: none; }
.wday.alldone .dnum::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%; background: var(--good) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 6.2 5 8l4-4.2' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100%; border: 2px solid var(--bg); }

/* ---------- workout hero ---------- */
.type-strength { --c: var(--strength); --cs: var(--strength-soft); }
.type-cardio { --c: var(--cardio); --cs: var(--cardio-soft); }
.type-mobility { --c: var(--mobility); --cs: var(--mobility-soft); }
.type-rest { --c: var(--rest); --cs: var(--rest-soft); }

.hero { border-radius: 26px; padding: 20px 18px 18px; background: var(--cs); position: relative; overflow: hidden; margin-top: 16px; }
.hero .kicker { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; color: var(--c); }
.hero .kicker .pill { background: var(--c); color: var(--bg); padding: 3px 9px; border-radius: 99px; font-size: 12px; }
.hero h2.title { font-size: 40px; font-weight: 850; letter-spacing: -0.045em; line-height: 1; margin: 10px 0 8px; color: var(--ink); }
.hero .meta { color: var(--ink-2); font-size: 14.5px; display: flex; gap: 14px; flex-wrap: wrap; }
.hero .meta b { color: var(--ink); font-weight: 750; }
.hero .notes { margin-top: 12px; font-size: 14.5px; color: var(--ink-2); line-height: 1.45; }
.hero .actions { display: flex; gap: 8px; margin-top: 16px; }
.hero .actions .btn.primary { background: var(--c); color: var(--bg); flex: 1; font-size: 16.5px; min-height: 52px; }
.hero .actions .btn:not(.primary) { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.hero.done::before { content: "Done"; z-index: 1; position: absolute; top: 18px; right: 18px; background: var(--good); color: var(--bg); font-weight: 800; font-size: 12.5px; padding: 4px 10px; border-radius: 99px; }
.hero-glyph { position: absolute; right: -18px; top: -22px; width: 130px; height: 130px; opacity: .12; color: var(--c); pointer-events: none; }

.exlist { margin-top: 14px; border-radius: var(--r-md); background: color-mix(in srgb, var(--surface) 75%, transparent); overflow: hidden; }
.exitem { display: flex; align-items: center; gap: 12px; padding: 11px 13px; }
.exitem + .exitem { border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.exitem .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--surface-2); color: var(--ink-2); flex: none; }
.exitem .n.g { background: var(--c); color: var(--bg); }
.exitem .name { font-weight: 650; font-size: 15px; }
.exitem .target { font-size: 13.5px; color: var(--ink-2); }
.exitem .check { margin-left: auto; color: var(--good); font-weight: 800; font-size: 13px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.stat { background: var(--surface); border-radius: var(--r-md); padding: 12px; box-shadow: var(--shadow); }
.stat .v { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; }
.stat .v small { font-size: 14px; font-weight: 650; color: var(--ink-2); }
.stat .l { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.ring-mini { width: 100%; height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.ring-mini i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }

/* ---------- check-in ---------- */
.checkin { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.metric { background: var(--surface-2); border-radius: var(--r-md); padding: 10px 12px 10px; position: relative; }
.metric label { font-size: 12.5px; font-weight: 650; color: var(--ink-2); display: flex; justify-content: space-between; }
.metric input { width: 100%; border: 0; background: transparent; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; padding: 2px 0 0; outline: none; font-variant-numeric: tabular-nums; }
.metric input::placeholder { color: var(--ink-3); font-weight: 600; }
.metric .bar { height: 4px; background: color-mix(in srgb, var(--ink-3) 30%, transparent); border-radius: 4px; margin-top: 6px; overflow: hidden; }
.metric .bar i { display: block; height: 100%; background: var(--good); }
.metric.wide { grid-column: 1 / -1; }
.metric textarea { width: 100%; border: 0; background: transparent; font-size: 15px; outline: none; resize: none; min-height: 40px; padding: 4px 0 0; }
.trend { font-size: 12.5px; font-weight: 700; }
.trend.down { color: var(--good); }
.trend.up { color: var(--warn); }

/* ---------- plan ---------- */
.weeknav { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.week { margin-bottom: 26px; }
.week-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; padding: 0 2px; }
.week-head h2 { font-size: 22px; }
.week-head .phase { font-size: 13.5px; color: var(--ink-2); font-weight: 600; }
.week-prog { height: 5px; border-radius: 5px; background: var(--surface-2); margin: 0 2px 10px; overflow: hidden; }
.week-prog i { display: block; height: 100%; background: var(--accent); }
.day { display: grid; grid-template-columns: 46px 1fr; gap: 10px; padding: 6px 0; border-radius: var(--r-md); transition: background .12s; min-height: 58px; }
.day.drop { background: var(--accent-soft); }
.day.past .dlabel { opacity: .55; }
.dlabel { text-align: center; padding-top: 8px; }
.dlabel .dn { font-size: 12px; color: var(--ink-2); font-weight: 650; }
.dlabel .dd { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; }
.day.today .dlabel .dd { color: var(--accent); }
.dslots { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.wcard { display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: var(--r-md); padding: 10px 10px 10px 0; box-shadow: var(--shadow); text-decoration: none; position: relative; overflow: hidden; touch-action: pan-y; }
.wcard::before { content: ""; width: 5px; align-self: stretch; background: var(--c); border-radius: 0 4px 4px 0; flex: none; }
.wcard .wt { font-weight: 750; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wcard .ws { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wcard.done .wt::after { content: " ✓"; color: var(--good); }
.wcard.skipped { opacity: .55; }
.wcard.skipped .wt { text-decoration: line-through; }
.wcard.type-rest { background: transparent; box-shadow: none; border: 1.5px dashed var(--line); }
.handle { width: 34px; height: 40px; display: grid; place-items: center; color: var(--ink-3); cursor: grab; touch-action: none; flex: none; margin-left: auto; }
.handle svg { width: 18px; height: 18px; fill: currentColor; }
.addday { appearance: none; border: 1.5px dashed var(--line); background: transparent; color: var(--ink-3); border-radius: var(--r-md); padding: 8px; font-size: 13.5px; font-weight: 650; cursor: pointer; text-align: left; padding-left: 14px; }
.dragging-ghost { position: fixed; z-index: 100; pointer-events: none; transform: rotate(-1.5deg) scale(1.03); box-shadow: 0 18px 40px rgba(0,0,0,.25); opacity: .96; }
.wcard.lifted { opacity: .25; }

/* ---------- editor ---------- */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.topbar .grow { font-weight: 700; color: var(--ink-2); font-size: 15px; }
.title-input { font-size: 30px; font-weight: 850; letter-spacing: -0.04em; border: 0; background: transparent; width: 100%; padding: 0; outline: none; }
.excard { background: var(--surface); border-radius: var(--r-lg); padding: 14px; box-shadow: var(--shadow); margin-top: 10px; }
.excard .exname { font-size: 17px; font-weight: 750; border: 0; background: transparent; width: 100%; outline: none; padding: 2px 0; }
.excard .grid-fields { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 8px; }
.excard .grid-fields label { display: block; }
.excard .grid-fields span { display: block; font-size: 11.5px; color: var(--ink-2); font-weight: 650; margin-bottom: 3px; }
.excard .grid-fields input { width: 100%; border: 1.5px solid var(--line); border-radius: 9px; background: var(--surface-2); padding: 8px 6px; text-align: center; font-weight: 700; font-size: 15px; outline: none; }
.excard .grid-fields input:focus { border-color: var(--accent); }
.excard .exnotes { width: 100%; border: 0; background: transparent; color: var(--ink-2); font-size: 14px; margin-top: 8px; outline: none; resize: none; padding: 0; }
.excard .tools { display: flex; gap: 4px; margin-left: auto; }
.excard .tools .icon-btn { width: 34px; height: 34px; }
.excard .tools .icon-btn svg { width: 17px; height: 17px; }
.gbadge { font-size: 11.5px; font-weight: 800; background: var(--accent-soft); color: var(--accent); padding: 2px 8px; border-radius: 99px; white-space: nowrap; }

/* ---------- session player ---------- */
.player-top { display: flex; align-items: center; gap: 10px; }
.player-top .elapsed { flex: 1; text-align: center; font-weight: 800; font-size: 19px; font-variant-numeric: tabular-nums; }
.progress-line { height: 6px; background: var(--surface-2); border-radius: 6px; margin: 14px 0 16px; overflow: hidden; }
.progress-line i { display: block; height: 100%; background: var(--c, var(--accent)); transition: width .3s ease; }
.exchips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 16px; padding: 2px 16px 6px; scrollbar-width: none; }
.exchips::-webkit-scrollbar { display: none; }
.chip { appearance: none; border: 0; flex: none; background: var(--surface); color: var(--ink-2); font-weight: 650; font-size: 13.5px; padding: 8px 12px; border-radius: 99px; box-shadow: var(--shadow); cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--ink); color: var(--bg); }
.chip.complete { color: var(--good); }
.chip.complete::before { content: "✓ "; }
.ex-hero h2 { font-size: 30px; font-weight: 850; letter-spacing: -0.04em; line-height: 1.05; }
.ex-hero .target { font-size: 16px; color: var(--ink-2); margin-top: 6px; }
.ex-hero .target b { color: var(--ink); }
.ex-hero .cue { margin-top: 10px; font-size: 14.5px; color: var(--ink-2); background: var(--surface-2); padding: 10px 12px; border-radius: var(--r-md); }
.lasttime { margin-top: 10px; font-size: 13.5px; color: var(--ink-2); }
.sets { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.sethead { display: grid; grid-template-columns: 26px 1fr 1fr 48px; gap: 8px; padding: 0 8px; font-size: 12.5px; font-weight: 700; color: var(--ink-3); text-align: center; margin-bottom: -2px; }
.setrow { display: grid; grid-template-columns: 26px 1fr 1fr 48px; gap: 8px; align-items: center; background: var(--surface); border-radius: 18px; padding: 8px; box-shadow: var(--shadow); transition: background .2s, transform .15s; }
.setrow.active { box-shadow: 0 0 0 2.5px var(--c, var(--accent)), var(--shadow); }
.setrow.logged { background: color-mix(in srgb, var(--good) 13%, var(--surface)); }
.setrow .sn { font-weight: 800; font-size: 15px; text-align: center; color: var(--ink-2); }
.stepper { display: flex; align-items: center; background: var(--surface-2); border-radius: 13px; overflow: hidden; height: 48px; }
.stepper button { appearance: none; border: 0; background: transparent; width: 32px; height: 100%; font-size: 21px; font-weight: 700; color: var(--ink-2); cursor: pointer; flex: none; }
.stepper button:active { background: var(--line); }
.stepper input { width: 100%; min-width: 0; border: 0; background: transparent; text-align: center; font-size: 19px; font-weight: 800; outline: none; font-variant-numeric: tabular-nums; padding: 0; }
.stepper .u { font-size: 10.5px; color: var(--ink-3); font-weight: 700; margin: 0 -2px; align-self: flex-end; padding-bottom: 8px; }
.logbtn { appearance: none; border: 0; width: 46px; height: 46px; border-radius: 50%; background: var(--surface-2); color: var(--ink-3); display: grid; place-items: center; cursor: pointer; justify-self: end; transition: background .15s, color .15s, transform .1s; }
.logbtn:active { transform: scale(.92); }
.logbtn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.setrow.active .logbtn { background: var(--c, var(--accent)); color: var(--bg); }
.setrow.logged .logbtn { background: var(--good); color: var(--bg); }
.player-nav { display: flex; gap: 8px; margin-top: 18px; }
.player-nav .btn { flex: 1; }

/* rest sheet */
.rest { position: fixed; inset: auto 0 0 0; z-index: 60; background: var(--ink); color: var(--bg); border-radius: 28px 28px 0 0; padding: 22px 20px calc(env(safe-area-inset-bottom) + 22px); box-shadow: 0 -10px 40px rgba(0,0,0,.3); transform: translateY(105%); transition: transform .32s cubic-bezier(.2,.9,.3,1); max-width: 560px; margin: 0 auto; }
.rest.open { transform: none; }
.rest .rt { display: flex; align-items: center; gap: 18px; }
.rest .ringwrap { width: 128px; height: 128px; position: relative; flex: none; }
.rest .ringwrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.rest .ringwrap .t { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; font-weight: 850; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.rest .label { font-size: 14px; opacity: .7; font-weight: 650; }
.rest .next { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; line-height: 1.2; }
.rest .ctrls { display: flex; gap: 8px; margin-top: 18px; }
.rest .ctrls .btn { flex: 1; background: color-mix(in srgb, var(--bg) 14%, transparent); color: var(--bg); }
.rest .ctrls .btn.primary { background: var(--accent); color: var(--accent-ink); }

/* ---------- timer page ---------- */
.bigring { width: min(78vw, 300px); aspect-ratio: 1; margin: 18px auto 10px; position: relative; }
.bigring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.bigring .t { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.bigring .t .time { font-size: clamp(46px, 15vw, 64px); font-weight: 850; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1; }
.bigring .t .sub { color: var(--ink-2); font-weight: 650; margin-top: 8px; font-size: 15px; }
.presets { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 10px 0 4px; }
.timer-ctrls { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
.timer-ctrls .btn { min-width: 120px; min-height: 54px; font-size: 17px; }
.laps { margin-top: 18px; }
.laps .lap { display: flex; justify-content: space-between; padding: 9px 4px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--ink-3); font-size: 10.5px; font-family: var(--font); }
.chart .dot { fill: var(--surface); stroke-width: 2; }
.chart-legend { display: flex; gap: 14px; font-size: 13px; color: var(--ink-2); margin-top: 6px; flex-wrap: wrap; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.bignum { font-size: 34px; font-weight: 850; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.bignum small { font-size: 16px; color: var(--ink-2); font-weight: 650; letter-spacing: 0; }
.empty { text-align: center; padding: 28px 16px; color: var(--ink-2); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

/* ---------- lists ---------- */
.list { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.list .li { display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-decoration: none; }
.list .li + .li { border-top: 1px solid var(--line); }
.list .li .grow > div:first-child { font-weight: 650; }
.badge { font-size: 12px; font-weight: 750; padding: 3px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badge.grey { background: var(--surface-2); color: var(--ink-2); }

/* ---------- sheet / modal ---------- */
.scrim { position: fixed; inset: 0; background: rgba(20, 8, 20, .45); z-index: 70; opacity: 0; transition: opacity .2s; }
.scrim.open { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 71; background: var(--bg); border-radius: 26px 26px 0 0; padding: 10px 18px calc(env(safe-area-inset-bottom) + 20px); max-height: 90dvh; overflow-y: auto; transform: translateY(100%); transition: transform .3s cubic-bezier(.2,.9,.3,1); max-width: 560px; margin: 0 auto; }
.sheet.open { transform: none; }
.sheet .grabber { width: 40px; height: 5px; border-radius: 5px; background: var(--line); margin: 0 auto 14px; }
.sheet h2 { margin-bottom: 14px; }
.sheet .actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet .actions .btn { flex: 1; }

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

/* ---------- login ---------- */
.login { min-height: 80dvh; display: flex; flex-direction: column; justify-content: center; }
.login .mark { width: 64px; height: 64px; margin-bottom: 22px; }
.login h1 { font-size: 40px; font-weight: 850; letter-spacing: -0.045em; }
.login p { color: var(--ink-2); margin: 8px 0 26px; }
.err { color: #d64545; font-size: 14px; font-weight: 600; margin-top: 10px; min-height: 20px; }

/* celebration */
.celebrate { text-align: center; padding: 10px 0 4px; }
.celebrate .big { font-size: 46px; font-weight: 900; letter-spacing: -0.05em; line-height: 1; }
.rating { display: flex; justify-content: center; gap: 8px; margin: 14px 0 6px; }
.rating button { appearance: none; border: 0; width: 50px; height: 50px; border-radius: 50%; background: var(--surface-2); font-size: 18px; font-weight: 800; color: var(--ink-2); cursor: pointer; }
.rating button.on { background: var(--accent); color: var(--accent-ink); }

.offline-pill { position: fixed; top: calc(env(safe-area-inset-top) + 8px); left: 50%; transform: translateX(-50%); background: var(--warn); color: #2a1d00; font-weight: 750; font-size: 13px; padding: 5px 12px; border-radius: 99px; z-index: 95; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}
@media (min-width: 700px) {
  .display { font-size: 40px; }
}
.rest:not(.open) { box-shadow: none; visibility: hidden; transition: transform .32s cubic-bezier(.2,.9,.3,1), visibility 0s .32s; }

/* ---------- plan generator ---------- */
.create-cta { display: flex; align-items: center; gap: 12px; text-decoration: none; margin-bottom: 12px; background: var(--accent-soft); box-shadow: none; }
.create-cta .icon-btn { background: var(--accent); color: var(--accent-ink); }
.q { margin-top: 26px; }
.q h3 { margin-bottom: 8px; }
.q p.small { margin: -4px 0 8px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices.col { flex-direction: column; }
.choice { appearance: none; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 14px; padding: 11px 14px; font-weight: 650; font-size: 15px; cursor: pointer; text-align: left; transition: border-color .12s, background .12s; }
.choices.col .choice { padding: 14px 16px; }
.choice.on { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 0 0 1px var(--accent); }
.daypick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.daypick button { appearance: none; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 14px; aspect-ratio: 1 / 1.15; font-weight: 800; font-size: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; cursor: pointer; padding: 0; }
.daypick button small { font-size: 10.5px; font-weight: 650; opacity: .8; }
.daypick button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.why { margin: 8px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 14.5px; }
.why li + li { margin-top: 5px; }
.weekpick { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px; padding: 4px 16px 6px; scrollbar-width: none; }
.weekpick::-webkit-scrollbar { display: none; }
.weekpick button { appearance: none; border: 0; flex: none; width: 42px; height: 42px; border-radius: 12px; font-weight: 800; font-size: 15px; cursor: pointer; color: var(--ink); background: var(--surface); box-shadow: inset 0 -4px 0 var(--pc); }
.weekpick .p1 { --pc: color-mix(in srgb, var(--accent) 35%, transparent); }
.weekpick .p2 { --pc: color-mix(in srgb, var(--accent) 65%, transparent); }
.weekpick .p3 { --pc: var(--accent); }
.weekpick .p4 { --pc: var(--mobility); }
.weekpick button.on { background: var(--ink); color: var(--bg); }
.tgt-row { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13.5px; color: var(--ink-2); margin: 10px 2px 4px; }
.tgt-row b { color: var(--ink); }
.rday { background: var(--surface); border-radius: var(--r-lg); padding: 12px 14px; box-shadow: var(--shadow); margin-top: 10px; border-left: 5px solid var(--c); }
.rday.type-rest { background: transparent; box-shadow: none; border: 1.5px dashed var(--line); border-left: 5px solid var(--c); }
.rday-head { display: flex; align-items: center; gap: 12px; }
.rday-day { font-weight: 800; font-size: 13px; color: var(--ink-2); width: 30px; flex: none; }
.rday-title { font-weight: 750; font-size: 16px; }
.rex { margin-top: 8px; border-top: 1px solid var(--line); }
.rex-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); }
.rex-row:last-child { border-bottom: 0; padding-bottom: 2px; }
.rex-name { font-weight: 650; font-size: 14.5px; }
.rex-dose { text-align: right; display: flex; flex-direction: column; font-size: 14px; flex: none; }
