/* Timer — Instrument. White, black hairlines, one red. No gradients.
   One token set; dark mode redefines tokens only. */
:root {
  color-scheme: light;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bg: #ffffff;
  --surface: #f4f4f5;
  --ink: #111113;
  --ink-2: #6e6e76;
  --ink-3: #a1a1aa;
  --line: #e4e4e7;
  --red: #ff3b30;
  --red-text: #d70015;
  --on-red: #ffffff;
  --knob: #ffffff;
  --gray: #a1a1aa;
  --scrim: #0000004d;
  --float: 0 0 0 1px #0000000d, 0 16px 40px -12px #00000040;
  --radius: 14px;
  --icon: 18px;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-drawer: cubic-bezier(.32, .72, 0, 1);
  --press: 140ms;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000; --surface: #1c1c1e; --ink: #f5f5f7; --ink-2: #98989f; --ink-3: #636366; --line: #2c2c2e;
    --red: #ff453a; --red-text: #ff6961; --knob: #000000; --gray: #636366; --scrim: #00000099;
    --float: 0 0 0 1px #ffffff14, 0 16px 40px -12px #000000;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000; --surface: #1c1c1e; --ink: #f5f5f7; --ink-2: #98989f; --ink-3: #636366; --line: #2c2c2e;
  --red: #ff453a; --red-text: #ff6961; --knob: #000000; --gray: #636366; --scrim: #00000099;
  --float: 0 0 0 1px #ffffff14, 0 16px 40px -12px #000000;
}

/* Interval tone by position: work, rest, then any more intervals. */
[data-tone="work"] { --tone: var(--red); --tone-text: var(--red-text); }
[data-tone="rest"] { --tone: var(--ink); --tone-text: var(--ink); }
[data-tone="other"] { --tone: var(--gray); --tone-text: var(--ink-2); }

/* Base */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
/* App feel: no text selection, no zoom gestures, native overscroll stretch without pull-to-refresh. */
html { overscroll-behavior-y: contain; touch-action: manipulation; }
* { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input { -webkit-user-select: text; user-select: text; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink);
  font: 15px/1.35 var(--font); letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-tap-highlight-color: transparent;
}
h1, h2, p { margin: 0; }
button, input, output { font: inherit; color: inherit; letter-spacing: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .3; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
svg.i, svg.s { flex: none; width: var(--icon); height: var(--icon); max-width: 22px; max-height: 22px; }
svg.i { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
svg.s { fill: currentColor; stroke: none; }
.digits, input, output { font-variant-numeric: tabular-nums; }
.caption { color: var(--ink-2); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }

/* Press feedback: every pressable thing answers on touch-down. */
.button, .pill, .icon-button, .play-button, .more-button, .again-button, .template-use, .text-button,
.stepper button, .remove-button, .run-toggle, .tab-bar button, .segmented button, .row-button {
  transition: transform var(--press) var(--ease-out), background-color .2s, color .2s, opacity .2s;
}
:is(.button, .pill, .icon-button, .play-button, .more-button, .again-button, .text-button, .stepper button,
.remove-button, .segmented button):active:not(:disabled) { transform: scale(.96); }
.template-use:active { transform: scale(.985); }
.tab-bar button:active { transform: scale(.94); }

/* Shell and pages */
.app { width: min(100%, 480px); margin: 0 auto; padding: max(8px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) calc(88px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
.view { display: flex; flex-direction: column; gap: 16px; animation: view-in 180ms var(--ease-out); }
@keyframes view-in { from { opacity: 0; } }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.page-head h1 { font-size: 28px; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; }
.head-actions { display: flex; align-items: center; gap: 4px; min-width: 0; }

/* Buttons: one solid red action per screen, hairlines for the rest. */
.button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: var(--radius); font-weight: 600; }
.button svg { --icon: 16px; }
.button-primary, .button-danger { background: var(--red); color: var(--on-red); }
.button-secondary { background: var(--bg); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.button.danger, .row-button.danger { color: var(--red-text); }
.text-button { min-height: 44px; padding: 0 4px; font-size: 15px; color: var(--red-text); font-weight: 600; }
.text-button.quiet { color: var(--ink-2); font-weight: 500; }
.icon-button { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--ink); }
.icon-button svg { --icon: 20px; }
.icon-button.outlined { width: 36px; height: 36px; box-shadow: inset 0 0 0 1px var(--line); color: var(--red); }
.icon-button.outlined svg { --icon: 18px; }
.pill { display: flex; align-items: center; gap: 2px; min-width: 0; min-height: 32px; padding: 0 6px 0 12px; border-radius: 16px; box-shadow: inset 0 0 0 1px var(--line); font-size: 13px; font-weight: 600; }
.pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill svg { --icon: 12px; color: var(--ink-2); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }

/* The dial: a hairline face, flat bands, 60 ticks, needle handles. */
.dial { position: relative; display: grid; place-items: center; aspect-ratio: 1; container-type: inline-size; }
.dial > svg:first-child { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.dial-face { fill: none; stroke: var(--line); stroke-width: 1; }
.dial-band { fill: none; stroke: var(--tone); stroke-width: 14; }
.dial-tick { stroke: var(--ink-3); stroke-width: .8; }
.dial-tick.major { stroke: var(--ink); stroke-width: 1.4; }
.dial-label { fill: var(--ink-2); font-size: 9px; font-weight: 500; text-anchor: middle; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.dial-tick.fine { stroke-width: .6; }
.dial-scale { transform-box: view-box; transform-origin: 150px 150px; }
.dial-handle line { stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
.dial-handle .knob { fill: var(--knob); stroke: var(--ink); stroke-width: 2; transform-box: fill-box; transform-origin: center; transition: transform .2s var(--ease-out); }
.dial-handle .knob-dot { fill: var(--tone); }
.dial-handle.is-active .knob { transform: scale(1.35); }
.dial-needle { stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
.dial-center { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; }

.mini-dial { flex: none; width: 34px; height: 34px; }
.mini-track { fill: none; stroke: var(--line); stroke-width: 14; }
.mini-band { fill: none; stroke: var(--tone); stroke-width: 14; }

/* Timer tab */
.view-timer { min-height: calc(100dvh - 104px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
.setup-dial { align-self: center; width: clamp(220px, calc(100dvh - 390px), 400px); max-width: 100%; margin-block: auto; touch-action: none; cursor: grab; }
.setup-dial.is-dragging { cursor: grabbing; }
.setup-dial .dial-center { width: 58%; }
.dial-row { display: flex; flex-direction: column; align-items: center; }
.dial-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tone-text); font-size: clamp(9px, 3.2cqi, 11px); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.dial-time {
  position: relative; display: flex; align-items: center; justify-content: center; color: var(--ink);
  font-size: clamp(20px, 8.6cqi, 30px); font-weight: 300; line-height: 1.15; letter-spacing: -.03em; font-variant-numeric: tabular-nums;
}
.dial-center[data-count="1"] .dial-time { font-size: clamp(30px, 14cqi, 48px); }
.dial-center[data-count="3"] .dial-time { font-size: clamp(16px, 7cqi, 24px); }
.seg { display: inline-flex; padding: 0 .08em; border-radius: 6px; overflow: hidden; cursor: ns-resize; touch-action: none; outline-offset: 0; transition: background-color .15s; }
.seg.is-spinning { background: var(--surface); }
.colon { padding-bottom: .08em; }
.roll { position: relative; display: inline-block; }
.roll > span { display: inline-block; }
.roll > .roll-old { position: absolute; left: 0; top: 0; }
.dial-time.is-editing > :not(input) { visibility: hidden; }
.dial-input {
  position: absolute; inset: 0 -6px; width: calc(100% + 12px); border: 0; padding: 0; border-radius: 8px; background: var(--surface); color: var(--ink);
  font: inherit; letter-spacing: inherit; text-align: center; font-size: max(16px, 1em);
}
.dial-input:focus { outline: none; }
.dial-rule { width: 30%; height: 1px; margin: 4px 0; background: var(--line); }
.dial-note { margin-top: 4px; color: var(--ink-2); font-size: 11px; font-variant-numeric: tabular-nums; }

/* Rounds: native scroll underneath, a curved projection and a fixed lens on top. */
.rounds { display: flex; flex-direction: column; gap: 8px; }
.rounds-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; color: var(--ink-2); font-size: 13px; }
.rounds-meta { font-variant-numeric: tabular-nums; text-align: right; }
.rounds-meta b { color: var(--ink); font-weight: 600; }
.lens { position: relative; height: 54px; border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.lens-scroll { position: absolute; inset: 0; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: none; scroll-snap-type: x mandatory; cursor: ew-resize; border-radius: inherit; }
.lens-scroll::-webkit-scrollbar { display: none; }
.lens-scroll:focus-visible { outline-offset: -2px; }
.lens-ticks { display: flex; width: max-content; height: 100%; }
.lens-ticks span { flex: 0 0 44px; scroll-snap-align: center; }
.lens-pad { flex: none; display: block; }
.lens-projection { position: absolute; inset: 0; pointer-events: none; }
.lens-mark { position: absolute; left: 50%; bottom: 10px; width: 1px; height: 6px; margin-left: -.5px; background: var(--ink-3); transform-origin: center bottom; }
.lens-mark.major { height: 10px; background: var(--ink-2); }
.lens-mark b { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); color: var(--ink-2); font-size: 13px; font-weight: 400; font-variant-numeric: tabular-nums; }
.lens-glass {
  position: absolute; top: 6px; bottom: 6px; left: 50%; width: 46px; transform: translateX(-50%);
  display: grid; place-items: center; border-radius: 10px; background: var(--bg); box-shadow: 0 0 0 1px var(--ink); pointer-events: none;
}
.lens-glass { overflow: hidden; }
.lens-zoom b { position: absolute; top: 0; bottom: 0; left: calc(50% - 22px); width: 44px; display: grid; place-items: center; color: var(--red-text); font-size: 22px; font-weight: 400; letter-spacing: -.02em; font-variant-numeric: tabular-nums; will-change: transform; }
.start-button { min-height: 48px; font-size: 16px; }

/* Templates tab: a hairline list */
.template-list { display: flex; flex-direction: column; }
.template-row { display: flex; align-items: center; gap: 4px; min-height: 64px; border-bottom: 1px solid var(--line); }
.template-row:first-child { border-top: 1px solid var(--line); }
.template-use { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 12px 4px 12px 0; text-align: left; }
.template-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.template-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.template-top .template-total { margin-left: auto; }
.template-top strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 600; }
.template-row.is-current strong { color: var(--red-text); }
.current-tag { flex: none; color: var(--ink-2); font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.template-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); font-size: 12px; }
.template-total { flex: none; color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.play-button { flex: none; display: grid; place-items: center; width: 32px; height: 32px; margin: 4px; border-radius: 50%; background: var(--red); color: var(--on-red); }
.play-button svg { --icon: 12px; margin-left: 2px; }
.more-button { flex: none; display: grid; place-items: center; width: 36px; height: 44px; margin-right: -8px; border-radius: 50%; color: var(--ink-2); }
.more-button svg { --icon: 18px; }

/* History tab */
.week-card { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px 14px; border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line); }
.week-line { color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.week-line strong { margin-right: 6px; color: var(--ink); font-size: 26px; font-weight: 300; letter-spacing: -.03em; }
.week-chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; margin-top: 12px; }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--ink-2); font-size: 11px; font-weight: 500; }
.week-day.is-today { color: var(--red-text); font-weight: 700; }
.week-bar { display: flex; flex-direction: column-reverse; width: 100%; max-width: 20px; height: 64px; }
.week-bar span { background: var(--ink); }
.week-day.is-today .week-bar span { background: var(--red); }
.week-bar:empty::after { content: ""; height: 1px; background: var(--line); }
.day-label, .group-label { margin: 12px 0 4px; }
.history-row { display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 8px 0; }
.history-row + .history-row { border-top: 1px solid var(--line); }
.history-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.history-row.is-early .history-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-2); }
.again-button { flex: none; min-height: 44px; padding: 0 4px; color: var(--red-text); font-size: 14px; font-weight: 600; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 72px 24px; color: var(--ink-2); text-align: center; }
.empty svg { --icon: 28px; max-width: 28px; max-height: 28px; margin-bottom: 8px; color: var(--ink-3); }
.empty strong { color: var(--ink); font-size: 17px; font-weight: 600; }
.empty span { font-size: 14px; }

/* Grouped rows (Settings, editor) */
.group { border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
#history-list .group { border-radius: 0; box-shadow: none; border-block: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 14px; }
.row + .row { border-top: 1px solid var(--line); }
.grow { flex: 1; min-width: 0; }
.grow small { display: block; margin-top: 1px; color: var(--ink-2); font-size: 12px; }
.row-icon { --icon: 18px; color: var(--ink-2); }
.row-button { flex: 1; display: flex; align-items: center; gap: 14px; min-height: 40px; text-align: left; color: var(--ink); }
.row-button.danger .row-icon { color: var(--red-text); }
.add-interval { gap: 8px; color: var(--red-text); font-weight: 500; }
.add-interval svg { --icon: 16px; }
.footnote { padding: 0 24px; color: var(--ink-2); font-size: 12px; text-align: center; }
.switch { position: relative; flex: none; width: 44px; height: 26px; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 16px; background: var(--line); pointer-events: none; transition: background-color .25s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px #00000026, 0 0 0 .5px #0000000f; transition: transform .25s var(--ease-out); }
.switch input:checked + span { background: var(--ink); }
.switch input:checked + span::after { transform: translateX(18px); background: var(--knob); }
.switch input:focus-visible + span { outline: 2px solid var(--red); outline-offset: 2px; }
.segmented { display: flex; padding: 2px; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--line); }
.segmented button { min-height: 28px; padding: 0 10px; border-radius: 8px; color: var(--ink-2); font-size: 12px; font-weight: 500; }
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--bg); font-weight: 600; }

/* Tab bar: a plain bar with a hairline on top. */
.tab-bar {
  position: fixed; z-index: 10; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 120px)); justify-content: center;
  padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  background: var(--bg); border-top: 1px solid var(--line);
}
.tab-bar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 46px; color: var(--ink-2); font-size: 10px; font-weight: 600; letter-spacing: 0; }
.tab-bar svg { --icon: 21px; }
.tab-bar [aria-current="page"] { color: var(--red); }
body.run-active .tab-bar { visibility: hidden; }

/* Sheets */
.sheet-layer { position: fixed; z-index: 30; inset: 0; display: flex; align-items: flex-end; justify-content: center; background: var(--scrim); }
.sheet { display: flex; flex-direction: column; gap: 12px; width: min(100%, 480px); max-height: calc(100dvh - max(24px, env(safe-area-inset-top))); overflow-y: auto; overscroll-behavior: contain; padding: 0 max(20px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); border-radius: 20px 20px 0 0; background: var(--bg); box-shadow: var(--float); }
.sheet-grab { display: grid; place-items: center; flex: none; height: 18px; margin: 0 -20px -12px; touch-action: none; cursor: grab; }
.sheet-grab span { width: 36px; height: 5px; border-radius: 3px; background: var(--line); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; min-height: 52px; touch-action: none; }
.sheet-head h2 { font-size: 15px; font-weight: 600; }
.editor-name { display: flex; align-items: center; gap: 14px; padding: 2px 0 8px; }
.editor-name .mini-dial { width: 40px; height: 40px; }
.name-input { flex: 1; min-width: 0; border: 0; padding: 4px 0; background: transparent; color: var(--ink); font-size: 24px; font-weight: 700; letter-spacing: -.03em; }
.name-input::placeholder { color: var(--ink-3); }
.name-input:focus { outline: none; }
.tone-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--tone); }
.label-input { width: 100%; min-width: 0; border: 0; padding: 6px 0; background: transparent; color: var(--ink); font-size: 15px; }
.label-input:focus { outline: none; }
.stepper { flex: none; display: flex; align-items: center; gap: 2px; }
.stepper button { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); }
.stepper button svg { --icon: 14px; }
.stepper input, .stepper output { width: 54px; border: 0; padding: 0; background: transparent; color: var(--ink); text-align: center; font-weight: 400; }
.stepper input:focus { outline: none; }
.remove-button { flex: none; display: grid; place-items: center; width: 28px; height: 32px; color: var(--ink-3); }
.remove-button svg { --icon: 16px; }
.sheet-total { color: var(--ink-2); font-size: 13px; text-align: center; font-variant-numeric: tabular-nums; }
.confirm-layer { align-items: center; padding: 24px; }
.confirm-card { display: flex; flex-direction: column; gap: 8px; width: min(100%, 340px); padding: 22px 20px 20px; border-radius: 20px; background: var(--bg); box-shadow: var(--float); text-align: center; }
.confirm-card h2 { font-size: 17px; letter-spacing: -.02em; }
.confirm-card p { margin-bottom: 14px; color: var(--ink-2); font-size: 14px; }
.confirm-card .button { min-height: 44px; }
.confirm-card .button-primary { background: var(--ink); color: var(--bg); }

/* Run screen: the page stays plain; the dial and the label carry the tone. */
.run {
  position: fixed; z-index: 20; inset: 0; display: flex; flex-direction: column; background: var(--bg);
  padding: max(10px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}
.run > * { width: min(100%, 480px); margin-inline: auto; }
.run-top { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; min-height: 48px; }
#run-end { grid-column: 1; }
#run-sound { grid-column: 3; }
.run-round { grid-column: 2; color: var(--ink-2); font-size: 13px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
#run-sound .sound-off, #run-sound[aria-pressed="false"] .sound-on { display: none; }
#run-sound[aria-pressed="false"] .sound-off { display: block; }
.icon-button.large { width: 52px; height: 52px; box-shadow: inset 0 0 0 1px var(--line); }
.icon-button.large svg { --icon: 18px; }
#run-skip .icon-end, #run-skip.is-end .icon-next { display: none; }
#run-skip.is-end .icon-end { display: block; }
#run-skip.is-end .icon-end { --icon: 16px; }
.run-body { flex: 1; display: grid; place-items: center; min-height: 0; cursor: pointer; }
.run-dial { width: clamp(200px, calc(100dvh - 330px), 360px); max-width: 100%; }
.run-dial .dial-band { transition: opacity .3s; }
.run-label { color: var(--tone-text); font-size: clamp(11px, 3.4cqi, 13px); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.run-time { font-size: clamp(44px, 16cqi, 66px); font-weight: 200; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; transition: opacity .3s; }
.run-time.pulse { animation: pulse .5s var(--ease-out); }
.run-time.count { animation: count .45s var(--ease-out); }
@keyframes pulse { from { transform: scale(1.06); } }
@keyframes count { from { transform: scale(1.08); color: var(--tone-text); } }
.run-state { min-height: 18px; color: var(--ink-2); font-size: 13px; font-weight: 500; }
.run.is-paused .run-time, .run.is-paused .dial-band { opacity: .35; }
.run-foot { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.run-next { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 0 14px; border-radius: 16px; color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.run-next i { width: 8px; height: 8px; border-radius: 50%; background: var(--tone); }
.run-next b { color: var(--ink); font-weight: 600; }
.run-controls { display: flex; align-items: center; justify-content: center; gap: 28px; }
.run-toggle { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--red); color: var(--on-red); }
.run-toggle:active { transform: scale(.94); }
.run-toggle svg { --icon: 24px; max-width: 24px; max-height: 24px; grid-area: 1 / 1; transition: opacity .15s, transform .2s var(--ease-out); }
.run-toggle .icon-play { margin-left: 4px; opacity: 0; transform: scale(.8); }
.run.is-paused .run-toggle .icon-play { opacity: 1; transform: none; }
.run.is-paused .run-toggle .icon-pause { opacity: 0; transform: scale(.8); }
.run-left { min-height: 18px; color: var(--ink-2); font-size: 13px; text-align: center; font-variant-numeric: tabular-nums; }

/* Done: a rare moment, so it gets a little more motion. The dial closes, then the check draws. */
.done { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; }
.done > * { animation: rise .5s var(--ease-out) both; }
.done > :nth-child(2) { animation-delay: 420ms; }
.done > :nth-child(3) { animation-delay: 470ms; }
.done > :nth-child(4) { animation-delay: 520ms; }
.done > :nth-child(5) { animation-delay: 580ms; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.done > .done-dial { width: 148px; margin-bottom: 18px; animation: none; }
.done-dial .dial-band { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .7s var(--ease-out) forwards; }
svg.done-check { position: relative; --icon: 40px; max-width: 40px; max-height: 40px; color: var(--red); stroke-width: 2; }
.done-check path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .35s var(--ease-out) .55s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.done h2 { font-size: 24px; letter-spacing: -.03em; }
.done-detail { color: var(--ink-2); font-size: 14px; }
.done-summary { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; width: min(100%, 320px); margin: 10px 0 32px; color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.done-summary span { display: inline-flex; align-items: center; gap: 6px; }
.done-summary i { width: 8px; height: 8px; border-radius: 50%; background: var(--tone); }
.done .button { min-height: 48px; }

/* Toast */
.toast {
  position: fixed; z-index: 50; top: max(14px, env(safe-area-inset-top)); left: 50%; padding: 11px 18px; border-radius: 22px;
  background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 600; white-space: nowrap; box-shadow: var(--float);
  opacity: 0; transform: translate(-50%, -12px) scale(.96); transition: transform .3s var(--ease-out), opacity .2s; pointer-events: none;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (hover: hover) and (pointer: fine) {
  :is(.button-primary, .play-button, .run-toggle):hover:not(:disabled) { opacity: .88; }
  :is(.button-secondary, .pill, .icon-button, .row-button, .stepper button, .more-button):hover:not(:disabled) { background-color: var(--surface); }
  .tab-bar button:hover { color: var(--ink); }
  .tab-bar [aria-current="page"]:hover { color: var(--red); }
}
/* Short screens: a smaller dial keeps the controls in reach. */
@media (max-height: 700px) {
  .page-head { min-height: 48px; }
  .page-head h1 { font-size: 26px; }
  .view { gap: 12px; }
  .lens { height: 50px; }
}
@media (max-height: 600px) { .run-foot { gap: 12px; } .run-toggle { width: 64px; height: 64px; } .icon-button.large { width: 46px; height: 46px; } }
/* Reduced motion: keep fades that explain a change, drop movement. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-property: opacity, color, background-color, border-color, box-shadow !important; }
  .run-time.pulse, .run-time.count { animation: none; }
  .done > * { animation-name: view-in; }
  .done-dial .dial-band, .done-check path { animation-duration: .01ms; animation-delay: 0s; }
}
@media (prefers-contrast: more) { :root { --line: #8e8e93; } }
