:root {
  --bg: #0E0F13;
  --card: #17191F;
  --card-2: #1F222A;
  --line: #2A2E38;
  --text: #F4F5F7;
  --muted: #9097A3;
  --faint: #5D6470;
  --accent: #FF5A36;
  --danger: #FF453A;
  --radius: 16px;
  --pad: 16px;
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
  --phase: #FFD60A;
  --on: #000;
  color-scheme: dark;
  -webkit-tap-highlight-color: transparent;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.screen {
  min-height: 100%;
  padding: calc(var(--top) + 8px) var(--pad) calc(var(--bottom) + 24px);
  max-width: 640px;
  margin: 0 auto;
}

/* bars */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  margin-bottom: 8px;
}
.bar h1 { font-size: 30px; line-height: 1.1; margin: 0; letter-spacing: -0.02em; }
.bar h2 { font-size: 17px; margin: 0; font-weight: 600; }
.bar-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--card);
  color: var(--text);
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.accent { background: var(--accent); color: #fff; }
.text-btn { min-height: 44px; padding: 0 4px; color: var(--muted); font-size: 17px; }
.text-btn.strong { color: var(--accent); font-weight: 600; }

.sheet-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: calc(-8px - var(--top)) calc(-1 * var(--pad)) 8px;
  padding: calc(var(--top) + 4px) var(--pad) 4px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

/* list */
.timers { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; }
.timer {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
}
.timer-start {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 4px 16px 16px;
  text-align: left;
}
.timer-dot {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #000;
}
.timer-dot svg { width: 20px; height: 20px; fill: currentColor; stroke: none; margin-left: 3px; }
.timer-text { min-width: 0; }
.timer-name { font-weight: 650; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer-sum { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.timer-more { flex: none; width: 52px; align-self: stretch; display: grid; place-items: center; color: var(--muted); }
.timer-strip { position: absolute; left: 0; bottom: 0; width: 100%; height: 3px; opacity: 0.9; }
.empty, .install-hint { color: var(--muted); text-align: center; margin: 32px 8px; }
.install-hint { font-size: 14px; margin-top: 24px; }

.resume {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 12px 16px;
  margin: 4px 0 10px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.resume > div { flex: 1; min-width: 0; display: grid; }
.resume span { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pill {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.pill.ghost { background: var(--card); color: var(--text); }
.pill.big { min-height: 52px; padding: 0 28px; font-size: 18px; }
.pill.wide { width: 100%; min-height: 48px; margin-top: 8px; background: var(--card-2); color: var(--text); }

/* editor */
.editor-body { display: grid; gap: 14px; }
.name-input {
  width: 100%;
  font: inherit;
  font-size: 22px;
  font-weight: 650;
  color: var(--text);
  background: var(--card);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 14px 16px;
}
.name-input:focus { border-color: var(--line); outline: none; }
.total-card { background: var(--card); border-radius: var(--radius); padding: 14px 16px 16px; display: grid; gap: 10px; }
.total-card .label { color: var(--muted); }
.total-num { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; margin-left: 6px; }
.strip { display: block; width: 100%; height: 10px; border-radius: 5px; }

.group { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.group-title { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; margin: 6px 4px -6px; }
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 6px 8px 6px 16px;
}
.row + .row { border-top: 1px solid var(--line); }
.row.off .row-label { color: var(--faint); }
.row-label { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row-label small { display: block; color: var(--muted); font-size: 13px; }
.swatch { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--c); }
.stepper { display: flex; align-items: center; gap: 2px; flex: none; }
.step {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  color: var(--text);
  background: var(--card-2);
  user-select: none;
  -webkit-user-select: none;
}
.step:active { background: var(--line); }
.step svg { width: 20px; height: 20px; }
.value {
  min-width: 76px;
  height: 44px;
  text-align: center;
  font-size: 19px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  border-radius: 10px;
}
input.value {
  font: inherit;
  font-size: 19px;
  font-weight: 650;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--accent);
  width: 76px;
  padding: 0;
}
.type-hint { color: var(--muted); font-size: 13px; padding: 0 16px 10px; margin-top: -4px; text-align: right; }

.seg { display: inline-flex; background: var(--card-2); border-radius: 12px; padding: 3px; flex: none; }
.seg button { min-height: 38px; padding: 0 14px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 15px; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }

.switch {
  flex: none;
  position: relative;
  width: 52px; height: 32px;
  border-radius: 16px;
  background: var(--line);
  transition: background 0.15s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.switch[aria-checked="true"] { background: #30D158; }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

.colors { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 14px; }
.color-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px 0 8px;
  border-radius: 999px;
  background: var(--card-2);
  font-size: 15px;
}
.color-chip .swatch { width: 24px; height: 24px; }

.danger-btn {
  min-height: 52px;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--danger);
  font-weight: 600;
  margin-top: 6px;
}

/* run */
.run {
  position: fixed;
  inset: 0;
  max-width: none;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--phase);
  color: var(--on);
  transition: background-color 0.25s;
  padding: calc(var(--top) + 6px) calc(var(--pad) + env(safe-area-inset-right, 0px)) calc(var(--bottom) + 16px) calc(var(--pad) + env(safe-area-inset-left, 0px));
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
.run.paused { filter: saturate(0.35) brightness(0.8); }
.run-top { display: flex; align-items: center; gap: 8px; min-height: 48px; }
.run-name { flex: 1; text-align: center; font-weight: 650; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0.8; }
.run-icon {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--on) 10%, transparent);
}
.run-icon svg { width: 22px; height: 22px; stroke-width: 2.4; }
.run-icon .snd-off, .run.muted .run-icon .snd-on { display: none; }
.run.muted .run-icon .snd-off { display: block; }
.end-confirm {
  position: absolute;
  top: calc(var(--top) + 58px);
  left: var(--pad);
  z-index: 2;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--on);
  color: var(--phase);
  font-weight: 650;
  font-size: 14px;
}
.run-wk {
  align-self: center;
  margin-top: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(14, 15, 19, 0.78);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.run-wk[hidden] { display: none; }
.run-wk-heart { color: #FF453A; }
.run-wk-zone {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--zc, #8E8E93);
  color: var(--zon, #000);
  font-size: 12px;
  font-weight: 750;
}
.run-wk-zone[hidden] { display: none; }
.run-wk-clock { color: rgba(255, 255, 255, 0.82); }

.run-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 0;
}
.phase-label {
  font-size: clamp(28px, 9vw, 64px);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1;
}
.clock {
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, sans-serif;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 0.95;
  margin: 0.08em 0 0.06em;
  font-size: min(38vw, 46vh);
}
.clock.len5 { font-size: min(30vw, 40vh); }
.clock.len6 { font-size: min(25vw, 36vh); }
.clock.len7 { font-size: min(21vw, 32vh); }
.clock.tick { animation: tick 0.5s ease-out; }
@keyframes tick { 0% { transform: scale(1.06); } 100% { transform: scale(1); } }
.run-count { font-size: clamp(17px, 5vw, 26px); font-weight: 650; font-variant-numeric: tabular-nums; opacity: 0.85; }
.next {
  margin-top: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 8px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--on) 12%, transparent);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.next:empty { visibility: hidden; }
.next .swatch { width: 16px; height: 16px; box-shadow: 0 0 0 2px color-mix(in srgb, var(--on) 50%, transparent); }

.sound-warn {
  margin: 0 auto 12px;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--on);
  color: var(--phase);
  font-weight: 650;
  text-align: center;
  cursor: pointer;
}

.run-bottom { display: grid; gap: 14px; }
.run-progress { display: grid; gap: 6px; }
.strip-wrap { position: relative; }
.run .strip { height: 12px; border-radius: 6px; box-shadow: 0 0 0 2px color-mix(in srgb, var(--on) 35%, transparent); }
.playhead {
  position: absolute;
  top: -5px; bottom: -5px;
  width: 4px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--on);
  left: 0;
}
.run-totals { display: flex; justify-content: space-between; font-weight: 650; font-variant-numeric: tabular-nums; opacity: 0.85; font-size: 15px; }
.controls { display: flex; align-items: center; justify-content: center; gap: 28px; }
.ctl {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--on) 12%, transparent);
}
.ctl svg { width: 28px; height: 28px; fill: currentColor; stroke-width: 2.4; }
.ctl.big { width: 88px; height: 88px; background: var(--on); color: var(--phase); }
.ctl.big svg { width: 38px; height: 38px; stroke-width: 3.2; }
.ctl.big.live-end { width: auto; min-width: 160px; padding: 0 36px; border-radius: 44px; font-size: 26px; font-weight: 750; letter-spacing: 0.02em; }
.ctl .i-play, .run.paused .ctl .i-pause { display: none; }
.run.paused .ctl .i-play { display: block; }
.ctl:active { transform: scale(0.94); }
.paused-tag {
  position: absolute;
  top: calc(var(--top) + 64px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 16px;
  border-radius: 999px;
  background: var(--on);
  color: var(--phase);
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 14px;
}

@media (orientation: landscape) and (max-height: 520px) {
  .run-main { flex-direction: row; flex-wrap: wrap; gap: 0 24px; align-content: center; }
  .phase-label { width: 100%; font-size: 26px; }
  .clock { margin: 0; }
  .run-count, .next { margin: 0; }
  .run-bottom { grid-template-columns: 1fr auto; align-items: center; gap: 24px; }
  .controls { gap: 16px; }
  .ctl { width: 52px; height: 52px; }
  .ctl.big { width: 64px; height: 64px; }
}

/* done */
.done { display: grid; place-items: center; text-align: center; }
.done-body { display: grid; justify-items: center; gap: 6px; }
.done-check { width: 96px; height: 96px; border-radius: 50%; background: #30D158; color: #000; display: grid; place-items: center; }
.done-check svg { width: 52px; height: 52px; stroke-width: 3; }
.done h2 { font-size: 34px; margin: 10px 0 0; }
.done p { color: var(--muted); margin: 0 0 18px; font-variant-numeric: tabular-nums; }
.done-actions { display: flex; gap: 12px; }

/* sheets */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 10; }
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 11;
  max-width: 640px;
  max-height: 90dvh;
  overflow-y: auto;
  margin: 0 auto;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 8px var(--pad) calc(var(--bottom) + 16px);
  display: grid;
  gap: 10px;
  animation: up 0.18s ease-out;
}
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
.sheet h2 { font-size: 17px; margin: 4px 0; text-align: center; }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 4px; }
.sheet-btn {
  min-height: 52px;
  border-radius: 14px;
  background: var(--card-2);
  font-size: 17px;
  font-weight: 600;
}
.sheet-btn.danger { color: var(--danger); }
.sheet-btn.cancel { background: none; color: var(--muted); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; }
.set-row.column { display: grid; gap: 8px; justify-content: stretch; }
.set-row input[type="range"] { flex: 1; max-width: 260px; accent-color: var(--accent); }
.fine { color: var(--muted); font-size: 13px; margin: 0; }
.faint { color: var(--faint); }
.done-sheet { justify-self: center; }
.palette { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; padding: 4px 4px 12px; }
.palette button {
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--c);
  display: grid;
  place-items: center;
  color: #000;
}
.palette button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--text); }
.palette svg { width: 22px; height: 22px; stroke-width: 3; }

/* tabs */
.tabs { display: flex; width: 100%; margin: 0 0 12px; }
.tabs button { flex: 1 0 auto; padding: 0 8px; font-size: 14px; white-space: nowrap; }

/* sessions: one page of bubbles, a menu per bubble */
.ses-ask { font-size: 22px; line-height: 1.2; margin: 4px 4px 2px; letter-spacing: -0.01em; }
.bubbles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 10px; }
.dense .bubbles { grid-template-columns: repeat(4, 1fr); gap: 10px 8px; }
.bubble {
  container-type: inline-size;
  position: relative;
  width: 100%;
  max-width: 100px;
  aspect-ratio: 1;
  justify-self: center;
  border-radius: 50%;
  padding: 4px;
  display: grid;
  place-content: center;
  gap: 1px;
  background: color-mix(in srgb, var(--c) 22%, var(--card));
  box-shadow: inset 0 0 0 2px var(--c);
  transition: transform 0.1s;
}
.bubble:active { transform: scale(0.95); background: color-mix(in srgb, var(--c) 40%, var(--card)); }
/* The longest word fills the circle at most: about 0.68em a letter, bold. */
.bubble-name {
  --max: 15px;
  font-weight: 650;
  font-size: clamp(9px, calc((100cqi - 8px) / (var(--len) * 0.68)), var(--max));
  line-height: 1.15;
  text-align: center;
}
.bubble-name.wrap { overflow-wrap: anywhere; }
.dense .bubble-name { --max: 13px; }
.bubble-sub { font-size: 12px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; opacity: 0.85; }
.dense .bubble-sub { font-size: 11px; }
.bubble.running { background: var(--c); color: var(--on); animation: beat 1.6s ease-in-out infinite; }
@keyframes beat { 50% { box-shadow: inset 0 0 0 2px var(--c), 0 0 0 6px color-mix(in srgb, var(--c) 35%, transparent); } }
.bubble-done {
  position: absolute;
  top: -5px; right: -5px;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--c);
  color: var(--on);
  box-shadow: 0 0 0 3px var(--bg);
}
.bubble-done svg { width: 14px; height: 14px; stroke-width: 3; }
.dense .bubble-done { top: -7px; right: -7px; width: 20px; height: 20px; }
.dense .bubble-done svg { width: 12px; height: 12px; }
.ses-today {
  width: 100%;
  margin-top: 18px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: var(--radius);
  background: var(--card);
  text-align: left;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.ses-week { flex: none; color: var(--muted); font-size: 14px; }
.ses-week::after { content: " \203A"; }
.pick-start { display: flex; align-items: center; justify-content: center; gap: 8px; }
.pick-start svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.rec-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rec-chips.pick-chips { grid-template-columns: repeat(4, 1fr); }
.rec-chips.two { grid-template-columns: repeat(2, 1fr); }
.pick-when { display: flex; align-items: center; justify-content: center; gap: 8px; }
.pick-when svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.pick-foot { display: flex; justify-content: space-between; }
.toast { display: flex; align-items: center; gap: 14px; }
.toast-act { color: var(--accent); font-weight: 700; min-height: 32px; }
.chip {
  min-height: 40px;
  border-radius: 999px;
  background: var(--card-2);
  font-weight: 600;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.chip:active { background: var(--line); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.rec-title { margin: 18px 4px 10px; }
.rec-title.first { margin-top: 4px; }
.rec-recent { list-style: none; margin: 0; padding: 0; max-height: 55vh; overflow-y: auto; }
.rec-recent li + li { border-top: 1px solid var(--line); }
.rec-row { width: 100%; text-align: left; }
.rec-state { color: var(--muted); font-size: 14px; flex: none; }
.rec-queue { margin: 12px 4px 0; }
.group.on-sheet { background: var(--card-2); }
.on-sheet .step { background: var(--line); }
.rec-when { position: relative; display: grid; place-items: center; min-width: 116px; font-size: 17px; white-space: nowrap; }
/* The phone's own wheel opens from a tap on this unseen field. */
.wheel-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; margin: 0; padding: 0; border: 0; -webkit-appearance: none; appearance: none; }
.fine.center { text-align: center; }
.sheet-btn.primary { background: var(--accent); color: #fff; }

/* edit session timers */
.type-list { list-style: none; margin: 0; padding: 0; }
.type-list .row + .row, .type-list li + li { border-top: 1px solid var(--line); }
.type-open { flex: 1; min-height: 44px; text-align: left; }
.type-row.off .swatch { opacity: 0.4; }
.step:disabled { opacity: 0.3; }
.row-value { color: var(--muted); font-size: 17px; padding-right: 8px; }
.kind-seg { display: flex; width: 100%; margin: 4px 0; }
.kind-seg button { flex: 1; padding: 0 6px; }
.type-note { margin: 0 4px; }
.type-palette { padding: 16px; }
.toast {
  position: fixed;
  left: 50%;
  top: calc(var(--top) + 12px);
  transform: translateX(-50%);
  z-index: 20;
  max-width: calc(100% - 2 * var(--pad));
  width: max-content;
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  text-align: center;
  animation: down 0.18s ease-out;
}
@keyframes down { from { transform: translate(-50%, -16px); opacity: 0; } }

/* live recovery timer */
.live-bell { display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 650; }
.live .seg { background: color-mix(in srgb, var(--on) 12%, transparent); }
.live .seg button { color: var(--on); opacity: 0.75; }
.live .seg button[aria-pressed="true"] { background: var(--on); color: var(--phase); opacity: 1; }
/* Five choices fit under "Bell at" on a 375 wide phone. */
.live .seg button { padding: 0 9px; }
@media (max-width: 380px) { .live .seg button { padding: 0 6px; font-size: 14px; } }
.bell-input {
  width: 64px; min-height: 38px;
  border: 0; border-radius: 9px;
  background: var(--on); color: var(--phase);
  font: inherit; font-size: 16px; font-weight: 650; text-align: center;
}
.bell-input::placeholder { color: var(--phase); opacity: 0.6; }
.live-meter { height: 12px; border-radius: 6px; overflow: hidden; background: color-mix(in srgb, var(--on) 15%, transparent); }
.live-meter i { display: block; height: 100%; width: 0; background: var(--on); transition: width 0.25s linear; }

/* stopwatch: the Vein mark as a dial, in the timers' own colors */
.watch {
  --wc: #30D158;
  --won: #000;
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--bottom) + 8px);
}
.watch-swatch {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 30%, transparent);
}
.watch-face { flex: none; display: grid; justify-items: center; }
.dial {
  position: relative;
  width: min(78vw, 300px, 36dvh);
  aspect-ratio: 1;
  border-radius: 50%;
}
.dial::before {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--wc) 20%, transparent), transparent);
  opacity: 0.4;
  transition: opacity 0.5s;
}
.watch.running .dial::before { opacity: 1; }
.dial:active svg { transform: scale(0.985); }
.dial svg {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: filter 0.5s;
}
.watch.running .dial svg { filter: drop-shadow(0 0 12px color-mix(in srgb, var(--wc) 35%, transparent)); }
.dial-track { fill: none; stroke: color-mix(in srgb, var(--wc) 10%, var(--card)); stroke-width: 3; }
.dial-ticks line { stroke: var(--line); stroke-width: 2.2; transition: stroke 0.25s; }
.dial-ticks line.major { stroke: var(--faint); stroke-width: 3.4; }
.dial-ticks line.lit { stroke: color-mix(in srgb, var(--wc) 70%, transparent); }
.dial-ticks line.major.lit { stroke: var(--wc); }
.dial-arc { fill: none; stroke: var(--wc); stroke-width: 4; stroke-dasharray: 0 1000; }
.dial-tip { fill: var(--wc); stroke: var(--bg); stroke-width: 3; transition: opacity 0.3s; }
.watch.idle .dial-tip { opacity: 0.35; }
.dial-pulse { fill: none; stroke: var(--wc); opacity: 0; transform-box: fill-box; transform-origin: center; }
.dial-pulse.go { animation: wpulse 0.75s ease-out; }
@keyframes wpulse {
  0% { opacity: 0.9; transform: scale(0.7); stroke-width: 12; }
  100% { opacity: 0; transform: scale(1.06); stroke-width: 1; }
}
.vein-field { fill: color-mix(in srgb, var(--wc) 7%, var(--bg)); stroke: none; }
.veins path { fill: var(--wc); stroke: none; }
.vein-frame { fill: none; stroke: var(--wc); stroke-width: 9; }
.vein-core { fill: var(--bg); stroke: var(--wc); stroke-width: 3.2; transition: fill 0.3s; }
/* Running, the core fills in, with a dark moat so it stands clear of the veins. */
.watch.running .vein-core { fill: var(--wc); stroke: var(--bg); stroke-width: 7; paint-order: stroke; }
/* Faded as one group, so the veins don't show doubled where they meet the frame. */
.vein-mark { transition: opacity 0.4s; }
.watch:not(.running) .vein-mark { opacity: 0.6; }
.watch.idle .vein-mark { animation: breathe 3.2s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 1; } }
.watch-time {
  margin-top: 4px;
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, sans-serif;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1;
  font-size: min(18vw, 76px, 9dvh);
}
.watch-time.long { font-size: min(14vw, 60px, 7.5dvh); }
.watch-cs { color: var(--wc); font-size: 0.6em; transition: color 0.3s; }
.watch-controls { flex: none; display: flex; justify-content: space-between; margin: 10px 4px 12px; }
.wbtn {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--card-2);
  color: var(--text);
  font-size: 17px;
  font-weight: 650;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--card-2);
  transition: transform 0.1s;
}
.wbtn:disabled { color: var(--faint); cursor: default; }
.wbtn.go {
  --b: color-mix(in srgb, var(--wc) 22%, var(--bg));
  background: var(--b);
  color: var(--wc);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--b);
}
.wbtn.go.stop { --b: color-mix(in srgb, #FF453A 22%, var(--bg)); color: #FF453A; }
.wbtn:not(:disabled):active { transform: scale(0.94); }
.laps {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.lap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.lap-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px color-mix(in srgb, var(--c) 60%, transparent); }
.lap-n { flex: 1; min-width: 0; display: grid; font-weight: 600; }
.lap-n small { color: var(--muted); font-size: 13px; font-weight: 500; }
.lap-tag { margin-left: 8px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; vertical-align: 1px; }
.lap-tag.fast { color: #30D158; background: color-mix(in srgb, #30D158 16%, transparent); }
.lap-tag.slow { color: #FF453A; background: color-mix(in srgb, #FF453A 16%, transparent); }
.lap-t { flex: none; font-size: 19px; font-weight: 650; }
.lap.current .lap-t { color: var(--c); }
.watch.running .lap.current .lap-dot { animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.tabs button.ticking { position: relative; }
.tabs button.ticking::after {
  content: "";
  position: absolute;
  top: 6px; right: 7px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 6px var(--c);
  animation: blink 1.2s ease-in-out infinite;
}
@media (orientation: landscape) and (max-height: 520px) {
  .watch { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto auto 1fr; column-gap: 28px; }
  .watch > .bar, .watch > .tabs { grid-column: 1 / -1; }
  .watch-face { grid-row: 3 / 5; align-self: start; }
  .dial { width: min(52dvh, 300px); }
  .watch-time { font-size: min(9dvh, 48px); }
  .watch-controls { margin-top: 0; }
  .wbtn { width: 64px; height: 64px; font-size: 15px; }
}

/* cardio workout mode: high-contrast dark surface, rounded tabular BPM + clock */
.workout {
  --accent-wk: #30D158;
  background: var(--bg);
  color: var(--text);
  gap: 10px;
}
.workout.paused { filter: none; }
.workout .run-icon { background: var(--card); color: var(--text); }
.workout .paused-tag { background: #FFD60A; color: #000; position: static; transform: none; align-self: center; }
.wk-head { flex: 1; min-width: 0; display: grid; justify-items: center; gap: 3px; }
.wk-title { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.wk-strap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.wk-strap.live { color: var(--text); border-color: color-mix(in srgb, #30D158 55%, var(--line)); }
.wk-strap.warn { color: #FFD60A; border-color: color-mix(in srgb, #FFD60A 50%, var(--line)); }
.wk-hint {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 14px;
  text-align: center;
}
.wk-main { gap: 4px; }
.wk-zone {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--zc, #8E8E93);
  color: var(--zon, #000);
  font-weight: 750;
  font-size: 15px;
  letter-spacing: 0.02em;
}
.wk-hr-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin: 2px 0;
}
.wk-heart { color: #FF453A; font-size: clamp(22px, 6vw, 34px); align-self: center; opacity: 0.55; transition: transform 0.15s, opacity 0.15s; }
.wk-heart.beat { opacity: 1; transform: scale(1.18); }
.wk-bpm {
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, sans-serif;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 0.92;
  font-size: min(36vw, 28vh);
}
.wk-unit { color: var(--muted); font-size: clamp(18px, 4.5vw, 24px); font-weight: 650; }
.wk-sub { color: var(--muted); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.wk-clock {
  margin-top: 4px;
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, sans-serif;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-size: clamp(34px, 11vw, 56px);
}
.wk-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.wk-stat {
  background: var(--card);
  border-radius: 14px;
  padding: 10px 8px;
  display: grid;
  justify-items: center;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}
.wk-stat-k { color: var(--muted); font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; }
.wk-stat-v { font-size: 19px; font-weight: 750; }
.workout .wk-bell { color: var(--muted); font-size: 14px; }
.workout .wk-bell .seg { background: var(--card); }
.workout .wk-bell .seg button { color: var(--muted); padding: 0 9px; }
.workout .wk-bell .seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.workout .bell-input { background: var(--text); color: var(--bg); }
.workout .bell-input::placeholder { color: var(--bg); opacity: 0.6; }
@media (max-width: 380px) { .workout .wk-bell .seg button { padding: 0 6px; font-size: 13px; } }
.wk-controls { gap: 16px; }
.wk-pause {
  width: auto;
  min-width: 128px;
  padding: 0 24px;
  border-radius: 44px;
  background: var(--card-2);
  color: var(--text);
  font-size: 21px;
  font-weight: 700;
}
.workout.paused .wk-pause { background: #FFD60A; color: #000; }
.workout .wk-done { background: var(--accent-wk); color: var(--on-wk, #000); }

.pick-workout { flex-direction: column; gap: 2px; padding: 10px 16px; }
.pick-workout-main { display: inline-flex; align-items: center; gap: 8px; }
.pick-strap-sub { font-size: 12px; font-weight: 600; opacity: 0.82; }
.pick-timer-row { width: 100%; min-height: 48px; text-align: left; }
.pick-timer-val { color: var(--muted); font-size: 16px; font-weight: 600; }

.wk-timer-slot { display: grid; }
.wk-timer-btn {
  min-height: 42px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}
.wk-timer-btn[hidden], .wk-timer-card[hidden] { display: none; }
.wk-timer-card {
  min-height: 50px;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--tc, #FF453A) 55%, var(--line));
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font-variant-numeric: tabular-nums;
}
.wk-tc-pill {
  flex: none;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--tc, #FF453A);
  color: var(--ton, #000);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.wk-tc-meta { flex: 1; min-width: 0; display: grid; line-height: 1.2; }
.wk-tc-meta strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-tc-meta small { color: var(--muted); font-size: 12px; font-weight: 600; }
.wk-tc-clock { flex: none; font-size: 20px; font-weight: 800; }

.strap-list { list-style: none; margin: 0; padding: 0; }
.strap-list li + li { border-top: 1px solid var(--line); }
.strap-item { width: 100%; text-align: left; }
.set-actions { display: flex; gap: 8px; align-items: center; }
.set-actions .pill.wide { margin-top: 0; flex: 1; }
.athlete-group .row { min-height: 50px; }
.athlete-field { display: flex; align-items: center; gap: 8px; }
.unit-seg button { min-height: 32px; padding: 0 10px; font-size: 14px; }
.set-input {
  width: 82px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.wk-sum-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.wk-sum-cell {
  background: var(--card-2);
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}
.wk-sum-cell small { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.wk-sum-cell strong { font-size: 20px; font-weight: 750; }
.wk-zones { display: grid; gap: 6px; background: var(--card-2); border-radius: 14px; padding: 10px 12px; }
.wk-zones-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.wk-zrow { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; font-size: 13px; font-variant-numeric: tabular-nums; }
.wk-zlabel { font-weight: 700; color: var(--muted); }
.wk-ztrack { height: 8px; border-radius: 4px; background: var(--bg); overflow: hidden; }
.wk-ztrack i { display: block; height: 100%; border-radius: 4px; background: var(--zc); }
.wk-ztime { color: var(--text); font-weight: 600; min-width: 72px; text-align: right; }
.wk-trace { display: block; width: 100%; height: 96px; border-radius: 12px; background: var(--card-2); }
.wk-intervals { display: grid; gap: 6px; background: var(--card-2); border-radius: 14px; padding: 10px 12px; font-variant-numeric: tabular-nums; }
.wk-iv-block { display: grid; gap: 4px; }
.wk-iv-block + .wk-iv-block { padding-top: 6px; border-top: 1px solid var(--line); }
.wk-iv-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.wk-round-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.wk-round-k { color: var(--muted); font-weight: 650; }
.wk-round-v { color: var(--text); font-weight: 650; }

@media (orientation: landscape) and (max-height: 520px) {
  .workout { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto auto auto; column-gap: 20px; }
  .workout > .run-top, .workout > .paused-tag, .workout > .wk-hint { grid-column: 1 / -1; }
  .wk-main { grid-column: 1; grid-row: 2 / 5; }
  .wk-bpm { font-size: min(22vw, 34vh); }
  .wk-clock { font-size: clamp(24px, 7vw, 38px); }
  .wk-stats { grid-column: 2; align-self: end; }
  .wk-timer-slot { grid-column: 2; }
  .wk-bottom { grid-column: 2; grid-template-columns: 1fr; gap: 10px; align-self: start; }
}

/* today */
.today-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.today-nav .step:disabled { opacity: 0.32; pointer-events: none; }
.today-date-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}
.today-offline {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.today-totals {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
}
.today-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}
.today-metric { display: grid; gap: 1px; }
.today-metric small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.today-metric strong { font-size: 17px; font-weight: 750; }
.today-groups { display: flex; flex-wrap: wrap; gap: 6px; }
.today-group-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  background: var(--card-2);
  font-size: 13px;
  font-weight: 600;
}
.today-group-chip .swatch { width: 10px; height: 10px; }
.today-timeline-wrap {
  background: var(--card);
  border-radius: var(--radius);
  padding: 10px 10px 14px 8px;
}
.today-cols-head {
  display: grid;
  grid-template-columns: 36px 66px 64px 1fr;
  gap: 6px;
  padding-bottom: 6px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.today-track {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 6px;
  position: relative;
}
.today-axis { position: relative; font-variant-numeric: tabular-nums; }
.today-hour {
  position: absolute;
  right: 2px;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--muted);
  line-height: 1;
}
.today-lanes {
  position: relative;
  display: grid;
  grid-template-columns: 66px 64px 1fr;
  gap: 6px;
}
.today-grid { position: absolute; inset: 0; pointer-events: none; }
.today-rule {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: color-mix(in srgb, var(--line) 65%, transparent);
}
.today-lane { position: relative; min-width: 0; }
.today-bar {
  position: absolute;
  left: 0;
  right: 0;
  border-radius: 7px;
  padding: 2px 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.today-bar-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.today-phone-home { background: var(--card-2); color: var(--muted); }
.today-phone-vehicle { background: rgba(10, 132, 255, 0.24); color: #64D2FF; border: 1px solid rgba(100, 210, 255, 0.35); }
.today-phone-walk { background: rgba(48, 209, 88, 0.22); color: #30D158; border: 1px solid rgba(48, 209, 88, 0.35); }
.today-phone-away { background: rgba(255, 159, 10, 0.16); color: #FFD60A; border: 1px solid rgba(255, 214, 10, 0.3); }
.today-phone-place { background: rgba(191, 90, 242, 0.24); color: #E5B8FF; border: 1px solid rgba(191, 90, 242, 0.45); }
.today-tag-bar {
  background: var(--card-2);
  border: 1px solid var(--accent);
  color: var(--text);
}
.today-gap {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--faint);
  color: var(--muted);
}
.today-gap:active { background: var(--card-2); color: var(--text); }

/* Settings > Devices (11-10): a gap under each device card and between them. */
#devices-row .set-actions { margin-top: 8px; }
#panel-dev + #strap-row { margin-top: 14px; }
