:root {
  --bg: #0f1112;
  --card: #1a1d1f;
  --card-2: #23272a;
  --line: #2e3337;
  --text: #f2f4f5;
  --muted: #9aa3a9;
  --accent: #c8f25a;      /* lime: go */
  --accent-ink: #15200a;
  --warm: #ffb35c;        /* sauna / rest */
  --field: #6fd3ff;
  --class: #c9a7ff;
  --danger: #ff6b6b;
  --r: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; }

.i { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }

main {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 20px) 16px calc(var(--safe-b) + 96px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
main.session, main.done { padding-bottom: calc(var(--safe-b) + 24px); }

h1 { font-size: 30px; line-height: 1.1; margin: 4px 0 0; letter-spacing: -0.02em; }
h2 { font-size: 24px; margin: 0; letter-spacing: -0.01em; }
h3 { font-size: 18px; margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
small, .small { font-size: 13px; }
.muted { color: var(--muted); margin: 0; }
.center { text-align: center; }
.label, .section-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0;
}
.section-label { margin: 12px 4px 0; }

.card {
  background: var(--card);
  border-radius: var(--r);
  padding: 16px;
  border: 1px solid var(--line);
}

/* session badge (icon in a tinted tile) */
.badge {
  --c: var(--accent);
  width: 44px; height: 44px; border-radius: 13px; flex: none;
  display: grid; place-items: center;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--card-2));
}
.badge .i { width: 24px; height: 24px; }
.badge.field { --c: var(--field); }
.badge.class { --c: var(--class); }
.badge.big { width: 60px; height: 60px; border-radius: 17px; }
.badge.big .i { width: 32px; height: 32px; }

/* week strip */
.week { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chip {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 12px; display: grid; grid-template-columns: 1fr auto; row-gap: 6px;
}
.chip span:first-child { color: var(--muted); font-size: 13px; }
.chip b { font-size: 15px; }
.chip .dots { grid-column: 1 / -1; display: flex; gap: 4px; }
.chip .dots i { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.chip .dots i.on { background: var(--accent); }
.chip.met { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }

/* session picker */
.tabs-session {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 5px;
}
.tabs-session button {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 4px 7px; border-radius: 12px; color: var(--muted); font-size: 13px; font-weight: 600;
}
.tabs-session button .i { width: 22px; height: 22px; }
.tabs-session button.on { background: var(--card-2); color: var(--text); }
.tabs-session button.on .i { color: var(--accent); }
.tabs-session .dot {
  position: absolute; top: 7px; right: calc(50% - 20px); width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--card);
}

/* next-up card */
.next { display: flex; flex-direction: column; gap: 16px; }
.next-head { display: flex; gap: 14px; align-items: center; }

.ctl { display: flex; flex-direction: column; gap: 8px; }
.ctl-label { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.ctl-label .i { color: var(--text); }
.info { margin-left: auto; color: var(--accent); font-size: 13px; }

.seg { display: grid; gap: 6px; }
.seg button {
  background: var(--card-2); border-radius: 12px; padding: 10px 0; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; gap: 2px; border: 1px solid transparent;
}
.seg button small { font-weight: 500; color: var(--muted); font-size: 11px; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.seg button.on small { color: var(--accent-ink); opacity: .7; }
.times { grid-template-columns: repeat(5, 1fr); }
.levels { grid-template-columns: repeat(3, 1fr); }
.levels button { gap: 4px; font-size: 13px; padding: 10px 0 9px; }
.bars { width: 16px; height: 16px; }
.level-line { margin: 0; font-size: 13px; color: var(--muted); }

.level-table { display: grid; gap: 8px; }
.level-table > div { background: var(--card-2); border-radius: 12px; padding: 12px; border: 1px solid transparent; }
.level-table > div.on { border-color: var(--accent); }
.level-table b { display: flex; align-items: center; gap: 6px; }
.level-table p { margin: 4px 0 6px; font-size: 13px; color: var(--muted); }
.level-table ul { margin: 0; padding-left: 18px; font-size: 13px; }

.plan-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: -8px; }
.est { margin: 0; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.est.over { color: var(--warm); }

.plan { list-style: none; margin: 0; padding: 0; }
.plan li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.plan li:first-child { border-top: 0; }
.row-name { flex: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.row-name .i { color: var(--warm); }
.plan li.fixed .row-name { color: var(--muted); }
.plan em, .pool em { font-style: normal; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 14px; }
.row-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; color: var(--muted); flex: none; }
button.row-btn:active { background: var(--card-2); }
.tag {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent);
  padding: 2px 6px; border-radius: 6px;
}

.more {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px; border-radius: 12px; border: 1px dashed var(--line); color: var(--accent); font-weight: 600; width: 100%;
}
.more.card { background: transparent; }
.pool { list-style: none; margin: 0; padding: 0; }
.pool li + li { border-top: 1px solid var(--line); }
.pool button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 0; text-align: left; }
.pool .plus { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--card-2); color: var(--accent); flex: none; }
.pool small { color: var(--muted); }

.primary {
  width: 100%; min-height: 58px; border-radius: 16px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 19px;
}
.primary:active { transform: scale(.98); }
.secondary {
  display: block; width: 100%; text-align: center; padding: 14px; margin-top: 10px;
  border-radius: 14px; background: var(--card-2); font-weight: 600;
}
.link { padding: 12px; color: var(--muted); font-size: 14px; }
.link.danger { color: var(--danger); }

.resume {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; text-align: left;
  border-color: var(--warm); background: color-mix(in srgb, var(--warm) 10%, var(--card));
}
.go { color: var(--muted); display: grid; place-items: center; }
.go .i { width: 22px; height: 22px; }

/* session */
.bar {
  position: sticky; top: 0; z-index: 5;
  margin: calc(-1 * var(--safe-t) - 20px) -16px 0;
  padding: calc(var(--safe-t) + 8px) 8px 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; gap: 4px;
}
.bar-title { text-align: center; display: flex; flex-direction: column; }
.bar-title small { color: var(--muted); font-variant-numeric: tabular-nums; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; }
.icon-btn .i { width: 26px; height: 26px; }
.finish-sm { font-size: 15px; font-weight: 600; color: var(--accent); height: 44px; }
.progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .3s; }

.check-row { display: flex; gap: 12px; align-items: center; }
.row-icon { color: var(--warm); display: grid; }
.row-icon .i { width: 24px; height: 24px; }
.check-row input, .item input {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 28px; height: 28px; border-radius: 9px; border: 2px solid var(--line); background: var(--card-2) center / 18px no-repeat;
  margin: 0;
}
.check-row input:checked, .item input:checked {
  background-color: var(--accent); border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2315200a' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
.check-row.done, .item.done span { opacity: .55; }
.check-row.sauna { border-color: color-mix(in srgb, var(--warm) 45%, var(--line)); }

.ex { display: flex; flex-direction: column; gap: 10px; scroll-margin-top: 90px; }
.ex.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.ex.complete { opacity: .55; padding: 12px 16px; }
.ex-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.ok { color: var(--accent); display: grid; }
.target { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.count { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.hint { margin: 0; font-size: 14px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.hint.up { color: var(--accent); }
.tip { margin: 0; font-size: 14px; color: var(--warm); }
.effort { margin: 0; font-size: 12px; color: var(--muted); text-align: right; }

.sets { display: flex; flex-direction: column; gap: 8px; }
.set { display: grid; grid-template-columns: 22px 1fr 1fr 52px; gap: 8px; align-items: center; }
.set .n { color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.field {
  display: flex; align-items: center; gap: 6px; background: var(--card-2);
  border-radius: 12px; padding: 0 12px; height: 52px;
}
.field input {
  width: 100%; min-width: 0; background: none; border: 0; outline: none;
  font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.field span { color: var(--muted); font-size: 13px; }
.field.static { color: var(--muted); justify-content: center; font-size: 14px; }
.field:focus-within { box-shadow: 0 0 0 2px var(--accent) inset; }
.tick {
  height: 52px; border-radius: 12px; border: 2px solid var(--line); background: var(--card-2);
  color: var(--accent-ink); display: grid; place-items: center;
}
.tick .i { width: 26px; height: 26px; stroke-width: 2.6; }
.set.done .tick { background: var(--accent); border-color: var(--accent); }
.set.done .field { opacity: .55; }

.ex-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 12px; border-radius: 12px; background: var(--card-2);
  font-size: 14px; text-decoration: none; color: var(--text);
}
.ghost .i { color: var(--accent); width: 16px; height: 16px; }

.block { display: flex; flex-direction: column; gap: 4px; }
.block h3 { margin-bottom: 6px; }
.item { display: flex; gap: 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.item:first-of-type { border-top: 0; }
.item span { flex: 1; }
.mini { color: var(--muted); padding: 6px 2px 6px 10px; display: grid; }
.mini .i { width: 14px; height: 14px; }

.q { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }
.q span { font-size: 14px; color: var(--muted); }
.q input { background: var(--card-2); border: 0; border-radius: 12px; padding: 14px; outline: none; }
.q input:focus { box-shadow: 0 0 0 2px var(--accent) inset; }

.spacer { height: 70px; }

/* rest timer */
.rest {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--safe-b) + 12px); z-index: 10;
  max-width: 536px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 18px;
  background: var(--warm); color: #2a1600; border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
  transform: translateY(150%); transition: transform .25s;
}
.rest.show { transform: none; }
.rest.over { background: var(--accent); color: var(--accent-ink); }
.rest span { font-weight: 600; }
.rest b { font-size: 28px; font-variant-numeric: tabular-nums; flex: 1; }
.rest button { background: rgba(0,0,0,.14); padding: 10px 14px; border-radius: 12px; font-weight: 700; }

/* done */
.done-hero { text-align: center; padding: 30px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hero-icon {
  width: 88px; height: 88px; border-radius: 26px; display: grid; place-items: center; margin-bottom: 10px;
  color: var(--warm); background: color-mix(in srgb, var(--warm) 14%, var(--card));
}
.hero-icon .i { width: 48px; height: 48px; }
.pr {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--accent); color: var(--accent-ink); border-radius: 6px; padding: 1px 6px; font-size: 11px;
}
.pr .i { width: 12px; height: 12px; }

/* history */
.hist { padding: 0; }
.hist-head { width: 100%; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; text-align: left; padding: 14px 16px; }
.hist-body { padding: 0 16px 8px; }
.hist-body .plan li { flex-direction: column; align-items: flex-start; gap: 2px; }
.hist-body .plan em { white-space: normal; }

.file { cursor: pointer; }

/* tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 8px 12px calc(var(--safe-b) + 8px);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabs button { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); padding: 6px; }
.tabs button .i { width: 22px; height: 22px; }
.tabs button.on { color: var(--accent); }

/* meals */
.meal-tabs { grid-template-columns: repeat(3, 1fr); }
.meal-sec { display: flex; flex-direction: column; gap: 12px; }
.dishes { display: flex; flex-direction: column; gap: 6px; }
.dish {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 10px 12px; border-radius: 12px; background: var(--card-2); border: 1px solid transparent;
}
.dish.on { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.dish .tick {
  width: 24px; height: 24px; border-radius: 8px; flex: none; display: grid; place-items: center;
  border: 2px solid var(--line); color: var(--accent-ink);
}
.dish.on .tick { background: var(--accent); border-color: var(--accent); }
.dish .tick .i { width: 16px; height: 16px; stroke-width: 3; }
.dish-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.dish-text small { color: var(--muted); }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button {
  width: 36px; height: 36px; border-radius: 10px; background: var(--card); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 20px;
}
.stepper button .i { width: 18px; height: 18px; }
.stepper b { min-width: 28px; text-align: center; font-variant-numeric: tabular-nums; }
.week-grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.week-grid th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 4px; font-size: 12px; }
.week-grid tbody th { width: 40px; }
.week-grid td { padding: 7px 8px; border-top: 1px solid var(--line); }
.week-grid td.batch { color: var(--text); }
.week-grid td.quick { color: var(--field); }
.week-grid td.free { color: var(--muted); font-style: italic; }
.shop-intro { margin: 0 4px; display: flex; gap: 6px; align-items: flex-start; }
.shop-intro .i { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.item.shop span { display: flex; flex-direction: column; }
.item.shop span small, .item.shop em small { color: var(--muted); font-weight: 400; }
.item.shop em { font-style: normal; text-align: right; display: flex; flex-direction: column; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item.done em { opacity: .55; }
.step-h { margin-top: 10px; font-size: 15px; color: var(--accent); }
.step-h:first-child { margin-top: 0; }
.tabs { padding-left: 4px; padding-right: 4px; }
.tabs button { font-size: 11px; padding: 6px 2px; }

/* stats */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.tile b { font-size: 24px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.tile span { font-size: 12px; color: var(--muted); line-height: 1.25; }
.seg.two { grid-template-columns: 1fr 1fr; }
.seg.two button { padding: 10px; }
.body-map { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.body-map figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.body-map figcaption { font-size: 12px; color: var(--muted); }
.body-svg { width: 100%; max-height: 360px; }
.body-svg .sil { fill: #1f2427; stroke: #3a4146; stroke-width: 1; }
.body-svg .mus { stroke: var(--card); stroke-width: 1.2; transition: fill .3s; }
.body-svg .mus[data-action] { cursor: pointer; }
.body-svg .mus[data-action]:hover { filter: brightness(1.25); }
.body-svg .mus:focus { outline: none; stroke: var(--text); }
.heat-legend, .legend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: 12px; color: var(--muted); }
.legend { justify-content: flex-start; }
.heat-legend i, .legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -2px; }
.mus-detail { background: var(--card-2); border-radius: 12px; padding: 10px 12px; }
.mus-detail p { margin: 0 0 2px; }
.chart { width: 100%; height: auto; overflow: visible; }
.chart .ax { fill: var(--muted); font-size: 10px; }
.chart .val { fill: var(--text); font-size: 10px; font-weight: 600; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .target { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .band { fill: color-mix(in srgb, var(--text) 5%, transparent); }
.chart [data-tip]:hover > rect:not([fill="transparent"]), .chart [data-tip]:hover > path { filter: brightness(1.2); }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; padding: 0 4px; }
.chips button { white-space: nowrap; padding: 7px 11px; border-radius: 99px; background: var(--card-2); color: var(--muted); font-size: 13px; font-weight: 600; }
.chips button.on { background: var(--text); color: var(--bg); }
.empty { padding: 18px 0; text-align: center; }
.tip-pop {
  position: fixed; z-index: 50; display: none; pointer-events: none; max-width: 260px;
  background: var(--text); color: var(--bg); font-size: 13px; font-weight: 600;
  padding: 6px 10px; border-radius: 8px; box-shadow: 0 4px 16px #0008;
}
.mini-body { display: flex; flex-direction: column; gap: 8px; text-align: left; width: 100%; }
.mini-head { display: flex; justify-content: space-between; align-items: center; }
.mini-head .small { display: flex; align-items: center; gap: 2px; }
.mini-head .i { width: 14px; height: 14px; }
.mini-body .body-svg { max-height: 170px; }
.mini-body .heat-legend { display: none; }
.body-svg .seam { fill: none; stroke: var(--card); stroke-width: 1.2; pointer-events: none; }
.body-svg .knee { fill: #262b2e; stroke: #3a4146; stroke-width: 1; }
.mus-detail { display: flex; flex-direction: column; gap: 4px; }
.mus-name { display: flex; flex-direction: column; }
.mus-name .small { font-style: italic; }
.stat-line { font-weight: 600; }
.mus-list { display: flex; flex-direction: column; gap: 10px; }
.mus-region .label { margin-bottom: 6px; }
.mus-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mus-chips button {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 99px;
  background: var(--card-2); font-size: 13px; border: 1px solid transparent;
}
.mus-chips button.on { border-color: var(--text); }
.mus-chips i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.mus-chips small { color: var(--muted); font-variant-numeric: tabular-nums; }
