:root {
  --bg: #fbf9f8;
  --surface: #ffffff;
  --surface-soft: #f1efee;
  --surface-muted: #e8e6e5;
  --ink: #172122;
  --ink-soft: #465052;
  --muted: #778082;
  --line: #d9dddc;
  --primary: #0b4749;
  --primary-strong: #073638;
  --primary-soft: #e9f2f1;
  --accent: #82551f;
  --accent-soft: #f8efe4;
  --danger: #a13b35;
  --success: #27725c;
  --shadow: 0 10px 24px rgba(22, 47, 48, .10);
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --content: 680px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  line-height: 1;
}
.material-symbols-outlined.filled { font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }

.app-shell { min-height: 100dvh; padding-bottom: calc(86px + var(--safe-bottom)); }
.session-shell { min-height: 100dvh; padding-bottom: calc(112px + var(--safe-bottom)); }
.content { width: min(100%, var(--content)); margin: 0 auto; padding: 0 24px; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px 12px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
}
.topbar-inner { width: min(100%, var(--content)); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.eyebrow { margin: 0 0 7px; color: var(--ink-soft); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; }
.greeting { margin: 0; font-size: clamp(22px, 5.4vw, 29px); line-height: 1.2; font-weight: 500; }
.icon-button {
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  display: inline-grid; place-items: center; color: var(--ink-soft); background: transparent;
}
.icon-button:hover, .icon-button:focus-visible { background: var(--surface-soft); color: var(--primary); outline: none; }

.hero { padding-top: 36px; }
.hero-kicker { color: var(--primary); font-weight: 700; letter-spacing: .08em; font-size: 15px; text-transform: uppercase; }
.hero h1 { margin: 14px 0 14px; font-size: clamp(38px, 10vw, 52px); letter-spacing: -.035em; line-height: 1.04; }
.hero-meta { margin: 0; color: var(--ink-soft); font-size: clamp(18px, 4.6vw, 24px); line-height: 1.45; }
.progress-line { height: 5px; margin-top: 36px; background: var(--surface-muted); border-radius: 999px; overflow: hidden; }
.progress-line > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }

.action-stack { display: grid; gap: 14px; margin-top: 52px; }
.btn {
  min-height: 54px; border: 0; border-radius: var(--radius); padding: 14px 20px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-weight: 650; text-decoration: none; transition: transform .14s ease, opacity .14s ease, background .14s ease;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--primary-strong); }
.btn-secondary { color: var(--accent); background: transparent; }
.btn-outline { color: var(--primary); background: transparent; border: 1px solid #abc1c0; }
.btn-soft { color: var(--ink); background: var(--surface-soft); }
.btn-danger { color: #fff; background: var(--danger); }
.btn-small { min-height: 44px; padding: 10px 16px; border-radius: 14px; font-size: 14px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }

.section-title { margin: 82px 0 26px; color: var(--muted); text-align: center; text-transform: uppercase; letter-spacing: .07em; font-size: 17px; }
.itinerary { position: relative; }
.itinerary::before { content: ""; position: absolute; left: 27px; top: 0; bottom: 18px; width: 3px; background: var(--line); }
.exercise-row {
  position: relative; display: grid; grid-template-columns: 56px 1fr 42px; align-items: center;
  min-height: 112px; border-bottom: 1px solid #e9e7e6; padding: 0 6px 0 0;
}
.exercise-row.current { margin-inline: -14px; padding-inline: 14px 6px; background: var(--surface-soft); border-radius: 14px; border-bottom-color: transparent; }
.exercise-node { z-index: 1; width: 56px; display: grid; place-items: center; }
.exercise-node span { width: 54px; height: 54px; border: 2px solid #ccd6d5; border-radius: 17px; background: var(--bg); display: grid; place-items: center; }
.exercise-node i { width: 12px; height: 12px; border-radius: 50%; background: #c9d1d1; }
.current .exercise-node span { border-color: #9bb6b5; }
.current .exercise-node i { background: var(--primary); }
.exercise-copy h3 { margin: 0 0 7px; font-size: 21px; line-height: 1.22; font-weight: 500; }
.exercise-row.current h3 { font-weight: 700; }
.exercise-copy p { margin: 0; color: var(--ink-soft); font-size: 16px; font-weight: 600; }
.video-link { width: 42px; height: 42px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; border-radius: 50%; }
.current .video-link { color: var(--primary); }
.video-link:hover { background: var(--surface-muted); }

.last-session { margin: 74px 10px 18px; display: flex; align-items: center; gap: 14px; color: var(--ink-soft); font-size: 16px; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  padding: 11px 10px calc(10px + var(--safe-bottom));
  background: color-mix(in srgb, var(--bg) 96%, transparent); backdrop-filter: blur(14px); border-top: 1px solid #ece9e8;
}
.nav-item { position: relative; min-height: 56px; border: 0; background: transparent; color: #666d6e; display: grid; place-items: center; align-content: center; gap: 5px; font-size: 13px; font-weight: 650; }
.nav-item.active { color: var(--primary); }
.nav-item.active::after { content: ""; position: absolute; bottom: 0; width: 5px; height: 5px; border-radius: 50%; background: var(--primary); }

.screen-header { padding: 22px 22px 10px; display: grid; grid-template-columns: 48px 1fr 48px; align-items: start; }
.screen-header .title { text-align: center; }
.screen-header h1 { margin: 0; font-size: 26px; line-height: 1.1; }
.screen-header p { margin: 6px 0 0; color: var(--ink-soft); font-size: 15px; font-weight: 600; }
.session-progress { height: 5px; background: var(--surface-muted); }
.session-progress span { display: block; height: 100%; background: var(--primary); }

.workout-main { padding-top: 38px; }
.workout-title-row { display: flex; justify-content: space-between; gap: 18px; align-items: start; }
.workout-title { margin: 0; max-width: 560px; font-size: clamp(35px, 9vw, 48px); line-height: 1.28; letter-spacing: -.025em; }
.workout-meta { margin: 18px 0 0; color: var(--ink-soft); font-size: 20px; line-height: 1.5; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 28px; }
.text-action { border: 0; background: transparent; padding: 0; display: inline-flex; gap: 8px; align-items: center; color: var(--primary); font-weight: 650; font-size: 16px; text-decoration: none; }
.previous { margin: 64px 0 42px; color: var(--ink-soft); font-size: 17px; font-weight: 600; }

.set-list { position: relative; margin-left: 15px; }
.set-list::before { content: ""; position: absolute; top: 20px; bottom: 30px; left: 13px; width: 3px; background: #e2e3e2; }
.set-complete { position: relative; display: grid; grid-template-columns: 54px 48px 1fr 1fr; align-items: center; min-height: 84px; color: var(--ink-soft); font-size: 18px; }
.set-check { z-index: 2; width: 31px; height: 31px; border-radius: 50%; background: #eef2f1; color: var(--primary); display: grid; place-items: center; }
.set-complete strong { color: var(--ink); }
.active-set { position: relative; margin-left: -15px; margin-top: 4px; padding: 30px 22px 34px 80px; background: var(--surface); border: 1px solid #ddd; border-radius: 8px; box-shadow: 0 3px 8px rgba(0,0,0,.08); }
.active-set::before { content: ""; position: absolute; top: 64px; left: 16px; width: 31px; height: 31px; border-radius: 50%; border: 4px solid var(--primary); background: var(--surface); }
.active-set-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 28px; font-size: 16px; font-weight: 700; color: var(--primary); }
.active-set-head span:last-child { color: var(--ink-soft); }
.set-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.control-label { display: block; margin-bottom: 12px; text-align: center; color: var(--ink-soft); font-weight: 650; font-size: 15px; }
.stepper { display: grid; grid-template-columns: 48px minmax(52px, 1fr) 48px; align-items: center; min-height: 66px; border: 1px solid #d9d7d6; border-radius: 14px; background: var(--surface-soft); overflow: hidden; }
.stepper button { height: 64px; border: 0; background: transparent; color: var(--ink); display: grid; place-items: center; }
.stepper button:hover { background: var(--surface-muted); }
.stepper output { text-align: center; font-size: 28px; font-weight: 550; font-variant-numeric: tabular-nums; }

.session-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  padding: 16px 24px calc(16px + var(--safe-bottom)); background: var(--bg); border-top: 1px solid #eeeceb;
}
.session-bottom .btn { width: min(100%, calc(var(--content) - 48px)); margin: 0 auto; display: flex; min-height: 68px; font-size: 18px; }

.rest-main { padding-top: 26px; text-align: center; }
.completion-note { display: flex; justify-content: space-between; align-items: center; gap: 16px; color: var(--ink); font-size: 15px; }
.completion-note span:first-child { display: inline-flex; align-items: center; gap: 7px; }
.rest-ring { --p: 74%; width: min(64vw, 300px); aspect-ratio: 1; margin: 82px auto 34px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--primary) var(--p), #ebeae9 0); position: relative; }
.rest-ring::after { content: ""; position: absolute; inset: 14px; background: var(--bg); border-radius: 50%; }
.rest-content { z-index: 1; }
.rest-label { color: var(--ink-soft); letter-spacing: .08em; font-size: 18px; text-transform: uppercase; }
.rest-time { margin: 8px 0; color: var(--primary); font-size: clamp(58px, 16vw, 82px); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.05em; }
.rest-sub { color: var(--ink-soft); font-weight: 650; }
.rest-actions { display: flex; justify-content: center; gap: 18px; }
.next-preview { margin-top: 70px; padding-top: 28px; border-top: 1px solid var(--line); text-align: left; }
.next-preview h2 { margin: 0 0 18px; font-size: 17px; text-transform: uppercase; letter-spacing: .06em; }
.next-preview p { margin: 8px 0; font-size: 20px; }
.next-preview .muted { color: var(--ink-soft); }

.sheet-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(20,20,20,.34); backdrop-filter: blur(5px); display: grid; align-items: end; }
.sheet { max-height: 88dvh; overflow: auto; background: var(--bg); border-radius: 32px 32px 0 0; padding: 26px 0 calc(18px + var(--safe-bottom)); animation: sheet-up .18s ease-out; }
.sheet-handle { width: 86px; height: 7px; border-radius: 999px; background: #ddd; margin: 0 auto 46px; }
.sheet-head, .sheet-options, .sheet-foot { width: min(100%, var(--content)); margin-inline: auto; padding-inline: 24px; }
.sheet-head h2 { margin: 0; font-size: 30px; }
.sheet-head p { margin: 18px 0 28px; color: var(--ink-soft); font-size: 18px; line-height: 1.55; }
.sheet-options { border-top: 1px solid #e5e3e2; padding-top: 22px; }
.sheet-option { width: 100%; display: grid; grid-template-columns: 54px 1fr 26px; gap: 16px; align-items: start; padding: 22px 14px; border: 0; border-radius: 14px; background: transparent; text-align: left; }
.sheet-option:hover { background: var(--surface-soft); }
.sheet-option.recommended { background: #f0f2f1; border: 1px solid #ccd4d3; }
.sheet-option h3 { margin: 0 0 8px; font-size: 18px; font-weight: 500; }
.sheet-option p { margin: 0; color: var(--ink-soft); font-size: 15px; line-height: 1.45; }
.sheet-foot { margin-top: 14px; text-align: center; }
@keyframes sheet-up { from { transform: translateY(24px); opacity: .5; } }

.page { padding-top: 24px; }
.page h1 { margin: 0 0 30px; font-size: 38px; }
.card { background: var(--surface); border: 1px solid #e2e0df; border-radius: var(--radius); padding: 20px; }
.stack { display: grid; gap: 16px; }
.list { display: grid; gap: 12px; }
.list-row { display: flex; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid #ebe9e8; }
.list-row:last-child { border-bottom: 0; }
.list-row strong { display: block; margin-bottom: 5px; }
.muted { color: var(--ink-soft); }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; background: var(--surface-soft); color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.status.completed { background: #e8f3ee; color: var(--success); }
.status.postponed { background: var(--accent-soft); color: var(--accent); }
.status.omitted { background: #f1eeee; color: #755d5a; }
.form-grid { display: grid; gap: 14px; }
.field label { display: block; margin-bottom: 7px; color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.field input, .field textarea, .field select { width: 100%; min-height: 50px; border: 1px solid #d6d4d3; border-radius: 12px; padding: 12px 14px; background: var(--surface); color: var(--ink); }
.field textarea { min-height: 96px; resize: vertical; }
.chart { width: 100%; height: 220px; display: block; overflow: visible; }
.chart text { font-family: Inter, sans-serif; fill: var(--muted); font-size: 11px; }
.empty { padding: 32px 14px; text-align: center; color: var(--ink-soft); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.toast { position: fixed; z-index: 100; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translate(-50%, 20px); padding: 12px 16px; border-radius: 12px; background: var(--ink); color: #fff; opacity: 0; pointer-events: none; transition: .2s; box-shadow: var(--shadow); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 480px) {
  .content { padding-inline: 21px; }
  .hero { padding-top: 28px; }
  .hero h1 { font-size: 41px; }
  .action-stack { margin-top: 42px; }
  .section-title { margin-top: 68px; font-size: 15px; }
  .exercise-row { min-height: 108px; grid-template-columns: 54px 1fr 40px; }
  .exercise-copy h3 { font-size: 19px; }
  .screen-header { padding-inline: 14px; }
  .workout-main { padding-top: 30px; }
  .workout-title { font-size: 39px; }
  .set-controls { gap: 14px; }
  .active-set { padding-left: 72px; padding-right: 16px; }
  .completion-note { font-size: 13px; }
  .rest-ring { margin-top: 70px; width: min(76vw, 286px); }
  .sheet-handle { margin-bottom: 38px; }
  .sheet-head h2 { font-size: 28px; }
}

@media (min-width: 760px) {
  .bottom-nav { width: min(100%, 760px); left: 50%; transform: translateX(-50%); border-inline: 1px solid #ece9e8; border-radius: 18px 18px 0 0; }
}
