/* ==========================================================================
   MuscleMap — design system
   Deep, warm dark UI. Colour comes from the muscles themselves.
   ========================================================================== */

:root {
  /* surfaces ------------------------------------------------------------ */
  --bg: #08090d;
  --bg-2: #0b0d13;
  --surface: #11141c;
  --surface-2: #171b25;
  --surface-3: #1f2430;
  --surface-4: #2a303e;
  --line: #262c3a;
  --line-soft: #1b202b;
  --hairline: rgba(255, 255, 255, .06);

  /* type ---------------------------------------------------------------- */
  --text: #f2f5fa;
  --text-dim: #9aa5ba;
  --text-faint: #626d84;

  /* brand --------------------------------------------------------------- */
  --accent: #ff4d2e;
  --accent-2: #ff8a3d;
  --accent-soft: #ff7d63;
  --accent-glow: rgba(255, 77, 46, .35);
  --gold: #ffb020;
  --gold-2: #ffd166;
  --green: #2fd98f;
  --blue: #4f9dff;
  --violet: #a78bfa;

  --grad-accent: linear-gradient(135deg, #ff4d2e 0%, #ff8a3d 100%);
  --grad-gold: linear-gradient(135deg, #ffb020 0%, #ffd76a 100%);

  /* geometry ------------------------------------------------------------ */
  --r-xs: 8px;
  --r-sm: 11px;
  --r: 16px;
  --r-lg: 22px;
  --r-xl: 30px;

  --shadow-1: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.28);
  --shadow-2: 0 2px 6px rgba(0,0,0,.4), 0 16px 44px rgba(0,0,0,.45);
  --shadow-glow: 0 8px 30px -8px var(--accent-glow);

  --header-h: 64px;
  --nav-h: 68px;
  --maxw: 1140px;
  --readw: 780px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(.22, .68, .32, 1);
}

[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-2: #eef1f7;
  --surface: #ffffff;
  --surface-2: #f4f6fb;
  --surface-3: #e9edf5;
  --surface-4: #dde3ee;
  --line: #dee4ef;
  --line-soft: #e9edf5;
  --hairline: rgba(16, 23, 37, .07);
  --text: #0d1420;
  --text-dim: #4d5970;
  --text-faint: #808da5;
  --accent-glow: rgba(255, 77, 46, .22);
  --shadow-1: 0 1px 2px rgba(16,23,37,.06), 0 4px 14px rgba(16,23,37,.06);
  --shadow-2: 0 2px 8px rgba(16,23,37,.08), 0 18px 40px rgba(16,23,37,.10);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  overflow-x: hidden;
}

/* Warm wash behind the top of every page. */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 520px;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 380px at 12% -8%, rgba(255, 77, 46, .16), transparent 62%),
    radial-gradient(760px 340px at 88% -14%, rgba(255, 176, 32, .11), transparent 60%);
}
[data-theme="light"] body::before {
  background:
    radial-gradient(900px 380px at 12% -8%, rgba(255, 77, 46, .10), transparent 62%),
    radial-gradient(760px 340px at 88% -14%, rgba(255, 176, 32, .10), transparent 60%);
}

h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -.028em; line-height: 1.12; }
h1 { font-size: clamp(1.85rem, 1.2rem + 2.2vw, 2.9rem); letter-spacing: -.038em; }
h2 { font-size: 1.32rem; }
h3 { font-size: 1.06rem; letter-spacing: -.02em; }
p { margin: 0 0 .85em; color: var(--text-dim); }
a { color: inherit; }
button { font-family: inherit; }
::selection { background: var(--accent); color: #fff; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ============================================================== layout === */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; position: relative; z-index: 1; }

.app-header {
  position: sticky; top: 0; z-index: 60;
  height: var(--header-h);
  display: flex; align-items: center;
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--hairline);
}
.app-header .wrap { display: flex; align-items: center; gap: 16px; width: 100%; }

.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.04rem; letter-spacing: -.035em;
  background: none; border: 0; color: var(--text); padding: 0; cursor: pointer;
}
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px; flex: none;
  background: var(--grad-accent); color: #fff;
  display: grid; place-items: center;
  box-shadow: var(--shadow-glow);
}
.brand span em { font-style: normal; color: var(--accent); }
.header-spacer { flex: 1; }

.plan-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: 999px;
  font-size: .74rem; font-weight: 750; letter-spacing: -.005em;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text-dim);
  cursor: pointer; white-space: nowrap; transition: all .18s var(--ease);
}
.plan-chip:hover { border-color: var(--accent); color: var(--text); transform: translateY(-1px); }
.plan-chip.is-pro {
  border-color: transparent; color: #2a1600; background: var(--grad-gold);
  box-shadow: 0 4px 16px -4px rgba(255, 176, 32, .5);
}
.plan-chip.is-pro:hover { color: #2a1600; filter: brightness(1.06); }

main { padding: 30px 0 48px; position: relative; z-index: 1; }

/* Sign-in / create-account gate: no tabs to navigate and nothing to upgrade
 * until there's an authenticated user to attach a plan or a route to. */
body.is-unauthed .tabbar,
body.is-unauthed .plan-chip { display: none; }

.view { animation: rise .4s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* staggered entrance for lists */
.stagger > * { animation: rise .42s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .06s; }
.stagger > *:nth-child(3) { animation-delay: .1s; }
.stagger > *:nth-child(4) { animation-delay: .14s; }
.stagger > *:nth-child(5) { animation-delay: .18s; }
.stagger > *:nth-child(6) { animation-delay: .22s; }
.stagger > *:nth-child(n+7) { animation-delay: .26s; }

.page-head { margin-bottom: 26px; max-width: var(--readw); }
.page-head .eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .72rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 12px;
}
.page-head .eyebrow::before {
  content: ""; width: 18px; height: 2px; border-radius: 2px; background: currentColor; opacity: .6;
}
.page-head p { max-width: 60ch; margin-top: 12px; font-size: 1.02rem; line-height: 1.62; }

.section-title {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin: 38px 0 16px;
}
.section-title h2 { font-size: 1.15rem; }
.section-title .hint { font-size: .8rem; color: var(--text-faint); font-weight: 600; }

/* two-column shell used on wide screens */
.split { display: grid; gap: 24px; align-items: start; }
@media (min-width: 960px) {
  .split { grid-template-columns: minmax(0, 1fr) 330px; gap: 30px; }
  .split-aside { position: sticky; top: calc(var(--header-h) + 22px); }
  .split.reverse { grid-template-columns: 330px minmax(0, 1fr); }
}

/* ================================================================= nav === */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 70;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  background: color-mix(in srgb, var(--bg-2) 88%, transparent);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-top: 1px solid var(--hairline);
}
.tabbar button {
  flex: 1; border: 0; background: none; color: var(--text-faint);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  font-size: .67rem; font-weight: 750; letter-spacing: .01em; cursor: pointer;
  padding: 0; position: relative; transition: color .18s var(--ease);
}
.tabbar button svg { width: 21px; height: 21px; transition: transform .22s var(--ease); }
.tabbar button.is-active { color: var(--accent); }
.tabbar button.is-active svg { transform: translateY(-1px) scale(1.08); }
.tabbar button.is-active::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 30px; height: 3px; border-radius: 0 0 4px 4px; background: var(--accent);
  box-shadow: 0 0 14px var(--accent-glow);
}
.tabbar button:not(.is-active):hover { color: var(--text-dim); }

/* =============================================================== cards === */
.card {
  position: relative;
  background: linear-gradient(180deg, var(--surface) 0%, color-mix(in srgb, var(--surface) 92%, var(--bg)) 100%);
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  padding: 20px;
  box-shadow: var(--shadow-1);
}
.card.pad-lg { padding: 26px; }
.card.flat { box-shadow: none; background: var(--surface); }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); }

/* ============================================================= buttons === */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font-size: .88rem; font-weight: 680; letter-spacing: -.01em; cursor: pointer;
  transition: transform .16s var(--ease), background .18s, border-color .18s, box-shadow .2s, opacity .18s;
  text-decoration: none; white-space: nowrap; line-height: 1.2;
}
.btn:hover { background: var(--surface-3); border-color: var(--surface-4); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn[disabled] { opacity: .42; cursor: not-allowed; transform: none; }
.btn svg { flex: none; width: 17px; height: 17px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg svg { width: 19px; height: 19px; }

.btn-primary {
  background: var(--grad-accent); border-color: transparent; color: #fff;
  box-shadow: 0 6px 22px -6px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn-primary:hover {
  background: var(--grad-accent); filter: brightness(1.08);
  box-shadow: 0 12px 30px -8px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.22);
}

.btn-gold {
  background: var(--grad-gold); border-color: transparent; color: #2a1600;
  box-shadow: 0 6px 22px -6px rgba(255,176,32,.5), inset 0 1px 0 rgba(255,255,255,.3);
}
.btn-gold:hover { background: var(--grad-gold); filter: brightness(1.05); }

.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--hairline); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: .79rem; border-radius: var(--r-xs); gap: 6px; }
.btn-lg { padding: 15px 26px; font-size: .98rem; border-radius: var(--r); }
.btn-danger { color: #ff8570; border-color: rgba(255,133,112,.28); background: rgba(255,77,46,.09); }
.btn-danger:hover { background: rgba(255,77,46,.16); border-color: rgba(255,133,112,.45); }
.btn-icon { padding: 9px; width: 36px; height: 36px; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================================================ body map === */
.bodymap-wrap {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  background: radial-gradient(120% 90% at 50% 0%, var(--surface-2), var(--surface));
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl); padding: 20px 16px 16px;
  box-shadow: var(--shadow-1);
}
.bodymap { width: 100%; max-width: 190px; height: auto; display: block; margin: 0 auto; }
.bodymap-label {
  text-align: center; font-size: .66rem; font-weight: 800; letter-spacing: .16em;
  text-transform: uppercase; color: var(--text-faint); padding-bottom: 8px;
}
.bodymap .region {
  fill: var(--rc, var(--accent));
  fill-opacity: 1;
  stroke: #12141a;
  stroke-width: 1.5;
  stroke-linejoin: round;
  cursor: pointer;
  transition: filter .18s var(--ease), transform .18s var(--ease);
  transform-box: fill-box;
  transform-origin: center;
}
.bodymap .region:hover,
.bodymap .region:focus-visible {
  filter: brightness(1.14) drop-shadow(0 0 7px var(--rc));
  transform: scale(1.035);
}
/* Flat "coloring book" silhouette: a light, uniform body with a thick dark
 * outline, so every coloured muscle shape reads clearly against it — no
 * gradients or shading standing in for actual anatomical form. */
.bodymap .frame { fill: #d7dbe4; stroke: #12141a; stroke-width: 1.6; stroke-linejoin: round; }
[data-theme="light"] .bodymap .frame { fill: #e7e9ef; }

.map-hint {
  text-align: center; font-size: .76rem; color: var(--text-faint);
  margin-top: 12px; font-weight: 600;
}

/* ======================================================== muscle cards === */
.muscle-card {
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r); padding: 17px 17px 15px; text-align: left;
  cursor: pointer; color: var(--text); font-family: inherit;
  transition: transform .2s var(--ease), border-color .2s, box-shadow .24s;
  display: flex; flex-direction: column; gap: 7px; min-height: 132px;
  box-shadow: var(--shadow-1);
}
.muscle-card::after {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0;
  background: radial-gradient(110% 80% at 0% 0%, var(--mc), transparent 62%);
  transition: opacity .28s var(--ease);
}
.muscle-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--mc) 55%, transparent);
  box-shadow: var(--shadow-2);
}
.muscle-card:hover::after { opacity: .13; }
.muscle-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--mc); border-radius: 3px 0 0 3px;
}
.muscle-card .mc-name {
  font-weight: 780; font-size: 1.02rem; letter-spacing: -.022em;
  display: flex; align-items: center; gap: 8px;
}
.muscle-card .mc-blurb { font-size: .8rem; color: var(--text-dim); line-height: 1.5; }
.muscle-card .mc-meta {
  margin-top: auto; padding-top: 10px;
  font-size: .71rem; color: var(--text-faint); font-weight: 650;
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
}
.muscle-card .mc-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--mc);
  display: inline-block; box-shadow: 0 0 8px var(--mc);
}

/* =============================================================== chips === */
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  padding: 7px 13px; border-radius: 999px; font-size: .78rem; font-weight: 660;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-dim);
  cursor: pointer; transition: all .16s var(--ease); white-space: nowrap; line-height: 1.2;
}
.chip:hover { color: var(--text); border-color: var(--surface-4); transform: translateY(-1px); }
.chip.is-on {
  background: var(--grad-accent); border-color: transparent; color: #fff;
  box-shadow: 0 4px 14px -4px var(--accent-glow);
}
.chip.is-static { cursor: default; }
.chip.is-static:hover { color: var(--text-dim); border-color: var(--line); transform: none; }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 6px; font-size: .69rem; font-weight: 720;
  letter-spacing: .01em; background: var(--surface-3); color: var(--text-dim);
}
.tag.compound { background: rgba(79,157,255,.14); color: #82bbff; }
.tag.isolation { background: rgba(167,139,250,.14); color: #c0aaff; }
.tag.beginner { background: rgba(47,217,143,.13); color: #52e2a5; }
.tag.intermediate { background: rgba(255,176,32,.13); color: #ffc253; }
.tag.advanced { background: rgba(255,77,46,.14); color: #ff8a72; }

/* ======================================================= exercise rows === */
.ex-list { display: flex; flex-direction: column; gap: 10px; }

.ex-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r); padding: 14px 16px;
  cursor: pointer; text-align: left; width: 100%;
  color: var(--text); font-family: inherit;
  transition: border-color .2s, transform .18s var(--ease), box-shadow .2s;
  box-shadow: var(--shadow-1);
}
.ex-row:hover {
  border-color: var(--line); transform: translateX(4px);
  box-shadow: var(--shadow-2);
}
.ex-row.is-locked { opacity: .82; }
.ex-row.is-locked:hover { opacity: 1; }

.ex-index {
  width: 32px; height: 32px; flex: none; border-radius: var(--r-xs);
  background: var(--surface-2); color: var(--text-faint);
  display: grid; place-items: center; font-size: .78rem; font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.ex-main { display: block; flex: 1; min-width: 0; }
.ex-name {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-weight: 700; font-size: .96rem; letter-spacing: -.018em;
}
.ex-sub { display: block; font-size: .76rem; color: var(--text-faint); margin-top: 4px; }
.ex-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.ex-side { display: flex; align-items: center; gap: 8px; flex: none; }

.fav-btn {
  border: 0; background: none; cursor: pointer; padding: 6px;
  color: var(--text-faint); line-height: 0; border-radius: var(--r-xs);
  transition: color .18s, transform .18s var(--ease);
}
.fav-btn:hover { color: var(--gold); transform: scale(1.15); }
.fav-btn.is-on { color: var(--gold); }

.lock-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .65rem; font-weight: 850; letter-spacing: .06em;
  padding: 3px 8px; border-radius: 999px;
  background: var(--grad-gold); color: #2a1600;
}

/* =============================================================== stats === */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 12px; }
.stat {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r); padding: 16px 17px;
  box-shadow: var(--shadow-1);
}
.stat .k {
  font-size: .66rem; font-weight: 800; letter-spacing: .13em;
  text-transform: uppercase; color: var(--text-faint);
}
.stat .v {
  font-size: 1.85rem; font-weight: 850; letter-spacing: -.045em;
  margin-top: 6px; line-height: 1; font-variant-numeric: tabular-nums;
}
.stat .u { font-size: .78rem; color: var(--text-faint); font-weight: 650; margin-left: 4px; letter-spacing: 0; }
.stat.accent .v { background: var(--grad-accent); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ================================================================ bars === */
/* On wide screens the balance list reads better as two columns than as one
   very long row of stretched bars. */
.balance-grid { display: grid; grid-template-columns: 1fr; column-gap: 30px; }
@media (min-width: 720px) { .balance-grid { grid-template-columns: 1fr 1fr; } }

.bar-row { display: grid; grid-template-columns: 118px 1fr 70px; gap: 12px; align-items: center; padding: 8px 0; }
.bar-row .bl { font-size: .82rem; font-weight: 640; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; transition: width .7s var(--ease); }
.bar-fill.under { background: var(--surface-4); }
.bar-fill.ok { background: linear-gradient(90deg, var(--green), #6ee7b7); }
.bar-fill.over { background: var(--grad-gold); }
.bar-val { font-size: .74rem; color: var(--text-faint); text-align: right; font-variant-numeric: tabular-nums; font-weight: 620; }

/* =============================================================== chart === */
.chart { width: 100%; height: 170px; display: block; }
.chart .grid-line { stroke: var(--hairline); stroke-width: 1; }
.chart .area { fill: url(#chartFade); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--accent); }

/* ============================================================= workout === */
.timeline { position: relative; padding-left: 0; }

.workout-block {
  position: relative;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r); overflow: hidden;
  box-shadow: var(--shadow-1);
  transition: border-color .2s, box-shadow .22s;
}
.workout-block:hover { border-color: var(--line); box-shadow: var(--shadow-2); }
.workout-block + .workout-block { margin-top: 12px; }

.wb-head { display: flex; align-items: flex-start; gap: 14px; padding: 16px 17px 12px; }
.wb-order {
  width: 32px; height: 32px; flex: none; border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 850; font-size: .82rem; font-variant-numeric: tabular-nums;
  background: var(--grad-accent); color: #fff;
  box-shadow: 0 4px 14px -5px var(--accent-glow);
}
.wb-order.accessory { background: var(--surface-3); color: var(--text-dim); box-shadow: none; }
.wb-title { display: block; flex: 1; min-width: 0; }
.wb-title .n { display: block; font-weight: 720; font-size: .99rem; letter-spacing: -.02em; }
.wb-title .s { display: block; font-size: .765rem; color: var(--text-faint); margin-top: 4px; line-height: 1.45; }
.wb-prescription {
  font-family: var(--mono); font-size: .82rem; font-weight: 700; flex: none;
  background: var(--surface-2); border: 1px solid var(--hairline);
  padding: 7px 12px; border-radius: var(--r-xs); white-space: nowrap;
  letter-spacing: -.02em;
}
.wb-actions {
  display: flex; gap: 7px; padding: 0 17px 14px; flex-wrap: wrap; align-items: center;
}

.summary-strip { display: flex; gap: 9px; flex-wrap: wrap; margin: 16px 0 20px; }
.summary-strip .pill {
  background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: 999px; padding: 8px 15px; font-size: .8rem; font-weight: 650;
  color: var(--text-dim);
}
.summary-strip .pill b { color: var(--text); font-weight: 800; }

/* the sticky session sidebar */
.aside-card {
  background: radial-gradient(120% 90% at 50% 0%, var(--surface-2), var(--surface));
  border: 1px solid var(--hairline); border-radius: var(--r-lg);
  padding: 22px; box-shadow: var(--shadow-1);
}
.aside-card h3 { margin-bottom: 4px; }
.aside-metric {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 11px 0; border-bottom: 1px solid var(--hairline);
  font-size: .84rem; color: var(--text-dim);
}
.aside-metric:last-of-type { border-bottom: 0; }
.aside-metric b { font-size: 1.05rem; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }

/* ========================================================== set logging === */
.set-table { width: 100%; max-width: 470px; border-collapse: separate; border-spacing: 0 5px; }
.set-table th {
  text-align: left; font-size: .63rem; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-faint); padding: 4px 6px;
}
.set-table td { padding: 0 5px; }
.set-table input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-xs); padding: 10px 10px; color: var(--text);
  font-family: var(--mono); font-size: .93rem; text-align: center; font-weight: 620;
  transition: border-color .16s, background .16s;
  -moz-appearance: textfield;
}
.set-table input::-webkit-outer-spin-button,
.set-table input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.set-table input:focus { border-color: var(--accent); outline: none; background: var(--surface-3); }
.set-table tr.is-done input {
  border-color: rgba(47,217,143,.38); background: rgba(47,217,143,.07); color: var(--text);
}
.set-num {
  width: 30px; color: var(--text-faint); font-weight: 800; font-size: .82rem;
  text-align: center; font-variant-numeric: tabular-nums;
}
.set-prev { font-size: .71rem; color: var(--text-faint); white-space: nowrap; font-family: var(--mono); }
.check-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text-faint); cursor: pointer;
  display: grid; place-items: center; transition: all .18s var(--ease);
}
.check-btn:hover { border-color: var(--green); color: var(--green); transform: scale(1.06); }
.check-btn.is-done {
  background: linear-gradient(135deg, var(--green), #6ee7b7);
  border-color: transparent; color: #04231a;
  box-shadow: 0 4px 14px -4px rgba(47,217,143,.5);
}

/* progress ring */
.ring-wrap { display: flex; align-items: center; gap: 16px; }
.ring { width: 62px; height: 62px; flex: none; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; stroke-linecap: round; }
.ring .track { stroke: var(--surface-3); }
.ring .value { stroke: url(#ringGrad); transition: stroke-dashoffset .6s var(--ease); }
.ring-label { font-size: .95rem; font-weight: 800; letter-spacing: -.02em; }
.ring-sub { font-size: .76rem; color: var(--text-faint); margin-top: 2px; }

/* =============================================================== timer === */
.rest-bar {
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  z-index: 65;
  background: color-mix(in srgb, var(--surface-2) 92%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-top: 1px solid var(--hairline);
  padding: 12px max(20px, calc((100vw - var(--maxw)) / 2 + 20px));
  display: flex; align-items: center; gap: 16px;
  transform: translateY(130%);
  visibility: hidden; opacity: 0;
  transition: transform .34s var(--ease), opacity .22s var(--ease), visibility .34s;
  box-shadow: 0 -10px 40px rgba(0,0,0,.4);
}
.rest-bar.is-open { transform: none; visibility: visible; opacity: 1; }
.rest-time {
  font-family: var(--mono); font-size: 1.55rem; font-weight: 800;
  letter-spacing: -.04em; min-width: 78px; font-variant-numeric: tabular-nums;
}
.rest-label {
  font-size: .64rem; color: var(--text-faint); font-weight: 800;
  letter-spacing: .16em; text-transform: uppercase;
}
.rest-progress { flex: 1; height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.rest-progress i {
  display: block; height: 100%; border-radius: 999px;
  background: var(--grad-accent); transition: width 1s linear;
}
body.rest-active { padding-bottom: calc(var(--nav-h) + 82px + env(safe-area-inset-bottom, 0px)); }

/* =============================================================== modal === */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(4, 5, 9, .72);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .22s var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  width: 100%; max-width: 620px; max-height: 92vh; overflow-y: auto;
  box-shadow: var(--shadow-2);
  animation: slideUp .36s var(--ease);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@keyframes slideUp { from { transform: translateY(36px); opacity: .4; } to { transform: none; opacity: 1; } }
.modal-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: flex-start; gap: 12px; padding: 22px 24px 15px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.modal-head h2 { flex: 1; font-size: 1.22rem; }
.modal-body { padding: 20px 24px 28px; }
.modal-close {
  border: 0; background: var(--surface-2); color: var(--text-dim);
  width: 34px; height: 34px; border-radius: 10px; cursor: pointer; flex: none;
  display: grid; place-items: center; font-size: 1.15rem; line-height: 1;
  transition: all .18s var(--ease);
}
.modal-close:hover { background: var(--surface-3); color: var(--text); transform: rotate(90deg); }

@media (min-width: 700px) {
  .modal-backdrop { align-items: center; padding: 26px; }
  .modal { border-radius: var(--r-xl); }
}

/* ============================================================== how-to === */
.howto { display: flex; flex-direction: column; gap: 20px; }
.howto h4 {
  font-size: .69rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 10px;
}
.howto ol, .howto ul { margin: 0; padding-left: 21px; }
.howto li { margin-bottom: 9px; line-height: 1.62; color: var(--text-dim); font-size: .89rem; }
.howto li::marker { color: var(--accent); font-weight: 800; }
.howto .mistakes li::marker { color: #ff8570; }
.howto .cues li::marker { color: var(--green); }

.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); gap: 10px; }
.kv { background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: 12px 14px; }
.kv .k { font-size: .62rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; color: var(--text-faint); }
.kv .v { font-size: .9rem; font-weight: 680; margin-top: 5px; letter-spacing: -.015em; }

/* ============================================================= pricing === */
.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.price-card {
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--r-xl); padding: 30px 26px 26px;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-1);
  transition: transform .24s var(--ease), box-shadow .26s;
}
.price-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.price-card.is-featured { border-color: var(--gold); }
.price-card.is-featured::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(110% 70% at 50% 0%, rgba(255,176,32,.14), transparent 62%);
}
.price-badge {
  position: absolute; top: 16px; right: 20px;
  background: var(--grad-gold); color: #2a1600;
  font-size: .65rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase;
  padding: 5px 11px; border-radius: 999px;
}
.price-name { font-size: .73rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; color: var(--text-faint); }
.price-amount { display: flex; align-items: baseline; gap: 3px; margin: 14px 0 6px; }
.price-amount .cur { font-size: 1.4rem; font-weight: 750; color: var(--text-dim); }
.price-amount .num { font-size: 3.4rem; font-weight: 870; letter-spacing: -.055em; line-height: .95; }
.price-amount .per { font-size: .92rem; color: var(--text-faint); font-weight: 660; margin-left: 3px; }
.price-note { font-size: .84rem; color: var(--text-dim); min-height: 40px; line-height: 1.55; }
.price-card ul { list-style: none; margin: 20px 0 22px; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.price-card li { display: flex; gap: 10px; font-size: .86rem; color: var(--text-dim); line-height: 1.45; }
.price-card li svg { flex: none; margin-top: 2px; color: var(--green); }
.price-card li.off { color: var(--text-faint); }
.price-card li.off svg { color: var(--text-faint); }
.price-card .btn { margin-top: auto; }

.save-flag {
  display: inline-block; margin-left: 8px; padding: 3px 9px; border-radius: 6px;
  background: rgba(47,217,143,.14); color: #52e2a5; font-size: .71rem; font-weight: 850;
}

.demo-note {
  display: flex; gap: 11px; align-items: flex-start;
  background: rgba(79,157,255,.07); border: 1px solid rgba(79,157,255,.22);
  border-radius: var(--r-sm); padding: 13px 15px; font-size: .82rem; color: var(--text-dim);
  line-height: 1.55;
}
.demo-note b { color: var(--blue); }

/* ============================================================= paywall === */
.paywall {
  position: relative; overflow: hidden; isolation: isolate;
  text-align: center; padding: 38px 26px;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-xl);
}
.paywall::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(100% 70% at 50% 0%, rgba(255,176,32,.13), transparent 65%);
}
.paywall .pw-icon {
  width: 54px; height: 54px; border-radius: 17px; margin: 0 auto 16px;
  background: var(--grad-gold); color: #2a1600;
  display: grid; place-items: center;
  box-shadow: 0 8px 26px -8px rgba(255,176,32,.6);
}
.paywall h3 { margin-bottom: 9px; font-size: 1.15rem; }
.paywall p { max-width: 44ch; margin: 0 auto 20px; font-size: .89rem; line-height: 1.6; }

/* =============================================================== forms === */
.field { margin-bottom: 18px; }
.field label {
  display: block; font-size: .75rem; font-weight: 760; letter-spacing: .03em;
  color: var(--text-dim); margin-bottom: 8px;
}
.field .desc { font-size: .76rem; color: var(--text-faint); margin-top: 8px; line-height: 1.5; }
.input, select.input, textarea.input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 12px 14px; color: var(--text);
  font-size: .92rem; font-family: inherit; transition: border-color .16s, background .16s;
}
.input:focus { border-color: var(--accent); outline: none; background: var(--surface-3); }
.input::placeholder { color: var(--text-faint); }
textarea.input { resize: vertical; line-height: 1.55; }

input[type="range"].input {
  padding: 0; height: 6px; background: var(--surface-3); border: 0;
  border-radius: 999px; appearance: none; cursor: pointer;
}
input[type="range"].input::-webkit-slider-thumb {
  appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: var(--grad-accent); border: 2px solid var(--bg);
  box-shadow: 0 2px 10px -2px var(--accent-glow); cursor: pointer;
}
input[type="range"].input::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--bg);
  background: var(--accent); cursor: pointer;
}

.toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--hairline);
}
.toggle-row:last-child { border-bottom: 0; padding-bottom: 0; }
.toggle-row .tr-label { font-size: .9rem; font-weight: 660; }
.toggle-row .tr-desc { font-size: .76rem; color: var(--text-faint); margin-top: 4px; line-height: 1.45; }
.switch {
  width: 48px; height: 28px; border-radius: 999px; border: 0; flex: none;
  background: var(--surface-3); cursor: pointer; position: relative;
  transition: background .24s var(--ease);
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: var(--text-faint);
  transition: transform .24s var(--ease), background .24s;
}
.switch.is-on { background: var(--grad-accent); }
.switch.is-on::after { transform: translateX(20px); background: #fff; }

/* ================================================================ misc === */
.empty {
  text-align: center; padding: 52px 24px; color: var(--text-faint);
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-xl);
}
.empty .e-icon { font-size: 2.4rem; margin-bottom: 12px; opacity: .6; }
.empty h3 { color: var(--text-dim); margin-bottom: 8px; }
.empty p { font-size: .87rem; max-width: 42ch; margin: 0 auto; }

.divider { height: 1px; background: var(--hairline); margin: 24px 0; border: 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px);
  transform: translateX(-50%) translateY(22px);
  z-index: 300; background: var(--surface-3); color: var(--text);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 12px 22px; font-size: .86rem; font-weight: 660;
  box-shadow: var(--shadow-2); opacity: 0; pointer-events: none;
  transition: opacity .26s var(--ease), transform .26s var(--ease);
  max-width: 90vw; text-align: center;
}
.toast.is-open { opacity: 1; transform: translateX(-50%); }

.history-row {
  display: flex; align-items: center; gap: 15px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r); cursor: pointer; width: 100%; text-align: left;
  color: var(--text); font-family: inherit;
  transition: border-color .2s, transform .18s var(--ease), box-shadow .2s;
  box-shadow: var(--shadow-1);
}
.history-row:hover { border-color: var(--line); transform: translateX(4px); box-shadow: var(--shadow-2); }
.history-date {
  width: 48px; flex: none; text-align: center; background: var(--surface-2);
  border: 1px solid var(--hairline); border-radius: 10px; padding: 7px 0;
}
.history-date .d { font-size: 1.06rem; font-weight: 850; line-height: 1; font-variant-numeric: tabular-nums; }
.history-date .m {
  font-size: .6rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-faint); margin-top: 4px;
}

.banner {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--accent);
  border-radius: var(--r-lg); padding: 18px 20px; margin-bottom: 20px;
  box-shadow: var(--shadow-1);
}
.banner::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(90% 100% at 0% 50%, var(--accent-glow), transparent 60%);
}
.banner .b-eyebrow {
  font-size: .68rem; font-weight: 850; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent);
}
.banner .b-title { font-weight: 720; margin-top: 6px; letter-spacing: -.02em; }

.note-card {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r); padding: 15px 17px; margin-bottom: 20px;
  box-shadow: var(--shadow-1);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ========================================================== responsive === */
@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bar-row { grid-template-columns: 90px 1fr 58px; gap: 9px; }
  .wb-prescription { font-size: .76rem; padding: 6px 9px; }
  .price-amount .num { font-size: 2.9rem; }
  main { padding-top: 22px; }
  .page-head { margin-bottom: 22px; }
  .section-title { margin: 30px 0 14px; }
  .card { padding: 17px; }
  .card.pad-lg { padding: 20px; }
}
@media (max-width: 430px) {
  .grid.auto { grid-template-columns: 1fr; }
  .grid.cols-2 { grid-template-columns: 1fr; }
  .ex-row { padding: 13px 14px; gap: 12px; }
  .bodymap-wrap { padding: 16px 8px 12px; gap: 6px; }
  .summary-strip .pill { padding: 7px 12px; font-size: .76rem; }
}

/* Desktop: the nav lifts into the header row. It stays a sibling of the
   header in the DOM — a backdrop-filter ancestor would otherwise become the
   containing block for its fixed positioning on mobile. */
@media (min-width: 900px) {
  .tabbar {
    position: fixed; top: 0; bottom: auto;
    left: 50%; transform: translateX(-50%);
    width: 100%; max-width: var(--maxw); height: var(--header-h);
    padding: 0 20px; z-index: 61;
    align-items: center; justify-content: center;
    background: none; backdrop-filter: none; -webkit-backdrop-filter: none;
    border: 0; display: flex; gap: 3px; pointer-events: none;
  }
  .tabbar button { pointer-events: auto; }
  .tabbar button {
    flex: none; flex-direction: row; gap: 8px; padding: 9px 14px;
    font-size: .84rem; border-radius: 10px; font-weight: 680;
  }
  .tabbar button.is-active { background: var(--surface-2); }
  .tabbar button.is-active::before { display: none; }
  .tabbar button.is-active svg { transform: none; }
  .tabbar button svg { width: 17px; height: 17px; }
  body { padding-bottom: 0; }
  .rest-bar { bottom: 0; }
  body.rest-active { padding-bottom: 82px; }
  .toast { bottom: 28px; }
}

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