/* ============ Tokens ============ */
:root {
  --bg: #F2F2F5;
  --surface: #FFFFFF;
  --surface-alt: #EBEBEE;
  --ink: #1E1E1E;
  --ink-soft: #5C5A58;
  --ink-faint: #8A8885;
  --line: #E5E5E8;
  --moss-900: #7A3500;
  --moss-700: #D4650A;
  --moss-500: #F5860A;
  --moss-100: #FFF2E5;
  --ember: #E04040;
  --ember-100: #FDECEC;
  --gold: #B98A2E;
  --gold-100: #F3E7CC;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 9px;
  --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-2: 0 12px 32px -16px rgba(0, 0, 0, 0.12);
  --shadow-3: 0 20px 50px -20px rgba(0, 0, 0, 0.18);

  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* E3: Dynamic Type — base font size respects system preference */
  font-size: clamp(15px, 1rem, 18px);

  /* E2: Spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Z-index scale */
  --z-topbar: 5;
  --z-tabbar: 10;
  --z-fab: 15;
  --z-backdrop: 20;
  --z-modal: 25;
  --z-context-menu-bg: 30;
  --z-context-menu: 31;
  --z-toast: 50;
  --z-onboarding: 100;
  --z-overlay: 9999;
}

/* ============ Inline SVG Icons ============ */
.section-title svg,
.btn svg,
.btn-visual-guide svg,
.rest-check-row svg,
.rest-track-row__icon svg,
.reminder-pill__icon svg,
.train-today-card__header svg,
.weight-wizard__title svg,
.toast svg,
.vis-tab svg,
.vis-section-title svg,
.pill svg,
.rest-note svg,
.big-timer-card__eyebrow svg,
.hero__title svg,
.progress-row__name svg {
  display: inline-block;
  vertical-align: -0.15em;
  flex-shrink: 0;
}

/* ============ Dark theme variables ============ */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #141414;
    --surface: #1E1E1E;
    --surface-alt: #282828;
    --ink: #EAEAEA;
    --ink-soft: #A8A8A6;
    --ink-faint: #6E6E6C;
    --line: #363636;
    --moss-900: #FFBA6B;
    --moss-700: #F5960A;
    --moss-500: #FFB44D;
    --moss-100: #2E2010;
    --ember: #F06060;
    --ember-100: #3A2020;
    --gold: #D4A636;
    --gold-100: #3A3020;
    --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-2: 0 12px 32px -16px rgba(0, 0, 0, 0.5);
    --shadow-3: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
  }
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141414;
  --surface: #1E1E1E;
  --surface-alt: #282828;
  --ink: #EAEAEA;
  --ink-soft: #A8A8A6;
  --ink-faint: #6E6E6C;
  --line: #363636;
  --moss-900: #FFBA6B;
  --moss-700: #F5960A;
  --moss-500: #FFB44D;
  --moss-100: #2E2010;
  --ember: #F06060;
  --ember-100: #3A2020;
  --gold: #D4A636;
  --gold-100: #3A3020;
  --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-2: 0 12px 32px -16px rgba(0, 0, 0, 0.5);
  --shadow-3: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #F2F2F5;
  --surface: #FFFFFF;
  --surface-alt: #EBEBEE;
  --ink: #1E1E1E;
  --ink-soft: #5C5A58;
  --ink-faint: #8A8885;
  --line: #E5E5E8;
  --moss-900: #7A3500;
  --moss-700: #D4650A;
  --moss-500: #F5860A;
  --moss-100: #FFF2E5;
  --ember: #E04040;
  --ember-100: #FDECEC;
  --gold: #B98A2E;
  --gold-100: #F3E7CC;
  --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-2: 0 12px 32px -16px rgba(0, 0, 0, 0.12);
  --shadow-3: 0 20px 50px -20px rgba(0, 0, 0, 0.18);
}

/* ============ Dark mode component overrides ============ */
@media (prefers-color-scheme: dark) {
  .modal-backdrop { background: rgba(0, 0, 0, 0.6); }
  .modal input[type="date"] { background: var(--bg); color: var(--ink); }
  .topbar__mark { color: #1A1D1A; }
  .big-timer-card { background: linear-gradient(145deg, #2E2010, #1E1508) !important; }
}
[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, 0.6); }
[data-theme="dark"] .modal input[type="date"] { background: var(--bg); color: var(--ink); }
[data-theme="dark"] .topbar__mark { color: #1A1D1A; }
[data-theme="dark"] .big-timer-card { background: linear-gradient(145deg, #2E2010, #1E1508) !important; }
[data-theme="dark"] .pill { background: var(--surface-alt); color: var(--ink-soft); }
[data-theme="dark"] .pill--ember { background: var(--ember-100); color: var(--ember); }
[data-theme="dark"] .pill--gold { background: var(--gold-100); color: var(--gold); }
[data-theme="dark"] .tabbar__indicator { background: var(--moss-100); }
[data-theme="dark"] .vis-tag--primary { background: var(--moss-100); color: var(--moss-700); }
[data-theme="dark"] .vis-tag--secondary { background: var(--surface-alt); color: var(--ink-soft); }
[data-theme="dark"] .muscle-svg .m-base { fill: var(--surface-alt); stroke: var(--line); }
@media (prefers-color-scheme: dark) {
  .pill { background: var(--surface-alt); color: var(--ink-soft); }
  .pill--ember { background: var(--ember-100); color: var(--ember); }
  .pill--gold { background: var(--gold-100); color: var(--gold); }
  .tabbar__indicator { background: var(--moss-100); }
  .vis-tag--primary { background: var(--moss-100); color: var(--moss-700); }
  .vis-tag--secondary { background: var(--surface-alt); color: var(--ink-soft); }
  .muscle-svg .m-base { fill: var(--surface-alt); stroke: var(--line); }
}

/* Dark-mode scrollbar */
@media (prefers-color-scheme: dark) {
  :root { scrollbar-color: #363636 #141414; }
}
[data-theme="dark"] { scrollbar-color: #363636 #141414; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}
button { font-family: inherit; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -0.01em; }
:focus-visible { outline: 2.5px solid var(--moss-500); outline-offset: 2px; border-radius: 6px; }

/* ============ App shell ============ */
.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) var(--space-lg) 14px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  transition: padding 0.3s ease, box-shadow 0.3s ease;
  will-change: padding, box-shadow;
}
.topbar--scrolled {
  padding-top: calc(env(safe-area-inset-top, 0px) + 10px);
  padding-bottom: 10px;
  box-shadow: 0 1px 0 var(--line);
}
.topbar__mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.topbar__title { flex: 1; min-width: 0; }
.topbar__eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--moss-500);
  margin-bottom: 2px;
}
.topbar__title h1 {
  font-size: 21px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: font-size 0.3s ease, opacity 0.3s ease;
}
.topbar--scrolled .topbar__title h1 {
  font-size: 17px;
}
.topbar--scrolled .topbar__eyebrow {
  font-size: 10px;
  margin-bottom: 0;
}
.topbar__settings {
  width: 38px; height: 38px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.topbar__settings:hover { color: var(--moss-700); border-color: var(--moss-500); }

.view {
  flex: 1;
  padding: var(--space-xs) var(--space-lg) calc(96px + env(safe-area-inset-bottom, 0px));
}

/* E1: Large title that appears above content */
.large-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  padding: var(--space-sm) 0 var(--space-md);
  transition: opacity 0.3s ease, transform 0.3s ease, max-height 0.3s ease;
  overflow: hidden;
  max-height: 60px;
}
.large-title--hidden {
  opacity: 0;
  transform: translateY(-8px);
  max-height: 0;
  padding: 0;
}

.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 8px 8px calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: var(--z-tabbar);
}
.tabbar__indicator {
  position: absolute;
  top: 6px;
  left: 0;
  height: calc(100% - 12px - env(safe-area-inset-bottom, 0px));
  background: var(--moss-100);
  border-radius: 14px;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 0;
  pointer-events: none;
}
.tabbar__btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px 6px;
  border: none; background: transparent; cursor: pointer;
  color: var(--ink-soft);
  opacity: 0.65;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 14px;
  position: relative;
  z-index: 1;
  transition: color .2s cubic-bezier(0.16, 1, 0.3, 1), opacity .2s cubic-bezier(0.16, 1, 0.3, 1);
}
.tabbar__btn svg {
  transition: transform .2s ease, stroke-width .2s ease;
}
.tabbar__btn:hover {
  opacity: 0.9; color: var(--moss-700);
}
.tabbar__btn[aria-current="page"] {
  opacity: 1;
  color: var(--moss-900);
  font-weight: 700;
}
.tabbar__btn[aria-current="page"] svg {
  transform: translateY(-2px) scale(1.08);
  stroke-width: 2.4px;
}

/* ============ Cards & primitives ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  padding: var(--space-lg);
}
.card + .card { margin-top: var(--space-md); }
.section-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: var(--space-xl) 2px var(--space-sm);
}
.section-title:first-child { margin-top: var(--space-xs); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  background: var(--moss-100);
  color: var(--moss-700);
}
.pill--ember { background: var(--ember-100); color: var(--ember); }
.pill--gold { background: var(--gold-100); color: var(--gold); }
.pill--muted { background: var(--surface-alt); color: var(--ink-soft); border: 1px solid var(--line); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 12px;
  padding: 13px 18px;
  font-weight: 600;
  font-size: 15px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .08s ease, opacity .15s ease;
}
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--moss-700); color: #FFFFFF; }
.btn--primary:hover { background: var(--moss-900); }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--moss-500); color: var(--moss-700); }
.btn--block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ============ Hero (Hoy) ============ */
.hero {
  background: linear-gradient(165deg, var(--moss-700), var(--moss-900));
  color: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: var(--space-lg) 22px;
  box-shadow: var(--shadow-3);
  position: relative;
  overflow: hidden;
  margin-bottom: var(--space-lg);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, transparent 50%);
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute; right: -30px; top: -30px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.12), transparent 70%);
}
.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #C7DCC4;
}
.hero .btn--primary { background: #FFFFFF; color: var(--moss-900); }
.hero .btn--primary:hover { background: #fff; }
.hero .btn--ghost { background: rgba(255,255,255,0.08); color: #FFFFFF; border-color: rgba(255,255,255,0.25); }

/* legacy .rest-card removed — see .rest-hero above */

/* ============ Session ============ */
.session-warmup {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface-alt);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  margin-top: 4px;
  margin-bottom: 16px;
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.session-warmup strong { color: var(--ink); }

.block-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--moss-500);
  margin: 22px 2px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.block-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.exercise-card { margin-bottom: 12px; }
.exercise-card__head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
}
.exercise-card__name { font-size: 16.5px; font-weight: 600; line-height: 1.3; }
.exercise-card__variant { color: var(--ink-faint); font-weight: 500; font-size: 13.5px; }
.exercise-card__equipment { color: var(--ink-soft); font-size: 12.5px; margin-top: 3px; }
.exercise-card__badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.ladder-container {
  margin-top: 14px;
  margin-bottom: 14px;
}
.ladder__label {
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  margin-bottom: 6px;
  display: block;
}
.ladder {
  display: flex; align-items: center; gap: 5px;
}
.ladder__dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1.6px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-faint);
  background: var(--surface);
}
.ladder__dot--hit { background: var(--moss-700); border-color: var(--moss-700); color: #FFFFFF; }
.ladder__dot--target { border-color: var(--moss-500); color: var(--moss-700); }
.ladder__arrow { color: var(--ink-faint); margin: 0 1px; font-size: 12px; }
.ladder__suggest {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ember);
  display: flex; align-items: center; gap: 4px;
}

.sets-grid { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.set-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.set-row__label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
  text-align: center;
}
.set-row input {
  width: 100%;
  border: 1.4px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  font-family: var(--font-mono);
  font-size: 14.5px;
  color: var(--ink);
  background: var(--bg);
  text-align: center;
}
.set-row input:focus { border-color: var(--moss-500); background: var(--surface); }
.set-row input::placeholder { color: var(--ink-faint); font-family: var(--font-body); }

.rest-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-faint);
  display: flex; align-items: center; gap: 5px;
}

.finish-bar { margin-top: 20px; }
.finish-bar p { text-align: center; font-size: 12.5px; color: var(--ink-faint); margin: 10px 0 0; }

/* ============ Week view ============ */
.week-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.week-cell {
  border: 1.6px solid var(--line);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
  background: var(--surface);
  cursor: pointer;
}
.week-cell__num { font-family: var(--font-mono); font-weight: 600; font-size: 15px; }
.week-cell__dot { width: 6px; height: 6px; border-radius: 50%; margin: 5px auto 0; background: var(--line); }
.week-cell--done { background: var(--moss-100); border-color: var(--moss-500); }
.week-cell--done .week-cell__dot { background: var(--moss-700); }
.week-cell--current { border-color: var(--moss-700); box-shadow: 0 0 0 3px var(--moss-100); }
.week-cell--deload { border-style: dashed; }

.phase-card { margin-bottom: 12px; }
.phase-card__weeks { font-family: var(--font-mono); font-size: 11.5px; color: var(--moss-500); }
.phase-card h3 { font-size: 17px; margin-top: 4px; }
.phase-card p { font-size: 13.5px; color: var(--ink-soft); line-height: 1.55; margin: 8px 0 0; }
.phase-card__note { font-size: 12.5px; color: var(--ink-faint); margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 8px; }

/* ============ Progress view ============ */
.progress-row { padding: 15px 0; border-bottom: 1px solid var(--line); }
.progress-row:last-child { border-bottom: none; }
.progress-row__top { display: flex; justify-content: space-between; align-items: baseline; }
.progress-row__name { font-weight: 600; font-size: 14.5px; }
.progress-row__weight { font-family: var(--font-mono); font-size: 15px; color: var(--moss-700); font-weight: 600; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 30px; margin-top: 10px; }
.spark__bar { flex: 1; background: var(--moss-100); border-radius: 3px 3px 1px 1px; min-height: 3px; }
.spark__bar--top { background: var(--moss-500); }
.empty-state { text-align: center; padding: 40px 16px; color: var(--ink-faint); }
.empty-state p { font-size: 13.5px; line-height: 1.6; margin-top: 8px; }

/* ============ SVG Charts ============ */
.svg-chart { width: 100%; margin-top: 8px; overflow: visible; }
.svg-chart__line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.svg-chart__area { opacity: 0.35; }
.svg-chart__dot { r: 3.5; stroke-width: 1.5; cursor: pointer; }
.svg-chart__dot:hover { r: 5; }
.svg-chart__label { font-family: var(--font-mono); font-size: 9px; fill: var(--ink-faint); }
.svg-chart__bar { rx: 3; ry: 3; cursor: pointer; }
.svg-chart__bar:hover { opacity: 0.8; }
.svg-chart__axis-label { font-family: var(--font-mono); font-size: 8.5px; fill: var(--ink-faint); }

/* ============ Plan reference view ============ */
.rule-step { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rule-step:last-child { border-bottom: none; }
.rule-step__num { font-family: var(--font-mono); font-weight: 700; color: var(--moss-700); font-size: 14px; flex-shrink: 0; width: 20px; }
.rule-step p { margin: 0; font-size: 13.5px; color: var(--ink-soft); line-height: 1.55; }
.rule-step strong { color: var(--ink); }

table.ref-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 12.5px; }
.ref-table th { text-align: left; font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); padding-bottom: 6px; border-bottom: 1px solid var(--line); font-weight: 600; }
.ref-table td { padding: 8px 6px 8px 0; border-bottom: 1px solid var(--line); color: var(--ink-soft); vertical-align: top; }
.ref-table td:first-child { color: var(--ink); font-weight: 500; }

/* ============ Modal (settings) — see Phase D for .modal/.modal-backdrop styles ============ */

/* ============ Exercise Visual Guide Modal ============ */
.exercise-card__actions {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px;
}
.btn-visual-guide {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--moss-100); color: var(--moss-700);
  border: 1px solid rgba(212, 101, 10, 0.15); border-radius: var(--radius-sm);
  padding: 6px 11px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .15s ease;
}
.btn-visual-guide:hover {
  background: #FFE8D0; border-color: var(--moss-500);
}

.vis-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: var(--z-modal); opacity: 1; transition: opacity .2s ease;
}
.vis-modal-backdrop.hidden { display: none; opacity: 0; pointer-events: none; }

.vis-modal {
  background: var(--surface);
  width: 100%; max-width: 560px; max-height: 90vh; max-height: 90dvh;
  border-radius: 24px 24px 0 0;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-2); overflow: hidden;
  animation: slideUp .25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.vis-modal__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--line);
}
.vis-modal__title h3 { font-size: 18px; color: var(--ink); }
.vis-modal__title p { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.vis-modal__close {
  background: var(--surface-alt); border: 1px solid var(--line);
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--ink-soft); cursor: pointer;
}
.vis-modal__close:hover { background: var(--line); color: var(--ink); }

.vis-nav {
  display: flex; background: var(--bg); padding: 6px 12px; gap: 6px;
  border-bottom: 1px solid var(--line);
}
.vis-tab {
  flex: 1; padding: 8px 10px; font-size: 12px; font-weight: 600;
  border-radius: var(--radius-sm); border: none; background: transparent;
  color: var(--ink-soft); cursor: pointer; text-align: center;
  transition: all .15s ease;
}
.vis-tab--active {
  background: var(--surface); color: var(--moss-700);
  box-shadow: var(--shadow-1);
}

.vis-content {
  padding: 20px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 16px;
}
.vis-panel { display: none; }
.vis-panel--active { display: flex; flex-direction: column; gap: 16px; }

/* Media frames */
.vis-media-container {
  width: 100%; min-height: 220px; background: var(--surface-alt);
  border-radius: var(--radius-md); border: 1px solid var(--line);
  overflow: hidden; display: flex; align-items: center; justify-content: center;
  position: relative;
}
.vis-media-img {
  width: 100%; max-height: 320px; object-fit: contain; display: block;
}

.vis-frames-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.vis-frame-card {
  background: var(--surface-alt); border: 1px solid var(--line);
  border-radius: var(--radius-md); overflow: hidden; text-align: center;
}
.vis-frame-card img {
  width: 100%; height: 160px; object-fit: cover; display: block;
}
.vis-frame-card span {
  display: block; padding: 6px; font-size: 11.5px; font-weight: 600;
  color: var(--ink-soft); background: var(--surface); border-top: 1px solid var(--line);
}

/* Instructions & Muscle Info */
.vis-section-title {
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-faint); font-weight: 600; margin-bottom: 6px;
}
.vis-steps-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.vis-steps-list li { font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; }

.vis-muscle-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.vis-tag {
  font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 100px;
}
.vis-tag--primary { background: var(--moss-100); color: var(--moss-700); border: 1px solid var(--moss-500); }
.vis-tag--secondary { background: var(--ember-100); color: var(--ember); border: 1px solid rgba(181, 86, 61, 0.4); }

/* Form Cues inside modal */
.vis-cues-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.vis-cue { font-size: 13px; line-height: 1.5; padding: 6px 0; color: var(--ink); }
.vis-cue--do {}
.vis-cue--avoid {}

/* Muscle SVG Diagram */
.vis-diagram-wrap {
  display: flex; justify-content: center; align-items: center;
  background: var(--surface-alt); border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: 16px; min-height: 200px;
}
.muscle-svg { max-width: 260px; width: 100%; height: auto; }
.muscle-svg path { transition: fill .2s ease; }
.muscle-svg .m-base { fill: #D0DCD0; stroke: #A2B5A3; stroke-width: 1.2; }
.muscle-svg .m-active-primary { fill: var(--moss-500); stroke: var(--moss-900); stroke-width: 1.5; }
.muscle-svg .m-active-secondary { fill: var(--ember); stroke: #802A16; stroke-width: 1.5; }

/* ============ Large Dedicated Rest Timer Card ============ */
.big-timer-card {
  background: linear-gradient(145deg, var(--moss-900), #4A1E00);
  color: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-2);
  text-align: center;
  position: relative;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  animation: fadeInDown .25s ease-out;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.big-timer-card__eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #A3C9A0;
}

.big-timer-card__title {
  font-size: 14px;
  color: #E2EFE0;
  margin-top: 4px;
  font-weight: 500;
}

.big-timer-card__clock {
  font-family: var(--font-mono);
  font-size: 52px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #FFFFFF;
  margin: 10px 0 8px;
  text-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.big-timer-card__progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 16px;
}

.big-timer-card__progress-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #629668, #A3C9A0);
  border-radius: 100px;
  transform-origin: left;
  transition: transform .25s linear;
}

.big-timer-card__controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.big-timer-btn {
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
}

.big-timer-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}
.big-timer-btn--accent {
  background: var(--moss-500);
  border-color: var(--moss-500);
}

/* Set Completion styling */
.set-row input { flex: 1; }

.set-row--done input,
.set-row--done select {
  background: var(--moss-100) !important;
  border-color: var(--moss-500) !important;
  color: var(--moss-900) !important;
  font-weight: 700;
}

/* RIR Selector */
.rir-select {
  width: 56px;
  padding: 6px 4px;
  border: 1.4px solid var(--line);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  appearance: none;
  text-align: center;
}
.rir-select:focus { outline: 2px solid var(--moss-500); outline-offset: 1px; }

/* Previous session hint */
.prev-session-hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--ink-faint);
  opacity: 0.75;
  font-style: italic;
}

/* Stagnation / consolidation notes */
.rest-note--warn {
  color: var(--ember);
  font-weight: 500;
  background: var(--ember-100);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}
.rest-note--info {
  color: var(--gold);
  font-weight: 500;
  background: var(--gold-100);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}

/* Volume indicators */
.volume-row { margin-bottom: 14px; }
.volume-row:last-child { margin-bottom: 0; }
.volume-row__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.volume-row__label { font-size: 13px; font-weight: 600; color: var(--ink); }
.volume-row__sets { font-size: 11.5px; color: var(--ink-soft); font-family: var(--font-mono); }
.volume-bar__track {
  position: relative;
  height: 8px;
  background: var(--surface-alt);
  border-radius: 4px;
  overflow: visible;
}
.volume-bar__fill {
  width: 100%;
  height: 100%;
  border-radius: 4px;
  transform-origin: left;
  transition: transform 0.3s ease;
}
.volume-bar__marker {
  position: absolute;
  top: -2px;
  width: 2px;
  height: 12px;
  border-radius: 1px;
  opacity: 0.5;
}
.volume-bar__marker--mev { background: var(--gold); }
.volume-bar__marker--mav { background: var(--moss-700); }

/* Reminder pills */
.reminder-pill {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.reminder-pill:last-child { border-bottom: none; }
.reminder-pill__icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.reminder-pill__text strong { color: var(--ink); }

/* ============ Warmup Checklist ============ */
.warmup-card { margin-bottom: 12px; }
.warmup-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 4px 0;
}
.warmup-card__header h3 { font-size: 15px; }
.warmup-card__body { overflow: hidden; transition: max-height 0.3s ease, opacity 0.3s ease; }
.warmup-card--done .warmup-card__body { max-height: 0 !important; opacity: 0; }
.warmup-card--done .warmup-card__header h3 { color: var(--moss-500); }
.warmup-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.warmup-item:last-child { border-bottom: none; }
.warmup-item__check {
  width: 22px;
  height: 22px;
  border: 1.6px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: all .15s ease;
  margin-top: 2px;
}
.warmup-item__check--done { background: var(--moss-700); border-color: var(--moss-700); color: #fff; }
.warmup-item__info { flex: 1; }
.warmup-item__name { font-size: 13px; font-weight: 600; color: var(--ink); }
.warmup-item__desc { font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }
.warmup-item__duration {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--moss-700);
  background: var(--moss-100);
  padding: 2px 6px;
  border-radius: 6px;
  flex-shrink: 0;
}

/* ============ Form Cues Accordion ============ */
.form-accordion__toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  font-size: 12.5px;
  color: var(--ink-soft);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font-body);
  font-weight: 600;
  width: 100%;
  text-align: left;
}
.form-accordion__toggle:hover { color: var(--ink); }
.form-accordion__content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.form-accordion--open .form-accordion__content { max-height: 500px; }
.form-cue { display: flex; gap: 6px; padding: 4px 0; font-size: 12px; line-height: 1.5; }
.form-cue--do { color: var(--moss-700); }
.form-cue--avoid { color: var(--ember); }
.form-cue__icon { flex-shrink: 0; }

/* ============ Tempo Badge ============ */
.tempo-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--ink-soft);
  background: var(--surface-alt);
  border-radius: 6px;
  cursor: pointer;
  border: none;
  margin-top: 6px;
}
.tempo-badge:hover { background: var(--line); }

/* ============ Weight Wizard ============ */
.weight-wizard {
  padding: 14px;
  background: var(--gold-100);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  border: 1.4px solid var(--gold);
}
.weight-wizard__title { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.weight-wizard__desc { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 10px; line-height: 1.5; }

@media (prefers-color-scheme: dark) {
  .weight-wizard {
    background: rgba(212, 166, 54, 0.08);
    border-color: rgba(212, 166, 54, 0.25);
  }
}
[data-theme="dark"] .weight-wizard {
  background: rgba(212, 166, 54, 0.08);
  border-color: rgba(212, 166, 54, 0.25);
}
.rpe-scale { display: flex; gap: 4px; flex-wrap: wrap; margin: 8px 0; }
.rpe-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.4px solid var(--line);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
}
.rpe-btn:hover { border-color: var(--moss-500); }
.rpe-btn--selected { background: var(--moss-700); color: #fff; border-color: var(--moss-700); }

/* ============ Victory Screen ============ */
.victory-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.victory-stat {
  text-align: center;
  padding: 12px 8px;
  background: var(--surface-alt);
  border-radius: var(--radius-md);
}
.victory-stat__value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--moss-900);
}
.victory-stat__label {
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 4px;
}

/* ============ Rest Day Redesigned ============ */
.rest-day-view {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.rest-hero {
  text-align: center;
  padding: 32px 20px 24px;
}
.rest-hero__icon { font-size: 36px; margin-bottom: 12px; opacity: 0.8; }
.rest-hero__title { font-size: 22px; margin-bottom: 8px; }
.rest-hero__sub { font-size: 13.5px; color: var(--ink-soft); line-height: 1.55; margin: 0 auto; max-width: 300px; }

/* Protocol items */
.rest-protocol-card { padding: 16px; }
.rest-protocol-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.rest-protocol-item:last-child { border-bottom: none; }
.rest-protocol-item__icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.rest-protocol-item__body { display: flex; flex-direction: column; gap: 2px; }
.rest-protocol-item__body strong { font-size: 13px; color: var(--ink); }
.rest-protocol-item__body span { font-size: 12px; color: var(--ink-soft); line-height: 1.45; }

/* Rest Day Tracking Rows */
.rest-track-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.rest-track-row:last-child { border-bottom: none; }
.rest-track-row__icon { font-size: 20px; flex-shrink: 0; margin-top: 4px; }
.rest-track-row__body { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.rest-track-row__label { font-size: 13px; font-weight: 600; color: var(--ink); }
.rest-track-row__input-wrap { display: flex; align-items: center; gap: 8px; }
.rest-track-input {
  width: 100px;
  border: 1.4px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font-family: var(--font-mono);
  font-size: 14px;
  background: var(--bg);
  color: var(--ink);
}
.rest-track-input:focus { border-color: var(--moss-500); outline: none; }
.rest-track-row__unit { font-size: 12px; color: var(--ink-faint); }
.rest-track-row__hint { font-size: 11.5px; color: var(--ink-soft); }

/* Checklist */
.rest-checklist-card { padding: 14px 16px; }
.rest-check-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  transition: opacity .15s ease;
}
.rest-check-row:last-of-type { border-bottom: none; }
.rest-check-row--done { opacity: 0.6; }
.rest-check-row--done .rest-check-text { text-decoration: line-through; }
.rest-check-box {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1.6px solid var(--line);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  font-size: 14px;
  color: transparent;
  transition: all .15s ease;
}
.rest-check-box:hover { border-color: var(--moss-500); }
.rest-check-box--done {
  background: var(--moss-700);
  border-color: var(--moss-700);
  color: #fff;
}
.rest-check-text { font-size: 13.5px; color: var(--ink); flex: 1; min-width: 0; }
.rest-check-complete {
  text-align: center;
  padding: 10px 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--moss-700);
}

/* Train Today */
.train-today-card {
  margin-top: 8px;
  margin-bottom: 16px;
  padding: 18px;
  background: transparent;
  border: 1.6px dashed var(--line);
  border-radius: var(--radius-lg);
}
.train-today-card__header {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}
.train-today-card__desc {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 0 0 12px;
  line-height: 1.5;
}
.train-today-card__warn {
  background: var(--gold-100);
  color: var(--gold);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 12px;
  line-height: 1.45;
}
.nutri-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.nutri-stat {
  padding: 12px;
  background: var(--surface-alt);
  border-radius: var(--radius-md);
}
.nutri-stat__label { font-size: 11px; color: var(--ink-soft); font-weight: 600; }
.nutri-stat__value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--moss-900);
  margin-top: 4px;
}
.nutri-stat__unit { font-size: 12px; color: var(--ink-faint); }
.nutri-stat--wide { grid-column: 1 / -1; }

/* ============ PR Hall & Streak ============ */
.pr-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.pr-row:last-child { border-bottom: none; }
.pr-row__name { font-weight: 600; font-size: 13px; color: var(--ink); }
.pr-row__metrics { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; font-size: 11.5px; font-family: var(--font-mono); color: var(--ink-soft); }
.pr-row__date { font-size: 10.5px; color: var(--ink-faint); margin-top: 2px; }

.streak-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--surface-alt);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}
.streak-card__icon { font-size: 24px; }
.streak-card__text { font-size: 13px; color: var(--ink-soft); }
.streak-card__text strong { color: var(--moss-700); }

/* ============ Train Today Option ============ */
.train-today-card {
  margin-top: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1.6px dashed var(--moss-500);
  border-radius: var(--radius-lg);
}
.train-today-card h3 { font-size: 15px; margin-bottom: 6px; }
.train-today-card p { font-size: 12.5px; color: var(--ink-soft); margin: 0 0 10px; line-height: 1.5; }

/* ============ Dumbbell Chips ============ */
.dumbbell-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--moss-100);
  color: var(--moss-900);
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-family: var(--font-mono);
}
.dumbbell-chip__remove {
  cursor: pointer;
  background: none;
  border: none;
  color: var(--ink-faint);
  font-size: 14px;
  padding: 0 2px;
  line-height: 1;
}
.dumbbell-chip__remove:hover { color: var(--ember); }

.set-check-btn {
  background: var(--surface-alt);
  border: 1.4px solid var(--line);
  border-radius: 10px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--ink-faint);
  cursor: pointer;
  transition: all .15s ease;
}

.set-check-btn--done {
  background: var(--moss-700);
  border-color: var(--moss-700);
  color: #FFFFFF;
}

.btn-complete-ex {
  margin-top: 12px;
  width: 100%;
  padding: 10px;
  font-size: 13px;
}

/* ============ Scientific Concepts & Glossary ============ */
.concept-list { display: flex; flex-direction: column; gap: 12px; }
.concept-block {
  padding: 14px;
  background: var(--surface-alt);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}
.concept-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.concept-title { font-weight: 700; font-size: 14.5px; color: var(--ink); }
.concept-tag {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  padding: 3px 8px; border-radius: 100px; background: var(--moss-100); color: var(--moss-700);
}
.concept-desc { font-size: 13px; color: var(--ink-soft); line-height: 1.55; margin: 0; }
.concept-desc strong { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .btn, .toast, .tabbar__btn, .vis-modal, .big-timer-card { transition: none; animation: none; }
}

@media (min-width: 640px) {
  .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}


/* ============ Update Banner ============ */
.update-banner {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-overlay);
  animation: bannerSlideUp .3s ease;
}
.update-banner__content {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1.4px solid var(--moss-500);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.update-banner__btn { padding: 6px 14px; font-size: 12px; }
@keyframes bannerSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ============ PHASE D: Native Components ============ */

/* Settings view */
.settings-view {
  padding: 0 4px;
}
.topbar__back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border: none; background: transparent;
  cursor: pointer;
  color: var(--moss-900);
  border-radius: 50%;
  transition: background 0.15s ease;
}
.topbar__back:active {
  background: var(--moss-100);
}
.topbar__back.hidden {
  display: none;
}

/* D1: Bottom Sheet */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: modalFadeIn 0.25s ease forwards;
}
.modal-backdrop.hidden { display: none; }
.modal-backdrop.closing {
  animation: modalFadeOut 0.25s ease forwards;
}
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalFadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes sheetSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes sheetSlideDown { from { transform: translateY(0); } to { transform: translateY(100%); } }

.modal {
  background: var(--surface);
  width: 100%; max-width: 560px;
  border-radius: 24px 24px 0 0;
  padding: 22px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  max-height: 90vh; max-height: 90dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-2);
  animation: sheetSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transform: translateY(100%);
}
.modal-backdrop.closing .modal {
  animation: sheetSlideDown 0.25s ease forwards;
}
.modal__handle {
  width: 36px;
  height: 4px;
  background: var(--line);
  border-radius: 100px;
  margin: 0 auto 16px;
}
.modal h2 { font-size: 19px; margin-bottom: 4px; }
.modal p.hint { font-size: 13px; color: var(--ink-soft); margin: 0 0 16px; }
.modal label { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; display: block; margin-bottom: 6px; }

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  margin: -22px -20px 16px;
  border-bottom: 1px solid var(--line);
}
.modal__header h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.modal__header p {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 2px 0 0;
}
.modal__close {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--ink-soft);
  cursor: pointer;
  flex-shrink: 0;
}
.modal__close:hover { background: var(--line); color: var(--ink); }
.modal__body {
  padding: 0;
}
.modal input[type="date"] {
  width: 100%; padding: 12px; border-radius: 10px; border: 1.6px solid var(--line);
  font-family: var(--font-mono); font-size: 14.5px; margin-bottom: 16px;
}
.modal .btn { margin-top: 4px; }
.modal-danger { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.modal-danger p { font-size: 12px; color: var(--ink-faint); margin-bottom: 10px; }

/* D2: Toast / Snackbar */
.toast {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 600;
  z-index: var(--z-toast);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  max-width: calc(100% - 40px);
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* D3: Segmented Control */
.segmented-control {
  display: inline-flex;
  background: var(--surface-alt);
  border-radius: 12px;
  padding: 3px;
  gap: 2px;
  position: relative;
}
.segmented-control__indicator {
  position: absolute;
  top: 3px;
  height: calc(100% - 6px);
  background: var(--surface);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 0;
}
.segmented-control__btn {
  position: relative;
  z-index: 1;
  padding: 8px 16px;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 10px;
  transition: color 0.2s ease;
}
.segmented-control__btn[aria-selected="true"] {
  color: var(--ink);
}

/* D4: Pull-to-refresh */
.ptr-indicator {
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  opacity: 0;
  z-index: var(--z-topbar);
}
.ptr-indicator--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(60px);
}
.ptr-indicator--refreshing {
  opacity: 1;
  transform: translateX(-50%) translateY(60px);
}
.ptr-indicator__spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--line);
  border-top-color: var(--moss-500);
  border-radius: 50%;
  animation: ptrSpin 0.7s linear infinite;
}
@keyframes ptrSpin {
  to { transform: rotate(360deg); }
}
.ptr-indicator__arrow {
  font-size: 16px;
  color: var(--moss-500);
  transition: transform 0.2s ease;
}
.ptr-indicator--ready .ptr-indicator__arrow {
  transform: rotate(180deg);
}

/* D5: Swipe between tabs */
.view--swipeable {
  touch-action: pan-y;
}
.view--swiping {
  transition: none !important;
}

/* D6: Long-press context menu */
.context-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-context-menu-bg);
  background: rgba(20, 28, 21, 0.3);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: backdropIn 0.2s ease forwards;
}
.context-menu {
  position: fixed;
  z-index: var(--z-context-menu);
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 6px;
  min-width: 200px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  animation: contextMenuIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}
@keyframes contextMenuIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
.context-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.15s ease;
}
.context-menu__item:hover,
.context-menu__item:active {
  background: var(--surface-alt);
}
.context-menu__item--danger { color: var(--ember); }
.context-menu__separator {
  height: 1px;
  background: var(--line);
  margin: 4px 8px;
}

/* D7: Floating Action Button */
.fab {
  position: fixed;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  right: 20px;
  left: auto;
  width: auto;
  height: 52px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--moss-700);
  color: #FFFFFF;
  border: none;
  border-radius: 16px;
  font-family: var(--font-body);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(212, 101, 10, 0.35);
  z-index: var(--z-fab);
  animation: fabIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
@media (min-width: 600px) {
  .fab {
    right: calc(50% - 280px + 20px);
  }
}
.fab:active {
  transform: scale(0.95);
  box-shadow: 0 3px 12px rgba(212, 101, 10, 0.25);
}
.fab__icon {
  font-size: 18px;
}
@keyframes fabIn {
  from { opacity: 0; transform: translateY(20px) scale(0.8); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============ PHASE C: Micro-interactions ============ */

/* C1: Tap feedback — scale-down on active for all interactive elements */
.btn:active,
.tabbar__btn:active,
.set-check-btn:active,
.card:active,
.topbar__settings:active,
.rest-check-box:active,
.btn-complete-ex:active {
  transform: scale(0.96);
  transition: transform 0.08s ease-out;
}
.btn:active { transform: scale(0.97); }

/* C2: Ripple effect */
.ripple-container {
  position: relative;
  overflow: hidden;
}
.ripple {
  position: absolute;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.12;
  transform: scale(0);
  animation: rippleExpand 0.5s ease-out forwards;
  pointer-events: none;
}
@keyframes rippleExpand {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* C4: Spring animation for check buttons */
.set-check-btn {
  transition: all 0.15s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.set-check-btn--done {
  animation: springPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.rest-check-box {
  transition: all 0.15s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.rest-check-box--done {
  animation: springPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes springPop {
  0% { transform: scale(0.7); }
  50% { transform: scale(1.2); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

/* C5: Confetti canvas overlay */
.confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: var(--z-overlay);
}

/* C6: Progress ring */
.progress-ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.progress-ring__svg {
  transform: rotate(-90deg);
}
.progress-ring__bg {
  fill: none;
  stroke: var(--line);
  stroke-width: 4;
}
.progress-ring__fill {
  fill: none;
  stroke: var(--moss-500);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.progress-ring__label {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
}

/* Staggered entry animation for cards (bonus from Phase B) */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in {
  animation: fadeSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.animate-in:nth-child(1) { animation-delay: 0ms; }
.animate-in:nth-child(2) { animation-delay: 50ms; }
.animate-in:nth-child(3) { animation-delay: 100ms; }
.animate-in:nth-child(4) { animation-delay: 150ms; }
.animate-in:nth-child(5) { animation-delay: 200ms; }
.animate-in:nth-child(6) { animation-delay: 250ms; }
.animate-in:nth-child(7) { animation-delay: 300ms; }
.animate-in:nth-child(8) { animation-delay: 350ms; }

/* ============ PHASE B: View Transitions & Skeletons ============ */

/* B1: View Transitions API support */
@view-transition {
  navigation: auto;
}
::view-transition-old(view-content) {
  animation: viewFadeOut 0.15s ease-out both;
}
::view-transition-new(view-content) {
  animation: viewFadeIn 0.2s ease-out 0.1s both;
}
@keyframes viewFadeOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.98); }
}
@keyframes viewFadeIn {
  from { opacity: 0; transform: scale(1.01); }
  to { opacity: 1; transform: scale(1); }
}

/* Fallback transition for browsers without View Transitions API */
.view--transitioning {
  animation: viewFadeIn 0.25s ease-out;
}

/* B3: Tab indicator — positioned via JS */
/* (styles already defined above in .tabbar__indicator) */

/* B4: Skeleton screens */
.skeleton {
  background: var(--surface-alt);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}
.skeleton::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.08) 50%,
    transparent 100%
  );
  animation: shimmer 1.5s infinite;
}
@media (prefers-color-scheme: dark) {
  .skeleton::after {
    background: linear-gradient(
      90deg,
      transparent 0%,
      rgba(255, 255, 255, 0.04) 50%,
      transparent 100%
    );
  }
}
[data-theme="dark"] .skeleton::after {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.04) 50%,
    transparent 100%
  );
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.skeleton--hero {
  height: 140px;
  margin-bottom: 16px;
}
.skeleton--card {
  height: 80px;
  margin-bottom: 12px;
}
.skeleton--text {
  height: 14px;
  border-radius: 7px;
  margin-bottom: 8px;
  width: 70%;
}
.skeleton--text-short {
  width: 40%;
}

/* B5: Shared element transitions */
.exercise-card {
  view-transition-name: var(--vt-name);
}
::view-transition-old(exercise-detail),
::view-transition-new(exercise-detail) {
  animation-duration: 0.3s;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============ PHASE E: Premium Layout ============ */

/* E4: Glassmorphism for highlighted cards */
.glass-card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
}
@media (prefers-color-scheme: dark) {
  .glass-card {
    background: rgba(37, 40, 37, 0.75);
    border-color: rgba(255, 255, 255, 0.08);
  }
}
[data-theme="dark"] .glass-card {
  background: rgba(37, 40, 37, 0.75);
  border-color: rgba(255, 255, 255, 0.08);
}

/* E4: Glassmorphism on rest-hero */
.rest-hero {
  position: relative;
  overflow: hidden;
}
.rest-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, transparent 60%);
  pointer-events: none;
  border-radius: inherit;
}

/* E2: Premium spacing for specific areas */
.hero__title {
  font-size: 28px;
  margin-top: 8px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.hero__meta {
  margin-top: 12px;
  font-size: 14px;
  color: #DCEBD9;
  line-height: 1.55;
}
.hero__actions { margin-top: var(--space-lg); display: flex; gap: 10px; }
.finish-bar {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--line);
}
.finish-bar p {
  font-size: 12.5px;
  color: var(--ink-faint);
  margin-top: var(--space-sm);
  text-align: center;
}

/* E5: Icon consistency — SVGs in buttons/nav */
.topbar__mark svg,
.topbar__settings svg,
.tabbar__btn svg {
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* E2: Breathing room for exercise cards */
.exercise-card {
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.exercise-card:hover {
  box-shadow: var(--shadow-2);
}
.exercise-card--completed {
  border-color: var(--moss-500);
  background: linear-gradient(180deg, var(--surface) 60%, var(--moss-100));
  box-shadow: var(--shadow-2);
}

/* E3: Dynamic type scaling */
@media (min-resolution: 2dppx) {
  :root { font-size: clamp(15px, 1rem, 17px); }
}
@supports (font: -apple-system-body) {
  :root { font: -apple-system-body; font-family: var(--font-body); }
}

/* ============ PHASE F: Onboarding & Empty States ============ */

/* F1: Welcome screen */
.onboarding {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: var(--z-onboarding);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) var(--space-lg) calc(var(--space-xl) + env(safe-area-inset-bottom, 0px));
}
.onboarding__slide {
  text-align: center;
  max-width: 320px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.onboarding__slide--enter {
  animation: fadeSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.onboarding__icon {
  margin-bottom: var(--space-lg);
  color: var(--moss-500);
  animation: onbIconPulse 2s ease-in-out infinite;
}
.onboarding__icon--logo {
  animation: none;
}

/* App logo colors — light mode (original dark tones) */
.onb-logo__arc { stroke: #2a2a2a; }
.onb-logo__node-start { fill: #2a2a2a; }
.onb-logo__grad-start { stop-color: #2a2a2a; }

/* App logo colors — dark mode (bright arc + subtle node) */
@media (prefers-color-scheme: dark) {
  .onb-logo__arc { stroke: #ffffff; }
  .onb-logo__node-start { fill: #9a9a9a; }
  .onb-logo__grad-start { stop-color: #9a9a9a; }
}
[data-theme="dark"] .onb-logo__arc { stroke: #ffffff; }
[data-theme="dark"] .onb-logo__node-start { fill: #9a9a9a; }
[data-theme="dark"] .onb-logo__grad-start { stop-color: #9a9a9a; }
[data-theme="light"] .onb-logo__arc { stroke: #2a2a2a; }
[data-theme="light"] .onb-logo__node-start { fill: #2a2a2a; }
[data-theme="light"] .onb-logo__grad-start { stop-color: #2a2a2a; }
@keyframes onbIconPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.onboarding__title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-sm);
}
.onboarding__desc {
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.6;
  margin: 0;
}
.onboarding__badge {
  margin-top: 20px;
  font-size: 11.5px;
  color: var(--moss-500);
  letter-spacing: 0.02em;
  font-weight: 600;
  text-transform: uppercase;
  opacity: 0.85;
}
.onboarding__dots {
  display: flex;
  gap: 8px;
  margin: var(--space-lg) 0;
}
.onboarding__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
  transition: all 0.3s ease;
}
.onboarding__dot--active {
  background: var(--moss-700);
  width: 24px;
  border-radius: 100px;
}
.onboarding__actions {
  width: 100%;
  max-width: 320px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}
.onboarding__btn {
  flex: 1;
  padding: 14px 20px;
  border-radius: 14px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.1s ease, opacity 0.15s ease;
}
.onboarding__btn:active { transform: scale(0.96); }
.onboarding__btn--primary {
  background: var(--moss-700);
  color: #FFFFFF;
}
.onboarding__btn--ghost {
  background: var(--surface-alt);
  color: var(--ink-soft);
}

/* F4: Setup wizard */
.setup-wizard {
  width: 100%;
  max-width: 320px;
  margin: var(--space-lg) 0;
}
.setup-wizard__field {
  margin-bottom: var(--space-lg);
}
.setup-wizard__label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  display: block;
  margin-bottom: 4px;
}
.setup-wizard__hint {
  font-size: 12.5px;
  color: var(--ink-faint);
  margin: 0 0 var(--space-sm);
}
.setup-wizard__input {
  width: 100%;
  padding: 13px 14px;
  border: 1.6px solid var(--line);
  border-radius: 12px;
  font-family: var(--font-mono);
  font-size: 15px;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.2s ease;
}
.setup-wizard__input:focus {
  outline: none;
  border-color: var(--moss-500);
}

/* F2: Empty states */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
}
.empty-state__icon {
  font-size: 56px;
  margin-bottom: var(--space-md);
  opacity: 0.9;
  color: var(--ink-faint);
}
.empty-state__icon svg {
  width: 48px;
  height: 48px;
}
.empty-state__title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 var(--space-sm);
}
.empty-state__desc {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.55;
  margin: 0 0 var(--space-lg);
  max-width: 260px;
  margin-left: auto;
  margin-right: auto;
}
.empty-state__cta {
  margin: 0 auto;
}

/* F3: Tooltips */
.tooltip-hint {
  animation: tooltipIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.tooltip-hint--hiding {
  animation: tooltipOut 0.25s ease forwards;
}
@keyframes tooltipIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes tooltipOut {
  to { opacity: 0; transform: translateY(-4px); }
}
.tooltip-hint__content {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  max-width: 260px;
}
.tooltip-hint__close {
  background: transparent;
  border: none;
  color: var(--ink-faint);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}
.tooltip-hint__close:hover { color: var(--bg); }

/* ============ Custom Date Picker (Bottom Sheet) ============ */
.dp-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0);
  z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
  transition: background 0.3s ease;
}
.dp-backdrop--visible { background: rgba(0,0,0,0.4); }
.dp-backdrop--visible .dp-sheet { transform: translateY(0); }

.dp-sheet {
  width: 100%; max-width: 560px;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.dp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.dp-header__title {
  font-weight: 600; font-size: 15px; color: var(--ink);
}
.dp-header__btn {
  background: none; border: none; font-size: 15px; font-weight: 500;
  cursor: pointer; padding: 4px 8px; border-radius: 8px;
  font-family: var(--font-body);
}
.dp-header__btn--cancel { color: var(--ink-soft); }
.dp-header__btn--confirm { color: var(--moss-700); font-weight: 600; }

.dp-columns {
  display: flex; gap: 0;
  height: 220px;
  position: relative;
}
.dp-columns::before {
  content: '';
  position: absolute;
  top: 50%; left: 12px; right: 12px;
  height: 40px;
  transform: translateY(-50%);
  background: var(--surface-alt);
  border-radius: 10px;
  pointer-events: none;
  z-index: 0;
}

.dp-col {
  flex: 1;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  position: relative; z-index: 1;
}
.dp-col::-webkit-scrollbar { display: none; }
.dp-col { scrollbar-width: none; }

.dp-col__list {
  padding: 90px 0;
}
.dp-col__cell {
  height: 40px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  color: var(--ink-faint);
  cursor: pointer;
  scroll-snap-align: center;
  transition: color 0.15s, font-weight 0.15s;
  user-select: none;
  font-family: var(--font-body);
}
.dp-col__cell--active {
  color: var(--ink);
  font-weight: 700;
  font-size: 17px;
}
.dp-col__sep {
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700;
  color: var(--ink);
  width: 24px; flex-shrink: 0;
  position: relative; z-index: 1;
}

/* Date display button (replaces native input) */
.date-display {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-body);
  transition: border-color 0.15s;
}
.date-display:hover, .date-display:focus {
  border-color: var(--moss-500);
  outline: none;
}

/* ============ PHASE G: Performance & Polish ============ */

/* G2: Content-visibility for off-screen cards */
.card,
.exercise-card,
.rest-protocol-card,
.rest-checklist-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 120px;
}

/* G4: Virtual scroll container */
.virtual-list {
  position: relative;
  overflow: hidden;
}
.virtual-list__spacer {
  width: 100%;
}
.virtual-list__viewport {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
}

/* G5: Circle-reveal theme transition */
.theme-transition-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  pointer-events: none;
  clip-path: circle(0% at var(--reveal-x, 50%) var(--reveal-y, 50%));
  animation: circleReveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes circleReveal {
  to {
    clip-path: circle(150% at var(--reveal-x, 50%) var(--reveal-y, 50%));
  }
}
.theme-transition-overlay--closing {
  animation: circleRevealOut 0.4s ease forwards;
}
@keyframes circleRevealOut {
  from { clip-path: circle(150% at var(--reveal-x, 50%) var(--reveal-y, 50%)); }
  to { clip-path: circle(0% at var(--reveal-x, 50%) var(--reveal-y, 50%)); }
}

/* ============ Refactored Utility Classes ============ */

/* Skeleton wrapper */
.skeleton-wrap {
  padding: 20px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 70px);
}

/* Settings sections */
.settings-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.settings-section--first {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.settings-section--compact {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* Settings labels */
.settings-label {
  font-size: 12.5px;
  color: var(--ink-soft);
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
}

/* Settings button rows */
.settings-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Settings buttons */
.btn--settings {
  padding: 9px 10px;
  font-size: 12.5px;
}

/* Settings hint */
.settings-hint {
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 6px;
}

/* Settings heading */
.settings-heading {
  margin: 16px 0 4px;
}

/* Settings link */
.settings-link {
  font-size: 12px;
  color: var(--ink-faint);
  text-decoration: underline;
}

/* Form inputs */
.input-field {
  width: 100%;
  border: 1.4px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 15px;
  background: var(--bg);
  box-sizing: border-box;
}

.input-field--sm {
  width: 80px;
  border: 1.4px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 15px;
  background: var(--bg);
}

.input-field--time {
  border: 1.4px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg);
}

/* Nutrition stat grid */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-grid--single {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
}

/* Stat cards */
.stat-card {
  background: var(--moss-50, #eef3ec);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.stat-card__label {
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.stat-card__value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--moss-700);
}

.stat-card__hint {
  font-size: 10px;
  color: var(--ink-faint);
}

/* Warmup card description */
.warmup-card__desc {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 12px;
}

/* Summary stats */
.summary-stat__value {
  font-size: 22px;
  font-weight: 700;
  color: var(--ember);
}

.summary-stat__label {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 4px;
}

/* Completed hero metrics */
.completed-metrics {
  margin-top: 14px;
  display: flex;
  justify-content: space-around;
  text-align: center;
  padding: 18px 12px;
}

.completed-metrics__box {
  flex: 1;
}

/* Progress wrap (weekly ring) */
.progress-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
  gap: 12px;
}

.progress-wrap__label {
  font-size: 13px;
  color: var(--ink-soft);
}

/* PR card */
.pr-card {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.pr-card__name {
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.pr-card__stats {
  font-size: 12.5px;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.pr-card__value {
  font-family: var(--font-mono);
  color: var(--moss-700);
}

.pr-card__date {
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 3px;
}

/* Adherence */
.adherence-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.adherence__value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
}

.adherence__text {
  font-size: 12px;
  color: var(--ink-soft);
}

/* Plan description */
.plan-desc {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.6;
  margin: 0;
}

/* Exercise name in table */
.ex-name {
  font-weight: 600;
  color: var(--ink);
}

/* Exercise sub-info */
.ex-sub {
  font-size: 11px;
  color: var(--ink-faint);
  display: block;
}

/* Weight wizard elements */
.wiz-label {
  font-size: 12.5px;
  color: var(--ink-soft);
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}

.wiz-desc {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 0 0 10px;
}

.wiz-input {
  width: 100%;
  border: 1.4px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 15px;
  background: var(--bg);
  margin-bottom: 10px;
}

.wiz-rpe-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.wiz-rpe-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  padding: 0;
  font-size: 12px;
  font-weight: 700;
  line-height: 32px;
  text-align: center;
}

/* Chip row */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

/* Dumbbell chip */
.dumbbell-chip {
  background: var(--moss-100);
  color: var(--moss-900);
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-family: var(--font-mono);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dumbbell-chip__remove {
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
}

/* Streak text */
.streak-text {
  margin: 0;
  color: var(--moss-500);
  font-weight: 600;
}

.streak-text--inactive {
  margin: 0;
  color: var(--ink-faint);
}

/* Vis muscles labels */
.vis-muscles-label {
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 4px;
  font-weight: 600;
}

/* Notif description */
.settings-notif-desc {
  font-size: 12px;
  color: var(--ink-faint);
  margin: 0 0 8px;
}

/* Notif toggle row */
.settings-notif-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Text utilities */
.text-faint-xs {
  font-size: 10px;
  color: var(--ink-faint);
}

/* Tempo badge */
.tempo-badge {
  display: inline-block;
  margin: 8px 0 4px 0;
  cursor: pointer;
  font-size: 12px;
}

/* Timer button inline */
.btn--timer-inline {
  padding: 6px 12px;
  font-size: 12.5px;
  margin-left: 8px;
}

/* Plan routine card head */
.plan-routine-head {
  font-size: 16.5px;
}

.plan-routine-head__sub {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
  font-weight: 500;
}

/* Ref table action btn (small) */
.btn-visual-guide--sm {
  margin-top: 0;
  padding: 4px 8px;
  font-size: 11px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Warmup pill sub text */
.warmup-sub-text {
  font-size: 12px;
  color: var(--ink-faint);
}

/* Progress row cursor (clickable name) */
.progress-row__name--clickable {
  cursor: pointer;
}

/* PR card no-border last */
.pr-card--last {
  border-bottom: none;
}

/* PR empty text */
.pr-empty-text {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0;
}

/* Wiz calc button */
.btn--wiz-calc {
  font-size: 13px;
}

/* Sub modal equipment hint */
.sub-equipment-hint {
  color: var(--ink-faint);
  display: block;
  margin-top: 2px;
}
