:root {
  --bg: #101418; --card: #1a2027; --line: #2a323c; --text: #f2f5f8; --muted: #94a0ad;
  --run: #ff5a36; --walk: #1fa37a; --easy: #3d6fd9; --accent: #ff5a36;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none; user-select: none;
  transition: background-color .4s;
}
body[data-phase="run"] { background: var(--run); }
body[data-phase="walk"] { background: var(--walk); }
body[data-phase="warmup"], body[data-phase="cooldown"] { background: var(--easy); }

.view {
  max-width: 520px; margin: 0 auto; min-height: 100%;
  padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 24px);
}
[hidden] { display: none !important; }
h1 { font-size: 28px; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 26px; margin: 2px 0 4px; letter-spacing: -.02em; }
h3 { margin: 0 0 4px; font-size: 18px; }
h4 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small-text { font-size: 13px; }
.center { text-align: center; }
.top { margin-bottom: 14px; }
.top p { margin: 2px 0 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.banner { border-color: var(--accent); }
.eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

button {
  font: inherit; color: var(--text); background: #26303a; border: 0; border-radius: 12px;
  padding: 12px 14px; font-weight: 600; cursor: pointer;
}
button:active { transform: scale(.98); opacity: .9; }
button.primary { background: var(--accent); color: #fff; }
button.big { width: 100%; padding: 16px; font-size: 18px; border-radius: 14px; }
button.small { padding: 9px 12px; font-size: 14px; }
button.link { background: none; color: var(--muted); font-weight: 500; font-size: 14px; width: 100%; margin-top: 6px; padding: 8px; }
button.danger { background: #4a1f1f; color: #ffb4a8; }
button.ghost { background: rgba(0,0,0,.25); }

/* workout shape bar */
.segbar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 1px; margin: 12px 0 8px; background: var(--line); }
.segbar i { display: block; min-width: 2px; }
.segbar .run { background: var(--run); }
.segbar .walk { background: var(--walk); }
.segbar .warmup, .segbar .cooldown { background: var(--easy); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.dot.run { background: var(--run); } .dot.walk { background: var(--walk); } .dot.easy { background: var(--easy); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 8px; text-align: center; }
.stat b { display: block; font-size: 20px; }
.stat span { font-size: 12px; color: var(--muted); }

.grid { display: grid; grid-template-columns: 44px repeat(3, 1fr); gap: 8px; align-items: center; margin-top: 10px; }
.grid .wk { font-size: 13px; color: var(--muted); font-weight: 600; }
.grid .divider { grid-column: 1 / -1; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.grid button { padding: 10px 0; background: #222a33; font-size: 14px; font-weight: 600; color: var(--muted); }
.grid button.done { background: rgba(31,163,122,.22); color: #6fe0bb; }
.grid button.next { box-shadow: inset 0 0 0 2px var(--accent); color: var(--text); }
.grid button.sel { background: var(--accent); color: #fff; }

details summary { font-weight: 700; font-size: 17px; cursor: pointer; }
.cues { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cues button { text-align: left; font-size: 15px; }
.cues small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; }
.opt input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--accent); }
.opt small { color: var(--muted); }

/* running screen */
.runview { display: flex; flex-direction: column; height: 100%; }
.runtop { display: flex; justify-content: space-between; align-items: center; font-weight: 600; opacity: .9; }
.badge { background: rgba(0,0,0,.35); border-radius: 8px; padding: 3px 8px; font-size: 12px; }
.phasewrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.phase { font-size: 52px; font-weight: 800; letter-spacing: -.02em; text-transform: uppercase; line-height: 1; }
.clock { font-size: 112px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.04em; line-height: 1.05; }
.next { font-size: 18px; opacity: .85; min-height: 26px; }
.runbottom .muted { color: rgba(255,255,255,.8); margin-bottom: 12px; }
.barwrap { position: relative; padding-top: 2px; }
.barwrap .segbar { background: rgba(0,0,0,.25); height: 16px; border-radius: 8px; }
.barwrap .segbar i { opacity: .55; background: #fff !important; }
.barwrap .segbar .run { opacity: .95; }
.marker { position: absolute; top: 8px; width: 4px; height: 28px; margin-left: -2px; border-radius: 2px; background: #fff; box-shadow: 0 0 0 2px rgba(0,0,0,.35); left: 0; }
.runview button { background: rgba(0,0,0,.3); color: #fff; }
body.paused .clock { opacity: .5; }

/* done screen */
.donewrap { min-height: 80vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px; }
.check { width: 96px; height: 96px; border-radius: 50%; background: var(--walk); font-size: 56px; line-height: 96px; margin-bottom: 14px; }
.donewrap button { margin-top: 18px; }
