/* ==========================================================================
   Dashboard design system
   1. tokens (primitives + semantic, dark default, light option)
   2. base / a11y   3. layout   4. header   5. now card   6. timer hero
   7. to-do   8. popups   9. mini / PiP   10. responsive   11. motion prefs
   Research notes: docs/UI-RESEARCH.md
   ========================================================================== */

/* ---------- 1. tokens ---------- */
:root {
  /* spacing (4px grid) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;
  /* radii */
  --r-sm: 10px; --r-md: 14px; --r-lg: 22px; --r-pill: 999px;
  /* touch targets: Apple 44pt, Material 48dp (bumped on coarse pointers below) */
  --hit: 44px;
  /* type scale */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --fs-xs: .75rem; --fs-sm: .875rem; --fs-md: 1rem; --fs-lg: 1.125rem; --fs-xl: 1.375rem;
  --fs-now: clamp(1.625rem, 1.1rem + 2.1vw, 2.75rem);
  --fs-timer: clamp(3.75rem, 2.4rem + 7vw, 6.5rem); /* fallback; overridden with container units below */
  --fw-regular: 400; --fw-medium: 500; --fw-semibold: 600; --fw-bold: 700;
  /* motion */
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --dur-1: 120ms; --dur-2: 220ms; --dur-3: 420ms;
  /* safe areas */
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
/* dark (default) */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1117;          /* page */
  --surface: #151b24;     /* cards */
  --surface-2: #1c2431;   /* controls, inputs, hover */
  --surface-3: #263143;   /* pressed, ring track */
  --border: #2a3545;      /* hairlines */
  --border-strong: #5b6a82; /* control boundaries (>=3:1 on surface) */
  --text: #eef2f7;        /* primary */
  --text-2: #b9c4d3;      /* secondary */
  --text-3: #8f9cb0;      /* tertiary / meta (still >= 4.5:1) */
  --accent: #7db4ff; --on-accent: #08111f;
  --ok: #4ade80; --on-ok: #06210f;
  --warn: #fbbf24; --bad: #ff7b7b; --brk: #5cc8ff;
  --focus: #a8cdff;
  --timer-l: 62%;         /* lightness of the pressure colour */
  --shadow-pop: 0 12px 36px rgba(0, 0, 0, .55);
  --shadow-drag: 0 14px 32px rgba(0, 0, 0, .6);
  --tint: 9%;             /* how much timer colour tints the hero card */
}
/* light (option) */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f9; --surface: #ffffff; --surface-2: #eef1f6; --surface-3: #dfe5ee;
  --border: #dbe1ea; --border-strong: #7a8699;
  --text: #121821; --text-2: #424e61; --text-3: #566274;
  --accent: #1d5fd1; --on-accent: #ffffff;
  --ok: #15803d; --on-ok: #ffffff;
  --warn: #a15c00; --bad: #b3261e; --brk: #0b6fa0;
  --focus: #1d5fd1;
  --timer-l: 30%;
  --shadow-pop: 0 12px 32px rgba(20, 30, 50, .22);
  --shadow-drag: 0 12px 28px rgba(20, 30, 50, .25);
  --tint: 7%;
}
@media (pointer: coarse) { :root { --hit: 48px; } }
@media (prefers-contrast: more) {
  :root, :root[data-theme] { --border: var(--border-strong); --text-3: var(--text-2); }
}

/* ---------- 2. base / a11y ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: var(--fw-regular) var(--fs-md)/1.45 var(--font); min-height: 100%; -webkit-text-size-adjust: 100%; }
body { padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l); overscroll-behavior-y: none; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input { font: inherit; color: var(--text); }
h1, h2 { margin: 0; }
.muted { color: var(--text-3); } .small { font-size: var(--fs-sm); } .center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.skip { position: absolute; left: var(--s-3); top: -80px; z-index: 100; background: var(--accent); color: var(--on-accent); padding: var(--s-2) var(--s-4); border-radius: var(--r-sm); font-weight: var(--fw-semibold); }
.skip:focus { top: var(--s-3); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
#timer-card:focus:not(:focus-visible) { outline: none; }
.link { color: var(--accent); font-size: var(--fs-sm); font-weight: var(--fw-medium); min-height: var(--hit); padding: 0 var(--s-3); border-radius: var(--r-sm); }
.link:hover { text-decoration: underline; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: var(--fs-xs); color: var(--text-2); font-weight: var(--fw-semibold); }

/* controls */
.btn { min-height: var(--hit); min-width: var(--hit); padding: 0 var(--s-5); border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-weight: var(--fw-semibold); transition: background var(--dur-1), transform var(--dur-1) var(--ease-out); }
.btn:hover { background: var(--surface-3); } .btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn.primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.lg { min-height: calc(var(--hit) + 8px); padding: 0 var(--s-8); font-size: var(--fs-lg); }
input.label-in, .add-form input, .custom input, .login-card input, .edit { background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--r-md); min-height: var(--hit); padding: 0 var(--s-4); }
input::placeholder { color: var(--text-3); opacity: 1; }
input:focus-visible { outline-offset: 0; border-color: var(--focus); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--s-6); }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-8); display: grid; gap: var(--s-4); text-align: center; box-shadow: var(--shadow-pop); }
.login-card h1 { font-size: var(--fs-xl); font-weight: var(--fw-bold); }
.login-card p { margin: 0; }
.login-card .logo { width: 64px; height: 64px; margin: 0 auto; border-radius: 16px; background: url(/icons/icon-192.png) center/cover; }
.login-card input { font-size: var(--fs-lg); text-align: center; min-height: 52px; }
.err { color: var(--bad); min-height: 1.3em; font-size: var(--fs-sm); }

/* ---------- 4. header ---------- */
.top { display: flex; align-items: center; justify-content: space-between; padding: var(--s-3) var(--s-5) var(--s-1); gap: var(--s-2); max-width: 1400px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: var(--s-2); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-3); display: inline-block; }
.dot.live { background: var(--ok); } .dot.degraded { background: var(--warn); } .dot.poll { background: var(--warn); } .dot.off { background: var(--bad); }
.top-actions { display: flex; gap: var(--s-1); align-items: center; }
.icon-btn, .pill-btn { height: var(--hit); border-radius: var(--r-md); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); transition: background var(--dur-1), color var(--dur-1); }
.icon-btn { width: var(--hit); }
.pill-btn { padding: 0 var(--s-4) 0 var(--s-3); font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.icon-btn:hover, .pill-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.on { color: var(--ok); }
.icon-btn[aria-pressed="false"] { color: var(--text-3); }
.tip { margin: var(--s-2) var(--s-5); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border); font-size: var(--fs-sm); display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }

/* ---------- 3. layout ---------- */
.grid { display: grid; gap: var(--s-4); padding: var(--s-3) var(--s-5) var(--s-8); max-width: 1400px; margin: 0 auto; grid-template-columns: 1fr; grid-template-areas: "now" "timer" "todo"; }
.now { grid-area: now; } .timer { grid-area: timer; } .todo { grid-area: todo; }
@media (min-width: 640px) { .grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "now now" "timer todo"; align-items: start; } }
@media (min-width: 1000px) { .grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); grid-template-areas: "now todo" "timer todo"; padding: var(--s-4) var(--s-8) var(--s-10); gap: var(--s-5) var(--s-6); } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-5) var(--s-6); position: relative; overflow: hidden; }
.card-h { display: flex; align-items: center; justify-content: space-between; min-height: 28px; margin-bottom: var(--s-2); }

/* ---------- 5. now card (secondary headline) ---------- */
.now { padding-left: calc(var(--s-6) + 4px); }
.now::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.now-text { position: relative; min-height: 1.3em; font-size: var(--fs-now); font-weight: var(--fw-bold); line-height: 1.15; letter-spacing: -.015em; overflow-wrap: anywhere; text-wrap: balance; }
.now-line.empty { color: var(--text-3); font-weight: var(--fw-regular); font-size: var(--fs-lg); letter-spacing: 0; padding-top: .4em; }
.now-line.enter { animation: nowIn var(--dur-3) var(--ease-out) both; }
.now-line.leave { position: absolute; inset: 0 0 auto 0; animation: nowOut var(--dur-2) ease-in both; }
@keyframes nowIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes nowOut { to { opacity: 0; transform: translateY(-10px); } }
.now.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 0 transparent; } 100% { box-shadow: inset 0 0 0 0 transparent; } }
.now-meta { margin-top: var(--s-2); font-size: var(--fs-sm); min-height: 1.4em; }
.now .link { margin: calc(var(--s-3) * -1) calc(var(--s-3) * -1) 0 0; }

/* ---------- 6. timer hero ---------- */
.timer {
  --hue: 215; --c: hsl(var(--hue) 78% var(--timer-l));
  container: timer / inline-size;
  display: grid; justify-items: center; gap: var(--s-4); padding: var(--s-8) var(--s-5) var(--s-6);
  transition: background var(--dur-3), border-color var(--dur-3);
  border-color: color-mix(in srgb, var(--c) 45%, var(--border));
  background: color-mix(in srgb, var(--c) var(--tint), var(--surface));
}
.timer[data-phase="idle"] { --c: var(--text-3); background: var(--surface); border-color: var(--border); }
.timer[data-mode="break"][data-phase="running"], .timer[data-mode="break"][data-phase="paused"] { --c: var(--brk); }
.ring-wrap { position: relative; width: min(100%, 360px); aspect-ratio: 1; container-type: inline-size; }
.ring { width: 100%; height: 100%; }
.ring .track { fill: none; stroke: var(--surface-3); stroke-width: 8; }
.ring .prog { fill: none; stroke: var(--c); stroke-width: 8; stroke-linecap: round; transition: stroke var(--dur-3); }
.timer[data-phase="idle"] .ring .prog { stroke: transparent; }
.digits { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.t-time { font-size: var(--fs-timer); font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; letter-spacing: -.025em; line-height: 1; color: var(--text); white-space: nowrap; }
@supports (font-size: 1cqw) {
  .t-time { font-size: 27cqw; }
  .timer[data-len="6"] .t-time { font-size: 22cqw; }
  .timer[data-len="7"] .t-time, .timer[data-len="8"] .t-time { font-size: 17.5cqw; }
}
.timer[data-phase="running"] .t-time, .timer[data-phase="overrun"] .t-time, .timer[data-phase="paused"] .t-time { color: var(--c); }
.timer[data-phase="paused"] .t-time { opacity: .8; }
.timer[data-phase="idle"] .t-time { color: var(--text-3); }
.t-sub { margin-top: var(--s-3); text-transform: uppercase; letter-spacing: .16em; font-size: var(--fs-sm); color: var(--text-2); font-weight: var(--fw-semibold); }
.t-label { min-height: 1.5em; text-align: center; font-size: var(--fs-lg); font-weight: var(--fw-semibold); max-width: 100%; overflow-wrap: anywhere; padding: 0 var(--s-2); text-wrap: balance; }
.t-controls { display: grid; gap: var(--s-3); justify-items: center; width: 100%; }
.t-controls > * { max-width: 100%; }
.t-controls:not(:has(.presets)) { display: flex; flex-wrap: wrap; justify-content: center; }
.t-controls .btn:not(.preset):not(.primary) { min-width: 72px; }
.t-controls .presets { display: flex; gap: var(--s-2); flex-wrap: wrap; justify-content: center; }
.preset { min-width: 64px; }
.preset.focus::after { content: " min"; font-weight: var(--fw-regular); color: var(--text-2); font-size: .85em; }
.preset.focus:first-child { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.preset.focus:first-child::after { color: var(--on-accent); }
.preset.brk { color: var(--brk); }
.label-in { width: min(380px, 100%); text-align: center; }
.custom { display: flex; gap: var(--s-2); } .custom input { width: 88px; text-align: center; }
.t-stats { margin-top: 0; text-align: center; }
/* pressure cues: colour + text always; motion only as a gentle extra (see reduced-motion block) */
.timer[data-phase="running"][data-level="urgent"] .ring-wrap { animation: breathe 2s ease-in-out infinite; }
.timer[data-phase="running"][data-level="critical"] .ring-wrap { animation: breathe 1.2s ease-in-out infinite; }
.timer[data-phase="overrun"] { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--surface)); animation: overrunGlow 2.4s ease-in-out infinite; }
.timer[data-phase="overrun"][data-mode="break"] { animation: none; border-color: var(--c); background: color-mix(in srgb, var(--c) var(--tint), var(--surface)); }
.timer[data-phase="overrun"] .ring .prog { stroke: var(--bad); }
.timer[data-phase="overrun"]:not([data-mode="break"]) .ring .track { stroke: color-mix(in srgb, var(--bad) 60%, var(--surface-3)); }
.timer[data-phase="overrun"] .t-time, .timer[data-phase="overrun"] .t-sub { color: var(--bad); }
.timer[data-phase="overrun"] .t-sub { font-weight: var(--fw-bold); }
.timer[data-phase="overrun"][data-mode="break"] .t-time { color: var(--c); } .timer[data-phase="overrun"][data-mode="break"] .t-sub { color: var(--text-2); } .timer[data-phase="overrun"][data-mode="break"] .ring .prog { stroke: var(--c); }
@keyframes breathe { 50% { transform: scale(1.015); } }
@keyframes overrunGlow { 50% { background: color-mix(in srgb, var(--bad) 22%, var(--surface)); } }

/* ---------- 7. to-do ---------- */
.todo { min-height: 360px; padding-left: var(--s-4); padding-right: var(--s-4); }
.todo .card-h { padding: 0 var(--s-2); }
.add-form { display: flex; gap: var(--s-2); margin: var(--s-2) 0 var(--s-3); }
.add-form input { flex: 1; min-width: 0; }
.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.item { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto auto; grid-template-areas: "h c t b g d"; align-items: start; column-gap: var(--s-1); border-radius: var(--r-md); padding: var(--s-1) var(--s-1) var(--s-1) 0; position: relative; touch-action: manipulation; transition: background var(--dur-1); }
.item + .item::before { content: ""; position: absolute; left: 76px; right: 8px; top: 0; height: 1px; background: var(--border); }
.item:hover { background: var(--surface-2); }
.item:hover::before, .item:hover + .item::before { opacity: 0; }
.item.enter { animation: itemIn var(--dur-3) var(--ease-out); } @keyframes itemIn { from { opacity: 0; transform: translateX(-14px); } }
.item.hl { animation: hl 2.2s ease-out; } @keyframes hl { 0% { background: color-mix(in srgb, var(--accent) 28%, var(--surface)); } 100% { background: transparent; } }
.item.is-now { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.item.is-now::before, .item.is-now + .item::before { opacity: 0; }
.item.is-now .text { font-weight: var(--fw-semibold); }
.item.done { grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "c t b d"; padding-left: var(--s-2); }
.item.checking { opacity: .5; transition: opacity var(--dur-2); } .item.checking .text { text-decoration: line-through; }
.item.dragging { z-index: 5; box-shadow: var(--shadow-drag); background: var(--surface-3); transition: none; }
.handle { grid-area: h; color: var(--text-3); width: 28px; height: var(--hit); letter-spacing: -2px; touch-action: none; cursor: grab; flex: none; border-radius: var(--r-sm); opacity: .7; }
.item:hover .handle, .handle:focus-visible { opacity: 1; } .handle:active { cursor: grabbing; }
.check { grid-area: c; width: var(--hit); height: var(--hit); flex: none; position: relative; border-radius: 50%; }
.check::before { content: ""; position: absolute; inset: 0; margin: auto; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border-strong); transition: background var(--dur-2), border-color var(--dur-2); }
.check:hover::before { border-color: var(--accent); }
.check.on::before { background: var(--text-3); border-color: var(--text-3); }
.check.on::after { content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 8px; border-left: 2.5px solid var(--bg); border-bottom: 2.5px solid var(--bg); transform: translateY(-2px) rotate(-45deg); }
.check:not(.on).checking::before, .item.checking .check::before { background: var(--ok); border-color: var(--ok); }
.text { grid-area: t; min-width: 0; overflow-wrap: anywhere; word-break: break-word; hyphens: auto; line-height: 22px; padding: 11px var(--s-2); cursor: text; font-size: var(--fs-md); }
.item.done .text { text-decoration: line-through; color: var(--text-3); }
.edit { grid-area: t; min-width: 0; width: 100%; border-color: var(--accent); }
.by { grid-area: b; align-self: start; margin-top: 12px; font-size: var(--fs-xs); font-weight: var(--fw-medium); line-height: 20px; padding: 0 var(--s-2); border-radius: var(--r-pill); background: var(--surface-3); color: var(--text-2); flex: none; }
.act { width: var(--hit); height: var(--hit); border-radius: var(--r-md); color: var(--text-3); flex: none; display: inline-flex; align-items: center; justify-content: center; transition: background var(--dur-1), color var(--dur-1); }
.act .ico { width: 20px; height: 20px; }
.act.go { grid-area: g; color: var(--accent); } .act.del { grid-area: d; }
.act:hover { background: var(--surface-3); } .act.del:hover { color: var(--bad); }
.empty { color: var(--text-3); text-align: center; padding: var(--s-6) var(--s-2); }
.done-wrap { margin-top: var(--s-4); } .done-wrap summary { cursor: pointer; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--hit); padding: 0 var(--s-2); border-radius: var(--r-sm); }
.done-wrap .items { margin-top: var(--s-1); }

/* ---------- 8. popups ---------- */
.popups { position: fixed; top: calc(var(--safe-t) + var(--s-3)); left: 0; right: 0; display: grid; justify-items: center; gap: var(--s-2); pointer-events: none; z-index: 50; padding: 0 var(--s-3); }
.popup { pointer-events: auto; background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); border-radius: var(--r-md); padding: var(--s-3) var(--s-5); min-width: min(340px, 94vw); max-width: min(560px, 96vw); animation: popIn var(--dur-3) var(--ease-out) both; }
.popup.out { animation: popOut var(--dur-2) ease-in both; }
.popup.alarm { border-color: var(--bad); box-shadow: var(--shadow-pop), inset 4px 0 0 var(--bad); }
.popup-title { font-weight: var(--fw-bold); } .popup-body { font-size: var(--fs-lg); margin-top: 2px; overflow-wrap: anywhere; } .popup-by { color: var(--text-3); font-size: var(--fs-xs); margin-top: 2px; }
@keyframes popIn { from { opacity: 0; transform: translateY(-16px); } } @keyframes popOut { to { opacity: 0; transform: translateY(-10px); } }

/* ---------- 9. mini / Document Picture-in-Picture ---------- */
body.pip { padding: var(--s-3); background: var(--bg); min-height: 100vh; }
.mini {
  --hue: 215; --c: hsl(var(--hue) 78% var(--timer-l));
  container-type: inline-size; display: grid; gap: var(--s-2); text-align: center; border-radius: var(--r-lg); padding: var(--s-4) var(--s-3) var(--s-3);
  background: color-mix(in srgb, var(--c) var(--tint), var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 45%, var(--border));
}
.mini[data-phase="idle"] { --c: var(--text-3); background: var(--surface); border-color: var(--border); }
.mini-time { font-size: clamp(2.75rem, 24cqw, 6.5rem); font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; color: var(--c); line-height: 1; letter-spacing: -.025em; white-space: nowrap; }
.mini[data-phase="overrun"] { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, var(--surface)); } .mini[data-phase="overrun"] .mini-time, .mini[data-phase="overrun"] .mini-sub { color: var(--bad); }
.mini[data-phase="overrun"][data-level="overrun"]:not([data-mode="break"]) { animation: overrunGlow 2.4s ease-in-out infinite; }
.mini-sub { font-size: var(--fs-xs); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: .12em; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-now { font-weight: var(--fw-bold); font-size: var(--fs-lg); line-height: 1.25; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; } .mini-now.empty { color: var(--text-3); font-weight: var(--fw-regular); font-size: var(--fs-md); }
.mini-list { list-style: none; padding: 0; margin: var(--s-1) 0 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; text-align: left; }
.mini-item { display: flex; gap: var(--s-1); align-items: center; border-radius: var(--r-sm); font-size: var(--fs-sm); min-height: var(--hit); } .mini-item.empty { color: var(--text-3); justify-content: center; }
.mini-item-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mini-check { width: var(--hit); height: var(--hit); flex: none; position: relative; border-radius: 50%; }
.mini-check::before { content: ""; position: absolute; inset: 0; margin: auto; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong); }
.mini-check:hover::before { border-color: var(--accent); }
.mini-ctl { display: flex; gap: var(--s-2); justify-content: center; margin-top: var(--s-1); flex-wrap: wrap; }
.mini-btn { min-height: var(--hit); min-width: var(--hit); padding: 0 var(--s-4); border-radius: var(--r-md); background: var(--surface-2); color: var(--text); border: 1px solid var(--border); font-weight: var(--fw-bold); }
.mini-btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.mini-btn.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); } .mini-btn.ghost:hover { background: var(--surface-3); }
/* shrinking the floating window progressively drops detail, never the time */
@media (max-height: 380px) { .mini-list { display: none; } }
@media (max-height: 260px) { .mini-now { display: none; } body.pip { padding: var(--s-2); } .mini { padding: var(--s-3) var(--s-2) var(--s-2); } }
@media (max-height: 170px) { .mini-ctl, .mini-sub { display: none; } .mini { padding: var(--s-2); } .mini-time { font-size: clamp(2rem, 36vh, 6.5rem); } }

/* ---------- 10. responsive ---------- */
@media (max-width: 999px) {
  .item { grid-template-columns: auto auto minmax(0, 1fr) auto auto; grid-template-areas: "h c t g d" ". . b . ."; }
  .item.done { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "c t d" ". b ."; }
  .by { justify-self: start; margin: -4px 0 var(--s-2) var(--s-2); }
  .by[hidden] { display: none; }
  .item + .item::before { left: 72px; }
}
@media (max-width: 480px) {
  .top { padding: var(--s-2) var(--s-3) 0; } .grid { padding: var(--s-2) var(--s-3) var(--s-6); gap: var(--s-3); }
  .card { padding: var(--s-4); } .now { padding-left: calc(var(--s-4) + 4px); } .todo { padding-left: var(--s-2); padding-right: var(--s-2); }
  .timer { padding: var(--s-5) var(--s-3) var(--s-4); gap: var(--s-3); }
  .pill-btn { display: none; } .ring-wrap { width: min(100%, 300px); }
  .handle { width: 24px; } .item { column-gap: 0; }
}
@media (max-width: 760px) { .pill-btn .lbl { display: none; } .pill-btn { padding: 0; width: var(--hit); } }

/* narrow timer card (phone, iPad portrait columns): big primary button on its own row, secondary row beneath */
@container timer (max-width: 420px) {
  .t-controls:not(:has(.presets)) { flex-wrap: wrap; }
  .t-controls:not(:has(.presets)) .btn { flex: 1 1 0; min-width: 0; padding: 0 var(--s-2); }
  .t-controls .btn.lg { flex: 1 0 100%; }
}

/* ---------- 11. motion preferences ----------
   Status is always carried by colour + text, so removing motion loses nothing.
   Replace movement with a plain highlight fade (no transform). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .item.hl { animation: hlFade 2.2s linear !important; }
  .now.flash { animation: hlFade 1.2s linear !important; }
  @keyframes hlFade { 0% { background-color: color-mix(in srgb, var(--accent) 28%, transparent); } 100% { background-color: transparent; } }
}

.build-stamp{text-align:center;padding:14px 0 calc(14px + env(safe-area-inset-bottom));opacity:.55;font-size:11px;letter-spacing:.02em;user-select:all}
