/* Rode Taak — Swiss-stijl: warm zand / zwart, rood als enige accent, grote koppen.
   Licht/donker volgt automatisch het systeem (prefers-color-scheme).
   Geen externe fonts of CDN: de app moet ook offline werken. */

:root {
  color-scheme: light dark;
  --bg: #E7E3D8;
  --card: #F3F0E8;
  --card-2: #DCD7CA;
  --ink: #111111;
  --muted: #6D685E;
  --line: #CDC7B8;
  --red: #E3120B;
  --red-deep: #A50D07;
  --on-red: #FFFFFF;
  --ok: #2F7D4A;
  --hatch: rgba(17, 17, 17, 0.28);
  --backdrop: rgba(17, 17, 17, 0.45);

  /* aliassen voor login.html (oude namen) */
  --text: var(--ink);
  --border: var(--line);
  --bg-2: var(--card-2);
  --accent: var(--red);

  --font: "Helvetica Neue", "Inter", "Arial Nova", Arial, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 22px;
  /* beweging: strak & snel, zachte ease-out, geen stuiter */
  --ease: cubic-bezier(.2, .75, .25, 1);
  --t-fast: 150ms;
  --t-mid: 240ms;
  --t-slow: 300ms;
  --nav-h: 72px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121110;
    --card: #1D1B19;
    --card-2: #2A2724;
    --ink: #F3F0E8;
    --muted: #9C968B;
    --line: #34302B;
    --red: #FF3B2F;
    --red-deep: #8E0B06;
    --on-red: #FFFFFF;
    --ok: #5CC283;
    --hatch: rgba(243, 240, 232, 0.28);
    --backdrop: rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
button:disabled { opacity: 0.4; cursor: default; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
input:focus-visible, textarea:focus-visible { outline: none; }

#confetti-canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }

.app {
  max-width: 640px; margin: 0 auto;
  padding: calc(10px + env(safe-area-inset-top)) 18px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom));
}

/* ---------- topline ---------- */
.topline { display: flex; align-items: center; justify-content: space-between; height: 32px; }
.wordmark {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
}
.wordmark .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); }
.streak { font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- views ---------- */
.view { display: none; }
.view.active { display: block; animation: rise var(--t-mid) var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.view-head { margin: 14px 0 18px; }
h1 {
  font-size: 44px; font-weight: 800; letter-spacing: -0.035em; line-height: 0.98;
}
.subtle { color: var(--muted); font-size: 14px; font-weight: 500; margin-top: 6px; }
.eyebrow {
  font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
}
.section-label {
  font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin: 26px 2px 10px;
}
.empty { color: var(--muted); font-size: 14px; text-align: center; padding: 22px 8px; line-height: 1.5; }
.panel-hint { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 6px 2px 14px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- inputs ---------- */
input, textarea {
  font: inherit; color: var(--ink);
  background: var(--card); border: 1.5px solid transparent;
  border-radius: 14px; padding: 14px 16px; width: 100%;
  font-size: 16px; /* 16px = geen iOS-zoom */
  outline: none; resize: none;
  transition: border-color 0.2s ease;
}
input:focus, textarea:focus { border-color: var(--ink); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

/* ---------- hero: volgende stap ---------- */
.hero {
  background: var(--card); border-radius: var(--radius);
  padding: 20px 20px 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.hero-title {
  background: transparent; border: none; padding: 0; border-radius: 0;
  font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.08;
  min-height: 1.1em;
}
.hero-title:focus { border: none; }
.hero-title.swap, .hero-meta.swap { animation: swap var(--t-mid) var(--ease); }
@keyframes swap { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.hero-meta { font-size: 13px; color: var(--muted); font-weight: 600; min-height: 1em; }
.hero-meta .now { color: var(--red); font-weight: 800; }

.duration { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.seg {
  min-width: 52px; height: 44px; padding: 0 14px;
  border-radius: 999px; background: var(--card-2);
  font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.seg.active, .seg-input.filled { background: var(--ink); color: var(--bg); }
.seg-input { cursor: text; }
.seg-input input {
  background: transparent; border: none; padding: 0; border-radius: 0;
  width: 34px; text-align: center; font-weight: 800; color: inherit;
}
.seg-input input::placeholder { color: inherit; opacity: 0.5; }
.seg-input:focus-within { background: var(--ink); color: var(--bg); }
.seg-input.wide { padding: 0 16px; }
.seg-input.wide span { color: inherit; opacity: 0.75; font-weight: 700; }
.duration-unit { font-size: 13px; font-weight: 700; color: var(--muted); margin-left: 2px; }

.hero-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }

/* grote ronde knoppen (zoals "More" in het voorbeeld) */
.circle-btn {
  width: 112px; height: 112px; border-radius: 50%;
  font-size: 18px; font-weight: 800; letter-spacing: -0.01em;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 0.12s ease, filter 0.15s ease;
  flex-shrink: 0;
}
.circle-btn:active { transform: scale(0.95); }
.circle-btn.red { background: var(--red); color: var(--on-red); }
.circle-btn.ink { background: var(--ink); color: var(--bg); }
.circle-btn.small { width: 52px; height: 52px; font-size: 26px; font-weight: 500; }
.circle-btn:hover { filter: brightness(1.06); }

.text-btn {
  font-size: 14px; font-weight: 700; color: var(--muted);
  padding: 10px 6px; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1.5px;
}
.text-btn:hover { color: var(--ink); }
.text-btn.danger { color: var(--red); }

.wide-btn {
  width: 100%; height: 54px; border-radius: 999px;
  background: var(--ink); color: var(--bg);
  font-size: 16px; font-weight: 800;
  transition: transform 0.12s ease;
}
.wide-btn:active { transform: scale(0.98); }
.wide-btn.red { background: var(--red); color: var(--on-red); }
.wide-btn.ghost { background: var(--card-2); color: var(--ink); }

.pill-btn {
  height: 46px; padding: 0 20px; border-radius: 999px;
  border: 2px solid currentColor; font-weight: 800; font-size: 15px;
}

/* ---------- rijen (lijsten) ---------- */
.rows { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.rows li {
  background: var(--card);
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px 14px 16px; min-height: 60px;
}
.rows li:first-child { border-radius: 18px 18px 6px 6px; }
.rows li:last-child { border-radius: 6px 6px 18px 18px; }
.rows li:only-child { border-radius: 18px; }
/* rij komt binnen (tab openen: kort na elkaar; ongedaan maken: alleen die rij) */
.rows li.row-in { animation: row-in var(--t-slow) var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms); }
@keyframes row-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* rij gaat weg: schuift opzij en klapt dicht, de rest schuift soepel op */
.rows li.row-out {
  overflow: hidden; pointer-events: none;
  transition: opacity var(--t-mid) var(--ease), transform var(--t-mid) var(--ease),
              max-height var(--t-mid) var(--ease) 80ms, min-height var(--t-mid) var(--ease) 80ms,
              padding var(--t-mid) var(--ease) 80ms, margin var(--t-mid) var(--ease) 80ms;
}
.rows li.row-out.go { opacity: 0; transform: translateX(24px); max-height: 0 !important; min-height: 0; padding-top: 0; padding-bottom: 0; margin-top: -2px; }
.rows li.pick { cursor: pointer; transition: background-color 0.15s ease; }
.rows li.pick:hover { background: var(--card-2); }
.rows li.selected { box-shadow: inset 4px 0 0 var(--red); }
.row-main { flex: 1; min-width: 0; cursor: pointer; }
.row-title { font-size: 16px; font-weight: 600; line-height: 1.3; word-break: break-word; }
.row-meta { font-size: 12px; color: var(--muted); margin-top: 3px; font-weight: 600; }
.row-meta .missed { color: var(--red); }
.row-time {
  font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums;
  min-width: 46px; flex-shrink: 0;
}
.row-num {
  font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--muted); flex-shrink: 0;
}
.badge-now {
  font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--red); color: var(--on-red);
  padding: 4px 8px; border-radius: 999px; flex-shrink: 0;
}
.badge-time {
  font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums;
  background: var(--ink); color: var(--bg);
  padding: 5px 9px; border-radius: 999px; flex-shrink: 0;
}

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); transition: background-color 0.15s ease, color 0.15s ease;
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: var(--card-2); color: var(--ink); }
.icon-btn.check { border: 2px solid var(--line); transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.icon-btn.check.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.icon-btn.check.done svg path { stroke-dasharray: 22; animation: draw var(--t-slow) var(--ease) both; }
@keyframes draw { from { stroke-dashoffset: 22; } to { stroke-dashoffset: 0; } }
.icon-btn:active, .circle-btn:active, .seg:active, .day:active { transform: scale(0.94); }
.icon-btn, .seg, .day { transition: transform var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.icon-btn.check:hover { border-color: var(--ok); color: var(--ok); background: transparent; }
.icon-btn.play:hover { color: var(--red); }

/* prioriteit: gevulde stip = hoog, ring = midden, klein grijs = laag */
.prio {
  width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.prio::before { content: ""; border-radius: 50%; display: block; }
.prio.high::before { width: 14px; height: 14px; background: var(--red); }
.prio.medium::before { width: 12px; height: 12px; border: 2.5px solid var(--ink); }
.prio.low::before { width: 8px; height: 8px; background: var(--line); }
button.prio:hover { background: var(--card-2); }
.prio.pop::before { animation: pop var(--t-mid) var(--ease); }
@keyframes pop { 0% { transform: scale(0.4); } 100% { transform: scale(1); } }

.prio-pick { display: flex; gap: 4px; background: var(--card-2); border-radius: 999px; padding: 4px; }
.prio-pick button {
  height: 36px; padding: 0 12px 0 8px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 700; color: var(--muted);
}
.prio-pick button .prio { width: 18px; height: 18px; }
.prio-pick button.active { background: var(--card); color: var(--ink); }

/* ---------- segmented control ---------- */
.segmented {
  position: relative;
  display: flex; background: var(--card-2); border-radius: 999px; padding: 4px; gap: 2px;
  margin-bottom: 16px;
}
/* schuivend blokje achter de actieve knop (zie syncIndicators in app.js) */
.seg-ind, .nav-ind {
  position: absolute; top: 4px; bottom: 4px; left: 0; width: 0;
  border-radius: 999px; background: var(--ink); pointer-events: none;
  transition: transform var(--t-slow) var(--ease), width var(--t-slow) var(--ease);
}
.no-anim .seg-ind, .no-anim .nav-ind, .seg-ind.no-anim, .nav-ind.no-anim { transition: none; }
.segmented.has-ind .segmented-btn { position: relative; z-index: 1; transition: color var(--t-mid) var(--ease); }
.segmented.has-ind .segmented-btn.active { background: transparent; }
.segmented.compact { margin: 0; }
.segmented-btn {
  flex: 1; height: 40px; padding: 0 14px; border-radius: 999px;
  font-size: 14px; font-weight: 800; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.segmented-btn.active { background: var(--ink); color: var(--bg); }
.count { font-size: 12px; font-variant-numeric: tabular-nums; opacity: 0.7; }
.count:empty { display: none; }

.panel { display: none; }
.panel.active { display: block; }

.form-card {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px;
}
.form-card input { background: var(--bg); }
.days { display: flex; gap: 4px; flex-wrap: wrap; }
.day {
  width: 38px; height: 34px; border-radius: 999px;
  background: var(--card-2); color: var(--muted);
  font-size: 12px; font-weight: 800;
}
.day.active { background: var(--ink); color: var(--bg); }
.habit-days { margin-top: 8px; }

/* ---------- focus: lopende sessie (hele scherm rood) ---------- */
body.running { background: var(--red); color: #111; }
body.running.overtime { background: #111; color: var(--red); }
body.running .wordmark .dot { background: #111; }
body.running .streak { color: inherit; opacity: 0.7; }
body.running.overtime .wordmark .dot { background: var(--red); }

.run-title { font-size: 40px; overflow-wrap: anywhere; }
.timer-dial { width: min(78vw, 320px); aspect-ratio: 1; margin: 8px auto 0; }
.timer-dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dial-track { fill: none; stroke: rgba(0, 0, 0, 0.16); stroke-width: 44; }
.dial-progress {
  fill: none; stroke: #111; stroke-width: 44; stroke-linecap: round;
  stroke-dasharray: 653.45; /* 2*pi*104 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.5s linear;
}
body.overtime .dial-track { stroke: rgba(255, 59, 47, 0.18); }
body.overtime .dial-progress { stroke: var(--red); }

.run-readout {
  position: relative;
  display: flex; align-items: flex-end; justify-content: space-between;
  padding-bottom: 6px; margin-top: 18px;
}
/* de lijn is een eigen element: kan zich tekenen (links -> rechts) en intrekken */
.run-line {
  position: absolute; left: 0; right: 0; bottom: 0; height: 1.5px;
  background: currentColor; transform-origin: left center;
}
/* venster boven de lijn: de cijfers komen er van achter de lijn uit omhoog */
.run-time-clip { display: inline-block; overflow: hidden; padding-top: 8px; margin-top: -8px; }
.run-time { display: inline-block; }
.run-state { font-size: 15px; font-weight: 600; opacity: 0.75; padding-bottom: 10px; }
.run-time {
  font-size: 84px; font-weight: 500; letter-spacing: -0.05em; line-height: 0.95;
  font-variant-numeric: tabular-nums;
}
.run-note { font-size: 14px; font-weight: 600; margin-top: 12px; line-height: 1.45; opacity: 0.85; animation: breathe 3s infinite ease-in-out; }
@keyframes breathe { 0%, 100% { opacity: 0.85; } 50% { opacity: 0.5; } }

.run-controls { display: flex; align-items: center; gap: 18px; margin-top: 22px; }
.run-side { flex: 1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.run-side .text-btn { color: inherit; opacity: 0.75; }
body.running .circle-btn.ink { background: #111; color: var(--red); }
body.running.overtime .circle-btn.ink { background: var(--red); color: #111; }

/* ---------- opbouw (enter) en afbouw (leave) van het focus-scherm, ±1 s ----------
   De ring en de cijfers lopen via JS (gelijk met elkaar); de rest hier.
   De bottombar staat met translateX(-50%) gecentreerd: eigen keyframes. */
body.intro .dial-progress { transition: none; }
body.enter .run-title, body.enter .wordmark { animation: up-in var(--t-slow) var(--ease) both; }
body.enter .timer-dial { animation: ring-in var(--t-slow) var(--ease) 60ms both; }
body.enter .run-line { animation: line-draw 420ms var(--ease) 200ms both; }
body.enter .run-time { animation: digits-up 380ms var(--ease) 330ms both; }
body.enter .run-state { animation: up-in var(--t-mid) var(--ease) 420ms both; }
body.enter #stop-btn { animation: pop-in var(--t-slow) var(--ease) 500ms both; }
body.enter #pause-btn { animation: pop-in var(--t-slow) var(--ease) 570ms both; }
body.enter #extend-btn { animation: pop-in var(--t-slow) var(--ease) 640ms both; }
body.enter #cancel-btn { animation: up-in var(--t-mid) var(--ease) 700ms both; }
body.enter .bottombar { animation: bar-up var(--t-slow) var(--ease) 640ms both; }
body.enter .add-fab { animation: none; }

body.leave #stop-btn, body.leave #pause-btn, body.leave #extend-btn, body.leave #cancel-btn,
body.leave .run-note { animation: pop-out 200ms var(--ease) forwards; }
body.leave .bottombar { animation: bar-down 220ms var(--ease) forwards; }
body.leave .run-time { animation: digits-down 240ms var(--ease) 60ms forwards; }
body.leave .run-state { animation: fade-out 160ms var(--ease) 60ms forwards; }
body.leave .run-line { transform-origin: right center; animation: line-retract 260ms var(--ease) 160ms forwards; }
body.leave .run-title { animation: fade-out 200ms var(--ease) 180ms forwards; }
body.leave .timer-dial { animation: ring-out 200ms var(--ease) 300ms forwards; }

@keyframes up-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes ring-in { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes line-draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes line-retract { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes digits-up { from { transform: translateY(105%); } to { transform: none; } }
@keyframes digits-down { to { transform: translateY(105%); } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
@keyframes pop-out { to { opacity: 0; transform: scale(0.7); } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes ring-out { to { opacity: 0; transform: scale(0.96); } }
@keyframes bar-up { from { opacity: 0; transform: translate(-50%, 40px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes bar-down { to { opacity: 0; transform: translate(-50%, 40px); } }

/* ---------- wins ---------- */
.big-stat { background: var(--card); border-radius: var(--radius); padding: 18px 20px 14px; }
.big-number { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.big-number span {
  font-size: 96px; font-weight: 500; letter-spacing: -0.06em; line-height: 0.9;
  font-variant-numeric: tabular-nums;
}
.big-number small { font-size: 22px; font-weight: 700; color: var(--muted); }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin-top: 2px; }
.mini-stats > div {
  background: var(--card); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px;
}
.mini-stats > div:first-child { border-radius: 6px 6px 6px 18px; }
.mini-stats > div:last-child { border-radius: 6px 6px 18px 6px; }
.mini-stats span { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.mini-stats small { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }

.week-card { background: var(--card); border-radius: var(--radius); padding: 16px 18px 14px; margin-top: 14px; }
.week-head { display: flex; justify-content: space-between; align-items: baseline; min-height: 18px; }
.week-tip { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.week-tip.swap { animation: swap var(--t-fast) var(--ease); }
.week-chart {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
  height: 150px; margin-top: 12px; align-items: end;
}
.wk-col {
  height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px;
  cursor: default;
}
.wk-bar {
  width: 62%; min-height: 3px; border-radius: 4px 4px 0 0;
  background: repeating-linear-gradient(135deg, var(--hatch) 0 3px, transparent 3px 7px);
  box-shadow: inset 0 0 0 1.5px var(--hatch);
  transition: height 520ms var(--ease);
  transition-delay: calc(var(--i, 0) * 40ms);
}
.wk-col.today .wk-bar { background: var(--ink); box-shadow: none; }
.wk-col.future .wk-bar { opacity: 0.35; }
.wk-col:hover .wk-bar, .wk-col.hl .wk-bar { box-shadow: inset 0 0 0 2px var(--ink); }
.wk-col.today:hover .wk-bar, .wk-col.today.hl .wk-bar { filter: brightness(1.25); }
.wk-label { font-size: 11px; font-weight: 700; color: var(--muted); }
.wk-col.today .wk-label { color: var(--ink); font-weight: 800; }
.week-foot {
  display: flex; justify-content: space-between; align-items: baseline;
  border-top: 1.5px solid var(--line); margin-top: 10px; padding-top: 10px;
  font-size: 14px; font-weight: 600; color: var(--muted);
}
.week-foot strong { color: var(--ink); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

.inline-add { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
.inline-add input { height: 52px; border-radius: 999px; padding: 0 20px; }

/* ---------- bottombar ---------- */
.bottombar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(12px + env(safe-area-inset-bottom));
  width: min(calc(100% - 24px), 520px); height: var(--nav-h);
  background: var(--ink); color: var(--bg);
  border-radius: 999px; padding: 8px 8px 8px 14px;
  display: flex; align-items: center; gap: 4px; z-index: 40;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
.nav-btn {
  flex: 1; height: 100%; border-radius: 999px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: inherit; opacity: 0.55; font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
  transition: opacity 0.15s ease;
}
.nav-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-btn { position: relative; z-index: 1; transition: opacity var(--t-mid) var(--ease); }
.nav-btn.active { opacity: 1; }
.nav-ind { top: 8px; bottom: 8px; background: color-mix(in srgb, currentColor 14%, transparent); }
.add-fab {
  width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0;
  background: var(--red); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 0.12s ease;
}
.add-fab svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.add-fab:active { transform: scale(0.92); }
body.running .bottombar { background: #111; color: #F3F0E8; }
/* tijdens focus: alleen parkeren. De tabs wijken, de +-knop wordt één brede knop. */
.fab-label { display: none; }
body.running .bottombar { padding: 8px; }
body.running .nav-btn, body.running .nav-ind { display: none; }
body.running .add-fab {
  flex: 1; width: auto; border-radius: 999px; gap: 10px;
  background: #F3F0E8; color: #111;
  font-size: 16px; font-weight: 800; letter-spacing: -0.01em;
  animation: fab-wide var(--t-slow) var(--ease);
}
body.running .add-fab svg { width: 22px; height: 22px; }
body.running .fab-label { display: inline; }
@keyframes fab-wide { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

/* het parkeer-venster tijdens focus: geen keuze taak/gedachte, gewoon een titel */
.focus-only { display: none; }
#add-sheet.focus-mode .focus-only { display: inline; }
#add-sheet.focus-mode #add-kind { display: none; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom));
  width: min(calc(100% - 24px), 520px);
  background: var(--ink); color: var(--bg);
  padding: 12px 12px 12px 18px; border-radius: 18px;
  display: flex; align-items: center; gap: 12px;
  font-size: 14px; font-weight: 600; z-index: 80;
  animation: rise 0.2s ease;
}
.toast > span { flex: 1; }
.toast.out { animation: toast-out var(--t-fast) var(--ease) forwards; }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, 8px); } }
.toast.win { box-shadow: inset 6px 0 0 var(--red); }
.toast-action {
  background: var(--bg); color: var(--ink);
  height: 36px; padding: 0 14px; border-radius: 999px;
  font-size: 13px; font-weight: 800; flex-shrink: 0;
}

/* ---------- sheets ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: var(--backdrop);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade var(--t-mid) var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  background: var(--bg); color: var(--ink);
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  border-radius: 28px 28px 0 0;
  padding: 18px 18px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px;
  animation: slide var(--t-slow) var(--ease);
}
@keyframes slide { from { transform: translateY(60px); } to { transform: none; } }
.sheet-backdrop.closing { animation: fade var(--t-fast) var(--ease) reverse forwards; }
.sheet-backdrop.closing .sheet { animation: slide-out var(--t-fast) var(--ease) forwards; }
@keyframes slide-out { to { transform: translateY(40px); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-title { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.sheet textarea { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.sheet-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.sheet-text { font-size: 15px; color: var(--muted); line-height: 1.5; }
.sheet-text strong { color: var(--ink); }
.sheet-hint { font-size: 12px; color: var(--muted); text-align: center; }
.sheet-buttons { display: flex; gap: 10px; }
.sheet .text-btn { align-self: center; }
.close-btn {
  width: 40px; height: 40px; border-radius: 50%; background: var(--card-2);
  font-size: 15px; color: var(--muted); flex-shrink: 0;
}
.close-btn:hover { color: var(--ink); }

/* ---------- beloning: rode puls vanuit het vinkje ---------- */
.pulse {
  position: fixed; z-index: 85; pointer-events: none;
  width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%;
  border: 3px solid var(--red);
  animation: pulse 560ms var(--ease) forwards;
}
.pulse.fill { background: var(--red); border: none; opacity: 0.18; animation-duration: 480ms; }
@keyframes pulse { from { transform: scale(0.6); opacity: 0.9; } to { transform: scale(3.2); opacity: 0; } }

/* start/stop: de knop groeit uit tot het hele scherm (en krimpt terug) */
.burst { position: fixed; z-index: 95; pointer-events: none; border-radius: 50%; will-change: transform, opacity; }

/* ---------- wanneer was het af? (compact, klapt open) ---------- */
.when-line {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card); border-radius: 14px; padding: 12px 14px;
  font-size: 14px; font-weight: 600; color: var(--muted); text-align: left;
}
.when-line strong { color: var(--ink); font-weight: 800; }
.when-line .when-edit { text-decoration: underline; text-underline-offset: 3px; font-weight: 700; }
.when-panel { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.when-panel .seg { font-size: 14px; height: 40px; }
.when-panel input[type="time"] {
  width: auto; height: 40px; padding: 0 14px; border-radius: 999px;
  background: var(--card-2); font-weight: 800; font-variant-numeric: tabular-nums;
}
.when-note { font-size: 12px; color: var(--muted); margin-top: 6px; }

@media (min-width: 700px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 28px; }
}
@media (max-width: 370px) {
  h1 { font-size: 38px; }
  .hero-title { font-size: 26px; }
  .run-time { font-size: 68px; }
  .circle-btn { width: 96px; height: 96px; }
  .big-number span { font-size: 80px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
