:root {
  --bg: #04182c; --card: #072340; --soft: #0b2d50; --soft2: #103a63; --line: #14426e;
  --mute: #8fa9c4; --mute2: #5f7f9f; --chip: #b7cbe0; --ink: #f3f8fc;
  --acc: #8ad6f7; --on-acc: #04182c; --done: #0d3a55; --warn: #ffb35c; --good: #6fe3a5;
  --r: 22px; --tabs: 74px;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); color: var(--ink); font-family: Manrope, system-ui, sans-serif; }
body { min-height: 100dvh; overscroll-behavior-y: none; }
button, input, select { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
input { background: var(--soft); border: 1px solid transparent; border-radius: 12px; padding: 10px 12px; width: 100%; outline: none; }
input:focus { border-color: var(--acc); }
#view { padding: env(safe-area-inset-top) 0 calc(var(--tabs) + 110px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; }
.pad { padding: 0 16px; }
h1, h2, h3 { letter-spacing: -.01em; }
.muted { color: var(--mute); }
.small { font-size: 13px; }

/* Top bar */
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.top img { height: 30px; }
.who { text-decoration: none; color: var(--ink); display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; background: var(--soft); border-radius: 99px; padding: 4px 12px 4px 4px; }
.av { width: 26px; height: 26px; border-radius: 50%; background: var(--acc); color: var(--on-acc); display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.kicker { color: var(--acc); font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.title { font-size: 36px; line-height: 1; font-weight: 800; text-transform: uppercase; margin-top: 6px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.chip { background: var(--soft); border-radius: 99px; padding: 6px 12px; font-size: 13px; color: var(--chip); }
.chip.warn { color: var(--warn); }

/* Cards and lists */
.card { background: var(--card); border-radius: var(--r); padding: 16px; margin: 12px 12px 0; }
.card h3 { font-size: 18px; font-weight: 800; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.btn { background: var(--acc); color: var(--on-acc); border-radius: 16px; padding: 15px 18px; font-weight: 800; font-size: 16px; width: 100%; }
.btn.ghost { background: transparent; color: var(--chip); border: 1px solid var(--line); }
.btn.soft { background: var(--soft); color: var(--ink); }
.btn.small { padding: 10px 14px; font-size: 14px; width: auto; border-radius: 12px; }
.tip { background: var(--soft); border-radius: 14px; padding: 12px; font-size: 13px; color: var(--chip); line-height: 1.45; margin-top: 12px; }
.tip b { color: var(--ink); }
.exrow { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--soft); }
.exrow:first-child { border-top: 0; }
.thumb { width: 56px; height: 56px; border-radius: 14px; overflow: hidden; background: #fff; flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.exrow b { font-size: 15px; display: block; }
.exrow .muted { font-size: 13px; margin-top: 2px; }
.tag { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--acc); }
.state { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 14px; flex: none; }
.state.ok { background: var(--acc); border-color: var(--acc); color: var(--on-acc); }
.state.part { border-color: var(--acc); color: var(--acc); }
.body-map { display: flex; gap: 6px; }
.muscles { display: flex; gap: 14px; align-items: center; margin: 14px 16px 0; }
.muscles p { font-size: 13px; color: var(--mute); line-height: 1.45; }
.bar { height: 6px; background: var(--soft); border-radius: 99px; overflow: hidden; margin: 14px 16px 0; }
.bar i { display: block; height: 100%; background: var(--acc); border-radius: 99px; transition: width .3s; }

/* Focus mode */
.focus-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 0; gap: 8px; }
.iconbtn { width: 44px; height: 44px; border-radius: 14px; background: var(--soft); display: grid; place-items: center; font-size: 20px; flex: none; }
.dots { display: flex; gap: 4px; flex: 1; }
.dots i { flex: 1; height: 5px; border-radius: 99px; background: var(--soft2); }
.dots i.d { background: var(--acc); } .dots i.c { background: var(--ink); }
.media { height: 230px; position: relative; background: #fff; }
.media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media .badge { position: absolute; left: 12px; top: 12px; background: var(--bg); color: var(--acc); font-weight: 800; font-size: 13px; padding: 4px 10px; border-radius: 8px; }
.media .note { position: absolute; left: 12px; bottom: 12px; right: 12px; background: rgba(4,24,44,.86); color: var(--warn); font-size: 12px; font-weight: 700; padding: 6px 10px; border-radius: 10px; }
.excard { background: var(--card); border-radius: 26px; overflow: hidden; margin: 12px 12px 0; }
.excard .body { padding: 16px; }
.excard h2 { font-size: 26px; font-weight: 800; text-transform: uppercase; line-height: 1.05; }
.excard .sub { color: var(--mute); font-size: 14px; margin-top: 4px; }
.sets { margin-top: 14px; display: grid; gap: 8px; }
.set { display: grid; grid-template-columns: 30px 1fr 1fr 52px; align-items: center; gap: 8px; background: var(--soft); border-radius: 16px; padding: 8px 8px 8px 10px; }
.set.timed { grid-template-columns: 30px 1fr 52px; }
.set .n { font-weight: 800; font-size: 18px; color: var(--mute2); text-align: center; }
.set label { display: flex; align-items: baseline; gap: 4px; background: var(--soft2); border-radius: 12px; padding: 6px 10px; }
.set input { background: transparent; border: 0; padding: 0; font-size: 22px; font-weight: 800; width: 100%; min-width: 0; }
.set small { font-size: 12px; color: var(--mute); }
.set .ck { width: 52px; height: 48px; border-radius: 14px; background: var(--soft2); display: grid; place-items: center; font-size: 22px; font-weight: 800; }
.set.done { background: var(--done); } .set.done .ck { background: var(--acc); color: var(--on-acc); }
.set.next { outline: 2px solid var(--acc); }
.last { font-size: 13px; color: var(--mute); margin-top: 12px; line-height: 1.5; }
.last b { color: var(--acc); }
.effort { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.effort button { background: var(--soft); border-radius: 12px; padding: 12px 0; font-weight: 700; font-size: 15px; }
.effort button.on { background: var(--acc); color: var(--on-acc); }
.row2 { display: flex; gap: 8px; margin-top: 12px; }
.row2 button { flex: 1; border: 1px solid var(--line); border-radius: 12px; padding: 12px 0; font-weight: 700; font-size: 14px; color: var(--chip); }
.cues { margin-top: 12px; display: grid; gap: 6px; font-size: 14px; color: var(--chip); line-height: 1.45; }
.cues li { margin-left: 18px; }
.navrow { display: flex; gap: 8px; margin: 12px 12px 0; }
.navrow .btn { flex: 1; }

/* Rest timer */
.rest { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabs) + 10px + env(safe-area-inset-bottom)); max-width: 536px; margin: 0 auto; background: var(--acc); color: var(--on-acc); border-radius: 22px; padding: 12px 14px 12px 18px; display: flex; align-items: center; justify-content: space-between; z-index: 20; box-shadow: 0 12px 30px rgba(0,0,0,.4); }
.rest[hidden] { display: none; }
.rest .lbl { font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.rest .num { font-size: 34px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.rest .acts { display: flex; gap: 8px; }
.rest button { background: rgba(0,0,0,.14); border-radius: 12px; padding: 10px 12px; font-weight: 800; }
.rest.over { background: var(--good); }

/* Tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(4,24,44,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--soft); display: flex; justify-content: space-around; padding: 8px 6px calc(10px + env(safe-area-inset-bottom)); z-index: 10; }
.tabs[hidden] { display: none; }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--mute2); text-decoration: none; min-width: 60px; padding: 4px 0; }
.tabs svg { width: 24px; height: 24px; }
.tabs a.on { color: var(--acc); }

/* Sheet and toast */
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet .panel { background: var(--card); width: 100%; max-width: 560px; max-height: 85dvh; overflow-y: auto; border-radius: 26px 26px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); }
.sheet .grab { width: 40px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 14px; }
.sheet h3 { font-size: 20px; font-weight: 800; }
.option { color: var(--ink); display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 10px; border-radius: 16px; background: var(--soft); margin-top: 8px; }
.option b { display: block; font-size: 15px; }
.option span { font-size: 12px; color: var(--mute); }
.toast { position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); background: var(--acc); color: var(--on-acc); font-weight: 800; padding: 12px 18px; border-radius: 16px; z-index: 40; box-shadow: 0 10px 30px rgba(0,0,0,.35); max-width: 90vw; text-align: center; }
.toast[hidden] { display: none; }

/* Stats, forms, charts */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 12px 0; }
.stat { background: var(--card); border-radius: 18px; padding: 14px; }
.stat b { font-size: 28px; font-weight: 800; display: block; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--mute); }
.stat b small { font-size: 14px; color: var(--mute); font-weight: 600; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.form label { font-size: 12px; color: var(--mute); display: grid; gap: 4px; }
.form .full { grid-column: 1 / -1; }
.chart { width: 100%; height: 160px; margin-top: 10px; }
.list { margin-top: 8px; }
.list .li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--soft); font-size: 14px; }
.list .li:first-child { border-top: 0; }
.check { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--soft); width: 100%; text-align: left; font-size: 15px; }
.check:first-child { border-top: 0; }
.box { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center; flex: none; font-weight: 800; }
.check.on .box { background: var(--acc); border-color: var(--acc); color: var(--on-acc); }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 36px; height: 36px; border-radius: 50%; background: var(--soft2); font-size: 20px; font-weight: 800; }
.stepper b { min-width: 64px; text-align: center; font-size: 18px; }
.meal { border-top: 1px solid var(--soft); padding: 12px 0; }
.meal:first-of-type { border-top: 0; }
.meal summary { list-style: none; cursor: pointer; }
.meal summary::-webkit-details-marker { display: none; }
.meal ul { margin: 8px 0 0 18px; color: var(--chip); font-size: 14px; line-height: 1.5; }
.weekgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.weekgrid button { background: var(--soft); border-radius: 12px; padding: 10px 0; font-weight: 700; font-size: 14px; }
.weekgrid button.on { background: var(--acc); color: var(--on-acc); }
.toggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--soft); font-size: 14px; }
.toggle:first-child { border-top: 0; }
.seg { display: flex; background: var(--soft); border-radius: 10px; padding: 3px; flex: none; }
.seg button { padding: 6px 10px; border-radius: 8px; font-size: 12px; font-weight: 700; color: var(--mute); }
.seg button.on { background: var(--acc); color: var(--on-acc); }

/* Onboarding */
.pick { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 24px 20px; }
.pick img { height: 44px; align-self: flex-start; margin-bottom: 18px; }
.pick h1 { font-size: 34px; font-weight: 800; line-height: 1.05; margin-bottom: 8px; }
.person { color: var(--ink); display: flex; align-items: center; gap: 16px; background: var(--card); border-radius: 24px; padding: 18px; text-align: left; border: 2px solid transparent; }
.person .av { width: 52px; height: 52px; font-size: 22px; }
.person b { font-size: 20px; display: block; }
.person span { font-size: 13px; color: var(--mute); }

/* Summary */
.summary { text-align: center; padding: 30px 16px 0; }
.summary .big { font-size: 64px; }
.summary h1 { font-size: 30px; font-weight: 800; text-transform: uppercase; margin-top: 8px; }

/* Water bottle */
.water .row { align-items: center; gap: 16px; }
.bottle { width: 76px; height: 152px; flex: none; }
.bottle .fill { transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.bottle .wave { animation: wave 2.4s linear infinite; }
@keyframes wave { to { transform: translateX(40px); } }
@media (prefers-reduced-motion: reduce) { .bottle .wave { animation: none; } }
.wnum { font-size: 30px; font-weight: 800; margin-top: 2px; }
.wnum small { font-size: 15px; color: var(--mute); font-weight: 600; }
.wbtns { display: grid; grid-template-columns: 1fr 1fr 44px; gap: 6px; margin-top: 10px; }
.wbtns button { background: var(--soft); border-radius: 12px; padding: 8px 4px; font-weight: 800; font-size: 14px; line-height: 1.15; }
.wbtns button small { font-weight: 600; color: var(--mute); font-size: 11px; }
.wbtns button:active { background: var(--acc); color: var(--on-acc); }
