:root {
  --ultra: #2b1fd6;
  --night: #120c4a;
  --volt: #e8ff3a;
  --flamingo: #ff4fa3;
  --lagoon: #22d3b6;
  --paper: #f6f3ff;
  --surface: #ffffff;
  --ink: #120c4a;
  --muted: #5b5791;
  --rule: #dcd6fb;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0b0733;
    --surface: #17105a;
    --ink: #f3f0ff;
    --muted: #a9a3e0;
    --rule: #2c2380;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { overflow-x: hidden; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.5 "Barlow", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.timing { overflow: hidden; }

button { font: inherit; color: inherit; cursor: pointer; }

:focus-visible { outline: 3px solid var(--flamingo); outline-offset: 3px; }

h1, h2, .brand, dd, .t-clock, .d-name, .ticker {
  font-family: "Big Shoulders Display", "Arial Narrow", sans-serif;
}

/* ---------- Kop ---------- */

.top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(14px, env(safe-area-inset-top)) 20px 10px;
  background: var(--ultra);
  color: #fff;
}

.mark {
  width: 30px;
  height: 18px;
  border: 3px solid var(--volt);
  border-radius: 999px;
  box-shadow: 0 0 0 3px var(--flamingo);
}

.brand { font-weight: 900; font-size: 24px; letter-spacing: 0.02em; text-transform: uppercase; }
.brand em { font-style: normal; color: var(--volt); }

.streak {
  margin-left: auto;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--flamingo);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}
.streak:empty { display: none; }

main { max-width: 760px; margin: 0 auto; }

/* ---------- Training van de dag ---------- */

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(255, 79, 163, 0.55), transparent 60%),
    radial-gradient(90% 70% at 0% 100%, rgba(34, 211, 182, 0.35), transparent 60%),
    var(--ultra);
  color: #fff;
  padding: 18px 20px 30px;
}

@media (min-width: 760px) {
  .hero { border-radius: 0 0 40px 40px; padding: 28px 36px 36px; }
}

/* De atletiekbaan die zich bij het laden tekent: het ene bewegende moment van de pagina. */
.oval {
  position: absolute;
  z-index: -1;
  top: -10px;
  right: -90px;
  width: 520px;
  height: 312px;
  opacity: 0.9;
  transform: rotate(-12deg);
}

.lane {
  fill: none;
  stroke-width: 3;
  stroke-dasharray: 1100;
  stroke-dashoffset: 1100;
  animation: draw 1.6s cubic-bezier(0.6, 0, 0.2, 1) forwards;
}
.l1 { stroke: rgba(255, 255, 255, 0.45); }
.l2 { stroke: rgba(232, 255, 58, 0.7); animation-delay: 0.15s; }
.l3 { stroke: rgba(255, 79, 163, 0.8); animation-delay: 0.3s; }
.runner { fill: var(--volt); filter: drop-shadow(0 0 8px var(--volt)); }

@keyframes draw { to { stroke-dashoffset: 0; } }

.when {
  display: inline-block;
  margin: 0;
  padding: 2px 12px;
  background: var(--volt);
  color: var(--night);
  font-weight: 700;
  transform: rotate(-2deg);
}

h1 {
  margin: 14px 0 10px;
  font-weight: 900;
  font-size: clamp(64px, 19vw, 132px);
  line-height: 0.86;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: #fff;
  text-shadow:
    4px 4px 0 var(--flamingo),
    8px 8px 0 var(--night);
  overflow-wrap: anywhere;
}

.purpose {
  margin: 0 0 24px;
  max-width: 42ch;
  font-size: 18px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
}

/* De training als baan: banen op de achtergrond, blokken naar zwaarte. */
.track {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 150px;
  padding: 8px 8px 0;
  background:
    repeating-linear-gradient(to bottom, transparent 0 36px, rgba(255, 255, 255, 0.35) 36px 38px),
    var(--night);
  border: 3px solid #fff;
  border-radius: 18px;
  box-shadow: 8px 8px 0 var(--flamingo);
  overflow: hidden;
}

.seg { flex-basis: 0; min-width: 3px; border-radius: 4px 4px 0 0; }
.seg-warm, .seg-cool { background: rgba(255, 255, 255, 0.5); }
.seg-rest { background: var(--lagoon); }
.seg-work {
  background: linear-gradient(to top, var(--flamingo), var(--volt) 70%);
  box-shadow: 0 0 14px rgba(232, 255, 58, 0.55);
}

.totals {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: start;
  gap: 30px;
  margin: 26px 0 24px;
}

.totals div { margin: 0; }
.totals dt { font-size: 14px; font-weight: 600; color: var(--volt); }
.totals dd { margin: 0; font-size: 38px; font-weight: 800; line-height: 1; white-space: nowrap; }

@media (max-width: 360px) {
  .totals { gap: 18px; }
  .totals dd { font-size: 30px; }
}

.actions { display: flex; gap: 14px; flex-wrap: wrap; }

.go, .done {
  min-height: 56px;
  padding: 0 28px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 18px;
  border: 3px solid var(--night);
  transition: transform 0.12s, box-shadow 0.12s;
}

.go {
  background: var(--volt);
  color: var(--night);
  box-shadow: 6px 6px 0 var(--night);
}
.go:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--night); }
.go:active { transform: translate(4px, 4px); box-shadow: 2px 2px 0 var(--night); }

.done {
  background: #fff;
  color: var(--night);
  box-shadow: 6px 6px 0 var(--flamingo);
}
.done[aria-pressed="true"] { background: var(--lagoon); }

@media (prefers-reduced-motion: reduce) {
  .lane { animation: none; stroke-dashoffset: 0; }
  .go, .done { transition: none; }
}

/* ---------- Lichtkrant ---------- */

.ticker {
  overflow: hidden;
  margin: 18px 0 0;
  background: var(--flamingo);
  color: #fff;
  transform: rotate(-1.5deg) scale(1.04);
  border-block: 3px solid var(--night);
}

.ticker-run {
  display: inline-block;
  padding: 8px 0;
  white-space: nowrap;
  font-size: 24px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  animation: ticker 28s linear infinite;
}

@keyframes ticker { to { transform: translateX(-50%); } }

@media (prefers-reduced-motion: reduce) { .ticker-run { animation: none; } }

/* ---------- Secties ---------- */

section:not(.hero) { padding: 34px 20px 4px; }

@media (min-width: 760px) { section:not(.hero) { padding: 40px 36px 4px; } }

h2 {
  margin: 0 0 16px;
  font-size: 40px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  color: var(--ultra);
}

@media (prefers-color-scheme: dark) { h2 { color: var(--volt); } }

/* Stappen: een echte volgorde, dus genummerd. */
.steps ol { list-style: none; margin: 0; padding: 0; counter-reset: step; display: grid; gap: 12px; }

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  column-gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 5px 5px 0 var(--lagoon);
}

.steps li::before {
  content: counter(step);
  grid-row: span 2;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ultra);
  color: #fff;
  font: 900 22px "Big Shoulders Display", sans-serif;
}

.steps li.hard { box-shadow: 5px 5px 0 var(--flamingo); }
.steps li.hard::before { background: var(--volt); color: var(--night); }

.s-name { font-weight: 700; font-size: 18px; }
.s-pace { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; color: var(--flamingo); }
.s-detail { grid-column: 2 / 4; color: var(--muted); }

/* Week */
.week ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.day {
  width: 100%;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 64px 24px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 3px solid var(--rule);
  border-radius: 16px;
  text-align: left;
  transition: transform 0.12s;
}
.day:hover { transform: rotate(-0.6deg) scale(1.01); }

.day[aria-current="date"] {
  border-color: var(--ink);
  box-shadow: 5px 5px 0 var(--volt), 5px 5px 0 3px var(--ink);
}

.d-name {
  font-weight: 900;
  font-size: 24px;
  text-transform: uppercase;
  color: var(--muted);
}
.day.is-today .d-name { color: var(--flamingo); }

.d-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-mini { display: flex; align-items: flex-end; gap: 1px; height: 30px; }
.d-mini .seg-warm, .d-mini .seg-cool { background: var(--rule); }
.d-mini .seg-work { box-shadow: none; }
.d-check {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 800;
  font-size: 14px;
}
.d-check:not(:empty) { background: var(--lagoon); color: var(--night); }

@media (prefers-reduced-motion: reduce) { .day { transition: none; } .day:hover { transform: none; } }

/* Tempo's */
.note { margin: 0 0 14px; color: var(--muted); }

.fivek { display: inline-flex; align-items: center; gap: 12px; font-weight: 700; margin-bottom: 16px; }

.fivek input {
  width: 100px;
  min-height: 48px;
  padding: 0 12px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: 800 22px "Big Shoulders Display", sans-serif;
  box-shadow: 4px 4px 0 var(--volt);
}

.paces ul { list-style: none; margin: 0; padding: 0; }

.paces li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px 92px;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
}

.p-bar { height: 14px; background: var(--rule); border-radius: 7px; overflow: hidden; }
.p-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--lagoon), var(--volt), var(--flamingo)); }

.p-name { font-weight: 700; }
.p-val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

footer {
  max-width: 760px;
  margin: 40px auto 0;
  padding: 20px 20px max(28px, env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Timer ---------- */

.timer {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  background: var(--ultra);
  color: #fff;
  transition: background-color 0.25s;
  overflow: hidden;
}

/* Bewegende baanstrepen tijdens het werk */
.timer::before {
  content: "";
  position: absolute;
  inset: -50%;
  z-index: -1;
  background: repeating-linear-gradient(-35deg, transparent 0 46px, rgba(255, 255, 255, 0.14) 46px 72px);
  animation: stripes 1.2s linear infinite;
  opacity: 0;
}
.timer[data-kind="work"]::before { opacity: 1; }
.timer { isolation: isolate; }

@keyframes stripes { to { transform: translateX(88px); } }

.timer[hidden] { display: none; }
.timer[data-kind="work"] { background: var(--flamingo); color: #fff; }
.timer[data-kind="rest"] { background: var(--lagoon); color: var(--night); }

@media (prefers-reduced-motion: reduce) {
  .timer { transition: none; }
  .timer::before { animation: none; }
}

.t-top { display: flex; align-items: center; justify-content: space-between; font-weight: 700; }

.t-close {
  background: transparent;
  border: 3px solid currentColor;
  border-radius: 999px;
  padding: 6px 16px;
  font-weight: 700;
}

.t-label { margin: auto 0 0; font-size: 28px; font-weight: 700; line-height: 1.2; }

.t-clock {
  margin: 0;
  font-size: clamp(130px, 40vw, 280px);
  font-weight: 900;
  line-height: 0.86;
  font-variant-numeric: tabular-nums;
  text-shadow: 6px 6px 0 rgba(18, 12, 74, 0.45);
}

.timer[data-kind="work"] .t-clock { color: var(--volt); text-shadow: 6px 6px 0 var(--night); }

.t-pace { margin: 8px 0 20px; font-size: 22px; font-weight: 600; }

.t-bar { height: 14px; border-radius: 7px; background: rgba(18, 12, 74, 0.25); overflow: hidden; }
.t-bar span { display: block; height: 100%; width: 0; background: currentColor; }

.t-next { margin: 16px 0 auto; font-size: 18px; font-weight: 500; opacity: 0.9; }

.t-ctrl { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.t-ctrl button {
  min-height: 64px;
  border-radius: 999px;
  border: 3px solid currentColor;
  background: transparent;
  font-weight: 800;
  font-size: 20px;
}

/* ---------- Confetti ---------- */

.confetti { position: fixed; inset: 0; z-index: 20; pointer-events: none; overflow: hidden; }

.confetti i {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 16px;
  border-radius: 2px;
  animation: fall linear forwards;
}

@keyframes fall {
  to { transform: translate(var(--drift), 110vh) rotate(var(--spin)); }
}
