:root {
  color-scheme: dark;
  --canvas: #111111;
  --surface: #1b1b1b;
  --surface-raised: #242424;
  --ink: #f5f5f5;
  --muted: #a3a3a3;
  --line: #363636;
  --danger: #ffb4ab;
  --danger-soft: #342120;
  --start: #86efac;
  --start-hover: #a7f3c2;
  --start-soft: #1c3325;
  --stop: #fca5a5;
  --stop-hover: #fecaca;
  --stop-soft: #392323;
  --radius: 1.5rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
a { color: var(--ink); text-underline-offset: 0.18em; }
:focus-visible { outline: 2px solid white; outline-offset: 5px; }
.site-header, main { width: min(100% - 2.5rem, 46rem); margin-inline: auto; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 2.5rem 2rem; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.3rem, 4.6vw, 1.8rem); font-weight: 600; letter-spacing: -0.045em; }
h2 { margin-bottom: 0.5rem; font-size: 1.2rem; font-weight: 550; letter-spacing: -0.025em; }
.eyebrow { margin-bottom: 0.45rem; color: var(--muted); font-size: 0.65rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.icon-button, .text-button { min-height: 2.75rem; border: 0; background: transparent; color: var(--ink); font-size: 0.85rem; font-weight: 550; }
.icon-button:hover, .text-button:hover { color: white; text-decoration: underline; text-underline-offset: 0.25em; }
.settings-button { display: flex; align-items: center; gap: 0.5rem; padding: 0.65rem 0.9rem; border: 1px solid var(--line); border-radius: 999px; }
.settings-button svg { flex: none; }
.settings-button circle { fill: var(--canvas); }
.summary-card { padding: 1.5rem 1.75rem 2rem; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(135deg, #292929, #202020); }
.summary-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.summary-heading h2 { font-size: 0.9rem; letter-spacing: 0; }
.summary-heading span { color: var(--muted); font-size: 0.75rem; }
.summary-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 1.5rem 0 0; text-align: center; }
.summary-stats > div { display: flex; flex-direction: column-reverse; gap: 0.45rem; }
.summary-stats > div + div { border-left: 1px solid #404040; }
.summary-stats dt { color: #b5b5b5; font-size: 0.8rem; }
.summary-stats dd { margin: 0; font-size: clamp(1.65rem, 6vw, 3rem); font-weight: 500; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.timer-card { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; padding: 2rem 0.75rem; border-bottom: 1px solid var(--line); }
.timer-state { display: inline-flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; padding: 0.6rem 0.85rem; border: 1px solid #41694f; border-radius: 999px; background: var(--start-soft); color: var(--start); font-size: 1rem; font-weight: 650; line-height: 1.4; }
.timer-state::before { content: ""; flex: none; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.timer-state.active { border-color: #805050; background: var(--stop-soft); color: var(--stop); }
.timer-state.active::before { border-radius: 2px; }
.timer-readout { display: flex; flex-direction: column; align-items: flex-start; }
.timer { font-variant-numeric: tabular-nums; font-size: clamp(3.5rem, 13vw, 4.5rem); font-weight: 400; line-height: 1; letter-spacing: -0.055em; }
.timer-kind { margin: 0.75rem 0 0; color: var(--muted); font-size: 0.75rem; }
.timer-controls { display: grid; justify-items: center; flex-shrink: 0; gap: 0.4rem; }
.primary-action { display: flex; align-items: center; justify-content: center; gap: 0.75rem; min-height: 4.25rem; padding: 1rem 1.5rem; border: 1px solid var(--start); border-radius: 999px; background: var(--start); color: #111; font-size: 0.95rem; font-weight: 650; box-shadow: 0 0 0 6px var(--start-soft); transition: box-shadow 150ms ease; }
.primary-action::before { content: ""; flex: none; width: 12px; height: 12px; border-radius: 50%; background: currentColor; }
.primary-action:hover { background: var(--start-hover); box-shadow: 0 0 0 8px var(--start-soft); }
.primary-action.active { border-color: var(--stop); background: var(--stop); box-shadow: 0 0 0 6px var(--stop-soft); }
.primary-action.active:hover { background: var(--stop-hover); box-shadow: 0 0 0 8px var(--stop-soft); }
.primary-action.active::before { border-radius: 2px; }
.alert, .reminder { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; padding: 1rem; border-radius: 1rem; }
.alert { flex-wrap: wrap; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.reminder { margin-top: 1rem; border: 1px solid #777; background: var(--surface-raised); }
.reminder p, .reminder h2 { margin-bottom: 0; }
.reminder p { line-height: 1.5; }
.reminder .icon-button { flex: none; }
.log-section { padding-block: 2rem 1rem; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.section-heading h2 { font-size: 1.35rem; }
.section-heading .danger-text { color: var(--muted); }
.log-columns { display: grid; grid-template-columns: minmax(0, 1fr) 4rem minmax(0, 1fr); gap: 1rem; margin: 1.75rem 0 0.5rem; text-align: center; color: #b5b5b5; font-size: 0.9rem; }
.log-columns small { display: block; margin-top: 0.3rem; color: var(--muted); font-size: 0.65rem; }
.track-label { padding-top: 0.2rem; font-size: 0.65rem; letter-spacing: 0.1em; text-transform: uppercase; }
.record-list { margin: 0; padding: 0; list-style: none; }
.record-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 4rem minmax(0, 1fr); column-gap: 1rem; min-height: 8.25rem; text-align: center; }
.record-card:not(:last-child)::before { content: ""; position: absolute; z-index: -1; left: calc(50% - 9px); top: 2.75rem; width: 18px; height: 8.25rem; background: linear-gradient(90deg, #292929, #3c3c3c, #292929); }
.record-card { isolation: isolate; }
.measurements { display: contents; }
.measurements dd { margin: 0; }
.record-duration { grid-column: 1; grid-row: 1; padding-top: 1.2rem; }
.record-duration dd, .record-frequency dd { font-variant-numeric: tabular-nums; font-size: clamp(1.65rem, 6vw, 2.2rem); letter-spacing: -0.035em; font-weight: 450; }
.record-time { display: block; margin-top: 0.45rem; color: var(--muted); font-size: 0.7rem; font-weight: 400; letter-spacing: 0; }
.record-frequency { grid-column: 3; grid-row: 1; padding-top: 5.1rem; color: #c2c2c2; }
.record-rest { grid-column: 3; grid-row: 2; display: flex; align-items: baseline; justify-content: center; gap: 0.35rem; padding: 0.3rem 0 0.4rem; color: var(--muted); font-size: 0.7rem; }
.record-rest dd { font-variant-numeric: tabular-nums; }
.record-bubble { z-index: 1; grid-column: 2; grid-row: 1; align-self: start; width: 4rem; height: 4rem; margin-top: 0.8rem; padding: 0; border: 1px solid #555; border-radius: 50%; background: #393939; color: var(--ink); font-size: 1.5rem; font-weight: 450; box-shadow: 0 0 24px rgb(255 255 255 / 4%); transition: background 150ms ease; }
.record-card:first-child .record-bubble { background: #f0f0f0; border-color: #f0f0f0; color: #111; }
.record-bubble:hover { background: #555; }
.record-card:first-child .record-bubble:hover { background: #ccc; }
.edit-hint { margin: 1.5rem 0 0; color: var(--muted); font-size: 0.72rem; text-align: center; }
.empty-state { padding: 2.5rem 0.5rem; color: #c2c2c2; text-align: center; }
.empty-state p { margin-bottom: 0.5rem; font-size: 0.9rem; }
.empty-state > span { color: var(--muted); font-size: 0.8rem; }
.empty-track { display: flex; align-items: center; justify-content: center; margin-bottom: 1.25rem; }
.empty-track span { width: 1.6rem; height: 1.6rem; border: 1px solid #555; border-radius: 50%; background: #292929; }
.empty-track span + span { margin-left: 0.65rem; position: relative; }
.empty-track span + span::before { content: ""; position: absolute; width: 0.65rem; height: 2px; top: calc(50% - 1px); right: 100%; background: #555; }
.pattern-card { margin-top: 1rem; padding: 1.4rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.pattern-card > p { margin-bottom: 0.65rem; font-size: 0.85rem; }
.pattern-card > p:last-child { margin-bottom: 0; }
.pattern-card h2 { margin-block: 0.7rem 1rem; font-variant-numeric: tabular-nums; }
.fine-print { color: var(--muted); font-size: 0.8rem; line-height: 1.6; }
.guidance { margin: 1rem 0 2rem; border: 1px solid var(--line); border-radius: var(--radius); }
.guidance summary { padding: 1.2rem; font-size: 0.9rem; font-weight: 550; cursor: pointer; }
.guidance > div { padding: 0 1.2rem 1.2rem; line-height: 1.6; font-size: 0.9rem; }
.offline-status { margin: 1rem auto 2rem; color: var(--muted); font-size: 0.72rem; text-align: center; }
.offline-status::before { content: ""; display: inline-block; width: 5px; height: 5px; margin-right: 0.5rem; border-radius: 50%; background: currentColor; vertical-align: middle; }
.danger-text { color: var(--danger); }
dialog { width: min(calc(100% - 2rem), 32rem); padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-raised); color: var(--ink); box-shadow: 0 24px 80px rgb(0 0 0 / 40%); }
dialog::backdrop { background: rgb(0 0 0 / 72%); backdrop-filter: blur(4px); }
dialog form { padding: 1.5rem; }
.dialog-heading, .dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
dialog form > p { color: var(--muted); font-size: 0.9rem; line-height: 1.5; }
dialog label { display: grid; gap: 0.5rem; margin-top: 1.25rem; font-size: 0.9rem; }
dialog label span { display: flex; align-items: center; gap: 0.5rem; }
dialog input { width: 100%; min-width: 0; min-height: 3rem; padding: 0.65rem; border: 1px solid #606060; border-radius: 0.65rem; background: var(--canvas); color: var(--ink); }
.dialog-actions { margin-top: 1.25rem; }
.primary-button, .secondary-button { min-height: 3rem; padding: 0.65rem 1rem; border-radius: 999px; font-size: 0.9rem; font-weight: 600; }
.primary-button { border: 0; background: var(--ink); color: var(--canvas); }
.secondary-button { border: 1px solid #606060; background: transparent; color: var(--ink); }
.secondary-button.danger-text { color: var(--danger); }
dialog form > .form-error { min-height: 1.3em; margin: 0.8rem 0 0; color: var(--danger); font-size: 0.9rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 35rem) {
  html, body { scrollbar-width: none; }
  html::-webkit-scrollbar, body::-webkit-scrollbar { width: 0; }
  .site-header { padding-block: 1.5rem; }
  .settings-button { flex-direction: column; gap: 0.2rem; padding: 0.6rem; border: 0; font-size: 0.65rem; }
  .summary-card { padding: 1.25rem 0.75rem 1.5rem; }
  .summary-heading { padding-inline: 0.25rem; }
  .summary-heading span { font-size: 0.65rem; }
  .summary-stats { margin-top: 1.25rem; }
  .summary-stats dt { font-size: 0.68rem; }
  .timer-card { flex-direction: column; gap: 1.5rem; padding-block: 1.75rem; text-align: center; }
  .timer-readout { align-items: center; }
  .timer-controls { width: 100%; }
  .primary-action { width: min(100% - 1rem, 20rem); }
  .log-columns, .record-card { column-gap: 0.5rem; grid-template-columns: minmax(0, 1fr) 3.5rem minmax(0, 1fr); }
  .record-bubble { width: 3.5rem; height: 3.5rem; font-size: 1.3rem; }
  .record-time { font-size: 0.62rem; }
  .log-section { padding-top: 1.5rem; }
  .log-columns { margin-top: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

.session-navigation { margin-bottom: 1.5rem; }
.session-navigation label { display: block; }
.session-navigation select { width: 100%; min-height: 3rem; padding: 0.7rem; border: 1px solid var(--line); border-radius: 0.75rem; background: var(--surface); color: var(--ink); font-size: 1rem; }
.session-navigation p { margin: 0.65rem 0 0; }
.session-navigation button { margin-top: 0.75rem; }
button:disabled { cursor: default; opacity: 0.5; }
#finish-hint { max-width: 15rem; text-align: center; font-size: 0.7rem; }
