:root {
  --bg: #1a1a1a;
  --surface: #242424;
  --surface-2: #2e2e2e;
  --accent: #ff2d9e;
  --accent-dim: #3d1030;
  --accent-ink: #2b0013;
  --text: #f2f2f2;
  --muted: #9a9a9a;
  --line: #333;
  --lb: #ff5a5a;         /* Lower-back caution — red */
  --lb-bg: #3a1414;
  --pf: #ffa53c;         /* Pelvic-floor check — orange */
  --pf-bg: #3a2812;
  --radius: 14px;
  --tap: 48px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px; line-height: 1.4;
}
body { padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--accent); }
.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px 40px; min-height: 100vh; }
.center { text-align: center; }
.hint { color: var(--muted); font-size: 13px; }
.hint.center { text-align: center; }

/* header */
.app-header { position: sticky; top: 0; z-index: 20; background: linear-gradient(180deg, var(--bg) 80%, rgba(26,26,26,0)); padding: 16px 0 10px; }
.app-title { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; margin: 0; }
.app-title .dot { color: var(--accent); }
.app-sub { color: var(--muted); font-size: 13px; margin: 3px 0 0; }
.back { background: none; border: none; color: var(--accent); font-weight: 700; font-size: 15px; padding: 4px 0; cursor: pointer; display: block; margin-bottom: 2px; }

/* panels & buttons */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted); margin: 0 0 10px; }
.btn { width: 100%; height: 52px; border: none; border-radius: var(--radius); font-size: 16px; font-weight: 800; cursor: pointer; letter-spacing: .2px; }
.btn.sm { height: 40px; font-size: 14px; width: auto; padding: 0 16px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }

/* inputs */
.fld { display: block; color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.input { display: block; width: 100%; height: var(--tap); margin-top: 6px; padding: 0 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-size: 16px; }
.input:focus { outline: none; border-color: var(--accent); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); margin-top: 8px; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--accent); }

/* notice cards (comeback / pt / phase / sunday / rest) */
.notice { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; }
.notice-t { font-weight: 800; margin-bottom: 4px; }
.notice-b { color: var(--muted); font-size: 14px; }
.notice .btn { margin-top: 10px; }

/* weekly calendar strip */
.weekstrip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.wcell { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 1px; text-align: center; display: flex; flex-direction: column; gap: 3px; align-items: center; }
.wcell.train { border-color: #4a4a4a; }
.wcell.today { border-color: var(--accent); background: var(--accent-dim); }
.wdow { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.wact { font-size: 12px; font-weight: 800; }
.wcell.off .wact { color: var(--muted); font-weight: 700; font-size: 11px; }
.wcell.done .wact { color: var(--accent); }
.wcell.today .wact, .wcell.today .wdow { color: var(--accent); }

/* weekly view (legacy) */
.week { display: flex; flex-direction: column; gap: 8px; }
.wk { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.wk.next { border-color: var(--accent); }
.wk.done { opacity: .7; }
.wk-check { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--line); display: grid; place-items: center; color: var(--accent-ink); font-weight: 900; }
.wk.done .wk-check { background: var(--accent); border-color: var(--accent); }
.wk-day { flex: 1; font-weight: 700; font-size: 15px; }
.wk-tag { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--accent); }

/* tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 8px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 12px; color: var(--text); font-weight: 700; font-size: 14px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tile-i { font-size: 22px; }

/* equipment modes */
.modes { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.mode { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 6px; cursor: pointer; color: var(--text); display: flex; flex-direction: column; gap: 3px; align-items: center; }
.mode b { font-size: 15px; }
.mode small { color: var(--muted); font-size: 11px; }
.mode.active { border-color: var(--accent); background: var(--accent-dim); }
.modes.grid2 { grid-template-columns: 1fr 1fr; }
.recbar { background: var(--accent-dim); border: 1px solid var(--accent); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: #ffd6ea; margin-bottom: 10px; }
.recbar b { color: var(--accent); }
.roadmap { margin-top: 10px; }
.road { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 5px 0; color: var(--muted); }
.road-i { width: 20px; text-align: center; font-weight: 800; }
.road.done { color: var(--text); }
.road.done .road-i { color: var(--accent); }
.road.cur { color: var(--accent); font-weight: 700; }
.road.lock { opacity: .55; }

/* check-in */
.checkin { display: flex; flex-direction: column; gap: 10px; }
.ci-row { display: flex; align-items: center; gap: 10px; }
.ci-lbl { width: 58px; color: var(--muted); font-size: 13px; }
.ci-opts { display: flex; gap: 6px; flex: 1; }
.ci-opts button { flex: 1; height: 42px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-weight: 700; font-size: 14px; cursor: pointer; }
.ci-opts button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* PF banner */
.pf-banner { background: var(--pf-bg); border: 1px solid var(--pf); border-radius: 12px; padding: 12px 14px; font-size: 13px; color: #ffd9ad; margin: 10px 0; position: relative; }
.pf-banner b { color: var(--pf); }
.pf-x { position: absolute; top: 8px; right: 8px; background: none; border: none; color: #ffd9ad; font-size: 15px; cursor: pointer; padding: 4px; }

/* filter chips (offday / timer presets) */
.filter-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; min-height: 40px; padding: 0 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; color: var(--text); font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.count { color: var(--muted); font-size: 13px; margin: 2px 0 10px; }
.section-title.sec { margin: 18px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }

/* exercise card */
.xcard { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.xcard.is-done { border-left-color: var(--muted); opacity: .82; }
.xhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.xname { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; margin: 0; }
.xbadges { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; flex: 0 0 auto; }
.badge { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; padding: 3px 7px; border-radius: 6px; white-space: nowrap; }
.badge.lb { color: var(--lb); background: var(--lb-bg); border: 1px solid var(--lb); }
.badge.pf { color: var(--pf); background: var(--pf-bg); border: 1px solid var(--pf); }
.xmeta { margin-top: 6px; font-size: 14px; color: var(--text); font-weight: 600; }
.xnote { margin-top: 4px; font-size: 13px; color: var(--accent); }
.xbreath { margin-top: 8px; font-size: 13px; color: var(--muted); font-style: italic; }
.ready { margin-top: 10px; background: var(--accent-dim); border: 1px solid var(--accent); border-radius: 10px; padding: 8px 10px; font-size: 13px; color: #ffd6ea; }
.mini { margin-left: 6px; background: var(--accent); color: var(--accent-ink); border: none; border-radius: 8px; padding: 5px 10px; font-weight: 800; font-size: 12px; cursor: pointer; }

.xcontrols { margin-top: 10px; }
.ctrl { width: 100%; min-height: var(--tap); border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-weight: 700; font-size: 15px; cursor: pointer; }
.ctrl.check.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ctrl.amrap, .ctrl.timed-b { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.timed { display: flex; align-items: center; gap: 10px; }
.timed-b { flex: 1; }
.timed-c { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--accent); min-width: 60px; }

.xhow { margin-top: 10px; }
.xhow summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 700; }
.xhow ul { margin: 8px 0 6px; padding-left: 18px; color: var(--text); font-size: 13px; }
.xhow li { margin-bottom: 3px; }
.vid { display: inline-block; font-size: 13px; font-weight: 700; margin-top: 2px; }

.xfeedback { display: flex; gap: 8px; margin-top: 12px; }
.fb { flex: 1; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); font-weight: 700; font-size: 13px; cursor: pointer; }
.fb.on { background: var(--surface-2); color: var(--text); border-color: var(--accent); }
.fb.mod.on { color: var(--accent); }

/* variant note (KB HIIT / DB Circuit source) */
.vnote { background: var(--accent-dim); border: 1px solid var(--accent); border-radius: 12px; padding: 12px 14px; font-size: 13px; color: #ffd6ea; margin: 10px 0; }
.vnote b { color: var(--accent); }
#ivt { margin: 4px 0 12px; }

/* rep/time PR row */
.xpr { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--muted); }
.xpr b { color: var(--accent); }
.pr-in { flex: 1; min-width: 0; height: 38px; padding: 0 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--text); font-size: 14px; }
.pr-in:focus { outline: none; border-color: var(--accent); }

/* start bar */
.start-bar { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(0deg, var(--bg) 72%, rgba(26,26,26,0)); }

/* weight log / history */
.wlog { list-style: none; margin: 0; padding: 0; }
.wlog li { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.wlog li:last-child { border-bottom: none; }
.hrec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.hrec-top { display: flex; justify-content: space-between; font-size: 15px; }
.hrec-top span { color: var(--muted); font-size: 13px; }
.hrec-sub { color: var(--muted); font-size: 12px; margin: 4px 0 8px; text-transform: capitalize; }
.hrec-ex { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.hrec-ex li { padding: 2px 0; color: var(--text); }
.hrec-ex em { color: var(--muted); }

/* toasts */
.toast-host { position: fixed; left: 0; right: 0; bottom: 84px; z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 14px; padding: 10px 16px; border-radius: 999px; opacity: 0; transform: translateY(10px); transition: .25s; box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.toast.show { opacity: 1; transform: translateY(0); }

/* ---- interval timer overlay ---- */
.timer-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.7); display: none; align-items: flex-end; justify-content: center; }
.timer-overlay.show { display: flex; }
.timer-card { width: 100%; max-width: 640px; background: var(--surface); border-top-left-radius: 20px; border-top-right-radius: 20px; border: 1px solid var(--line); padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); position: relative; }
.timer-close { position: absolute; top: 12px; right: 14px; background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.timer-title { font-weight: 800; font-size: 18px; margin-bottom: 12px; }
.timer-presets { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.timer-presets::-webkit-scrollbar { display: none; }
.tm-preset { font-size: 13px; }
.timer-config { }
.tm-field { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tm-field label { color: var(--muted); font-size: 14px; }
.tm-step { display: flex; align-items: center; gap: 14px; }
.tm-step button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 20px; font-weight: 800; cursor: pointer; }
.tm-step span { min-width: 56px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.tm-total { text-align: center; color: var(--muted); font-size: 13px; margin: 12px 0; }
.tm-start { margin-top: 4px; }

.timer-run { text-align: center; padding: 10px 0 4px; }
.tm-phase { font-size: 18px; font-weight: 900; letter-spacing: 3px; padding: 6px 0; }
.tm-phase.is-work { color: var(--accent); }
.tm-phase.is-rest { color: var(--pf); }
.tm-count { font-size: 76px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.05; }
.tm-round { color: var(--muted); font-size: 15px; margin-bottom: 12px; }
.tm-run-btns { display: flex; gap: 10px; }
.tm-run-btns .btn { height: 48px; }

/* install banner */
.install-banner { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 608px; margin: 0 auto; z-index: 60; background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); padding: 14px 16px; display: none; align-items: center; gap: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.install-banner.show { display: flex; }
.install-banner .ib-text { flex: 1; font-size: 14px; }
.install-banner .ib-text b { color: var(--accent); }
.install-banner button { flex: 0 0 auto; height: 40px; padding: 0 14px; border-radius: 10px; border: none; font-weight: 800; font-size: 14px; cursor: pointer; }
.ib-install { background: var(--accent); color: var(--accent-ink); }
.ib-dismiss { background: transparent; color: var(--muted); border: 1px solid var(--line) !important; }
