:root {
  --bg: #F4F6F4; --surface: #FFFFFF; --surface-2: #EEF1EF; --ink: #111816; --muted: #56625D;
  --line: #DFE5E2; --accent: #0E7A5E; --accent-ink: #FFFFFF; --accent-soft: #E2F1EB;
  --warn-bg: #FFF3DC; --warn-ink: #6E4500; --danger: #B3261E; --danger-soft: #FCE8E6;
  --radius: 18px; --shadow: 0 1px 2px rgba(17, 24, 22, .05), 0 4px 14px rgba(17, 24, 22, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1211; --surface: #171D1B; --surface-2: #202826; --ink: #EDF2EF; --muted: #9DA9A4;
    --line: #2A3330; --accent: #3DD3A1; --accent-ink: #032419; --accent-soft: #143329;
    --warn-bg: #3A2A0E; --warn-ink: #FFD38A; --danger: #FF8A80; --danger-soft: #3B1A18;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1211; --surface: #171D1B; --surface-2: #202826; --ink: #EDF2EF; --muted: #9DA9A4;
  --line: #2A3330; --accent: #3DD3A1; --accent-ink: #032419; --accent-soft: #143329;
  --warn-bg: #3A2A0E; --warn-ink: #FFD38A; --danger: #FF8A80; --danger-soft: #3B1A18;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
  min-height: 100dvh;
}
main {
  max-width: 560px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 120px);
}
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
.num { font-variant-numeric: tabular-nums; }
svg { width: 20px; height: 20px; flex: none; }

/* ---------- top bar ---------- */
.top { display: flex; align-items: center; gap: 8px; min-height: 52px; margin-bottom: 8px; }
.top h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; flex: 1; }
.top .sub { display: block; font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.icon-btn {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  color: var(--ink); background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line);
}
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* ---------- feelings ---------- */
.feel-q { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 18px 0 14px; }
.feel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.feel {
  min-height: 112px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow); display: flex; flex-direction: column; justify-content: space-between;
  align-items: flex-start; padding: 16px; text-align: left; font-size: 19px; font-weight: 650;
}
.feel svg { width: 28px; height: 28px; color: var(--accent); }
.feel.pijn svg { color: var(--danger); }
.feel:active { transform: scale(.98); }
.feel-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-weight: 600;
}
.feel-chip span { color: var(--muted); font-weight: 500; }
.feel-chip svg { width: 18px; height: 18px; color: var(--accent); }
.feel-chip { white-space: nowrap; }

/* ---------- recommendation ---------- */
.reco { background: var(--accent); color: var(--accent-ink); border: 0; }
.reco .eyebrow { color: inherit; opacity: .8; }
.reco h2 { font-size: 30px; line-height: 1.1; letter-spacing: -.02em; margin: 6px 0 8px; }
.reco p { opacity: .92; }
.reco.pain { background: var(--danger-soft); color: var(--ink); border: 1px solid var(--line); }
.reco .note { margin-top: 10px; font-size: 14px; font-weight: 600; opacity: 1; }
.btn {
  min-height: 56px; border-radius: 16px; padding: 0 20px; font-size: 17px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  background: var(--accent); color: var(--accent-ink);
}
.reco .btn { background: var(--accent-ink); color: var(--accent); margin-top: 16px; }
.reco.pain .btn { background: var(--ink); color: var(--surface); }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn.line { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
.btn svg { width: 20px; height: 20px; }
.btn:active { transform: scale(.99); }

.opt-list { display: flex; flex-direction: column; }
.opt {
  display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 4px; width: 100%; text-align: left;
  border-top: 1px solid var(--line);
}
.opt:first-child { border-top: 0; }
.opt .t { flex: 1; }
.opt .n { font-weight: 650; }
.opt .r { display: block; font-size: 13px; color: var(--muted); }
.opt svg { color: var(--muted); }
.sheet .opt.cur svg { color: var(--accent); }
.opt[disabled] { cursor: default; }
.opt[disabled] .n { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.opt[disabled] svg { visibility: hidden; }
.link-btn { min-height: 44px; color: var(--accent); font-weight: 650; padding: 0 4px; }

/* ---------- checklist ---------- */
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 10px 0 6px; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .3s; }
.check {
  display: flex; align-items: center; gap: 14px; min-height: 54px; width: 100%; text-align: left;
  border-top: 1px solid var(--line); padding: 6px 2px;
}
.check:first-of-type { border-top: 0; }
.box {
  width: 28px; height: 28px; border-radius: 9px; border: 2px solid var(--line); flex: none;
  display: grid; place-items: center; color: transparent;
}
.box svg { width: 18px; height: 18px; }
.check.on .box { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.check .t { flex: 1; font-weight: 550; }
.check.on .t { color: var(--muted); }
.check .d { font-size: 13px; color: var(--muted); }
.head-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.head-row h3 { font-size: 18px; }

/* ---------- banners ---------- */
.banner { border-radius: 14px; padding: 12px 14px; font-size: 14px; background: var(--surface-2); }
.banner.warn { background: var(--warn-bg); color: var(--warn-ink); font-weight: 600; }
.banner.accent { background: var(--accent-soft); }
.banner b { font-weight: 700; }

/* ---------- workout ---------- */
.ex-head { display: flex; align-items: flex-start; gap: 10px; }
.ex-head .t { flex: 1; min-width: 0; }
.ex-head h3 { font-size: 19px; line-height: 1.25; margin-top: 4px; }
.tag { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.tag .pill { padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--ink); letter-spacing: .03em; }
.swap { min-height: 44px; padding: 0 14px; border-radius: 12px; background: var(--surface-2); font-weight: 650; font-size: 15px; display: inline-flex; gap: 6px; align-items: center; flex: none; }
.swap svg { width: 18px; height: 18px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; color: var(--muted); margin: 10px 0 4px; }
.meta b { color: var(--ink); font-weight: 650; }
.prev { font-size: 14px; margin-top: 8px; }
.hint { margin-top: 8px; display: inline-block; font-size: 14px; font-weight: 700; color: var(--accent); }
.sets { display: grid; grid-template-columns: 64px 1fr 1fr; gap: 8px 10px; align-items: center; margin-top: 14px; }
.sets .h { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sets .lbl { font-weight: 650; font-size: 15px; }
.sets .wu { grid-column: 2 / -1; font-size: 15px; color: var(--muted); min-height: 36px; display: flex; align-items: center; }
.field { position: relative; }
.field input {
  width: 100%; min-height: 54px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2);
  padding: 0 40px 0 14px; font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums;
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; background: var(--surface); }
.field span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--muted); pointer-events: none; }
.rest-btn { margin-top: 14px; }
.note-line { font-size: 13px; color: var(--muted); margin-top: 6px; font-style: italic; }

/* ---------- session (non-strength) ---------- */
.lead { font-size: 17px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.zone { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 0; border-top: 1px solid var(--line); }
.zone:first-child { border-top: 0; }
.zone b { font-size: 18px; white-space: nowrap; }
.mob { padding: 12px 0; border-top: 1px solid var(--line); }
.mob:first-child { border-top: 0; }
.mob .n { font-weight: 650; }

/* ---------- settings ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 14px; }
.seg button { min-height: 44px; border-radius: 11px; font-weight: 600; font-size: 15px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
label.lab { display: block; font-weight: 650; margin-bottom: 8px; }
.input {
  width: 100%; min-height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2);
  padding: 0 14px; font-size: 18px;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- sheet ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; animation: fade .15s; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 82dvh; overflow: auto;
  background: var(--surface); border-radius: 22px 22px 0 0; padding: 10px 16px calc(env(safe-area-inset-bottom) + 16px);
  max-width: 560px; margin: 0 auto; animation: up .2s ease-out;
}
.sheet .grab { width: 40px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 12px; }
.sheet h3 { font-size: 20px; margin-bottom: 4px; }
.sheet .opt.cur .n::after { content: " · current"; color: var(--accent); font-weight: 600; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- timer ---------- */
.timer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 10px 16px calc(env(safe-area-inset-bottom) + 10px);
  background: var(--ink); color: var(--bg);
}
.timer-in { max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 10px; }
.timer .time { font-size: 30px; font-weight: 750; font-variant-numeric: tabular-nums; min-width: 92px; }
.timer .what { flex: 1; font-size: 13px; opacity: .8; line-height: 1.3; min-width: 0; }
.timer button { min-height: 48px; min-width: 56px; border-radius: 12px; background: color-mix(in srgb, currentColor 16%, transparent); color: inherit; font-weight: 700; }
.timer .bar { height: 4px; background: rgba(127,127,127,.35); border-radius: 99px; margin: 0 auto 8px; max-width: 560px; overflow: hidden; }
.timer .bar i { display: block; height: 100%; background: var(--accent); }
.timer.done { background: var(--accent); color: var(--accent-ink); animation: pulse 1s 3; }
@keyframes pulse { 50% { filter: brightness(1.25); } }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 24px); z-index: 50;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 650; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  max-width: calc(100% - 32px);
}
.sticky-save { position: sticky; bottom: calc(env(safe-area-inset-bottom) + 12px); z-index: 5; }
body.timer-on .sticky-save { bottom: calc(env(safe-area-inset-bottom) + 92px); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
