/* Adaptive Workout Coach: static demo stylesheet (GitHub Pages) */
:root {
  --bg: #f4f7f5;
  --paper: #ffffff;
  --ink: #182420;
  --muted: #64716b;
  --line: #dde5e1;
  --green: #147a5c;
  --green-soft: #ddf2e8;
  --blue: #2a6d8a;
  --blue-soft: #ddeff5;
  --red: #b0483c;
  --red-soft: #fbe7e3;
  --amber: #9a6200;
  --amber-soft: #fff1d4;
  --radius: 14px;
  --shadow: 0 14px 44px rgba(24, 40, 32, .09);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1513;
    --paper: #182019;
    --ink: #eef4f0;
    --muted: #a9b5ae;
    --line: #2c3833;
    --green: #6fd6a8;
    --green-soft: #16382c;
    --blue: #7fc7de;
    --blue-soft: #173642;
    --red: #f0978b;
    --red-soft: #452723;
    --amber: #f5bd60;
    --amber-soft: #43300f;
    --shadow: 0 16px 50px rgba(0, 0, 0, .3);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); min-height: 100vh; }
button, input, select { font: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
a { color: var(--blue); }

.page { width: min(1060px, calc(100% - 32px)); margin: 0 auto; padding: 22px 0 120px; }

/* Sticky status bar */
.status-bar {
  position: sticky; top: 10px; z-index: 30;
  display: grid; grid-template-columns: auto 1fr; gap: 6px 20px; align-items: center;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px 10px; margin-bottom: 26px; box-shadow: var(--shadow);
}
.status-state { display: flex; align-items: center; gap: 9px; font-size: .9rem; font-weight: 600; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.status-bar.active .status-dot { background: var(--green); }
.status-bar.complete .status-dot { background: var(--blue); }
.status-detail { display: flex; justify-content: flex-end; gap: 20px; color: var(--muted); font-size: .8rem; font-weight: 600; }
.status-track { grid-column: 1 / -1; height: 4px; border-radius: 99px; background: var(--line); overflow: hidden; }
.status-fill { width: 0; height: 100%; background: var(--green); transition: width .25s ease; }

.intro { display: grid; grid-template-columns: 1fr 220px; gap: 24px; align-items: end; margin-bottom: 20px; }
.intro-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.header-tools { display: flex; gap: 8px; flex: 0 0 auto; }
.icon-btn { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); display: grid; place-items: center; cursor: pointer; padding: 0; }
.icon-btn[aria-expanded="true"] { border-color: var(--green); background: var(--green-soft); }
.hamburger { display: grid; gap: 4px; width: 18px; }
.hamburger span { display: block; height: 2px; background: currentColor; border-radius: 2px; }
.icon-info { width: 18px; height: 18px; border: 2px solid currentColor; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; font-weight: 800; line-height: 1; }
.icon-info::before { content: "i"; }
h1 { font-size: clamp(2rem, 5vw, 3.6rem); letter-spacing: -.03em; margin: 0 0 10px; line-height: 1; }
.lede { color: var(--muted); line-height: 1.6; margin: 0; max-width: 640px; }
.demo-badge { display: inline-block; margin: 10px 0 0; font-size: .78rem; font-weight: 700; color: var(--blue); background: var(--blue-soft); border-radius: 20px; padding: 4px 12px; }
.frequency { border-top: 1px solid var(--line); padding-top: 12px; display: flex; justify-content: space-between; font-size: .88rem; color: var(--muted); }

.safety { background: var(--red-soft); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 20px; font-size: .92rem; line-height: 1.5; }
.safety strong { color: var(--red); }

.dashboard { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; margin-bottom: 26px; }
.timer-panel, .progress-panel { padding: 22px; }
.timer-panel { border-right: 1px solid var(--line); }
.panel-label { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.timer-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.timer { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: clamp(2rem, 6vw, 3.2rem); font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.timer.done { color: var(--red); }
.timer-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.session-date { margin-top: 10px; font-size: .82rem; color: var(--muted); }

.btn { min-height: 44px; border: 0; border-radius: 10px; padding: 0 18px; font-weight: 700; cursor: pointer; background: var(--green); color: #fff; }
@media (prefers-color-scheme: dark) { .btn { color: #0d1a14; } }
.btn.secondary { background: var(--line); color: var(--ink); }
.btn.danger { background: var(--red-soft); color: var(--red); }

.clear-confirm { display: none; grid-column: 1 / -1; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--red-soft); font-size: .88rem; }
.clear-confirm.show { display: flex; }
.clear-actions { display: flex; gap: 8px; }
.session-message { display: none; grid-column: 1 / -1; padding: 10px 20px; background: var(--blue-soft); font-size: .86rem; border-top: 1px solid var(--line); }
.session-message.show { display: block; }

.prompt-bar { display: none; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; border-radius: 12px; font-size: .88rem; margin-top: 12px; }
.prompt-bar.show { display: flex; }
.prompt-bar.danger { background: var(--red-soft); }
.prompt-bar.ok { background: var(--green-soft); }
.prompt-bar.warn { background: var(--amber-soft); }
.prompt-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dashboard .prompt-bar { grid-column: 1 / -1; margin: 0; border-radius: 0; border-top: 1px solid var(--line); }

.progress-top { display: flex; justify-content: space-between; align-items: baseline; }
.progress-count { font: 700 1.15rem/1 ui-monospace, Menlo, monospace; }
.progress-track { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 12px 0 10px; }
.progress-fill { width: 0; height: 100%; background: var(--green); transition: width .25s ease; }
.progress-note { font-size: .84rem; color: var(--muted); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.section { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; margin-bottom: 16px; overflow: hidden; }
.section-head { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 16px 18px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; text-align: left; }
.section-head::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s; flex: 0 0 auto; }
.section.collapsed .section-head { border-bottom-color: transparent; }
.section.collapsed .section-head::after { transform: rotate(-45deg); }
.section.collapsed .exercise-list { display: none; }
.section.complete .section-head { background: var(--green-soft); }
.section-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.step-no { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 800; background: var(--green-soft); color: var(--green); }
.section-heading { margin: 0; font-size: 1.02rem; }
.duration { font-size: .8rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.block-tag { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--blue); background: var(--blue-soft); border-radius: 6px; padding: 3px 8px; }

.exercise-list { list-style: none; margin: 0; padding: 0; }
.exercise { border-bottom: 1px solid var(--line); }
.exercise:last-child { border-bottom: 0; }
.check-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 16px 18px; cursor: pointer; }
.check-row input { appearance: none; width: 24px; height: 24px; margin: 1px 0 0; border: 2px solid var(--line); border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.check-row input::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0); }
.check-row input:checked { background: var(--green); border-color: var(--green); }
.check-row input:checked::after { transform: rotate(45deg) scale(1); }
.check-row input:disabled { cursor: not-allowed; opacity: .55; }
.check-row:has(input:disabled) { cursor: not-allowed; }
.exercise-name { display: block; font-weight: 700; line-height: 1.35; }
.exercise-note { display: block; color: var(--muted); font-size: .86rem; margin-top: 3px; line-height: 1.5; }
.muscle-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.muscle-tag { font-size: .7rem; font-weight: 700; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 20px; padding: 2px 9px; }
.dose { font: 700 1.02rem/1.4 ui-monospace, Menlo, monospace; background: var(--bg); border: 1px solid var(--line); padding: 8px 12px; border-radius: 8px; white-space: nowrap; }

.exercise-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 280px); align-items: start; }
.exercise-video { padding: 16px 16px 16px 0; }
.video-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #111; border-radius: 10px; overflow: hidden; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.demo-watch { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }
.demo { margin: 0 18px 12px 58px; padding-top: 10px; border-top: 1px dashed var(--line); }
.demo-link { display: block; color: var(--blue); text-decoration: none; font-size: .84rem; font-weight: 700; margin-bottom: 4px; }
.demo-link:hover { text-decoration: underline; }
.demo-desc { display: block; color: var(--muted); font-size: .78rem; font-weight: 400; margin-top: 2px; }
.demo-nav { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.demo-arrow { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); cursor: pointer; font-size: 1rem; line-height: 1; }
.demo-pos { font-size: .72rem; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }

.sidebar { position: sticky; top: 18px; }
.side-card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin-bottom: 16px; }
.side-card h2 { font-size: .98rem; margin: 0 0 4px; }
.side-card p { margin: 0 0 10px; color: var(--muted); font-size: .84rem; line-height: 1.55; }
.demo-card { display: block; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.demo-card:hover .demo-title { color: var(--blue); text-decoration: underline; }
.demo-title { font-size: .86rem; font-weight: 700; }
.demo-desc2 { font-size: .76rem; color: var(--muted); margin-top: 2px; line-height: 1.45; }

.cal-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.cal-progress { font: 700 1.4rem/1 ui-monospace, Menlo, monospace; }

/* Program phase card */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 22px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.phase-card { margin-bottom: 20px; }
.phase-card h2 { margin: 4px 0 6px; font-size: 1.3rem; }
.draft-note { color: var(--amber); font-size: .88rem; font-weight: 700; margin: 0 0 8px; line-height: 1.4; }
.phase-btn .phase-draft { justify-self: center; font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--amber); background: var(--amber-soft); border-radius: 999px; padding: 2px 8px; }
.phase-card .muted { margin: 0 0 4px; }
.phase-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.phase-btn { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 10px; padding: 10px 8px; cursor: pointer; display: grid; gap: 2px; text-align: center; font: inherit; }
.phase-btn strong { font-size: .85rem; }
.phase-btn span { font-size: .75rem; color: var(--muted); }
.phase-btn.active { border-color: var(--green); background: var(--green-soft); }
.phase-progress { display: grid; gap: 6px; margin-bottom: 14px; font-size: .88rem; }
.phase-row { display: flex; justify-content: space-between; gap: 10px; }
.phase-row .done { color: var(--green); font-weight: 700; }
.checklist { border-top: 1px solid var(--line); padding-top: 14px; }
.checklist h3 { margin: 0 0 6px; font-size: .95rem; }
.check-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; font-size: .9rem; }
.check-item input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--green); flex: 0 0 auto; }
#advanceBtn { margin-top: 10px; }
#advanceBtn:disabled { opacity: .5; cursor: not-allowed; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.day { border: 1px solid var(--line); border-radius: 10px; padding: 10px 6px; text-align: center; background: var(--bg); cursor: default; }
.day.gym { background: var(--green-soft); border-color: var(--green); cursor: pointer; font-weight: 700; }
.day.gym:hover { outline: 2px solid var(--green); }
.day .dow { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.day .dnum { display: block; font-size: 1.25rem; font-weight: 800; margin: 2px 0; }
.day .dmark { display: block; font-size: .72rem; min-height: 1.1em; color: var(--green); font-weight: 700; }
.day.today { box-shadow: 0 0 0 2px var(--blue); }
.day.selected { outline: 2px solid var(--blue); }
.day-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.day-choice { display: flex; align-items: center; gap: 8px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.day-choice input { width: 20px; height: 20px; accent-color: var(--green); flex: 0 0 auto; }
.demo-directory { margin-top: 8px; }
.demo-directory h2 { margin: 0 0 6px; font-size: 1.3rem; }
.demo-list { list-style: none; margin: 12px 0 0; padding: 0; }
.demo-row { display: grid; gap: 8px; padding: 16px 0; border-top: 1px solid var(--line); }
.demo-name { font-weight: 700; }
.demo-missing { color: var(--muted); font-size: .86rem; }

.footer-note { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 14px; display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .76rem; flex-wrap: wrap; }
.disclaimer-footer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--paper); border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); text-align: center; }
.disclaimer-footer p { margin: 0; font-size: .95rem; line-height: 1.45; color: var(--ink); }
.disclaimer-footer a { font-weight: 700; text-decoration: underline; }

.week-note { color: var(--muted); font-size: .88rem; line-height: 1.5; margin: 8px 0 0; }
.advice { background: var(--amber-soft); border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; line-height: 1.45; }
.advice[hidden] { display: none !important; }
.phase-lock { display: none; font-size: .68rem; color: var(--amber); font-weight: 700; line-height: 1.3; }
.phase-btn.locked { opacity: .72; }
.phase-btn.locked .phase-lock { display: block; }
.btn:disabled, #advanceBtn:disabled { opacity: .5; cursor: not-allowed; }

.modal[hidden] { display: none !important; }
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(15, 21, 19, .55); display: grid; place-items: center; padding: 18px; }
.modal-backdrop { position: absolute; inset: 0; border: 0; padding: 0; background: transparent; cursor: pointer; }
.modal-card { position: relative; z-index: 1; width: min(520px, 100%); max-height: min(92vh, 760px); overflow: auto; background: var(--paper); color: var(--ink); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); }
.modal-card h2 { margin: 0 0 8px; font-size: 1.25rem; }
.modal-card p { margin: 0 0 12px; line-height: 1.5; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.field { display: grid; gap: 6px; font-size: .92rem; margin-top: 12px; }
.field input, .field select, .checkin-grid select { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); width: 100%; }

@media (max-width: 860px) {
  .intro { grid-template-columns: 1fr; }
  .dashboard { grid-template-columns: 1fr; }
  .timer-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .week-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
  .day { padding: 8px 2px; }
  .day .dow { letter-spacing: 0; font-size: .62rem; }
  .day .dnum { font-size: .95rem; }
  .exercise-main { grid-template-columns: 1fr; }
  .exercise-video { padding: 0 16px 16px; }
  .demo { margin-left: 18px; margin-right: 18px; }
  .check-row { grid-template-columns: 26px minmax(0, 1fr); }
  .dose { grid-column: 2; justify-self: start; }
  .status-bar { grid-template-columns: 1fr; }
  .status-detail { justify-content: space-between; }
  .status-track { grid-column: 1; }
  .clear-confirm { flex-direction: column; align-items: stretch; }
  .prompt-bar { flex-direction: column; align-items: stretch; }
  .modal-card { padding: 16px; }
  .safety, .phase-card, .demo-directory { width: 100%; }
  .day-choices { grid-template-columns: 1fr 1fr; }
}
