:root {
  color-scheme: light;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", ui-sans-serif, sans-serif;
  --background: #ffffff;
  --background-subtle: #00000005;
  --bg-1: #ffffff;
  --bg-2: #0000000a;
  --bg-3: #0000000f;
  --bg-4: #00000017;
  --fg-1: #0000004d;
  --fg-2: #00000066;
  --fg-3: #00000099;
  --fg-4: #000000e6;
  --bg-a1: #00000008;
  --bg-a2: #0000000d;
  --bg-a3: #00000014;
  --fg-a2: #00000066;
  --purple-1: #e0f2fe;
  --purple-2: #bae6fd;
  --purple-4: #0ea5e9;
  --sky-1: #e0f2fe;
  --sky-4: #0ea5e9;
  --green-1: #effbf2;
  --green-4: #33c758;
  --red-1: #fff3f0;
  --red-4: #ff2f00;
  --shadow-1: none;
  --shadow-2: 0 1px 3px #00000014, 0 0 0 1px #00000005;
  --shadow-3: 0 1px 3px #0000000f, 0 8px 16px #0000000f, 0 0 0 1px #00000005;
  --text-large-title: 34px;
  --leading-large-title: 41px;
  --text-title-1: 28px;
  --leading-title-1: 34px;
  --text-headline: 17px;
  --leading-headline: 22px;
  --text-body: 17px;
  --leading-body: 22px;
  --text-subhead: 15px;
  --leading-subhead: 20px;
  --text-footnote: 13px;
  --leading-footnote: 18px;
  --text-metric: 64px;
  --leading-metric: 70px;
  --radius-3: 6px;
  --radius-5: 12px;
  --radius-6: 16px;
  --radius-3xl: 24px;
  --radius-pill: 9999px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --motion-fast: 140ms;
  --motion-base: 180ms;
  --motion-slow: 240ms;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--fg-4);
  letter-spacing: 0;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--background);
  padding-bottom: 156px;
  -webkit-tap-highlight-color: transparent;
}

body.run-active {
  overflow: hidden;
  padding-bottom: 0;
}

body.modal-active {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.app-shell {
  width: min(100%, 1064px);
  margin: 0 auto;
  padding: 20px max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
}

main {
  padding: 18px 0 56px;
}

#view-home,
#view-templates,
#view-history,
#view-settings {
  width: min(100%, 420px);
  margin: 0 auto;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.home-header,
.section-heading,
.panel-header,
.timer-topline,
.summary-header,
.settings-row,
.dialog-header,
.run-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.home-header {
  margin-bottom: 18px;
}

h1,
h2 {
  margin: 0;
  color: var(--fg-4);
  font-weight: 600;
  letter-spacing: 0;
  text-wrap: balance;
}

h1,
#home-title {
  font-size: var(--text-title-1);
  line-height: var(--leading-title-1);
}

h2 {
  font-size: var(--text-title-1);
  line-height: var(--leading-title-1);
}

.timer-card,
.home-summary,
.home-panel,
.template-card,
.history-item,
.settings-list,
.dialog-card {
  border: 1px solid var(--bg-a2);
  border-radius: var(--radius-6);
  background: var(--background);
  box-shadow: none;
}

.confirm-card {
  display: grid;
  gap: 18px;
  width: min(100%, 360px);
  padding: 18px;
  border: 1px solid var(--bg-a2);
  border-radius: var(--radius-3xl);
  background: var(--background);
  box-shadow: var(--shadow-3);
}

.confirm-card strong {
  display: block;
  color: var(--fg-4);
  font-size: var(--text-headline);
  line-height: var(--leading-headline);
}

.confirm-card p {
  margin: 6px 0 0;
  color: var(--fg-3);
  font-size: var(--text-subhead);
  line-height: var(--leading-subhead);
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.confirm-actions .danger-action {
  background: var(--red-4);
}

.timer-card,
.home-summary,
.home-panel,
.settings-list {
  border: 0;
  border-radius: 0;
  padding: 0;
}

.timer-card {
  display: grid;
  gap: 16px;
  margin-bottom: 0;
  text-align: center;
}

.timer-topline {
  color: var(--fg-3);
  font-size: var(--text-footnote);
  font-weight: 600;
  line-height: var(--leading-footnote);
}

.stat-label {
  color: var(--fg-3);
  font-size: var(--text-footnote);
  font-weight: 600;
  line-height: var(--leading-footnote);
}

.time-button {
  display: grid;
  width: 100%;
  min-height: 182px;
  place-items: center;
  gap: 4px;
  border: 0;
  border-radius: var(--radius-3xl);
  background: var(--purple-1);
  color: var(--purple-4);
}

.time-button strong {
  font-family: var(--font-sans);
  font-size: var(--text-metric);
  font-weight: 600;
  line-height: var(--leading-metric);
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
}

.time-button span {
  color: var(--fg-3);
  font-size: var(--text-headline);
  font-weight: 600;
  line-height: var(--leading-headline);
}

.home-summary {
  display: grid;
  gap: 14px;
  margin: 24px 0 0;
}

.summary-header h2 {
  font-size: var(--text-headline);
  line-height: var(--leading-headline);
}

.summary-header p,
.template-card p,
.settings-copy small,
.history-item p {
  margin: 4px 0 0;
  color: var(--fg-3);
  font-size: var(--text-subhead);
  font-weight: 500;
  line-height: var(--leading-subhead);
}

.round-stepper {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--bg-a1);
}

.round-stepper button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--fg-4);
  font-size: 20px;
}

.round-stepper strong {
  min-width: 30px;
  color: var(--fg-4);
  font-family: var(--font-sans);
  font-size: var(--text-headline);
  line-height: var(--leading-headline);
  text-align: center;
}

.interval-list {
  display: grid;
  gap: 8px;
}

.interval-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) 84px 32px;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 8px;
  border-radius: var(--radius-6);
  background: var(--bg-a1);
}

.interval-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot-color, var(--purple-4));
}

.interval-row input,
.field input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--bg-a2);
  border-radius: var(--radius-5);
  background: var(--background);
  color: var(--fg-4);
  padding: 0 10px;
  font-size: var(--text-subhead);
  font-weight: 500;
  line-height: var(--leading-subhead);
}

.interval-row input:focus,
.field input:focus {
  outline: 2px solid var(--purple-2);
  outline-offset: 1px;
}

.delete-interval {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--fg-2);
  font-size: 18px;
}

.home-panel {
  margin-top: 24px;
}

.panel-header {
  margin-bottom: 14px;
}

.panel-header h2 {
  font-size: var(--text-headline);
  line-height: var(--leading-headline);
}

.button,
.icon-button,
.nav-tab,
.text-button {
  border: 0;
  border-radius: var(--radius-pill);
  transition: transform var(--motion-fast) var(--ease-out);
}

.button:active,
.icon-button:active,
.nav-tab:active {
  transform: scale(0.97);
}

.button {
  min-height: 56px;
  padding: 0 18px;
  font-size: var(--text-headline);
  font-weight: 600;
  line-height: var(--leading-headline);
}

.small-button {
  min-height: 44px;
  padding: 0 16px;
}

.button-primary {
  background: var(--purple-4);
  color: #ffffff;
}

.button-secondary {
  background: var(--bg-a1);
  color: var(--fg-4);
}

.add-button {
  width: 100%;
}

.text-button {
  min-height: 44px;
  padding: 0 8px;
  background: transparent;
  color: var(--purple-4);
  font-size: var(--text-subhead);
  font-weight: 600;
}

.icon-button {
  display: inline-flex;
  min-width: 36px;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  background: var(--sky-1);
  color: var(--sky-4);
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.section-heading {
  margin-bottom: 20px;
}

.template-list,
.history-list {
  display: grid;
  gap: 12px;
}

.template-list.compact {
  gap: 8px;
}

.template-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.template-card h3,
.history-item strong,
.settings-copy span {
  margin: 0;
  color: var(--fg-4);
  font-size: var(--text-headline);
  font-weight: 600;
  line-height: var(--leading-headline);
}

.template-actions,
.split-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.template-actions .button {
  flex: 1;
}

.template-actions .text-button {
  color: var(--red-4);
}

.home-stat-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--bg-a2);
  border-radius: var(--radius-6);
  background: var(--background);
}

.home-stat-strip div {
  display: grid;
  min-height: 120px;
  place-items: center;
  align-content: center;
  gap: 8px;
  text-align: center;
}

.home-stat-strip div + div {
  border-left: 1px solid var(--bg-a2);
}

.home-stat-strip strong {
  color: var(--sky-4);
  font-size: var(--text-large-title);
  font-weight: 600;
  line-height: var(--leading-large-title);
  font-variant-numeric: tabular-nums;
}

.home-stat-strip div:nth-child(2) strong {
  color: var(--purple-4);
}

.home-stat-strip span {
  color: var(--fg-3);
  font-size: var(--text-body);
  font-weight: 500;
  line-height: var(--leading-body);
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
}

.settings-list {
  display: grid;
  overflow: hidden;
}

.settings-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 76px;
  padding: 16px 0;
  border-bottom: 1px solid var(--bg-a2);
}

.settings-row:last-child {
  border-bottom: 0;
}

.settings-control {
  display: flex;
  width: 112px;
  justify-content: flex-end;
}

.settings-control.split-actions {
  flex-direction: column;
  gap: 8px;
}

.settings-control .button,
.settings-row > .button {
  width: 104px;
  padding: 0;
}

.settings-row-stack {
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 12px;
}

.settings-row-stack .settings-copy,
.settings-row-stack .settings-copy small {
  max-width: none;
}

.settings-row-stack .settings-control {
  width: 100%;
  justify-content: stretch;
}

.settings-row-stack .settings-control.split-actions {
  flex-direction: row;
}

.settings-row-stack .settings-control .button {
  width: auto;
  flex: 1;
}

.settings-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
  max-width: 230px;
}

.settings-copy span,
.settings-copy small {
  display: block;
}

.settings-copy small {
  max-width: 210px;
}

.settings-control input[type="file"],
#import-data {
  display: none;
}

.danger,
.danger-zone .button {
  color: var(--red-4);
}

.toggle {
  position: relative;
  display: inline-flex;
  flex: 0 0 52px;
  width: 52px;
  height: 32px;
}

.toggle input {
  position: absolute;
  opacity: 0;
}

.toggle span {
  width: 100%;
  border-radius: var(--radius-pill);
  background: var(--bg-3);
  transition: background-color var(--motion-base) ease;
}

.toggle span::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: var(--shadow-2);
  transition: transform var(--motion-base) var(--ease-out);
}

.toggle input:checked + span {
  background: var(--purple-4);
}

.toggle input:checked + span::before {
  transform: translateX(20px);
}

.bottom-nav {
  --active-offset: 0px;
  position: fixed;
  right: 50%;
  bottom: 24px;
  z-index: 20;
  display: inline-flex;
  gap: 4px;
  padding: 6px;
  border-radius: 34px;
  background: color-mix(in srgb, var(--background) 92%, transparent);
  box-shadow: var(--shadow-3);
  transform: translateX(50%);
  backdrop-filter: blur(16px);
}

.bottom-nav::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 6px;
  width: 84px;
  height: 52px;
  border-radius: var(--radius-pill);
  background: var(--purple-1);
  transform: translateX(var(--active-offset));
  transition: transform var(--motion-slow) var(--ease-out);
  pointer-events: none;
}

.nav-tab {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 84px;
  min-height: 52px;
  place-items: center;
  gap: 3px;
  padding: 6px 12px;
  background: transparent;
  color: var(--fg-3);
  font-size: 12px;
  font-weight: 500;
}

.nav-tab.is-active {
  color: var(--purple-4);
}

.bottom-nav svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.run-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  padding: max(18px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 24px max(20px, env(safe-area-inset-left));
  background: var(--background);
}

.run-counters {
  display: grid;
  justify-items: center;
  gap: 2px;
}

.run-counters span {
  color: var(--fg-3);
  font-size: var(--text-footnote);
  font-weight: 600;
  line-height: var(--leading-footnote);
}

.run-counters strong {
  color: var(--fg-4);
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 600;
  line-height: 30px;
}

.end-run,
.audio-button {
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  background: transparent;
  color: var(--fg-3);
}

.run-card {
  display: grid;
  width: min(100%, 628px);
  min-height: 360px;
  place-items: center;
  align-content: center;
  gap: 8px;
  margin: 0 auto;
  border: 1px solid var(--bg-a2);
  border-radius: var(--radius-3xl);
  background: var(--run-bg, var(--green-1));
  text-align: center;
}

.run-status {
  color: var(--fg-3);
  font-size: var(--text-footnote);
  font-weight: 600;
  line-height: var(--leading-footnote);
}

.run-card p {
  margin: 0;
  color: var(--run-color, var(--green-4));
  font-size: var(--text-title-1);
  font-weight: 600;
  line-height: var(--leading-title-1);
}

.run-card strong {
  color: var(--fg-4);
  font-family: var(--font-sans);
  font-size: clamp(72px, 22vw, 132px);
  font-weight: 600;
  letter-spacing: -0.07em;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}

.run-actions {
  display: grid;
  grid-template-columns: 1fr 1.25fr 1fr;
  gap: 10px;
  width: min(100%, 628px);
  margin: 0 auto;
}

.run-actions .button {
  min-height: 56px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  align-items: end;
  justify-items: center;
  padding: 12px max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(8px);
}

.modal-overlay[hidden] {
  display: none;
}

.dialog-card {
  display: grid;
  gap: 14px;
  width: min(100%, 420px);
  max-height: min(760px, calc(100dvh - 24px));
  overflow-y: auto;
  padding: 16px;
}

.dialog-header strong {
  color: var(--fg-4);
  font-size: var(--text-headline);
  line-height: var(--leading-headline);
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--fg-3);
  font-size: var(--text-footnote);
  font-weight: 600;
  line-height: var(--leading-footnote);
}

.empty {
  color: var(--fg-3);
  padding: 18px;
  text-align: center;
}

body.dark {
  --background: #14141f;
  --background-subtle: #181925;
  --bg-1: #181925;
  --bg-2: #212131;
  --bg-3: #2b2c3b;
  --bg-4: #333447;
  --fg-1: #73748c;
  --fg-2: #9192a1;
  --fg-3: #bbbcc3;
  --fg-4: #eaeaeb;
  --bg-a1: #cccfff14;
  --bg-a2: #cccfff1a;
  --bg-a3: #cccfff24;
  --purple-1: #082f49;
  --sky-1: #082f49;
  --green-1: #0a2912;
}


/* iPhone-first surfaces, with room for a wider desktop canvas. */
:root { --background: #f5f5f7; --surface: #fff; --purple-4: #0071e3; --sky-4: #0071e3; --green-4: #197745; --fg-3: #66666c; --fg-4: #202024; }
body.dark { --background: #111114; --surface: #202024; --purple-4: #5aafff; --sky-4: #5aafff; --green-4: #61d990; }
html, body { overscroll-behavior: none; }
body { min-height: 100dvh; padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
.app-shell { padding-top: calc(12px + env(safe-area-inset-top)); }
main { padding-top: 10px; }
h1, h2 { letter-spacing: -.035em; }
#home-title { font-size: 36px; line-height: 1.15; font-weight: 700; }
.eyebrow { font-size: 10px; letter-spacing: .12em; color: var(--fg-3); font-weight: 650; margin: 0 0 8px; }
.home-header { margin-bottom: 28px; }
.icon-button { min-width: 44px; min-height: 44px; border-radius: 50%; }
.timer-card { padding: 0; border: 0; background: transparent; gap: 12px; }
.timer-topline { padding: 0 4px; font-size: 14px; }
.time-button { background: var(--surface); color: var(--fg-4); padding: 28px 16px 18px; min-height: 208px; gap: 20px; box-shadow: 0 2px 12px #00000004, 0 0 0 1px #00000003; }
.time-button strong { font-family: var(--font-sans); font-size: clamp(56px, 17vw, 80px); font-weight: 300; line-height: 1; letter-spacing: -.055em; }
.time-button span { display: grid; place-content: center; background: var(--purple-4); color: white; width: 100%; min-height: 54px; border-radius: 16px; }
body.dark .time-button span, body.dark .button-primary { color: #08182b; }
.home-summary { margin-top: 28px; gap: 16px; }
.summary-header p { font-size: 13px; }
.round-stepper { background: var(--surface); padding: 0; }
.round-stepper button { width: 44px; height: 44px; }
.interval-row { grid-template-columns: 8px minmax(0,1fr) 80px 44px; padding: 8px 10px; gap: 6px; background: var(--surface); border-radius: 16px; }
.interval-row input { padding: 0 4px; border: 0; background: transparent; font-size: 16px; min-height: 44px; }
.interval-row input:nth-of-type(2) { text-align: right; font-variant-numeric: tabular-nums; }
.delete-interval { width: 44px; min-height: 44px; }
.field input { font-size: 16px; min-height: 48px; }
.button { border-radius: 16px; }
.add-button { background: transparent; box-shadow: inset 0 0 0 1px var(--bg-a2); color: var(--purple-4); min-height: 48px; }
.home-panel { margin-top: 32px; }
.panel-header h2 { font-size: 18px; letter-spacing: -.02em; }
.template-card, .history-item, .home-stat-strip { border: 0; background: var(--surface); border-radius: 20px; }
.template-card { padding: 18px; }
.template-list.compact .template-card { grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; }
.compact .template-actions .button { min-height: 44px; padding: 0 14px; font-size: 14px; }
.compact .template-actions .button-secondary { display: none; }
.bottom-nav { width: min(calc(100% - 32px), 420px); bottom: calc(12px + env(safe-area-inset-bottom)); border-radius: 26px; background: color-mix(in srgb, var(--surface) 92%, transparent); }
.bottom-nav::before { display: none; }
.nav-tab { flex: 1; min-width: 0; padding: 8px 2px; border-radius: 20px; }
.nav-tab.is-active { background: var(--purple-1); }
.view.is-active, .run-screen, .modal-overlay, .dialog-card, .confirm-card { animation: none; }
.run-screen { height: 100dvh; overflow-y: auto; padding-bottom: calc(24px + env(safe-area-inset-bottom)); gap: 24px; background: var(--background); }
.run-card { min-height: 0; border: 0; background: transparent; gap: 20px; }
.run-card strong { font-family: var(--font-sans); font-weight: 300; font-size: clamp(64px, 21vw, 132px); letter-spacing: -.05em; }
.run-card p { font-size: 24px; }
.run-card .run-next { font-size: 14px; color: var(--fg-3); min-height: 20px; }
.run-status { padding: 7px 14px; border-radius: 99px; background: var(--run-bg); color: var(--run-color); }
.run-actions { grid-template-columns: 1fr 1.6fr 1fr; }
.run-actions .button { min-height: 64px; padding: 0 8px; }
.modal-overlay { background: #00000055; backdrop-filter: none; padding: 0; }
.settings-sheet, .dialog-card { width: min(100%, 480px); max-height: calc(100dvh - max(24px, env(safe-area-inset-top))); overflow-y: auto; overscroll-behavior: contain; background: var(--background); border-radius: 28px 28px 0 0; padding: 24px max(20px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
.settings-sheet .section-heading { flex-direction: row-reverse; }
.settings-sheet h2 { font-size: 26px; }
.settings-list { background: var(--surface); padding: 0 16px; border-radius: 20px; }
.settings-copy small { font-size: 13px; line-height: 1.5; }
.toggle { height: 44px; align-items: center; }
.toggle span { height: 32px; position: relative; }
.toggle input { width: 100%; height: 100%; margin: 0; }
.confirm-overlay { z-index: 90; align-items: center; padding: 20px; }
.confirm-card { background: var(--surface); }
button { -webkit-touch-callout: none; transition: transform 140ms var(--ease-out); }
button:active { transform: scale(.97); transition-duration: 100ms; }
:focus-visible { outline: 3px solid var(--purple-4); outline-offset: 3px; }
.toggle:has(input:focus-visible) { outline: 3px solid var(--purple-4); outline-offset: 3px; border-radius: 99px; }
body.keyboard-input button, body.keyboard-input .toggle span::before { transition: none; }
body.keyboard-input button:active { transform: none; }
.toggle span { transition: none; }
@media (hover: hover) and (pointer: fine) { button:hover { filter: brightness(.96); } }
@media (prefers-reduced-motion: reduce) { button, .toggle span::before { transition: none; } button:active { transform: none; } }
@media (prefers-reduced-transparency: reduce) { .bottom-nav { background: var(--surface); backdrop-filter: none; } }
@media (prefers-contrast: more) { .button, .template-card, .history-item, .settings-list { border: 1px solid var(--fg-3); } }
@media (min-width: 900px) { #view-home { width: 820px; display: none; grid-template-columns: 1fr 1fr; column-gap: 40px; align-items: start; } #view-home.is-active { display: grid; } .home-header { grid-column: 1 / -1; } .home-summary { margin-top: 0; } .home-panel { grid-column: 1 / -1; } .compact { grid-template-columns: repeat(3,1fr); } .template-list.compact .template-card { grid-template-columns: 1fr; } .time-button { min-height: 280px; } }
@media (max-height: 450px) { .run-screen { grid-template-rows: auto auto auto; gap: 12px; } .run-card { gap: 8px; } .run-card strong { font-size: 64px; } }
.toggle span { pointer-events: none; }
.setup-disclosure { margin-top: 24px; }
.setup-disclosure > summary { display: flex; justify-content: space-between; align-items: center; min-height: 56px; padding: 0 4px; list-style: none; cursor: pointer; font-size: 16px; font-weight: 600; }
.setup-disclosure > summary::-webkit-details-marker { display: none; }
.disclosure-hint { color: var(--purple-4); font-size: 14px; }
.setup-disclosure[open] .disclosure-hint { font-size: 0; }
.setup-disclosure[open] .disclosure-hint::after { content: 'Close'; font-size: 14px; }
.setup-disclosure .home-summary { margin-top: 12px; }
#view-home { min-height: min(600px, calc(100svh - 160px)); }
@media (min-width:900px) { #view-home { width: min(100%,480px); } #view-home.is-active { display: block; } .time-button { min-height: 280px; } }

/* Remove repeated labels and secondary actions from the primary flow. */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.run-counters span { font-size: 13px; font-weight: 500; }
.run-counters strong { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.template-card { display: flex; align-items: center; padding: 4px 12px 4px 4px; gap: 4px; }
.template-start { display: flex; flex: 1; align-items: center; justify-content: space-between; text-align: left; min-height: 84px; border: 0; background: transparent; color: var(--fg-4); padding: 14px; border-radius: 16px; min-width: 0; }
.template-start strong { display: block; font-size: 17px; font-weight: 600; }
.template-start small { display: block; font-size: 13px; color: var(--fg-3); margin-top: 6px; font-variant-numeric: tabular-nums; }
.play-icon { color: var(--purple-4); font-size: 24px; margin-left: 12px; }
.template-more { background: transparent; color: var(--fg-3); padding: 0; font-size: 14px; letter-spacing: 2px; }
.action-sheet { display: grid; gap: 12px; }
.action-sheet .section-heading { flex-direction: row; margin-bottom: 4px; }
.data-disclosure > summary { min-height: 64px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-size: 17px; font-weight: 600; list-style: none; }
.data-disclosure > summary::-webkit-details-marker { display: none; }
.data-disclosure .settings-row-stack { padding-top: 0; }
.run-card { gap: 18px; }

.nav-tab { transition: none; }

.round-stepper strong { font-variant-numeric: tabular-nums; }

.modal-overlay[data-closing="true"], .run-screen[data-closing="true"] { pointer-events: none; }
/* A press commits on release; visual response starts at contact. */
.button, .icon-button, .text-button, button { transition: transform 100ms var(--ease-out); }
.button:active, .icon-button:active, .text-button:active, button:active { transition-duration: 140ms; }
.nav-tab, .nav-tab:active { transition: none; transform: none; }
body.keyboard-input button { transition: none; }
@media (prefers-reduced-motion: reduce) {
  .button, .icon-button, .nav-tab, .text-button, button, .toggle span::before { transition: none; }
  .button:active, .icon-button:active, .nav-tab:active, button:active { transform: none; }
}

/* Reference layout: one reachable setup panel, ruler, then Start. */
#view-home.is-active { display: flex; flex-direction: column; min-height: calc(100svh - 148px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
.home-header { flex: 0 0 auto; margin-bottom: 32px; }
.setup-panel { margin-top: auto; background: var(--surface); border-radius: 28px; padding: 22px 18px 18px; }
.setup-panel .timer-card { display: block; }
#quick-label { max-width: 45%; border: 0; background: transparent; color: var(--fg-4); font: inherit; font-size: 17px; font-weight: 600; padding: 8px 0; min-height: 44px; }
#quick-round-label { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.duration-control { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0 12px; }
#quick-total { width: min(100%, 6ch); min-width: 0; border: 0; background: transparent; color: var(--fg-4); font: 300 clamp(44px, 14vw, 64px)/1.2 var(--font-sans); font-variant-numeric: tabular-nums; letter-spacing: -.05em; text-align: center; padding: 0; }
.duration-control .icon-button { background: var(--bg-a1); color: var(--fg-4); padding: 0; font-size: 24px; flex: 0 0 44px; }
.ruler-wrap { position: relative; margin: 8px -8px 0; }
.duration-ruler { height: 78px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; touch-action: auto; scrollbar-width: none; user-select: none; -webkit-user-select: none; cursor: ew-resize; }
.duration-ruler::-webkit-scrollbar { display: none; }
.ruler-ticks { display: flex; align-items: start; width: max-content; padding: 8px 0 0; }
.ruler-tick { flex: 0 0 12px; width: 12px; height: 18px; border-left: 1px solid var(--fg-2); margin-top: 8px; }
.ruler-major { height: 30px; margin-top: 0; position: relative; }
.ruler-major span { position: absolute; top: 38px; left: 0; transform: translateX(-50%); color: var(--fg-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.ruler-index { pointer-events: none; position: absolute; top: 2px; left: 50%; width: 2px; height: 40px; border-radius: 2px; background: var(--purple-4); transform: translateX(-50%); }
.setup-panel .setup-disclosure { margin: 4px 0 14px; }
.setup-panel .setup-disclosure > summary { min-height: 48px; padding: 0; font-size: 15px; }
.setup-panel .interval-row { background: var(--background); }
.setup-panel .time-button { display: block; min-height: 56px; width: 100%; padding: 0 16px; margin: 0; background: var(--purple-4); color: #fff; border-radius: 16px; font-size: 17px; font-weight: 600; }
body.dark .setup-panel .time-button { color: #08182b; }
.completion-sheet { display: grid; gap: 30px; padding-top: 30px; }
#completion-name { color: var(--fg-3); margin: 8px 0 0; font-size: 16px; }
.completion-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 20px; margin: 4px 0 10px; }
.completion-metrics > div { display: flex; flex-direction: column-reverse; gap: 6px; }
.completion-metrics dt { font-size: 13px; color: var(--fg-3); }
.completion-metrics dd { margin: 0; font-size: 32px; line-height: 1.1; font-weight: 500; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
@media (min-width:900px) { #view-home.is-active { min-height: 700px; max-width: 480px; } }
@media (max-height:500px) { #view-home.is-active { min-height: 0; } .home-header { margin-bottom: 16px; } }
#view-home.is-active { align-items: stretch; }
.setup-panel, .ruler-wrap, .duration-ruler { min-width: 0; }
.duration-ruler { width: 100%; }
.duration-ruler { scroll-snap-type: x proximity; scroll-padding-inline: 50%; }
.ruler-tick { scroll-snap-align: start; }

/* Keep native snap geometry but project its appearance around a cylinder. */
.ruler-ticks { opacity: 0; }
.ruler-projection { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.projected-tick { position: absolute; left: 50%; top: 16px; width: 1px; height: 18px; background: var(--fg-2); transform-origin: center top; }
.projected-major { top: 8px; height: 30px; }
.projected-major > span { position: absolute; top: 38px; left: 50%; transform: translateX(-50%); color: var(--fg-3); font-size: 11px; font-variant-numeric: tabular-nums; }
@media (prefers-contrast: more) { .projected-tick { background: var(--fg-4); } }
.setup-disclosure > summary { color: var(--fg-4); }
