:root {
  color-scheme: dark;
  --bg: #0c0e13;
  --panel: #141821;
  --panel-raised: #1b2230;
  --line: #293142;
  --field-line: #52617d;
  --text: #f4f6fc;
  --muted: #a4aec2;
  --accent: #a6c0ff;
  --accent-soft: #d8e4ff;
  --primary: #315cdb;
  --primary-hover: #3965e6;
  --primary-tint: #182746;
  --on-primary: #fff;
  --primary-deep: #254bbd;
  --accent-border: #5073b4;
  --accent-glow: #19397045;
  --accent-glow-faint: #1939701c;
  --heat-low: #3e5f9a;
  --heat-medium: #6b92e5;
  --nav-background: #0d1018;
  --backdrop: #060811c9;
  --error: #ffd2d2;
  --error-border: #ee9292;
  --nav-height: 65px;
  --header-height: 48px;
  --top-space: max(14px, env(safe-area-inset-top));
  --radius: 17px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f6fc;
  --panel: #fff;
  --panel-raised: #eaf0fa;
  --line: #d0daeb;
  --field-line: #8190a8;
  --text: #182135;
  --muted: #4e5c73;
  --nav-background: #f3f6fc;
  --backdrop: #10182c70;
  --error: #9e2424;
  --error-border: #bd4646;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); overflow-x: clip; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  color: var(--text);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { overflow-wrap: anywhere; line-height: 1.14; }
h1 { font-size: clamp(27px, 6.5vw, 36px); font-weight: 650; letter-spacing: -.037em; }
h2 { font-size: 20px; font-weight: 650; letter-spacing: -.025em; }
h3 { font-size: 17px; font-weight: 650; }
p { color: var(--muted); }
hr { width: 100%; border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
details > summary { cursor: pointer; }
summary::marker { color: var(--muted); }

.wrap {
  max-width: 660px;
  padding: var(--top-space) clamp(18px, 5.4vw, 30px) calc(var(--nav-height) + 26px + env(safe-area-inset-bottom));
  margin-inline: auto;
}
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  min-height: var(--header-height);
}
.topbar #btn-data { justify-self: end; }
.brand-button, .profile-button, .iconbtn, .text-button {
  color: var(--text);
  border: 0;
  background: none;
}
.brand-button {
  display: flex;
  align-items: baseline;
  gap: 3px;
  min-height: 44px;
  padding: 5px 7px;
  border-radius: 10px;
  font-size: 23px;
  font-weight: 690;
  letter-spacing: -.055em;
}
.brand-button span { width: 5px; height: 5px; border-radius: 50%; background: var(--logo-dot, var(--accent)); }
.launch-intro { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; isolation: isolate; overflow: hidden; }
.launch-backdrop { position: absolute; inset: 0; z-index: -1; background: var(--bg); }
.launch-mark, .onboarding-brand {
  display: flex;
  align-items: baseline;
  gap: .13em;
  color: var(--text);
  font-size: clamp(46px, 12vw, 60px);
  font-weight: 690;
  letter-spacing: -.055em;
  transform-origin: top left;
}
.launch-dot { width: .2174em; height: .2174em; border-radius: 50%; background: var(--logo-dot, var(--accent)); }
.setup-view { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.onboarding-welcome {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(16px, 4vh, 32px);
  min-height: calc(100svh - var(--top-space) - max(24px, env(safe-area-inset-bottom)));
}
.onboarding-welcome-content { display: grid; gap: 18px; width: min(100%, 320px); text-align: center; }
.onboarding-welcome-content h1 { font-size: clamp(27px, 7vw, 34px); }
.onboarding-program { padding-top: 14px; }
.onboarding-program .onboarding-brand { justify-content: center; font-size: 27px; margin-bottom: 14px; }
.onboarding-intro { margin-bottom: 8px; }
.onboarding-intro button { justify-self: start; }
@media (prefers-reduced-motion: no-preference) {
  .launch-in-progress :is(.brand-button, .onboarding-brand) { opacity: 0; }
  .launch-in-progress .onboarding-welcome-content { animation: workout-arrive 340ms ease-out 1120ms backwards; }
}
@media (prefers-reduced-motion: reduce) {
  .launch-intro { display: none; }
}
.profile-button {
  display: grid;
  place-items: center;
  justify-self: start;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 0;
}
.profile-button .avatar { border: 1px solid var(--line); }
.profile-name-label .fieldlabel { margin: 0; }
.profile-name-label { margin-bottom: 6px; }
#profile-name-count { font-variant-numeric: tabular-nums; }
#profile-name[aria-invalid="true"] { border-color: var(--error-border); }
#profile-name-error { margin-top: 6px; }
.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  background: var(--panel-raised);
  color: var(--accent-soft);
  font-size: 12px;
  font-weight: 650;
}
.avatar svg, .iconbtn svg { width: 19px; height: 19px; }
.iconbtn, .quiet-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  color: var(--muted);
}
.iconbtn:hover, .quiet-icon:hover, .profile-button:hover .avatar { background: var(--panel-raised); color: var(--text); }
.inner-page { padding-top: 24px; }
.inner-page:has(.workout-page) { padding-top: 8px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.page-heading button { flex-shrink: 0; }
.stack { display: grid; gap: 14px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.note { font-size: 13px; color: var(--muted); }
.empty { padding: 18px; text-align: center; color: var(--muted); font-size: 14px; }

button.primary, button.secondary, .program-import-guide {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 15px;
  font-weight: 650;
}
button.primary { background: var(--primary); color: var(--on-primary); }
button.primary:hover { background: var(--primary-hover); }
button.secondary, .program-import-guide { background: var(--panel); color: var(--text); border-color: var(--line); font-size: 13px; }
button.secondary:hover, .program-import-guide:hover { background: var(--panel-raised); }
button.pill { border-radius: 999px; padding-inline: 19px; font-weight: 600; }
.text-button { min-height: 42px; padding: 0; color: var(--accent); font-size: 13px; font-weight: 600; }
.text-button:hover { color: var(--accent-soft); }
.text-button.danger-action, .text-button.danger-action:hover { color: var(--error); }
.fieldlabel { display: block; color: var(--muted); font-size: 12px; font-weight: 550; margin-bottom: 6px; }
input[type="text"], input[type="number"], select {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 9px 11px;
  border: 1px solid var(--field-line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 16px;
}

.nav {
  position: fixed;
  z-index: 10;
  inset: auto 0 -2px;
  padding: 4px 6px calc(max(env(safe-area-inset-bottom), 6px) + 2px);
  background: var(--nav-background);
  border-top: 1px solid var(--line);
}
.nav-inner { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); max-width: 480px; margin-inline: auto; }
.nav button {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 53px;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 10px;
  padding: 4px 0;
  font-size: 10px;
  font-weight: 600;
}
.nav-icon { display: grid; place-items: center; width: 37px; height: 25px; border-radius: 8px; }
.nav-icon svg { width: 20px; height: 20px; }
.nav button[aria-current="page"] { color: var(--accent-soft); }
.nav button[aria-current="page"] .nav-icon { background: var(--primary-tint); color: var(--accent); }
.nav button[data-nav="home"] {
  justify-self: center;
  width: min(calc(100% - 4px), 68px);
  gap: 2px;
  transform: translateY(-3px);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-raised);
  box-shadow: 0 2px 6px #0002;
}
.nav button[data-nav="home"] .nav-icon svg { width: 23px; height: 23px; }
.nav button[data-nav="home"][aria-current="page"] {
  border-color: var(--accent-border);
  background: var(--primary-tint);
}
.nav button[data-nav="home"][aria-current="page"] .nav-icon { background: transparent; }
.nav .nav-highlight-arriving { position: relative; z-index: 1; isolation: isolate; }
.nav button[aria-current="page"] .nav-icon.nav-highlight-arriving { background: transparent; }
.nav button[data-nav="home"].nav-highlight-arriving[aria-current="page"] { background: var(--panel-raised); border-color: var(--line); }
.nav-moving-highlight {
  position: absolute;
  inset: 0 auto auto 0;
  z-index: -1;
  border: 1px solid transparent;
  background: var(--primary-tint);
  pointer-events: none;
}

.home-stage {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: calc(100svh - var(--top-space) - var(--header-height) - var(--nav-height) - env(safe-area-inset-bottom));
  padding: clamp(24px, 5.3vh, 48px) 0 34px;
}
.home-program { width: min(100%, 412px); margin-inline: auto; }
.home-program > .home-context, .home-program h1 { text-align: center; }
.home-context { color: var(--muted); font-size: 13px; font-weight: 540; }
.home-program h1 { margin: 5px 0 0; text-wrap: balance; }
.program-frequency { text-align: center; font-size: 13px; margin-top: 4px; }
.progress-block { display: grid; gap: 5px; }
.progress-caption { color: var(--muted); font-size: 12px; }
progress {
  display: block;
  width: 100%;
  height: 5px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--line);
  accent-color: var(--accent);
}
progress::-webkit-progress-bar { background: var(--line); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }

.home-workout {
  display: grid;
  justify-items: center;
  align-content: start;
  text-align: center;
  gap: 21px;
  padding-block: clamp(30px, 7vh, 68px) 25px;
}
.workout-info h2 { font-size: clamp(27px, 7vw, 36px); margin: 3px 0; text-wrap: balance; }
.workout-info p:last-child { font-size: 13px; }
.start-orbit {
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
  width: clamp(154px, 45vw, 187px);
  aspect-ratio: 1;
}
.start-orbit::before {
  content: "";
  position: absolute;
  z-index: -2;
  top: 50%;
  left: 50%;
  width: min(420px, calc(100vw - 36px));
  height: calc(100% + 118px);
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse, var(--accent-glow) 13%, var(--accent-glow-faint) 45%, transparent 72%);
  opacity: .82;
  pointer-events: none;
}
.start-orbit::after {
  content: "";
  position: absolute;
  z-index: -1;
  border: 1px solid var(--accent-border);
  border-radius: 50%;
  pointer-events: none;
}
.start-orbit::after { inset: 9px; opacity: .56; }
.program-progress-ring {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.program-progress-ring svg { display: block; width: 100%; height: 100%; fill: none; stroke-width: 2.35; }
.program-progress-track { stroke: var(--line); }
.program-progress-fill { stroke: var(--accent); stroke-dasharray: 100; }
.start-progress-caption {
  margin-top: -10px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.start-button {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  width: calc(100% - 38px);
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  color: var(--on-primary);
  background: radial-gradient(ellipse at 42% 22%, var(--primary), var(--primary) 55%, var(--primary-deep));
  box-shadow: 0 0 26px var(--accent-glow);
  font-weight: 650;
  font-size: 14px;
}
button.start-button:hover { background: var(--primary-hover); }
.start-button.program-complete { border: 1px solid var(--accent-border); background: var(--primary-tint); color: var(--accent); }
.start-button svg { width: 27px; height: 27px; }
.workout-preview-shared #workout-preview-title { transform-origin: top left; }
button.preview-start.workout-preview-morph { position: relative; z-index: 2; isolation: isolate; background: transparent; }
.workout-preview-surface { position: absolute; inset: 0 auto auto 0; z-index: -1; background: var(--primary); pointer-events: none; }
.workout-preview-surface-label { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 4px; font-size: 14px; }
.workout-preview-surface-label svg { width: 27px; height: 27px; }

@media (prefers-reduced-motion: no-preference) {
  .home-stage-enter .program-progress-fill { animation: home-progress-fill 720ms cubic-bezier(.24, .7, .26, 1); }
  .home-stage-enter .start-orbit::before { animation: home-glow-breathe 4.6s ease-in-out; }
  .start-orbit::before { transition: opacity 180ms ease, transform 180ms ease; }
  .start-orbit:has(button:is(:hover, :focus-visible, :active))::before {
    animation: none;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
  }

  .workout-preview-enter > * { animation: workout-arrive 220ms ease-out backwards; }
  .workout-preview-enter > .workout-overview { animation-delay: 28ms; }
  .tab-page-enter { animation: workout-arrive 245ms ease-out backwards; }
  [data-set-keyboard] .tab-page-enter { animation: none; }
  .workout-preview-shared .workout-context > .note { animation: workout-fade 210ms ease-out 165ms backwards; }
  .workout-preview-shared > .workout-footer { animation: workout-arrive 275ms ease-out 210ms backwards; }
  .workout-start-enter > * {
    --workout-entry-shift: -12px;
    animation: workout-arrive 300ms cubic-bezier(.2, .7, .28, 1) 54ms backwards;
  }
  .workout-start-enter > .workout-context {
    --workout-entry-shift: -5px;
    animation-duration: 240ms;
    animation-delay: 0ms;
  }
  .workout-start-enter > .movement {
    --workout-entry-shift: 11px;
    animation-duration: 320ms;
    animation-delay: 22ms;
  }
  [data-set-keyboard] .workout-start-enter > .movement { animation: none; }

  .workout-start-shared .workout-title-group > strong { transform-origin: top left; }
  .workout-start-shared :is(#save-warmup, #save-set) { position: relative; z-index: 2; transform-origin: top left; }
  .workout-previous-action { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
  .workout-start-shared .progress-block progress { animation: workout-progress-grow 320ms ease-out 75ms backwards; }
  .workout-start-shared .progress-block .progress-caption { animation: workout-fade 210ms ease-out 395ms backwards; }
  .workout-start-shared .workout-elapsed { animation: workout-fade 210ms ease-out 395ms backwards; }
  .workout-start-shared .workout-title-group > span { animation: workout-fade 210ms ease-out 250ms backwards; }
  .workout-start-shared .movement > :not(form),
  .workout-start-shared .set-form > :not(#save-warmup, #save-set) { animation: workout-fade 340ms ease-out 120ms backwards; }

  .stats-slide-frame { overflow: clip; padding: 4px; margin: -4px; }
  .stats-slide-next { --stats-slide-offset: 14%; }
  .stats-slide-previous { --stats-slide-offset: -14%; }
  :is(.stats-slide-next, .stats-slide-previous) .stats-slide-panel { animation: stats-slide-in 275ms cubic-bezier(.22, .72, .25, 1) backwards; }
  .stats-motion .stats-chart-line { stroke-dasharray: 100; stroke-dashoffset: 100; }
  .stats-motion :is(.stats-revealed, .stats-settled) .stats-chart-line { stroke-dashoffset: 0; }
  .stats-motion .stats-revealed .stats-chart-line { animation: draw-stats-line 730ms ease-out backwards; }
  .stats-motion .chart:not(.stats-revealed, .stats-settled) circle { opacity: 0; }
  .stats-motion .chart.stats-revealed circle { animation: workout-fade 280ms ease-out 200ms backwards; }
  .stats-motion .heatmap:not(.stats-revealed, .stats-settled) :is(.level-1, .level-2, .level-3) { background: var(--panel-raised); }
  .stats-motion .heatmap.stats-revealed :is(.level-1, .level-2, .level-3) {
    animation: stats-attendance-fill 290ms ease-out calc(20ms * var(--heat-week)) backwards;
  }

  @keyframes home-progress-fill { from { stroke-dashoffset: 100; } }
  @keyframes home-glow-breathe {
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.09); }
  }
  @keyframes workout-arrive {
    from { opacity: .65; transform: translateY(var(--workout-entry-shift, 7px)); }
  }
  @keyframes workout-fade { from { opacity: 0; } }
  @keyframes workout-progress-grow {
    from { clip-path: inset(0 calc(100% - 5px) 0 0 round 3px); }
    to { clip-path: inset(0 round 3px); }
  }
  @keyframes stats-slide-in { from { opacity: .62; transform: translateX(var(--stats-slide-offset)); } }
  @keyframes draw-stats-line { from { stroke-dashoffset: 100; } }
  @keyframes stats-attendance-fill { from { background: var(--panel-raised); } }
}

.dashboard-grid { display: grid; gap: 16px; }
.dashboard-card { min-width: 0; padding: 17px 0; border-top: 1px solid var(--line); }
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 15px; }
.card-header p { font-size: 12px; margin-top: 2px; }
.attendance-total { color: var(--accent); font-size: 13px; white-space: nowrap; }
.weekly-attendance { margin: -4px 0 12px; color: var(--accent-soft); font-size: 13px; }
.heatmap { display: grid; grid-template-columns: 15px repeat(16, minmax(0, 1fr)); gap: clamp(2px, .4vw, 4px); max-width: 460px; }
.heatmap-weekdays, .heatmap-week { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 16px repeat(7, auto); gap: inherit; }
.heatmap-weekdays { color: var(--muted); font-size: 9px; text-align: center; align-items: center; }
.heatmap-month { width: 0; overflow: visible; color: var(--muted); font-size: 10px; white-space: nowrap; }
.heatmap-cell { display: block; width: 100%; min-width: 0; aspect-ratio: 1; border: 0; border-radius: 3px; padding: 0; background: var(--panel-raised); }
.heatmap-cell.level-1 { background: var(--heat-low); }
.heatmap-cell.level-2 { background: var(--heat-medium); }
.heatmap-cell.level-3 { background: var(--accent); }
.heatmap-cell.future { opacity: .35; }
.heatmap-cell[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--accent-soft); }
.heatmap-cell:focus-visible { outline-offset: 1px; }
.heatmap-footer {
  max-width: 460px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
}
.heatmap-legend { display: flex; gap: 3px; align-items: center; white-space: nowrap; }
.heatmap-legend i { width: 9px; }
.quiet-icon { background: var(--panel); border: 1px solid var(--line); }
.quiet-icon svg { width: 17px; height: 17px; }
.dashboard-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.dashboard-metrics > div { min-width: 0; }
.dashboard-metrics span { display: block; color: var(--muted); font-size: 12px; }
.dashboard-metrics strong { display: block; color: var(--text); font-size: clamp(18px, 6vw, 27px); font-weight: 650; letter-spacing: -.04em; overflow-wrap: anywhere; }
.dashboard-metrics small { color: var(--muted); font-size: .58em; letter-spacing: 0; }
.volume-comparison { display: flex; align-items: center; gap: 5px; margin-top: 4px; color: var(--muted); }
.volume-comparison svg { flex: 0 0 17px; width: 17px; height: 17px; color: var(--accent); }
.volume-comparison span { overflow-wrap: anywhere; }
.stats-volume { grid-column: 1 / -1; }
.stats-volume strong { white-space: nowrap; }
@media (min-width: 560px) {
  .stats-totals { grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(0, 1fr)); }
  .stats-volume { grid-column: auto; }
}
.strength-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  margin-top: 14px;
  padding: 8px 0;
  text-align: left;
  color: var(--text);
  background: none;
  border: 0;
  border-top: 1px solid var(--line);
}
.stats-pages { min-width: 0; touch-action: pan-y pinch-zoom; }
.stats-page-dots { display: flex; justify-content: center; gap: 2px; }
.stats-page-dots button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 42px;
  border: 0;
  background: transparent;
  color: var(--muted);
}
.stats-page-dots button span { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.stats-page-dots button[aria-pressed="true"] { color: var(--accent); }
.stats-page-dots button[aria-pressed="true"] span { width: 15px; border-radius: 99px; }
.strength-lift-list { padding-inline-start: 20px; margin-block: 4px 8px; color: var(--muted); font-size: 13px; }
.strength-summary > span:first-child { flex: 1; min-width: 0; }
.strength-summary strong, .strength-summary small { display: block; overflow-wrap: anywhere; }
.strength-summary strong { font-size: 13px; }
.strength-summary small { color: var(--muted); font-size: 11px; }
.strength-summary > svg:last-child { width: 15px; flex: 0 0 15px; }
.strength-sparkline { width: 58px; flex: 0 0 58px; }
.strength-change { white-space: nowrap; font-size: 12px; font-weight: 650; }
.trend-up { color: var(--accent); }
.trend-down { color: var(--muted); }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 16px; }
.chart .chart-axis-label { font-variant-numeric: tabular-nums; }
#exercise-progress { scroll-margin-block-start: 16px; }
.stats-comparison { color: var(--text); font-size: 14px; }
.stats-comparison strong, .stats-comparison small { display: block; }
.stats-comparison strong { color: var(--accent); font-size: 12px; margin-bottom: 3px; }
.stats-comparison small { color: var(--muted); margin-top: 4px; }
.stats-details > summary { color: var(--accent); font-weight: 600; min-height: 42px; padding-block: 9px; }
.stats-details > div { margin-top: 8px; }
.reference-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: start; }
.reference-toggle-track {
  display: flex;
  align-items: center;
  flex: none;
  width: 38px;
  height: 22px;
  padding: 2px;
  border: 1px solid var(--field-line);
  border-radius: 999px;
  background: var(--panel-raised);
}
.reference-toggle-track::after {
  content: '';
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
}
.reference-toggle[aria-checked="true"] .reference-toggle-track { background: var(--primary); border-color: var(--primary); }
.reference-toggle[aria-checked="true"] .reference-toggle-track::after { margin-inline-start: auto; background: var(--on-primary); }
.reference-file-details { display: grid; gap: 2px; padding-inline: 4px; }
#reference-file-name { color: var(--text); overflow-wrap: anywhere; }

.workout-page { display: grid; gap: 30px; }
.workout-preview { gap: 19px; }
.workout-preview .workout-context { gap: 7px; }
.workout-preview .preview-start { margin-top: 5px; }
.workout-preview .exercise-line { color: var(--text); }
.workout-preview .exercise-line > svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--muted); }
.workout-context { display: grid; gap: 9px; }
.workout-context-active { gap: 6px; margin-block-end: -14px; }
.workout-context-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.workout-title-group { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; overflow-wrap: anywhere; }
.workout-title-group strong { color: var(--text); font-size: 20px; font-weight: 700; line-height: 1.2; }
.workout-title-group span { color: var(--muted); font-size: 11px; }
.workout-context-top .workout-elapsed { margin-inline-start: auto; white-space: nowrap; }
.workout-context .progress-caption { font-variant-numeric: tabular-nums; }
.workout-context .row > .note, .shared-workout-name .note { margin: 0; }
.shared-workout-name { padding: 12px; background: var(--panel-raised); border-radius: 10px; overflow-wrap: anywhere; }
.workout-share-actions { display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; }
.workout-qr { width: min(100%, 340px); margin: 12px auto; background: white; border-radius: 8px; }
.workout-qr svg { display: block; width: 100%; height: auto; }
.workout-scanner-video { width: 100%; max-height: 46dvh; object-fit: contain; border-radius: 10px; background: var(--panel-raised); }
.workout-elapsed { display: flex; justify-content: flex-end; gap: 7px; color: var(--muted); font-size: 12px; }
.workout-elapsed output { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.movement { min-width: 0; }
.movement-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px 12px; }
.movement-heading-copy { grid-area: 1 / 1; align-self: center; }
.movement-title-qualifier {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 550;
  letter-spacing: normal;
  line-height: 1.3;
}
.movement-index { color: var(--accent); font-size: 12px; margin-bottom: 5px; }
.movement-notes { margin-top: 8px; }
.movement-set-position {
  grid-area: 2 / 2;
  display: grid;
  align-items: center;
  min-height: 34px;
  justify-self: center;
  color: var(--text);
  font-size: clamp(14px, 4vw, 18px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.movement-complete { margin-top: 19px; color: var(--accent-soft); }
.rest-timer {
  position: relative;
  display: grid;
  grid-area: 1 / 2;
  justify-self: center;
  justify-items: center;
  align-self: start;
}
.rest-timer-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.rest-dial { position: relative; width: 66px; aspect-ratio: 66 / 74; }
.rest-dial-ring { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke-width: 3.25; pointer-events: none; }
.rest-dial-title { fill: var(--muted); font-size: 8.5px; font-weight: 650; letter-spacing: .055em; text-transform: uppercase; }
.rest-dial-track { stroke: var(--line); }
.rest-dial-progress { stroke: var(--accent); stroke-dasharray: 100; stroke-dashoffset: var(--rest-offset, 100); }
.rest-dial output { font-size: 13px; font-variant-numeric: tabular-nums; font-weight: 650; }
.rest-dial :is(output, .rest-dial-complete) { position: absolute; left: 50%; top: 60.8%; transform: translate(-50%, -50%); }
.rest-active .rest-dial output { top: 52%; }
.rest-dial-complete { display: grid; place-items: center; color: var(--accent); }
.rest-dial-complete svg { width: 20px; height: 20px; }
.rest-timer .rest-skip { position: absolute; left: 50%; top: 60%; transform: translateX(-50%); min-width: 44px; min-height: 24px; color: var(--muted); font-size: 11px; }
.rest-timer .rest-skip:hover { color: var(--text); }
@media (prefers-reduced-motion: no-preference) {
  .rest-active .rest-dial-progress { animation: rest-drain var(--rest-time-left, 0ms) linear both; }
  @keyframes rest-drain { from { stroke-dashoffset: var(--rest-start, 100); } to { stroke-dashoffset: 100; } }
}
.warmup-cue { padding: 10px 12px; border-radius: 9px; background: var(--primary-tint); }
.warmup-cue h2 { color: var(--accent-soft); font-size: 15px; }
.warmup-cue p { margin-top: 4px; font-size: 13px; }
.set-form { display: grid; gap: 12px; margin-top: 21px; }
.set-context { margin: 0; display: grid; gap: 5px; font-size: 12px; }
.set-context > div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; }
.set-context dt { color: var(--muted); }
.set-context dd { margin: 0; font-variant-numeric: tabular-nums; }
.set-context .working-target :is(dt, dd) { color: var(--accent-soft); font-weight: 650; }
.form-error { color: var(--error); font-size: 13px; }
.set-form [aria-invalid="true"], .warmup-form [aria-invalid="true"], #edit-set-form [aria-invalid="true"] { border-color: var(--error-border); }
.set-fields { display: grid; grid-template-columns: 1fr 1fr minmax(73px, .78fr); align-items: end; gap: 8px; }
.set-field-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; }
.set-field-target { color: var(--accent-soft); font-size: 11px; font-weight: 650; }
.set-fields > div { min-width: 0; }
.set-fields input, .set-fields select { min-height: 50px; font-variant-numeric: tabular-nums; }
.set-fields input { font-size: 19px; }
.set-fields.compact-fields { grid-template-columns: 1fr 1fr; }
.set-fields:has(> div:nth-child(3)):has(.rep-stepper) {
  grid-template-columns: minmax(0, 1fr) minmax(101px, 1.28fr) minmax(55px, .72fr);
}
.rep-stepper {
  display: grid;
  grid-template-columns: minmax(29px, .8fr) minmax(0, 1.4fr) minmax(29px, .8fr);
  border: 1px solid var(--field-line);
  border-radius: 10px;
  background: var(--panel);
}
.rep-stepper input[type="number"] {
  appearance: textfield;
  min-height: 48px;
  padding-inline: 0;
  border: 0;
  text-align: center;
  background: transparent;
}
.rep-stepper input::-webkit-inner-spin-button, .rep-stepper input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.rep-stepper button {
  min-height: 48px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: var(--accent-soft);
  background: var(--panel-raised);
  font-size: 19px;
}
.rep-stepper:has(input[aria-invalid="true"]) { border-color: var(--error-border); }
.drop-fields { color: var(--muted); font-size: 13px; }
.drop-fields .set-fields { grid-template-columns: 1fr 1fr; padding-top: 9px; }
.drop-stage {
  min-width: 0;
  margin: 3px 0 0;
  padding: 8px 13px 5px;
  border: 1px solid var(--accent-border);
  border-radius: 14px;
  background: var(--primary-tint);
}
.drop-stage legend { padding-inline: 7px; color: var(--accent-soft); font-weight: 700; }
.preview-start, .finish-ready { width: 100%; margin-top: 19px; }
.movement-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 18px;
  row-gap: 0;
  margin-top: 10px;
  font-size: 13px;
}
.movement-heading-actions { grid-area: 2 / 1; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; }
.movement-guide { min-width: 0; max-width: 100%; }
.movement-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding-inline: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  list-style: none;
}
.movement-guide > summary::-webkit-details-marker, .exercise-actions > summary::-webkit-details-marker { display: none; }
.movement-action:hover { color: var(--text); }
.movement-action svg { width: 14px; height: 14px; flex: none; }
.movement-guide[open] > summary svg:last-child { transform: rotate(90deg); }
.movement-guide-content { display: grid; gap: 5px; margin-top: 6px; padding: 10px 12px; border-radius: 8px; background: var(--panel); font-size: 13px; }
.movement-guide-content p { max-width: 58ch; }
.movement-guide-content a { color: var(--accent); }
.set-list { list-style: none; padding: 0; margin: 0; }
.set-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); }
.set-list small { display: block; color: var(--muted); }
.log-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: end; }
.logged-sets-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.logged-sets-columns section + section { padding-inline-start: 12px; border-inline-start: 1px solid var(--line); }
.logged-sets-columns h3 { margin-block-end: 6px; font-size: 14px; }
.logged-sets-columns .set-list li { display: grid; gap: 2px; padding-block-start: 7px; font-size: 13px; overflow-wrap: anywhere; }
.logged-sets-columns .log-actions { justify-content: start; gap: 10px; }
.logged-sets-columns .log-actions .text-button { min-height: 36px; }
.workout-overview { border-top: 1px solid var(--line); padding-top: 17px; }
.workout-overview:has(.exercise-wheel) { border-top: 0; padding-top: 0; }
.workout-overview-heading { min-height: 40px; }
.exercise-actions { position: relative; z-index: 2; flex: none; }
.exercise-actions > summary { position: relative; display: grid; place-items: center; width: 44px; height: 44px; list-style: none; border-radius: 10px; }
.exercise-actions > summary::before { content: ''; position: absolute; inset: 6px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.exercise-actions > summary svg { position: relative; width: 17px; height: 17px; }
.exercise-actions[open] > summary::before, .exercise-actions > summary:hover::before { background: var(--panel-raised); }
.exercise-actions[open] > summary svg { transform: rotate(45deg); }
.exercise-actions-panel {
  position: absolute;
  inset-block-start: 100%;
  inset-inline-end: 6px;
  display: grid;
  min-width: max-content;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 8px 20px #0003;
}
.exercise-actions-panel button { min-height: 40px; padding-inline: 12px; border-radius: 7px; text-align: start; }
.exercise-actions-panel button:hover { background: var(--panel-raised); }
.exercise-list { list-style: none; display: grid; gap: 7px; padding: 0; margin: 10px 0 0; }
.exercise-preview-group {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  padding: 7px 8px;
  text-align: start;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-color: color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 12px;
}
.exercise-preview-group:hover { background: var(--panel); }
.exercise-preview-group .exnum { color: var(--muted); }
.exercise-preview-copy { display: grid; gap: 4px; min-width: 0; }
.exercise-preview-work { display: flex; align-items: center; gap: 8px; min-height: 39px; }
.exercise-preview-work > svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.warmup-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 23px;
  margin-inline-end: 18px;
  padding: 2px 7px;
  text-align: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
}
.warmup-line small { white-space: nowrap; font-size: 11px; }
.exercise-wheel-wrap { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.exercise-wheel-wrap > .exercise-preview-group { position: absolute; backface-visibility: hidden; }
.exercise-line {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 8px 9px;
  text-align: left;
  color: var(--muted);
  background: none;
  border: 1px solid transparent;
  border-radius: 10px;
}
.exercise-line:hover { background: var(--panel); }
.exercise-line.active { border-color: var(--accent-border); background: var(--primary-tint); color: var(--text); }
.exnum { min-width: 20px; font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.exercise-line.active .exnum { color: var(--accent); }

.exercise-wheel {
  --wheel-row: 84px;
  --wheel-height: calc(2.4 * var(--wheel-row));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  isolation: isolate;
  margin-top: 8px;
  background: radial-gradient(ellipse at center, var(--primary-tint), transparent 72%);
}
.exercise-wheel:has(.exercise-wheel-control) { grid-template-columns: 44px minmax(0, 1fr); }
.exercise-wheel-track {
  height: var(--wheel-height);
  margin: 0;
  padding: calc((var(--wheel-height) - var(--wheel-row)) / 2) 6px;
  list-style: none;
  overflow: hidden auto;
  overscroll-behavior-y: none;
  scrollbar-width: none;
  scroll-snap-type: y mandatory;
}
.exercise-wheel-track::-webkit-scrollbar { display: none; }
.exercise-wheel-track.is-seeking { scroll-snap-type: none; }
.exercise-wheel-track li {
  height: var(--wheel-row);
  display: grid;
  align-items: center;
  scroll-snap-align: center;
}
.exercise-wheel-track .exercise-line {
  min-width: 0;
  min-height: 62px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.exercise-wheel-track li.is-centered .exercise-line { border-color: var(--field-line); background: var(--panel-raised); }
.exercise-wheel-track li .exercise-line.active { color: var(--text); background: var(--primary-tint); border-color: var(--accent); }
.exercise-wheel-track .active .exname { color: var(--accent-soft); }
.exercise-wheel-track .active small { color: var(--accent-soft); }
.exercise-wheel-control {
  position: relative;
  height: calc(100% - 28px);
  align-self: center;
  border-radius: 8px;
}
.exercise-wheel-control:has(input:focus-visible) { outline: 2px solid var(--accent); }
.exercise-wheel-dots {
  position: absolute;
  inset: 8px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.exercise-wheel-dot {
  width: clamp(1px, calc(140px / var(--wheel-dot-count)), 6px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--field-line);
}
.exercise-wheel-dot.active { outline: 1px solid var(--accent); outline-offset: 2px; }
.exercise-wheel-dot.is-centered { background: var(--accent-soft); transform: scale(1.4); }
#exercise-wheel-slider {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  appearance: none;
  cursor: ns-resize;
  touch-action: none;
  writing-mode: vertical-lr;
  direction: ltr;
}
#exercise-wheel-slider::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; }
#exercise-wheel-slider::-moz-range-thumb { width: 14px; height: 14px; border: 0; }
@media (prefers-reduced-motion: no-preference) {
  .exercise-wheel-track li {
    position: relative;
    z-index: var(--wheel-order, 0);
    perspective: 360px;
    perspective-origin: 50% calc(50% - var(--wheel-y, 0px));
    pointer-events: none;
  }
  .exercise-wheel-track .exercise-line {
    transform: translate3d(0, var(--wheel-offset, 0px), var(--wheel-depth, 0px)) rotateX(var(--wheel-angle, 0deg));
    opacity: var(--wheel-opacity, 1);
    backface-visibility: hidden;
    pointer-events: auto;
  }
  .exercise-wheel-track .is-behind .exercise-line { opacity: 0; pointer-events: none; }
}
.exname { flex: 1; min-width: 0; font-size: 14px; font-weight: 570; overflow-wrap: anywhere; }
.exname small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; }
.exercise-count { color: var(--accent); font-size: 12px; }
.exercise-count svg { display: block; width: 17px; height: 17px; }
.workout-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; padding-top: 9px; border-top: 1px solid var(--line); }
.workout-page:has(.exercise-wheel) > .workout-footer { padding-top: 0; border-top: 0; }
.workout-footer .text-button { color: var(--muted); }

.program-library { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
.program-import-button svg { width: 20px; height: 20px; }
.program-import-guide { display: grid; place-items: center; text-align: center; text-decoration: none; }
.program-poster { display: grid; align-content: start; gap: 7px; min-width: 0; padding: 0; border: 0; background: none; color: var(--text); text-align: start; }
.program-poster-art {
  display: grid;
  aspect-ratio: 525 / 680;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #101219;
}
.program-poster-active .program-poster-art { outline: 2px solid var(--accent); outline-offset: 2px; }
.program-art { display: block; width: 100%; height: 100%; min-height: 0; object-fit: cover; }
.program-poster-name { font-size: 13px; font-weight: 650; overflow-wrap: anywhere; }
.program-poster-fallback {
  display: flex;
  flex-direction: column;
  justify-content: end;
  gap: 8px;
  padding: clamp(10px, 3vw, 20px);
  background: radial-gradient(ellipse at 75% 10%, var(--primary-tint), transparent 80%), var(--panel);
  color: var(--text);
  overflow-wrap: anywhere;
}
.program-poster-fallback small, .program-status { color: var(--accent); font-size: 12px; }
.program-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr); gap: 12px; align-items: start; }
.program-detail .program-poster-art { filter: grayscale(1); }
.program-detail-text { display: grid; gap: 8px; overflow-wrap: anywhere; }
.program-detail-text p { font-size: 13px; }
.program-variants { min-inline-size: 0; margin: 0; padding: 0; border: 0; }
.program-variants legend { padding: 0; }
.program-variant-list { display: grid; gap: 5px; }
.program-variant-list label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 13px;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.program-variant-list input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.program-variant-list label:has(input:checked) {
  border-color: var(--accent-border);
  background: var(--primary-tint);
}
.history-item summary { display: flex; justify-content: space-between; gap: 12px; }
.history-item summary > span:last-child { text-align: right; }
.history-item .history-position { color: var(--accent); }
.history-item small { display: block; margin-top: 3px; color: var(--muted); }
.history-item time { font-size: 13px; white-space: nowrap; }
.history-sets { display: grid; gap: 8px; margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); font-size: 13px; }
.history-sets h3 { margin: 5px 0; }
.history-set-label { color: var(--muted); font-size: 12px; margin: 7px 0 0; }
.history-filter button { flex-shrink: 0; }

.modal {
  width: min(calc(100% - 24px), 460px);
  max-height: 85dvh;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 20px 55px #0008;
}
.modal[open] { display: grid; gap: 12px; }
.modal::backdrop { background: var(--backdrop); }
.backup-reminder-toggle { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.backup-reminder-toggle input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.custom-setup::backdrop { backdrop-filter: blur(4px); }
.program-report { display: grid; gap: 16px; }
.program-report header p { margin-top: 4px; }
.report-section { display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.report-metrics { gap: 12px 16px; }
.report-strength-value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.report-strength-value strong { color: var(--accent); font-size: 27px; font-variant-numeric: tabular-nums; }
.report-lifts { display: grid; gap: 7px; padding: 0; margin: 8px 0 0; list-style: none; }
.report-lifts li { display: flex; justify-content: space-between; gap: 8px; padding-top: 7px; border-top: 1px solid var(--line); font-size: 13px; }
.report-lifts li div { min-width: 0; overflow-wrap: anywhere; }
.report-lifts small { display: block; color: var(--muted); }
.report-lifts li > span { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.share-choices .pick {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  min-height: 44px;
  gap: 10px;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.share-choices .sharechoice { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.modal .row .iconbtn { margin-inline-end: -6px; }
.picker-weeks { display: grid; }
.picker-weeks details { border-top: 1px solid var(--line); }
.picker-weeks summary { display: flex; align-items: center; gap: 10px; min-height: 48px; list-style: none; }
.picker-weeks summary::-webkit-details-marker { display: none; }
.picker-weeks summary span { margin-inline-start: auto; color: var(--muted); font-size: 12px; }
.picker-weeks summary svg { width: 15px; height: 15px; color: var(--accent); }
.picker-weeks details[open] > summary svg { transform: rotate(90deg); }
.workout-options { display: grid; gap: 3px; margin: 0 0 7px; }
button.workout-option {
  min-height: 45px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 9px;
}
button.workout-option:hover { background: var(--panel-raised); }
button.workout-option-current { background: var(--primary-tint); border-color: var(--accent-border); }
.workout-option strong { font-weight: 600; }
.workout-option small, .picker-preview small { display: block; color: var(--muted); font-size: 12px; }
.workout-option svg { width: 15px; height: 15px; flex: 0 0 15px; color: var(--accent); }
.picker-back { justify-self: start; }
.preview-heading p { margin-top: 3px; font-size: 13px; }
.picker-preview { display: grid; gap: 8px; margin: 0; padding-inline-start: 20px; }
button.custom-workout-option { background: var(--primary-tint); }
.custom-row { min-inline-size: 0; margin: 0; padding: 8px 10px 10px; border: 1px solid var(--line); border-radius: 9px; }
.custom-row legend { padding-inline: 4px; }
.custom-targets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 8px; margin-top: 8px; }
.custom-superset-toggle { display: flex; align-items: center; gap: 9px; min-height: 42px; width: fit-content; cursor: pointer; }
.custom-superset-toggle input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.custom-suggestions { list-style: none; display: grid; gap: 2px; padding: 5px; margin: 4px 0 0; background: var(--panel-raised); border-radius: 9px; }
.custom-suggestions button { width: 100%; min-height: 40px; text-align: start; overflow-wrap: anywhere; }
.custom-replacement-label { display: block; color: var(--muted); }
.custom-workout-form [aria-invalid="true"] { border-color: var(--error-border); }
.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: calc(var(--nav-height) + 12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(90vw, 420px);
  padding: 9px 15px;
  border-radius: 999px;
  background: var(--panel-raised);
  color: var(--text);
  border: 1px solid var(--accent-border);
  box-shadow: 0 8px 22px #0006;
  text-align: center;
  font-size: 13px;
  font-weight: 650;
}
.toast button {
  min-height: 36px;
  margin-inline: 3px -5px;
  padding: 3px 8px;
  color: var(--on-primary);
  background: var(--primary);
  border: 0;
  border-radius: 999px;
  font-weight: 700;
}

@media (pointer: coarse) {
  [data-set-keyboard] .nav { visibility: hidden; }
  [data-set-keyboard="set-form"] #set-form, [data-set-keyboard="warmup-form"] #warmup-form { padding-bottom: 52px; }
  [data-set-keyboard] :is(#set-form, #warmup-form) input { scroll-margin-block-end: 60px; }
  [data-set-keyboard="set-form"] #save-set, [data-set-keyboard="warmup-form"] #save-warmup {
    position: fixed;
    z-index: 12;
    inset: auto max(16px, calc((100vw - 600px) / 2)) calc(var(--keyboard-inset, 0px) + 8px);
    box-shadow: 0 4px 20px #0008;
  }
}

@media (max-width: 520px) {
  .modal { margin-block: auto max(7px, env(safe-area-inset-bottom)); }
}
@media (max-height: 650px) {
  .home-stage { padding-block: 14px 8px; }
  .home-workout { gap: 13px; padding-block: 20px 10px; }
  .start-progress-caption { margin-top: -4px; }
  .start-orbit { width: 146px; }
}
@media (min-width: 660px) {
  .nav { width: 520px; margin-inline: auto; border-inline: 1px solid var(--line); border-radius: 18px 18px 0 0; }
}

.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-photo {
  display: grid;
  grid-template-columns: auto minmax(0, max-content);
  justify-content: center;
  align-items: center;
  gap: clamp(10px, 4vw, 18px);
}
.profile-photo .avatar {
  --profile-photo-size: clamp(72px, 22vw, 84px);
  width: var(--profile-photo-size);
  height: var(--profile-photo-size);
  font-size: 23px;
}
.profile-photo .avatar svg { width: 30px; height: 30px; }
.profile-photo-actions { display: grid; min-width: 0; gap: 4px; }
.profile-photo-actions button { text-align: start; overflow-wrap: anywhere; }
.profile-photo-actions .text-button { padding-inline: 15px; }
.appearance-field { padding: 0; margin: 0; border: 0; min-width: 0; }
.appearance-field legend { padding: 0; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.theme-modes, .theme-swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.theme-modes button { flex: 1 1 0; min-width: 0; padding-inline: 5px; }
.theme-modes button[aria-pressed="true"] { background: var(--primary-tint); border-color: var(--accent-border); }
.theme-swatch {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border: 1px solid var(--field-line);
  border-radius: 50%;
  background: var(--panel-raised);
  color: var(--on-primary);
}
.theme-swatch span { display: block; width: 100%; aspect-ratio: 1; border-radius: 50%; background: var(--swatch); }
.theme-swatch[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.custom-accent { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.custom-accent input { width: 60px; height: 44px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); cursor: pointer; }
.profile-photo-message:empty { display: none; }
.profile-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.profile-fields [aria-invalid="true"] { border-color: var(--error-border); }
.profile-health-import { display: grid; gap: 6px; }
#profile-health-message:empty { display: none; }
.body-weight-heading button { flex-shrink: 0; }
.body-weight-summary { align-items: start; flex-wrap: wrap; }
.body-weight-summary strong { font-size: clamp(24px, 6vw, 33px); }
.body-weight-summary small { font-size: .58em; color: var(--muted); }
.body-weight-summary span { color: var(--accent); font-weight: 650; }

.strength-groups { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.strength-groups button { padding-inline: 5px; }
.strength-groups button[aria-pressed="true"] { background: var(--primary-tint); border-color: var(--accent-border); }
.strength-index-value { flex-wrap: wrap; }
.strength-index-value strong { font-size: clamp(24px, 6vw, 33px); }
.strength-index-value span { color: var(--accent); font-size: 13px; margin-inline-start: 8px; font-weight: 650; }
.strength-index-value div + div { text-align: end; }
.strength-index-value p { font-size: 12px; }
.strength-index-value small { font-size: 11px; color: var(--muted); }
.strength-index .stats-details .note + .note { margin-top: 7px; }

.training-map h2 + .note { margin-top: 4px; }
.training-map-figures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  justify-items: center;
  padding: 8px 0 4px;
  background: radial-gradient(ellipse at center, var(--primary-tint), transparent 70%);
}
.training-map-figures figure { margin: 0; text-align: center; }
.training-map-figures svg { display: block; width: 100%; max-width: 132px; height: auto; margin-inline: auto; }
.training-map-figures figcaption, .training-map-legend, .training-map-range { color: var(--muted); font-size: 12px; }
.training-map-body { fill: var(--panel-raised); stroke: var(--field-line); stroke-width: 1; }
.training-map-region { stroke: var(--panel); stroke-width: 1.25; stroke-linejoin: round; }
.training-map-region, .training-map-swatch {
  fill: var(--region-fill);
  background: var(--region-fill);
}
.training-map-legend { display: flex; justify-content: center; align-items: center; gap: 8px; }
.training-map-range { display: flex; gap: 3px; }
.training-map-swatch { display: inline-block; width: 10px; height: 10px; border: 1px solid var(--field-line); border-radius: 3px; flex: none; }
.training-map-counts { list-style: none; padding: 0; margin: 0 0 8px; }
.training-map-counts li { display: flex; gap: 8px; align-items: center; min-height: 30px; font-size: 13px; }
.training-map-counts strong { margin-inline-start: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.training-map .note + .note { margin-top: 6px; }

.demo-banner {
  padding: 4px 10px;
  margin-bottom: 6px;
  border-radius: 8px;
  background: var(--primary-tint);
  color: var(--accent);
  font-size: 12px;
  text-align: center;
}
.first-launch-demo-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-block: 0; }
.first-launch-demo-banner button { min-height: 44px; padding-inline: 2px; color: inherit; background: transparent; border: 0; font-weight: 650; }
.setup-view:has(.first-launch-demo-banner) { display: grid; grid-template-rows: auto 1fr; min-height: 100svh; }
.setup-view:has(.first-launch-demo-banner) .onboarding-welcome { min-height: 0; }
