:root {
  color-scheme: dark;
  --bg: #090b09;
  --surface: #111511;
  --surface-raised: #171c17;
  --surface-soft: #1c221b;
  --line: #252c24;
  --text: #f3f5ef;
  --muted: #9da59b;
  --subtle: #737c70;
  --lime: #c5f36b;
  --lime-dark: #29371a;
  --danger: #ff8a79;
  --radius: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--bg); }
body { min-width: 320px; min-height: 100vh; margin: 0; }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
}

.app-shell {
  width: min(100%, 560px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 20px calc(100px + env(safe-area-inset-bottom));
  position: relative;
}
.topbar {
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
  font-size: 21px;
  font-weight: 760;
  letter-spacing: -1px;
}
.brand-mark {
  width: 29px;
  height: 29px;
  border-radius: 9px;
  object-fit: cover;
}
.brand-period { color: var(--lime); }
.storage-warning {
  margin: 3px 0 14px;
  border: 1px solid #57372f;
  background: #251713;
  color: #ffd2c9;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
}

#app-main { min-height: 70vh; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.7px;
  font-size: 10px;
  font-weight: 760;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 8px;
  font-size: clamp(30px, 8vw, 39px);
  line-height: 1.02;
  letter-spacing: -1.8px;
  font-weight: 730;
}
h2 { margin-bottom: 5px; font-size: 21px; letter-spacing: -.55px; }
h3 { margin-bottom: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.section-heading { margin: 26px 0 13px; display: flex; justify-content: space-between; align-items: end; }
.section-heading h2 { margin: 0; }
.text-button {
  border: 0;
  padding: 8px 0 5px 10px;
  background: none;
  color: var(--lime);
  font-size: 12px;
  font-weight: 700;
}
.hero-intro { padding: 17px 0 20px; }
.hero-intro .muted { margin: 0; font-size: 14px; }

.program-card {
  overflow: hidden;
  border: 1px solid #344128;
  border-radius: 25px;
  padding: 22px;
  background:
    radial-gradient(ellipse at 95% 4%, rgba(197, 243, 107, .13), transparent 48%),
    linear-gradient(145deg, #172017, #111511 70%);
}
.program-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.program-tag {
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 30px;
  background: rgba(197, 243, 107, .11);
  color: var(--lime);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 9px;
  font-weight: 790;
}
.date-tag { color: var(--muted); font-size: 11px; }
.program-card h2 { margin: 18px 0 5px; font-size: 27px; letter-spacing: -1px; }
.program-card .program-subtitle { margin: 0; color: #adb7a7; font-size: 13px; }
.card-divider { height: 1px; margin: 19px 0 16px; background: rgba(220, 238, 208, .12); }
.program-stats { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stat-value { display: block; font-size: 17px; font-weight: 690; letter-spacing: -.4px; }
.stat-label { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.progress-track { height: 5px; margin-top: 16px; overflow: hidden; border-radius: 8px; background: #303a2c; }
.progress-fill { height: 100%; border-radius: inherit; background: var(--lime); transition: width .25s ease; }

.button {
  min-height: 49px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 15px;
  padding: 0 17px;
  background: var(--lime);
  color: #11150c;
  font-weight: 770;
  font-size: 14px;
  text-decoration: none;
  transition: transform .12s ease, filter .12s ease;
}
.button:active { transform: scale(.985); filter: brightness(.95); }
.button.secondary {
  border: 1px solid var(--line);
  background: var(--surface-raised);
  color: var(--text);
}
.button.ghost { min-height: 43px; background: transparent; border: 1px solid var(--line); color: var(--muted); }
.button:disabled { opacity: .45; }
.button .button-arrow { font-size: 18px; line-height: 0; }
.hero-cta { margin-top: 16px; }
.rest-card {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--surface);
  display: flex;
  gap: 13px;
  align-items: flex-start;
}
.rest-icon { width: 37px; height: 37px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 12px; background: #1e2920; color: var(--lime); }
.rest-icon svg { width: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rest-card h3 { margin: 1px 0 5px; font-size: 14px; }
.rest-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.rest-card .rest-date { display: block; margin-top: 7px; color: var(--lime); font-size: 11px; font-weight: 700; }
.macro-card, .training-targets { margin-top: 16px; border: 1px solid var(--line); border-radius: 19px; padding: 17px; background: var(--surface); }
.macro-card-top, .training-targets-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.macro-card .eyebrow, .training-targets .eyebrow { margin-bottom: 5px; font-size: 9px; }
.macro-card h2, .training-targets h2 { margin: 0; font-size: 17px; }
.macro-day-label { color: var(--muted); font-size: 10px; text-align: right; }
.steps-target { color: var(--lime); font-size: 13px; font-weight: 760; white-space: nowrap; }
.macro-values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 15px; }
.macro-values > div { border: 1px solid #252c24; border-radius: 12px; padding: 11px 10px; background: #0d100d; }
.macro-values span { display: block; color: var(--muted); font-size: 10px; }
.macro-values strong { display: block; margin-top: 5px; font-size: 20px; letter-spacing: -.5px; }
.macro-values small { margin-left: 3px; color: var(--muted); font-size: 10px; font-weight: 600; }
.macro-setup-hint { margin: 11px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.training-targets { margin: 12px 0 4px; padding: 14px; background: rgba(13, 16, 13, .65); }
.training-targets .macro-values { margin-top: 12px; }
.training-targets .macro-values > div { background: var(--surface); }

.week-strip, .day-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 1px 8px; scrollbar-width: none; }
.week-strip::-webkit-scrollbar, .day-strip::-webkit-scrollbar { display: none; }
.week-pill, .day-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 57px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.week-pill.is-selected, .day-pill.is-selected { border-color: var(--lime); color: var(--lime); background: #1a2415; }
.day-pill { flex: 1 0 59px; min-width: 58px; padding: 10px 7px; }
.day-pill span { display: block; }
.day-pill span:last-child { margin-top: 4px; color: inherit; opacity: .72; font-size: 9px; font-weight: 550; }

.workout-header { padding: 14px 0 11px; }
.workout-header h1 { font-size: 32px; }
.workout-header .muted { margin: 0; font-size: 13px; }
.workout-completion { margin-top: 14px; }
.completion-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.completion-row strong { color: var(--text); font-weight: 660; }
.exercise-list { display: grid; gap: 11px; margin-top: 13px; }
.exercise-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 14px 13px;
  background: var(--surface);
}
.exercise-card.is-done { border-color: #3a4c2a; }
.exercise-top { display: flex; gap: 11px; align-items: flex-start; }
.exercise-number {
  display: grid; flex: 0 0 auto; place-items: center;
  width: 28px; height: 28px; border-radius: 9px;
  background: #1d241c; color: var(--lime);
  font-size: 11px; font-weight: 800;
}
.exercise-title-wrap { min-width: 0; flex: 1; }
.exercise-title { margin: 2px 0 5px; font-size: 14px; line-height: 1.25; font-weight: 690; }
.exercise-prescription { color: var(--muted); font-size: 11px; line-height: 1.45; }
.exercise-target { margin-left: auto; flex: 0 0 auto; color: var(--lime); font-size: 10px; font-weight: 760; text-align: right; }
.exercise-note { margin: 11px 0 0 39px; color: #a6afa2; font-size: 11px; line-height: 1.4; }
.exercise-video { margin: 12px 0 0 39px; border-top: 1px solid var(--line); padding-top: 11px; }
.exercise-video summary { display: flex; align-items: center; justify-content: space-between; color: var(--lime); cursor: pointer; font-size: 11px; font-weight: 700; list-style: none; }
.exercise-video summary::-webkit-details-marker { display: none; }
.exercise-video summary::after { content: "+"; font-size: 16px; font-weight: 500; }
.exercise-video[open] summary::after { content: "−"; }
.exercise-video-player { overflow: hidden; margin-top: 10px; border-radius: 12px; background: #000; }
.exercise-video-player iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; }
.group-label { margin: 12px 0 0 39px; color: #d5dda9; font-size: 9px; font-weight: 760; letter-spacing: .8px; text-transform: uppercase; }
.set-table { margin-top: 14px; border-top: 1px solid #252c24; padding-top: 10px; }
.set-table-head, .set-row { display: grid; grid-template-columns: 37px minmax(70px, 1fr) minmax(70px, 1fr) 40px; gap: 8px; align-items: center; }
.set-table.is-cardio .set-table-head, .set-table.is-cardio .set-row { grid-template-columns: 37px minmax(70px, 1fr) 40px; }
.set-table-head { margin-bottom: 5px; color: var(--subtle); font-size: 9px; text-transform: uppercase; letter-spacing: .7px; }
.set-row { min-height: 43px; }
.set-number { color: var(--muted); font-size: 11px; font-weight: 650; }
.set-input {
  min-width: 0;
  width: 100%;
  height: 34px;
  border: 1px solid #30382f;
  border-radius: 9px;
  padding: 0 8px;
  background: #0d100d;
  color: var(--text);
  font-size: 12px;
  appearance: none;
}
.set-input::placeholder { color: #636b61; opacity: 1; }
.set-input:disabled { opacity: .67; }
.set-check {
  width: 28px; height: 28px; justify-self: end;
  appearance: none; border: 1px solid #455044; border-radius: 9px;
  margin: 0; background: #101410; display: grid; place-items: center;
}
.set-check:checked { border-color: var(--lime); background: var(--lime); }
.set-check:checked::after { content: ""; width: 8px; height: 5px; border-left: 2px solid #11150c; border-bottom: 2px solid #11150c; transform: rotate(-45deg) translate(1px, -1px); }
.set-check:disabled { opacity: .5; }
.workout-note-field { display: block; margin-top: 18px; }
.workout-note-field span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 680; }
.workout-note-field textarea {
  display: block; width: 100%; min-height: 74px;
  border: 1px solid var(--line); border-radius: 13px;
  padding: 11px 12px; resize: vertical;
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 12px; line-height: 1.5;
}
.finish-wrap { padding-top: 17px; }
.locked-banner {
  margin: 12px 0 0;
  border: 1px solid #33402c; border-radius: 13px; padding: 12px 13px;
  background: #141b11; color: #d4e6bd; font-size: 12px; line-height: 1.45;
}
.empty-state {
  margin-top: 20px; border: 1px solid var(--line); border-radius: 20px;
  padding: 25px 20px; background: var(--surface); text-align: center;
}
.empty-state .empty-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; margin-bottom: 13px; border-radius: 14px; background: #1c2517; color: var(--lime); font-size: 20px; }
.empty-state h2 { margin-bottom: 7px; font-size: 18px; }
.empty-state p { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.5; }

.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.metric-card { min-height: 102px; border: 1px solid var(--line); border-radius: 17px; padding: 16px; background: var(--surface); }
.metric-card strong { display: block; margin: 4px 0 6px; font-size: 27px; letter-spacing: -1px; }
.metric-card span { color: var(--muted); font-size: 11px; }
.week-progress-list { display: grid; gap: 10px; }
.week-progress { border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px; background: var(--surface); }
.week-progress-top { display: flex; justify-content: space-between; margin-bottom: 9px; font-size: 11px; font-weight: 700; }
.week-progress-top span:last-child { color: var(--muted); font-weight: 500; }
.week-dots { display: flex; gap: 7px; }
.week-dot { width: 9px; height: 9px; border-radius: 50%; background: #343b32; }
.week-dot.is-done { background: var(--lime); }
.week-dot.is-current { box-shadow: 0 0 0 3px #26351b; }

.settings-section { margin-top: 24px; }
.settings-section:first-of-type { margin-top: 18px; }
.settings-section h2 { margin-bottom: 10px; font-size: 16px; }
.settings-card { overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-copy { flex: 1; }
.setting-copy strong { display: block; font-size: 12px; }
.setting-copy span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.setting-input {
  width: 94px; height: 39px; border: 1px solid #353d34;
  border-radius: 10px; padding: 0 10px; background: #0b0e0b;
  color: var(--text); text-align: right; font-size: 13px;
}
.profile-select { text-align: left; }
.unit-toggle { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: #0b0e0b; }
.unit-option { min-width: 43px; min-height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; }
.unit-option.is-active { background: var(--lime); color: #10140d; }
.backup-actions { display: grid; gap: 9px; }
.backup-hint { margin: 10px 2px 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.file-input { display: none; }
.danger-button {
  width: 100%; min-height: 45px; border: 1px solid #51312d; border-radius: 13px;
  background: #1e1311; color: #ffb0a4; font-size: 12px; font-weight: 700;
}
.onboarding {
  padding: 30px 5px 0;
}
.onboarding-mark {
  display: block; width: 62px; height: 62px; margin-bottom: 27px;
  border-radius: 16px; object-fit: cover;
}
.onboarding h1 { max-width: 350px; margin-bottom: 12px; font-size: 42px; }
.onboarding > p { max-width: 380px; margin-bottom: 25px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.onboarding-points { display: grid; gap: 12px; margin: 0 0 26px; padding: 0; list-style: none; }
.onboarding-points li { display: flex; gap: 10px; color: #c2c9bd; font-size: 12px; line-height: 1.45; }
.checkmark { flex: 0 0 auto; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 6px; background: #202a19; color: var(--lime); font-size: 11px; }
.onboarding .privacy-note { margin-top: 14px; color: var(--subtle); font-size: 10px; text-align: center; }
.finish-overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 24px; background: rgba(0,0,0,.74); }
.finish-dialog { width: min(100%, 380px); border: 1px solid var(--line); border-radius: 22px; padding: 23px; background: #141914; box-shadow: 0 20px 80px rgba(0,0,0,.5); }
.finish-dialog h2 { margin-bottom: 8px; }
.finish-dialog p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.finish-dialog-actions { display: grid; gap: 8px; margin-top: 17px; }
.tabbar {
  position: fixed;
  z-index: 5;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 560px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 9px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(57, 65, 54, .72);
  background: rgba(13, 16, 13, .94);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
.tab-button {
  min-height: 50px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #7f897d;
  font-size: 9px;
  font-weight: 650;
}
.tab-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tab-button.is-active { color: var(--lime); }
.toast {
  position: fixed;
  z-index: 12;
  bottom: calc(88px + env(safe-area-inset-bottom));
  left: 50%;
  width: max-content;
  max-width: calc(100% - 36px);
  transform: translate(-50%, 10px);
  border: 1px solid #3a4436;
  border-radius: 12px;
  padding: 11px 15px;
  background: #20271e;
  color: var(--text);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
[hidden] { display: none !important; }

@media (min-width: 700px) {
  body { background: #111411; }
  .app-shell { border-inline: 1px solid #1b211a; background: var(--bg); }
  .tabbar { border-inline: 1px solid #1b211a; }
}
@media (max-width: 360px) {
  .app-shell { padding-inline: 15px; }
  .program-card { padding: 18px; }
  .set-table-head, .set-row { grid-template-columns: 30px minmax(64px, 1fr) minmax(64px, 1fr) 36px; gap: 6px; }
  .exercise-card { padding-inline: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
