:root {
  --lime: #c9ff3d;
  --cyan: #58e6ff;
  --violet: #b18cff;
  --orange: #ffb15f;
  --danger: #ff6b7a;
  --radius: 26px;
  --radius-sm: 16px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080a12;
  --bg-image:
    radial-gradient(circle at 6% 0%, rgba(88, 230, 255, 0.16), transparent 32rem),
    radial-gradient(circle at 92% 4%, rgba(201, 255, 61, 0.14), transparent 28rem),
    linear-gradient(160deg, #080a12 0%, #0f1324 52%, #070911 100%);
  --surface: linear-gradient(150deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.045));
  --surface-solid: rgba(255, 255, 255, 0.05);
  --surface-sunken: rgba(0, 0, 0, 0.22);
  --line: rgba(255, 255, 255, 0.13);
  --line-strong: rgba(255, 255, 255, 0.22);
  --text: #f6f8ff;
  --soft: #d8dded;
  --muted: #a3abbf;
  --accent: var(--lime);
  --accent-ink: #10140a;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.42);
  --shadow-sm: 0 10px 26px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5fa;
  --bg-image:
    radial-gradient(circle at 4% 0%, rgba(88, 230, 255, 0.22), transparent 30rem),
    radial-gradient(circle at 96% 2%, rgba(177, 140, 255, 0.18), transparent 28rem),
    linear-gradient(160deg, #f7f8fc 0%, #eef0f8 60%, #f4f5fa 100%);
  --surface: linear-gradient(150deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.78));
  --surface-solid: rgba(255, 255, 255, 0.82);
  --surface-sunken: rgba(16, 20, 40, 0.045);
  --line: rgba(16, 20, 40, 0.1);
  --line-strong: rgba(16, 20, 40, 0.2);
  --text: #10142a;
  --soft: #333c58;
  --muted: #626c88;
  --accent: #14181f;
  --accent-ink: #eaffb0;
  --shadow: 0 20px 48px rgba(20, 26, 60, 0.12);
  --shadow-sm: 0 8px 22px rgba(20, 26, 60, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  /* clip, not hidden — hidden would make body a scroll container and break the sticky nav */
  overflow-x: clip;
  background: var(--bg) var(--bg-image) fixed;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button,
a,
input,
select,
textarea,
label {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button,
select,
textarea,
input {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1, h2, h3 {
  font-family: "Space Grotesk", Inter, sans-serif;
  letter-spacing: -0.035em;
  overflow-wrap: break-word;
}

h1 {
  max-width: 15ch;
  margin-bottom: 22px;
  font-size: clamp(2.2rem, 8vw, 5.4rem);
  font-weight: 700;
  line-height: 0.98;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.7rem, 3.2vw, 2.6rem);
  font-weight: 700;
  line-height: 1.04;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.08rem;
  font-weight: 600;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 60;
  padding: 12px 18px;
  border-radius: 0 0 14px 14px;
  background: var(--lime);
  color: #10140a;
  font-weight: 800;
  transition: top 200ms var(--ease);
}

.skip-link:focus {
  top: 0;
}

.shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding-right: env(safe-area-inset-right);
  padding-left: env(safe-area-inset-left);
}

.card,
.hero-card,
.metrics article,
.today-card,
.week-day,
.workout-panel,
.info-card,
.tracker-section,
.summary-card {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

/* ------------------------------------------------------------------- nav */

.topbar-wrap {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 14px 0;
  padding-top: max(14px, env(safe-area-inset-top));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 10px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(22px) saturate(140%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 13px;
  background: var(--lime);
  color: #10140a;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
}

.brand-name {
  display: grid;
  line-height: 1.15;
}

.brand-sub {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.nav-links {
  display: flex;
  gap: 2px;
}

.nav-links a {
  padding: 9px 13px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 200ms var(--ease), color 200ms var(--ease);
}

.nav-links a:hover {
  background: var(--surface-sunken);
  color: var(--text);
}

.nav-links a.current {
  background: var(--surface-sunken);
  color: var(--text);
}

.nav-actions {
  display: flex;
  gap: 6px;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-sunken);
  color: var(--text);
  cursor: pointer;
  transition: border-color 200ms var(--ease), transform 200ms var(--ease);
}

.icon-button:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

[data-theme="dark"] .icon-sun,
[data-theme="light"] .icon-moon {
  display: none;
}

.menu-button {
  display: none;
}

.burger,
.burger::before,
.burger::after {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  content: "";
}

.burger::before {
  transform: translateY(-5px);
}

.burger::after {
  transform: translateY(3px);
}

/* ------------------------------------------------------------------ hero */

.hero {
  padding: 26px 0 40px;
  scroll-margin-top: 90px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.55fr);
  gap: 30px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

[data-theme="dark"] .eyebrow {
  color: var(--lime);
}

.hero-text,
.section-text,
.section-heading > p,
.info-card p,
.exercise-card p,
.week-day p,
.today-card > p,
.tracker-row small {
  color: var(--muted);
  line-height: 1.62;
}

.hero-text {
  max-width: 60ch;
  font-size: 1.08rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.94rem;
  font-weight: 700;
  transition: transform 200ms var(--ease), background 200ms var(--ease), border-color 200ms var(--ease);
}

.button:hover {
  transform: translateY(-2px);
}

.button.primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.button.ghost {
  border-color: var(--line);
  background: var(--surface-sunken);
  color: var(--text);
}

.button.ghost:hover {
  border-color: var(--line-strong);
}

.button.small {
  min-height: 38px;
  padding-inline: 14px;
  font-size: 0.86rem;
}

.button.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  margin-top: 34px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.hero-stat span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero-stat strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.4rem;
}

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 26px;
  border-radius: var(--radius);
  text-align: center;
}

.hero-card::after {
  position: absolute;
  right: -60px;
  bottom: -60px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: var(--cyan);
  content: "";
  filter: blur(52px);
  opacity: 0.2;
}

.ring-wrap {
  position: relative;
  width: 168px;
  margin: 4px auto 20px;
}

.ring {
  width: 168px;
  height: 168px;
  transform: rotate(-90deg);
}

.ring circle {
  fill: none;
  stroke-width: 11;
  stroke-linecap: round;
}

.ring-track {
  stroke: var(--surface-sunken);
}

[data-theme="dark"] .ring-track {
  stroke: rgba(255, 255, 255, 0.09);
}

.ring-value {
  stroke: var(--lime);
  transition: stroke-dashoffset 700ms var(--ease);
}

.ring-center {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  gap: 2px;
}

.ring-center strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 2.1rem;
  letter-spacing: -0.05em;
}

.ring-center span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.card-kicker,
.tracker-status,
.metrics span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero-card h2 {
  font-size: 1.25rem;
}

.hero-card-foot {
  display: grid;
  gap: 8px;
  justify-items: center;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.hero-card-foot p {
  margin: 0;
  color: var(--soft);
  font-size: 0.92rem;
  font-weight: 600;
}

/* --------------------------------------------------------------- metrics */

.metrics {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  scroll-margin-top: 100px;
}

.metrics article {
  padding: 18px;
  border-radius: 20px;
}

.metrics strong {
  display: block;
  margin: 7px 0 4px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}

.metrics small {
  color: var(--muted);
  font-size: 0.8rem;
}

/* -------------------------------------------------------------- sections */

.section {
  padding: 76px 0 0;
  scroll-margin-top: 92px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.section-heading > p {
  max-width: 46ch;
  margin: 0;
}

.split-section {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 24px;
  align-items: start;
}

.today-card,
.workout-panel,
.info-card,
.tracker-section {
  border-radius: var(--radius);
}

.today-card {
  padding: 26px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-sunken);
  color: var(--soft);
  font-size: 0.8rem;
  font-weight: 700;
}

.pill.link {
  border-color: transparent;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding-inline: 0;
  transition: color 200ms var(--ease);
}

.pill.link:hover {
  color: var(--text);
}

.today-preview {
  display: grid;
  gap: 6px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.today-preview li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 14px;
  border-radius: 13px;
  background: var(--surface-sunken);
  font-size: 0.92rem;
}

.today-preview li span {
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.today-preview li.more {
  justify-content: center;
  background: none;
  color: var(--muted);
  font-size: 0.84rem;
}

.today-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

/* ------------------------------------------------------------ week strip */

.week-strip {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 4px;
  margin-top: 28px;
}

.week-chip {
  position: relative;
  display: grid;
  height: 62px;
  align-content: end;
  justify-items: center;
  overflow: hidden;
  padding-bottom: 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-sunken);
  cursor: pointer;
  transition: border-color 200ms var(--ease), transform 200ms var(--ease);
}

.week-chip:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

.week-chip.active {
  border-color: var(--lime);
}

.week-chip-fill {
  position: absolute;
  inset: auto 0 0 0;
  background: linear-gradient(180deg, var(--cyan), var(--lime));
  opacity: 0.55;
  transition: height 400ms var(--ease);
}

.week-chip-label {
  position: relative;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.week-chip.active .week-chip-label {
  color: var(--text);
}

/* ------------------------------------------------------------ week split */

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 11px;
}

.week-day {
  display: flex;
  flex-direction: column;
  min-height: 186px;
  padding: 17px;
  border-radius: 22px;
  transition: transform 240ms var(--ease), border-color 240ms var(--ease);
}

.week-day:hover {
  border-color: var(--line-strong);
  transform: translateY(-4px);
}

.week-day.rest {
  background: var(--surface-sunken);
  box-shadow: none;
}

.week-day p {
  flex: 1;
  font-size: 0.86rem;
}

.day-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.day-tag {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-sunken);
  color: var(--muted);
  font-size: 0.66rem;
}

.week-day:not(.rest) .day-tag {
  background: color-mix(in srgb, var(--lime) 22%, transparent);
  color: var(--text);
}

[data-theme="dark"] .week-day:not(.rest) .day-tag {
  color: var(--lime);
}

.week-day h3 {
  font-size: 1rem;
}

/* -------------------------------------------------------------- workouts */

.segmented,
.workout-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segmented {
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-sunken);
}

.phase-button,
.tab-button,
.status-button,
.expand-button,
.rest-button {
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
  transition: background 200ms var(--ease), color 200ms var(--ease), border-color 200ms var(--ease);
}

.phase-button {
  padding: 9px 16px;
  font-size: 0.88rem;
}

.phase-button.active {
  background: var(--accent);
  color: var(--accent-ink);
}

.workout-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.tab-button {
  display: grid;
  gap: 1px;
  padding: 9px 16px;
  border-color: var(--line);
  background: var(--surface-sunken);
  text-align: center;
}

.tab-button small {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  opacity: 0.7;
  text-transform: uppercase;
}

.tab-button:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.tab-button.active {
  border-color: transparent;
  background: var(--text);
  color: var(--bg);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 230px;
  min-width: 0;
  max-width: 320px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-sunken);
  color: var(--muted);
}

.search-field input {
  width: 100%;
  padding: 11px 0;
  border: 0;
  background: none;
  font-size: 0.9rem;
  outline: none;
}

.workout-panel {
  padding: 24px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.panel-head .section-text {
  max-width: 52ch;
  margin: 0;
}

.panel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.exercise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 11px;
  margin-top: 22px;
}

.exercise-card {
  display: flex;
  flex-direction: column;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--surface-sunken);
  transition: border-color 220ms var(--ease), transform 220ms var(--ease);
}

.exercise-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-3px);
}

.exercise-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.exercise-card h3 {
  margin-bottom: 0;
  font-size: 1rem;
  line-height: 1.3;
}

.exercise-card p {
  flex: 1;
  margin-bottom: 14px;
  font-size: 0.86rem;
}

.type-tag {
  flex-shrink: 0;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-sunken);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

[data-theme="dark"] .type-tag {
  background: rgba(255, 255, 255, 0.08);
}

.type-tag[data-type="compound"] { color: var(--lime); }
.type-tag[data-type="isolation"] { color: var(--cyan); }
.type-tag[data-type="abs"] { color: var(--violet); }
.type-tag[data-type="accessory"],
.type-tag[data-type="grip"] { color: var(--orange); }

[data-theme="light"] .type-tag[data-type="compound"] { color: #4c7a00; }
[data-theme="light"] .type-tag[data-type="isolation"] { color: #006a86; }
[data-theme="light"] .type-tag[data-type="abs"] { color: #6b3fd4; }
[data-theme="light"] .type-tag[data-type="accessory"],
[data-theme="light"] .type-tag[data-type="grip"] { color: #a2600d; }

.exercise-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0;
}

.meta {
  padding: 6px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cyan) 16%, transparent);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
}

.rest-button {
  align-self: flex-start;
  padding: 8px 13px;
  border-color: var(--line);
  font-size: 0.79rem;
}

.rest-button:hover {
  border-color: var(--lime);
  color: var(--text);
}

.rest-button.compact {
  padding: 6px 10px;
  font-size: 0.72rem;
}

.empty-state {
  grid-column: 1 / -1;
  margin: 0;
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
}

.notes-card {
  margin-top: 16px;
  padding: 24px;
}

.clean-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.clean-list li {
  display: flex;
  gap: 11px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-sunken);
  color: var(--soft);
  font-size: 0.9rem;
  line-height: 1.5;
}

.note-index {
  display: grid;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.76rem;
  font-weight: 800;
}

/* --------------------------------------------------------------- tracker */

.tracker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tracker-section {
  padding: 24px;
}

.program-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface-sunken);
}

.program-bar[data-mode="active"] { border-left-color: var(--lime); }
.program-bar[data-mode="before"] { border-left-color: var(--cyan); }
.program-bar[data-mode="after"] { border-left-color: var(--violet); }

.program-bar-text strong {
  display: block;
  margin-top: 4px;
  font-size: 0.95rem;
  font-weight: 600;
}

.program-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.program-bar input[type="date"] {
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 600;
}

[data-theme="dark"] .program-bar input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  opacity: 0.7;
  cursor: pointer;
}

.today-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: middle;
}

.tracker-row.today {
  border-color: var(--line-strong);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--lime) 30%, transparent);
}

.tracker-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 11px;
  margin-bottom: 18px;
}

.summary-card {
  padding: 16px;
  border-radius: 18px;
  box-shadow: none;
  background: var(--surface-sunken);
}

.summary-card strong {
  display: block;
  margin-top: 5px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.7rem;
  letter-spacing: -0.04em;
}

.summary-card[data-tone="good"] strong { color: var(--lime); }
.summary-card[data-tone="warn"] strong { color: var(--orange); }
.summary-card[data-tone="bad"] strong { color: var(--danger); }

[data-theme="light"] .summary-card[data-tone="good"] strong { color: #4c7a00; }

.tracker-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.icon-button.ghost {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 1.2rem;
}

.week-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

select {
  min-width: 210px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-sunken);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.week-phase {
  display: flex;
  gap: 7px;
  margin: 0 0 0 auto;
}

.tracker-list {
  display: grid;
  gap: 9px;
}

.tracker-row {
  padding: 15px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 19px;
  background: var(--surface-sunken);
}

.tracker-row[data-status="Done"] { border-left-color: var(--lime); }
.tracker-row[data-status="Skipped"] { border-left-color: var(--orange); }
.tracker-row[data-status="Missed"] { border-left-color: var(--danger); }
.tracker-row.open { border-color: var(--line-strong); }

.tracker-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.tracker-row-main {
  min-width: 175px;
}

.tracker-row strong {
  display: block;
  margin-bottom: 3px;
  font-size: 0.98rem;
}

.tracker-row small {
  font-size: 0.8rem;
}

.status-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.status-button,
.expand-button {
  padding: 8px 11px;
  border-color: var(--line);
  background: var(--surface);
  font-size: 0.79rem;
}

.status-button:hover,
.expand-button:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.status-button.active[data-status="Done"] {
  border-color: transparent;
  background: var(--lime);
  color: #10140a;
}

.status-button.active[data-status="Skipped"] {
  border-color: transparent;
  background: var(--orange);
  color: #241304;
}

.status-button.active[data-status="Missed"] {
  border-color: transparent;
  background: var(--danger);
  color: #26070b;
}

.status-button.active[data-status="Not Started"] {
  border-color: var(--line-strong);
  color: var(--text);
}

.expand-button {
  border-style: dashed;
}

/* ----------------------------------------------------------- session log */

.session-log {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  animation: reveal 260ms var(--ease);
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.log-grid {
  display: grid;
  gap: 5px;
}

.log-head,
.log-row {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) 0.9fr 0.75fr 0.75fr auto;
  gap: 9px;
  align-items: center;
}

.log-head {
  padding: 0 11px 6px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.log-head span:last-child {
  grid-column: span 2;
}

.log-row {
  padding: 8px 11px;
  border-radius: 13px;
  background: var(--surface);
}

.log-name {
  display: grid;
  font-size: 0.89rem;
  font-weight: 600;
  line-height: 1.3;
}

.log-name small {
  color: var(--muted);
  font-size: 0.71rem;
  font-weight: 600;
}

.log-target {
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 700;
}

.log-row input,
.log-notes textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-sunken);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 200ms var(--ease);
}

.log-row input:focus,
.log-notes textarea:focus {
  border-color: var(--cyan);
}

.log-notes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  margin-top: 12px;
}

.log-notes label {
  display: grid;
  gap: 6px;
}

.log-notes span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.log-notes textarea {
  border-radius: 13px;
  resize: vertical;
  font-family: inherit;
}

/* ----------------------------------------------------------- progression */

.progression-grid,
.recovery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.info-card {
  padding: 24px;
}

.info-card.wide {
  grid-row: span 2;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  border-radius: 16px;
  background: var(--surface-sunken);
}

.timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}

.timeline-head strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.02rem;
}

.timeline-item p {
  margin: 0 0 10px;
  color: var(--soft);
  font-size: 0.92rem;
}

.timeline-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.timeline-meta span {
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.45;
}

.timeline-meta em {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.11em;
  opacity: 0.75;
  text-transform: uppercase;
}

.table-scroll {
  overflow-x: auto;
  margin-top: 14px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  white-space: nowrap;
}

.data-table th {
  padding: 0 12px 9px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-align: left;
  text-transform: uppercase;
}

.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--soft);
  vertical-align: top;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table td.highlight {
  color: var(--text);
  font-weight: 700;
}

[data-theme="dark"] .data-table td.highlight {
  color: var(--lime);
}

/* -------------------------------------------------------------- recovery */

.abs-days {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.abs-day {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-sunken);
}

.abs-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.abs-day-head strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.02rem;
}

.abs-day .table-scroll {
  margin-top: 10px;
}

.mini-list {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.mini-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-sunken);
}

.mini-item strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
  font-size: 0.92rem;
}

.mini-item span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* ---------------------------------------------------------------- footer */

.footer {
  margin-top: 80px;
  padding: 30px 0 calc(46px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.footer p {
  margin: 0 0 6px;
}

.footer strong {
  color: var(--text);
}

.footer-meta {
  font-size: 0.82rem;
  opacity: 0.8;
}

/* -------------------------------------------------------- timer & toast */

.timer-dock {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  animation: reveal 260ms var(--ease);
}

.timer-dock[hidden] {
  display: none;
}

.timer-label {
  margin: 0 0 2px;
  max-width: 180px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.timer-value {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.7rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.timer-buttons {
  display: flex;
  gap: 7px;
}

.toast {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 50%;
  z-index: 50;
  max-width: calc(100vw - 32px);
  padding: 13px 20px;
  text-align: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 260ms var(--ease), transform 260ms var(--ease);
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 1080px) {
  .metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .week-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 900px) {
  .menu-button {
    display: grid;
  }

  .nav-links {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    display: none;
    flex-direction: column;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);
  }

  .nav-links.open {
    display: flex;
  }

  .topbar {
    position: relative;
  }

  .hero-grid,
  .split-section,
  .progression-grid,
  .recovery-grid {
    grid-template-columns: 1fr;
  }

  .info-card.wide {
    grid-row: auto;
  }

  .workout-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-field {
    max-width: none;
  }

  .nav-links a {
    display: flex;
    align-items: center;
  }

  /* Prev · select · next on one row, phase pills underneath. */
  .tracker-controls {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
  }

  .week-label > span {
    display: none;
  }

  .week-phase {
    grid-column: 1 / -1;
    margin-left: 0;
  }

  .log-head {
    display: none;
  }

  .log-row {
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    padding: 12px;
  }

  .log-name,
  .log-target {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100% - 20px, 1200px);
  }

  .section {
    padding-top: 56px;
  }

  .section-heading,
  .tracker-row-head,
  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .metrics,
  .tracker-summary,
  .log-notes,
  .timeline-meta {
    grid-template-columns: repeat(2, 1fr);
  }

  .week-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .week-day {
    min-height: 0;
  }

  .week-strip {
    grid-template-columns: repeat(8, 1fr);
    gap: 5px;
  }

  .week-chip {
    height: 48px;
  }

  .week-phase {
    margin-left: 0;
  }

  .program-bar,
  .program-bar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .tracker-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  /* Status choices become a grid so every target stays thumb-sized. */
  .status-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 7px;
    margin-top: 14px;
  }

  .expand-button {
    grid-column: 1 / -1;
  }

  .hero-card,
  .today-card,
  .workout-panel,
  .info-card,
  .tracker-section,
  .notes-card {
    padding: 20px;
  }

  .hero-stats {
    gap: 18px 26px;
  }

  .section,
  .hero {
    scroll-margin-top: 78px;
  }
}

/* ---- phones ---- */

@media (max-width: 560px) {
  .brand-sub {
    display: none;
  }

  .hero {
    padding-top: 18px;
  }

  .hero-actions .button,
  .today-actions .button,
  .program-bar-actions .button {
    flex: 1 1 100%;
  }

  .metrics {
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }

  .metrics article {
    padding: 15px;
  }

  .timeline-meta,
  .log-notes {
    grid-template-columns: 1fr;
  }

  .log-row .rest-button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .today-preview li {
    flex-direction: column;
    gap: 2px;
  }

  .today-preview li span {
    white-space: normal;
  }

  .timer-dock {
    right: 12px;
    left: 12px;
    justify-content: space-between;
    padding: 12px 14px;
  }

  .ring-wrap,
  .ring {
    width: 148px;
  }

  .ring {
    height: 148px;
  }
}

@media (max-width: 400px) {
  .shell {
    width: min(100% - 16px, 1200px);
  }

  .metrics,
  .tracker-summary,
  .week-grid,
  .tracker-actions,
  .status-options {
    grid-template-columns: 1fr;
  }

  .segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .tab-button {
    flex: 1 1 calc(50% - 3px);
  }

  .hero-card,
  .today-card,
  .workout-panel,
  .info-card,
  .tracker-section,
  .notes-card {
    padding: 17px;
  }
}

/* ---- touch input ---- */

@media (max-width: 900px) {
  /* 16px minimum stops iOS Safari zooming the page when a field is focused. */
  input,
  select,
  textarea,
  .log-row input,
  .search-field input,
  .log-notes textarea,
  .program-bar input[type="date"] {
    font-size: 16px;
  }

  select,
  .program-bar input[type="date"] {
    width: 100%;
    min-width: 0;
    min-height: 46px;
  }

  .program-bar input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
  }
}

@media (pointer: coarse) {
  .button,
  .status-button,
  .expand-button,
  .phase-button,
  .tab-button,
  .rest-button,
  .nav-links a {
    min-height: 44px;
  }

  .icon-button {
    width: 44px;
    height: 44px;
  }
}

@media (hover: none) {
  /* Without a real pointer :hover sticks after a tap — use :active instead. */
  .button:hover,
  .icon-button:hover,
  .week-chip:hover,
  .week-day:hover,
  .exercise-card:hover {
    transform: none;
  }

  .button:active,
  .icon-button:active,
  .status-button:active,
  .expand-button:active,
  .tab-button:active,
  .phase-button:active,
  .rest-button:active,
  .week-chip:active {
    transform: scale(0.97);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .topbar-wrap,
  .hero-actions,
  .tracker-actions,
  .timer-dock,
  .toast,
  .rest-button,
  .week-strip,
  .skip-link {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .section {
    padding-top: 24px;
    break-inside: avoid;
  }
}
