/* =============================================================
   TimerStopwatch.com — stylesheet
   One file, no framework, no web fonts. Light and dark themes are
   the same set of tokens redefined, so every component follows the
   theme without being named.
   ============================================================= */

:root {
  --bg:            #f6f5f1;
  --surface:       #ffffff;
  --surface-2:     #f2f1ec;
  --surface-3:     #e8e6df;
  --border:        #e3e1d9;
  --border-strong: #cdc9be;
  --text:          #17181c;
  --text-soft:     #464a53;
  --text-mut:      #696d76;
  --brand:         #c2410c;   /* 5.2:1 under white text, 4.8:1 as text on --bg */
  --brand-strong:  #9a3412;
  --brand-soft:    #fdeee4;
  --on-brand:      #ffffff;
  --ring:          #ea580c;   /* a graphic, so 3:1 is the bar: 3.6:1 on white */
  --ring-track:    #ebe8e0;
  --good:          #047857;
  --bad:           #b91c1c;
  --danger:        #dc2626;
  --on-danger:     #ffffff;
  --header-bg:     rgba(246, 245, 241, .86);
  --shadow:        0 1px 2px rgba(23,24,28,.04), 0 12px 32px -14px rgba(23,24,28,.16);
  --shadow-sm:     0 1px 2px rgba(23,24,28,.06);
  --focus:         0 0 0 3px rgba(234, 88, 12, .35);
  --radius-lg:     26px;
  --radius:        16px;
  --radius-sm:     10px;
  --maxw:          1180px;
  --sans:   system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --digits: "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono:   ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;

  /* Phase colours: full-bleed backgrounds under white text, so each is
     at least 4.5:1 against #fff in both themes. */
  --ph-work:     #dc2626;
  --ph-rest:     #047857;
  --ph-warmup:   #1d4ed8;
  --ph-cooldown: #6d28d9;
  --ph-done:     #c2410c;
  --pomo-focus:  #e5484d;
  --pomo-short:  #0d9488;
  --pomo-long:   #2563eb;
  color-scheme: light;
}

/* Dark follows the system unless the visitor has chosen light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #0e1117;
    --surface:       #161a22;
    --surface-2:     #1d222c;
    --surface-3:     #272d39;
    --border:        #2a303c;
    --border-strong: #3b4351;
    --text:          #eceef2;
    --text-soft:     #b9bfca;
    --text-mut:      #9199a6;
    --brand:         #fb923c;
    --brand-strong:  #fdba74;
    --brand-soft:    #2b1c12;
    --on-brand:      #1b0f06;
    --ring:          #fb8a3c;
    --ring-track:    #262c38;
    --good:          #34d399;
    --bad:           #f87171;
    --danger:        #f87171;
    --on-danger:     #1d0707;
    --header-bg:     rgba(14, 17, 23, .82);
    --shadow:        0 1px 2px rgba(0,0,0,.4), 0 14px 36px -16px rgba(0,0,0,.6);
    --shadow-sm:     0 1px 2px rgba(0,0,0,.4);
    --focus:         0 0 0 3px rgba(251, 146, 60, .4);
    --pomo-focus:    #ff6b70;
    --pomo-short:    #2dd4bf;
    --pomo-long:     #60a5fa;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg:            #0e1117;
  --surface:       #161a22;
  --surface-2:     #1d222c;
  --surface-3:     #272d39;
  --border:        #2a303c;
  --border-strong: #3b4351;
  --text:          #eceef2;
  --text-soft:     #b9bfca;
  --text-mut:      #9199a6;
  --brand:         #fb923c;
  --brand-strong:  #fdba74;
  --brand-soft:    #2b1c12;
  --on-brand:      #1b0f06;
  --ring:          #fb8a3c;
  --ring-track:    #262c38;
  --good:          #34d399;
  --bad:           #f87171;
  --danger:        #f87171;
  --on-danger:     #1d0707;
  --header-bg:     rgba(14, 17, 23, .82);
  --shadow:        0 1px 2px rgba(0,0,0,.4), 0 14px 36px -16px rgba(0,0,0,.6);
  --shadow-sm:     0 1px 2px rgba(0,0,0,.4);
  --focus:         0 0 0 3px rgba(251, 146, 60, .4);
  --pomo-focus:    #ff6b70;
  --pomo-short:    #2dd4bf;
  --pomo-long:     #60a5fa;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
/* `hidden` is only a user-agent rule, so any author `display` beats it.
   Enforced once here so markup that says hidden stays hidden. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--brand-strong); }
img, svg { max-width: 100%; }
.icon { flex: none; vertical-align: middle; }

h1, h2, h3 { line-height: 1.18; margin: 0 0 .55em; letter-spacing: -.018em; font-weight: 750; }
h1 { font-size: clamp(2rem, 1.35rem + 2.6vw, 3.1rem); letter-spacing: -.03em; }
h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.8rem); }
h3 { font-size: 1.08rem; letter-spacing: -.01em; }
p { margin: 0 0 1rem; }
code, kbd { font-family: var(--mono); font-size: .88em; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: .05em .35em; word-break: break-word; }
kbd {
  display: inline-block; min-width: 1.7em; padding: .05em .45em; text-align: center;
  background: var(--surface); border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 6px; color: var(--text); line-height: 1.5;
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-mut); }
.small { font-size: .9rem; }
.good { color: var(--good); }
.bad { color: var(--bad); }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
button:focus-visible, .btn:focus-visible, .chip:focus-visible { outline: none; box-shadow: var(--focus); }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--brand); color: var(--on-brand); padding: 10px 16px; border-radius: 10px; font-weight: 700;
}
.skip-link:focus { top: 12px; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 16px; }
.wrap.narrow { max-width: 820px; }
@media (min-width: 720px) { .wrap { padding-inline: 24px; } }
main { display: block; outline: none; }
.noscript { margin-top: 16px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--text); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 12px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 1.12rem; letter-spacing: -.02em; }
.brand:hover { color: var(--text); }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(140deg, #f97316, #c2410c); color: #fff;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.15), 0 4px 12px -4px rgba(234,88,12,.6);
}
.brand-name { font-weight: 600; white-space: nowrap; }
.brand-name b { font-weight: 800; }
.brand-name small { font-size: .78em; font-weight: 600; color: var(--text-mut); }

.site-nav { margin-left: auto; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; }
.site-nav a {
  display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 999px;
  color: var(--text-soft); font-weight: 600; font-size: .94rem; text-decoration: none;
  transition: background .15s, color .15s;
}
.site-nav a:hover { background: var(--surface-2); color: var(--text); }
.site-nav a.active { background: var(--brand-soft); color: var(--brand); }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-soft); cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
/* Light offers dark (a moon); dark offers light (a sun). */
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
}
.nav-toggle { display: none; }
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-menu { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }

@media (max-width: 959px) {
  .site-nav { margin-left: 0; }
  .theme-toggle { margin-left: auto; }
  .nav-toggle { display: inline-grid; }
  .site-nav {
    position: absolute; top: 64px; left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
    display: none; padding: 8px 16px 14px;
  }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; gap: 2px; }
  .site-nav a { padding: 12px 14px; border-radius: 12px; font-size: 1rem; }
  /* Without JS the toggle cannot open anything, so show the links inline. */
  :root:not(.js) .site-nav { position: static; display: block; box-shadow: none; border: 0; padding: 0; background: none; }
  :root:not(.js) .nav-toggle { display: none; }
}
@media (max-width: 380px) { .brand-name small { display: none; } }

/* ---------- Breadcrumbs, headings ---------- */
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 0; padding: 0; font-size: .9rem; color: var(--text-mut); }
.breadcrumbs li + li::before { content: "›"; margin-right: 6px; color: var(--border-strong); }
.breadcrumbs a { color: var(--text-mut); text-decoration: none; }
.breadcrumbs a:hover { color: var(--brand); text-decoration: underline; }

.hero, .page-head { padding: 28px 0 22px; max-width: 860px; }
.hero { padding: 26px 0 16px; text-align: center; margin-inline: auto; }
.hero h1 .amp { color: var(--brand); font-weight: 600; }
.lead { font-size: clamp(1.03rem, .98rem + .3vw, 1.18rem); color: var(--text-soft); margin: 0; max-width: 72ch; }
.hero .lead { margin-inline: auto; }
.answer strong { color: var(--text); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-weight: 650; font-size: .97rem; line-height: 1; white-space: nowrap;
  cursor: pointer; text-decoration: none; user-select: none; -webkit-user-select: none;
  transition: background .15s, border-color .15s, color .15s, transform .08s, box-shadow .15s;
  touch-action: manipulation;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: var(--on-brand); box-shadow: 0 6px 18px -8px rgba(194,65,12,.7); }
.btn-primary:hover:not(:disabled) { background: var(--brand-strong); color: var(--on-brand); }
:root[data-theme="dark"] .btn-primary:hover:not(:disabled) { background: #fdba74; }
.btn-primary.is-pause { background: var(--text); color: var(--surface); box-shadow: none; }
.btn-soft { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-soft:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-strong); color: var(--text); }
.btn-danger { background: var(--danger); color: var(--on-danger); }
.btn-danger:hover { filter: brightness(.94); color: var(--on-danger); }
.btn-xl { height: 58px; padding: 0 30px; font-size: 1.12rem; min-width: 168px; }
.btn-sm { height: 36px; padding: 0 14px; font-size: .9rem; gap: 6px; }
.btn-icon { width: 44px; padding: 0; }
.btn-icon .icon-compress { display: none; }
.btn-icon[aria-pressed="true"] .icon-expand { display: none; }
.btn-icon[aria-pressed="true"] .icon-compress { display: block; }

/* ---------- Tool layout ---------- */
.tool {
  display: grid; gap: 16px; align-items: start;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 960px) {
  .tool { grid-template-columns: minmax(0, 1.4fr) minmax(330px, 1fr); gap: 20px; }
}
.stage, .panel, .card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.card-pad { padding: 24px; }
@media (min-width: 720px) { .card-pad { padding: 32px; } }
.stage {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: 22px 16px 26px; text-align: center; container-type: inline-size;
  min-height: 100%;
}
@media (min-width: 720px) { .stage { padding: 28px 28px 32px; } }
.panel { padding: 20px; display: grid; gap: 18px; align-content: start; }
@media (min-width: 720px) { .panel { padding: 24px; } }
.panel-title { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; margin: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.panel-actions { display: flex; gap: 8px; }
.panel-note { display: flex; gap: 8px; align-items: center; margin: 0; font-size: .9rem; color: var(--text-soft); }

.stage-title { width: 100%; max-width: 520px; }
.stage-title input {
  width: 100%; border: 0; border-bottom: 1px dashed transparent; background: transparent;
  text-align: center; font: inherit; font-size: clamp(1.05rem, 3.6cqi, 1.5rem); font-weight: 650;
  color: var(--text); padding: 4px 8px; border-radius: 8px;
}
.stage-title input::placeholder { color: var(--text-mut); font-weight: 500; }
.stage-title input:hover { border-bottom-color: var(--border-strong); }
.stage-title input:focus { outline: none; background: var(--surface-2); border-bottom-color: var(--brand); }

/* The ring is its own container so the digits inside it scale with the
   ring — in a card, on a phone, or filling a projector in full screen. */
/* Sized by the viewport's height as well as the card's width, so the Start
   button under it is on screen without scrolling on a laptop (the 520px is
   roughly the header, the heading and the controls). svh where supported:
   it ignores a phone's collapsing toolbar. */
.ring { position: relative; width: min(100%, clamp(250px, calc(100vh - 520px), 420px)); aspect-ratio: 1; container-type: inline-size; }
.ring { width: min(100%, clamp(250px, calc(100svh - 520px), 420px)); }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring-track { fill: none; stroke: var(--ring-track); stroke-width: 6.5; }
.ring-bar {
  fill: none; stroke: var(--ring); stroke-width: 6.5; stroke-linecap: round;
  stroke-dasharray: 100; stroke-dashoffset: 0;
  transition: stroke-dashoffset .26s linear, stroke .3s;
}
.ring-bar.is-empty { opacity: 0; }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; gap: 2px; }
.digits {
  font-family: var(--digits); font-variant-numeric: tabular-nums; font-feature-settings: "tnum";
  font-weight: 650; letter-spacing: -.035em; line-height: 1; color: var(--text);
  font-size: clamp(56px, 25cqi, 140px);
}
.ring .digits { font-size: 24cqi; }
.ring .digits.long { font-size: 17.5cqi; }
.digits-sub { color: var(--text-soft); font-size: clamp(.92rem, 4.2cqi, 1.15rem); font-weight: 550; min-height: 1.5em; }
.ring .digits-sub { font-size: max(13px, 4.4cqi); margin-top: 6px; }
.controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.audio-hint { margin: 0; display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--brand); font-weight: 600; }
.alarm-stop { animation: nudge 1s ease-in-out infinite; }

/* Finished: the face turns to the alarm colour and breathes. */
.is-done .ring-bar { stroke: var(--danger); }
.is-done .ring-center .digits { color: var(--danger); }
.is-ringing .stage { animation: ringing 1.1s ease-in-out infinite; }
@keyframes ringing {
  0%, 100% { box-shadow: var(--shadow), 0 0 0 0 rgba(220,38,38,0); }
  50% { box-shadow: var(--shadow), 0 0 0 10px rgba(220,38,38,.22); }
}
@keyframes nudge { 0%, 100% { transform: none; } 50% { transform: scale(1.04); } }
@media (prefers-reduced-motion: reduce) {
  .is-ringing .stage, .alarm-stop { animation: none; }
  .ring-bar { transition: none; }
}

/* ---------- Timer setup ---------- */
.hms { display: flex; align-items: flex-start; justify-content: center; gap: 6px; }
.hms-field { display: grid; justify-items: center; gap: 4px; }
.hms-field input {
  width: 3.1ch; font-family: var(--digits); font-variant-numeric: tabular-nums; font-weight: 650;
  font-size: 2.6rem; line-height: 1.1; text-align: center; padding: 6px 8px; box-sizing: content-box;
  color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px;
}
.hms-field input:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); background: var(--surface); }
.hms-field input:disabled { opacity: .6; }
.hms-field span { font-size: .78rem; color: var(--text-mut); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.hms-sep { font-size: 2.2rem; font-weight: 600; color: var(--text-mut); padding-top: 6px; }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 340px; width: 100%; margin-inline: auto; }
.key {
  height: 52px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font: inherit; font-size: 1.35rem; font-weight: 600; cursor: pointer;
  font-variant-numeric: tabular-nums; touch-action: manipulation;
  display: grid; place-items: center; transition: background .12s, border-color .12s;
}
.key:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-strong); }
.key:active:not(:disabled) { transform: scale(.97); }
.key:disabled { opacity: .45; cursor: not-allowed; }
.key-alt { font-size: .95rem; color: var(--text-soft); }

.chips, .link-chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.chips { justify-content: center; }
.chip {
  display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.chip:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.chip.is-on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.chip:disabled { opacity: .45; cursor: not-allowed; }
.panel.is-locked .hms, .panel.is-locked .keypad, .panel.is-locked .chips { opacity: .55; }

/* ---------- Options ---------- */
.options { display: grid; gap: 14px; padding-top: 16px; border-top: 1px solid var(--border); }
.opt { display: grid; gap: 6px; }
.opt > label, .field > label, .field > .label {
  display: flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 650; color: var(--text-soft);
}
.opt-row { display: flex; gap: 8px; }
.opt-row select { flex: 1; }
select, .field input {
  width: 100%; height: 42px; padding: 0 12px; font: inherit; font-size: .97rem; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
}
select { cursor: pointer; padding-right: 32px; appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
select:focus, .field input:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
input[type="range"] { width: 100%; accent-color: var(--brand); height: 28px; }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: .95rem; position: relative; }
.switch input { position: absolute; opacity: 0; width: 44px; height: 26px; margin: 0; cursor: pointer; }
.switch-ui {
  flex: none; width: 44px; height: 26px; border-radius: 999px; background: var(--surface-3);
  border: 1px solid var(--border-strong); position: relative; transition: background .15s, border-color .15s;
}
.switch-ui::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s;
}
.switch input:checked + .switch-ui { background: var(--brand); border-color: var(--brand); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-ui { box-shadow: var(--focus); }

.form-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 520px) { .form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid .span-2 { grid-column: span 2; } }
.field { display: grid; gap: 6px; }
.field-total output { display: flex; align-items: center; height: 42px; font-family: var(--digits); font-variant-numeric: tabular-nums; font-size: 1.4rem; font-weight: 700; }
.hint { font-size: .86rem; color: var(--text-mut); margin: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* ---------- Shortcuts strip ---------- */
.shortcuts {
  display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; justify-content: center;
  margin: 14px 0 0; font-size: .86rem; color: var(--text-mut);
}
.shortcuts-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; }
@media (hover: none) { .shortcuts { display: none; } }

/* ---------- Home tabs ---------- */
.tabs {
  display: flex; justify-content: center; gap: 4px; margin: 0 auto 14px; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; width: max-content; max-width: 100%;
}
.tabs button {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 22px; border: 0; border-radius: 999px;
  background: transparent; color: var(--text-soft); font: inherit; font-weight: 650; cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }

/* ---------- Stopwatch ---------- */
.sw-face { display: grid; gap: 6px; padding: 18px 0 6px; width: 100%; }
.digits-sw { font-size: clamp(54px, 17cqi, 168px); }
.digits-sw .cs { font-size: .5em; color: var(--text-mut); letter-spacing: -.02em; margin-left: .04em; }
.digits-sw.long { font-size: clamp(44px, 12.5cqi, 140px); }
.lap-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; }
.lap-stats div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px; }
.lap-stats dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-mut); font-weight: 650; }
.lap-stats dd { margin: 0; font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; font-size: .92rem; }
.lap-stats [data-stat="best"] { color: var(--good); }
.lap-stats [data-stat="worst"] { color: var(--bad); }
@media (max-width: 420px) { .lap-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.laps-wrap { max-height: 420px; overflow: auto; border: 1px solid var(--border); border-radius: 14px; }
.laps { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.laps th, .laps td { padding: 9px 12px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.laps th:first-child, .laps td:first-child { text-align: left; }
.laps thead th { position: sticky; top: 0; background: var(--surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-mut); }
.laps tbody tr:last-child td, .laps tbody tr:last-child th { border-bottom: 0; }
.laps td { font-family: var(--mono); font-size: .95rem; }
.laps tbody th { font-weight: 600; }
.laps .is-best td:nth-child(2) { color: var(--good); font-weight: 700; }
.laps .is-worst td:nth-child(2) { color: var(--bad); font-weight: 700; }
.laps .tag { display: inline-block; margin-left: 6px; font-family: var(--sans); font-size: .7rem; font-weight: 700; padding: 1px 6px; border-radius: 999px; vertical-align: 1px; }
.laps .is-best .tag { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.laps .is-worst .tag { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.laps .is-current td, .laps .is-current th { color: var(--text-mut); font-style: italic; }
.empty { margin: 0; color: var(--text-mut); font-size: .92rem; }

/* ---------- Pomodoro ---------- */
.tool-pomodoro .stage { --ring: var(--pomo-focus); }
.tool-pomodoro .stage[data-phase="short"] { --ring: var(--pomo-short); }
.tool-pomodoro .stage[data-phase="long"] { --ring: var(--pomo-long); }
.segmented { display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); max-width: 100%; overflow-x: auto; }
.segmented button {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 999px; border: 0;
  background: transparent; color: var(--text-soft); font: inherit; font-size: .92rem; font-weight: 650; cursor: pointer; white-space: nowrap;
}
.segmented button[aria-pressed="true"] { background: var(--ring); color: #fff; }
:root[data-theme="dark"] .segmented button[aria-pressed="true"] { color: #10131a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .segmented button[aria-pressed="true"] { color: #10131a; } }
/* The Pomodoro face carries a mode switch, a task and the session dots as
   well as the ring, so the ring gives up the difference. */
.tool-pomodoro .ring { width: min(100%, clamp(220px, calc(100vh - 590px), 400px)); }
.tool-pomodoro .ring { width: min(100%, clamp(220px, calc(100svh - 590px), 400px)); }
@media (min-width: 960px) and (max-height: 880px) {
  .stage { gap: 12px; padding-top: 20px; padding-bottom: 22px; }
}
.pomo-dots { display: flex; gap: 8px; list-style: none; margin: -4px 0 0; padding: 0; }
.pomo-dots li { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--ring); opacity: .55; }
.pomo-dots li.is-done { background: var(--ring); opacity: 1; }
.pomo-dots li.is-now { opacity: 1; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 25%, transparent); }
.today { display: flex; align-items: center; gap: 8px; margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-weight: 600; font-size: .93rem; }
.today .icon { color: var(--good); }

/* ---------- Interval ---------- */
.tool-interval .stage { transition: background .35s, color .35s; min-height: 420px; justify-content: center; }
.tool-interval .stage[data-phase="work"],
.tool-interval .stage[data-phase="rest"],
.tool-interval .stage[data-phase="warmup"],
.tool-interval .stage[data-phase="cooldown"],
.tool-interval .stage[data-phase="done"] { color: #fff; border-color: transparent; }
.tool-interval .stage[data-phase="work"]     { background: var(--ph-work); }
.tool-interval .stage[data-phase="rest"]     { background: var(--ph-rest); }
.tool-interval .stage[data-phase="warmup"]   { background: var(--ph-warmup); }
.tool-interval .stage[data-phase="cooldown"] { background: var(--ph-cooldown); }
.tool-interval .stage[data-phase="done"]     { background: var(--ph-done); }
.tool-interval .stage:not([data-phase="ready"]) .digits,
.tool-interval .stage:not([data-phase="ready"]) .digits-sub,
.tool-interval .stage:not([data-phase="ready"]) .int-meta { color: #fff; }
.tool-interval .stage:not([data-phase="ready"]) .btn-soft { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.28); color: #fff; }
.tool-interval .stage:not([data-phase="ready"]) .btn-soft:hover:not(:disabled) { background: rgba(255,255,255,.26); }
.tool-interval .stage:not([data-phase="ready"]) .btn-primary { background: #fff; color: #17181c; box-shadow: none; }
.tool-interval .stage:not([data-phase="ready"]) .btn-primary.is-pause { background: rgba(0,0,0,.28); color: #fff; }
.tool-interval .stage:not([data-phase="ready"]) .audio-hint { color: #fff; }
.phase-name { font-size: clamp(1.4rem, 7cqi, 3.2rem); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.tool-interval .digits { font-size: clamp(72px, 28cqi, 230px); }
.tool-interval .digits.long { font-size: clamp(56px, 19cqi, 170px); }
.int-track { width: min(100%, 560px); height: 10px; border-radius: 999px; background: color-mix(in srgb, currentColor 18%, transparent); overflow: hidden; }
.tool-interval .stage[data-phase="ready"] .int-track { background: var(--surface-3); }
.int-bar { height: 100%; width: 0; border-radius: inherit; background: currentColor; transition: width .25s linear; }
.tool-interval .stage[data-phase="ready"] .int-bar { background: var(--ring); }
.int-meta { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; font-weight: 600; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.preset-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 520px) and (max-width: 959px) { .preset-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.preset {
  display: grid; gap: 2px; text-align: left; padding: 10px 12px; border-radius: 14px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font: inherit;
}
.preset b { font-size: .95rem; }
.preset small { font-size: .78rem; color: var(--text-mut); }
.preset:hover { border-color: var(--brand); }
.preset.is-on { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }

/* ---------- Countdown ---------- */
.tool-countdown { grid-template-columns: minmax(0, 1fr) !important; }
.cd-stage { padding-block: 34px 30px; }
.cd-eyebrow { margin: 0; display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); }
.cd-title { margin: 0; font-size: clamp(1.6rem, 6cqi, 3.4rem); letter-spacing: -.03em; overflow-wrap: anywhere; }
.cd-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(8px, 2cqi, 18px); width: min(100%, 860px); }
.cd-tile { display: grid; gap: 4px; padding: clamp(12px, 3cqi, 26px) 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: clamp(14px, 3cqi, 24px); }
.cd-num { font-family: var(--digits); font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: -.04em; font-size: clamp(2.1rem, 11cqi, 7rem); line-height: 1; }
.cd-unit { font-size: clamp(.7rem, 2.2cqi, 1rem); text-transform: uppercase; letter-spacing: .08em; color: var(--text-mut); font-weight: 700; }
.cd-when { margin: 0; color: var(--text-soft); font-weight: 600; }
.cd-done { margin: 0; font-size: 1.3rem; font-weight: 750; color: var(--brand); }
.cd-stage[data-today] .cd-tiles { opacity: .45; }

/* ---------- Full screen ----------
   Two separate rules on purpose: a selector list containing a pseudo-class
   the browser does not know is dropped whole, so ":fullscreen,
   :-webkit-full-screen" would style nothing in either. */
.stage:fullscreen {
  width: 100vw; height: 100vh; max-width: none; border-radius: 0; border: 0; box-shadow: none;
  justify-content: center; gap: 3vh; padding: 4vh 4vw; background: var(--bg); overflow: auto;
}
.stage:-webkit-full-screen {
  width: 100vw; height: 100vh; max-width: none; border-radius: 0; border: 0; box-shadow: none;
  justify-content: center; gap: 3vh; padding: 4vh 4vw; background: var(--bg); overflow: auto;
}
.stage:fullscreen .ring { width: min(78vh, 88vw); }
.stage:-webkit-full-screen .ring { width: min(78vh, 88vw); }
.stage:fullscreen .digits-sw { font-size: min(19vw, 32vh); }
.stage:-webkit-full-screen .digits-sw { font-size: min(19vw, 32vh); }
.tool-interval .stage:fullscreen .digits { font-size: min(30vw, 44vh); }
.tool-interval .stage:-webkit-full-screen .digits { font-size: min(30vw, 44vh); }
.tool-interval .stage:fullscreen[data-phase="ready"] { background: var(--bg); }
.tool-interval .stage:-webkit-full-screen[data-phase="ready"] { background: var(--bg); }
.stage:fullscreen .stage-title input:placeholder-shown { display: none; }
.stage:-webkit-full-screen .stage-title input:placeholder-shown { display: none; }
.cd-stage:fullscreen .cd-tiles { width: min(92vw, 1400px); }
.cd-stage:-webkit-full-screen .cd-tiles { width: min(92vw, 1400px); }
.stage::backdrop { background: var(--bg); }

/* ---------- Content sections ---------- */
.section { margin-top: 56px; }
.section > h2 { margin-bottom: .45em; }
.section > .muted { margin-top: -.2em; }
.two-col { display: grid; gap: 0 40px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.prose { max-width: 78ch; }
.prose p, .prose li { color: var(--text-soft); }
.prose strong { color: var(--text); }
.prose ul { padding-left: 1.2em; margin: 0 0 1rem; }
.prose li { margin-bottom: .45em; }
.prose h2 { font-size: 1.35rem; margin-top: 1.6em; }
.prose h2:first-child { margin-top: 0; }
.card.prose { max-width: none; }

.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 14px; }
.steps li { counter-increment: step; position: relative; padding: 16px 18px 16px 64px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.steps li::before {
  content: counter(step); position: absolute; left: 16px; top: 16px; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 800;
}
.steps h3 { margin: 4px 0 4px; font-size: 1.02rem; }
.steps p { margin: 0; color: var(--text-soft); font-size: .96rem; }

.facts { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; font-variant-numeric: tabular-nums; }
.facts th, .facts td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.facts tbody tr:last-child th, .facts tbody tr:last-child td { border-bottom: 0; }
.facts thead th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-mut); }
.facts tbody th { font-weight: 600; color: var(--text-soft); width: 42%; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.table-wrap .facts tbody th { width: auto; }
.table-wrap .facts { min-width: 560px; }

.ticks { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 8px; }
.ticks li { position: relative; padding-left: 28px; color: var(--text-soft); }
.ticks li::before { content: ""; position: absolute; left: 4px; top: .45em; width: 12px; height: 7px; border-left: 2.5px solid var(--good); border-bottom: 2.5px solid var(--good); transform: rotate(-45deg); }
.neighbours { display: flex; flex-wrap: wrap; gap: 10px; }

.use-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 600px) { .use-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) { .use-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.use-grid li { display: flex; gap: 10px; align-items: center; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); font-weight: 550; }
.use-grid .icon { color: var(--good); }

.feature-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 980px) { .feature-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.feature { padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.feature-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: var(--brand-soft); color: var(--brand); margin-bottom: 12px; }
.feature h3 { margin-bottom: .35em; }
.feature p { margin: 0; color: var(--text-soft); font-size: .96rem; }

.card-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 980px) { .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tool-card {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  transition: border-color .15s, box-shadow .15s;
}
.tool-card:hover { color: var(--text); border-color: var(--brand); box-shadow: var(--shadow); }
.tool-card.is-on { border-color: var(--brand); background: var(--brand-soft); }
.tool-card-icon { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); }
.tool-card-body { display: grid; gap: 2px; flex: 1; min-width: 0; }
.tool-card-body b { font-size: 1.02rem; }
.tool-card-body span { color: var(--text-soft); font-size: .9rem; line-height: 1.45; }
.tool-card > .icon-arrow { color: var(--text-mut); transition: transform .15s, color .15s; }
.tool-card:hover > .icon-arrow { color: var(--brand); transform: translateX(3px); }

.preset-groups { display: grid; gap: 18px; }
@media (min-width: 900px) { .preset-groups { grid-template-columns: 1fr 2fr 1.2fr; } }
.preset-group h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-mut); margin-bottom: 10px; }

.faq-list { display: grid; gap: 10px; max-width: 900px; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.faq-item summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; cursor: pointer; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::marker { content: ""; }
.faq-item summary h3 { margin: 0; font-size: 1.02rem; }
.faq-item summary .icon { color: var(--text-mut); transition: transform .2s; }
.faq-item[open] summary .icon { transform: rotate(180deg); }
.faq-item summary:hover h3 { color: var(--brand); }
.faq-a { padding: 0 20px 16px; }
.faq-a p { margin: 0; color: var(--text-soft); }

.share-box {
  display: grid; gap: 16px; padding: 24px; border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--brand-soft), var(--surface) 70%); border: 1px solid var(--border);
}
@media (min-width: 900px) { .share-box { grid-template-columns: 1fr 1.4fr; align-items: center; } }
.share-box h2 { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; margin-bottom: .3em; }
.share-box p { margin: 0; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.notice { display: flex; gap: 10px; align-items: flex-start; margin-top: 40px; padding: 14px 18px; border-radius: var(--radius); background: var(--brand-soft); color: var(--text-soft); font-size: .95rem; }
.notice .icon { color: var(--brand); margin-top: 2px; }
.updated { margin: 40px 0 0; font-size: .86rem; color: var(--text-mut); }
.contact-mail { display: flex; align-items: center; gap: 10px; font-size: 1.25rem; font-weight: 650; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 80px; padding: 48px 0 28px; background: var(--surface); border-top: 1px solid var(--border); }
.footer-grid { display: grid; gap: 32px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; } }
.footer-brand p { color: var(--text-soft); font-size: .94rem; margin: 14px 0; max-width: 40ch; }
.footer-badges { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: .88rem; color: var(--text-soft); }
.footer-badges li { display: flex; align-items: center; gap: 8px; }
.footer-badges .icon { color: var(--good); }
.site-footer h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-mut); margin-bottom: 12px; }
.footer-col ul, .footer-family ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 7px; }
.footer-col a, .footer-family a { color: var(--text-soft); text-decoration: none; font-size: .93rem; }
.footer-col a:hover, .footer-family a:hover { color: var(--brand); text-decoration: underline; }
.footer-family { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--border); }
.footer-family ul { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin-top: 28px; font-size: .86rem; color: var(--text-mut); }
.footer-bottom p { margin: 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 16px); opacity: 0; max-width: calc(100vw - 32px);
  background: var(--text); color: var(--surface); padding: 12px 18px; border-radius: 14px;
  font-weight: 600; font-size: .94rem; box-shadow: 0 12px 30px -10px rgba(0,0,0,.45);
  transition: opacity .2s, transform .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Print: the face and the facts, nothing else ---------- */
@media print {
  .site-header, .site-footer, .controls, .panel, .shortcuts, .share, .tabs, .toast { display: none !important; }
  body { background: #fff; color: #000; }
  .stage, .card, .faq-item, .feature, .steps li { box-shadow: none; border-color: #ccc; }
  .faq-item:not([open]) .faq-a { display: block; }
}
