:root {
  --bar: 0px;
  --accent: #38bdf8;
  --warn: #fb923c;
  --ink: #f4f7fb;
  --muted: rgba(244, 247, 251, 0.62);
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --sans: 'Space Grotesk', system-ui, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: #000; color: var(--ink); font-family: var(--sans); overflow: hidden; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%); }
#fade { position: fixed; inset: 0; background: #000; pointer-events: none; opacity: 1; }
.bar { position: fixed; left: 0; right: 0; height: var(--bar); background: #000; pointer-events: none; z-index: 2; }
.bar.top { top: 0; }
.bar.bottom { bottom: 0; }

.overlay { z-index: 3; pointer-events: none; transition: opacity 0.4s; }
body.clean .overlay, body.clean #vignette { opacity: 0 !important; }

/* ------------------------------------------------------------ tijdcode */
#rec {
  position: fixed; top: calc(var(--bar) + 18px); left: 24px;
  display: flex; align-items: center; gap: 8px;
  font: 500 11px/1 var(--mono); letter-spacing: 0.14em; color: var(--muted);
}
#rec i { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; animation: blink 1.2s steps(2) infinite; }

/* ------------------------------------------------------------ HUD-labels */
#hud {
  position: fixed; top: calc(var(--bar) + 16px); right: 24px; list-style: none;
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
}
#hud li {
  font: 500 11px/1 var(--mono); letter-spacing: 0.12em;
  padding: 7px 10px 7px 12px;
  background: rgba(8, 12, 18, 0.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border-left: 2px solid var(--accent);
  opacity: 0; transform: translateX(12px);
  transition: opacity 0.4s, transform 0.5s var(--ease);
}
#hud li.on { opacity: 1; transform: none; }
#hud li.warn { border-color: var(--warn); color: #fed7aa; }
#hud li.warn.on { animation: warn 0.9s steps(2) infinite; }

/* ------------------------------------------------------------ onderbalk-titel */
#lower {
  position: fixed; left: clamp(20px, 5vw, 72px);
  bottom: calc(var(--bar) + clamp(70px, 10vh, 110px));
  max-width: min(560px, 82vw);
}
#lower::before {
  content: ''; display: block; height: 2px; width: 0; margin-bottom: 14px;
  background: var(--accent); transition: width 0.8s var(--ease);
}
#lower.show::before { width: 64px; }
#lower-idx, #lower h2, #lower p { opacity: 0; transform: translateY(14px); transition: opacity 0.6s, transform 0.7s var(--ease); }
#lower.show #lower-idx { opacity: 1; transform: none; transition-delay: 0.1s; }
#lower.show h2 { opacity: 1; transform: none; transition-delay: 0.2s; }
#lower.show p { opacity: 1; transform: none; transition-delay: 0.35s; }
#lower-idx { display: block; margin-bottom: 10px; font: 500 11px/1 var(--mono); letter-spacing: 0.2em; color: var(--accent); }
#lower h2 { font: 700 clamp(30px, 5.2vw, 64px)/1 var(--sans); text-transform: uppercase; letter-spacing: -0.01em; text-shadow: 0 2px 24px rgba(0, 0, 0, 0.5); }
#lower p { margin-top: 12px; font: 400 clamp(14px, 1.5vw, 18px)/1.4 var(--sans); color: var(--muted); text-shadow: 0 1px 12px rgba(0, 0, 0, 0.6); }

/* ------------------------------------------------------------ titelkaart */
#card { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; padding: 0 16px; }
#card h1 {
  font: 700 clamp(40px, 10vw, 140px)/1 var(--sans);
  letter-spacing: 0.32em; margin-right: -0.32em;
  opacity: 0; filter: blur(14px); transform: scale(1.05);
  transition: opacity 1.1s, filter 1.1s, transform 1.4s var(--ease), letter-spacing 1.6s var(--ease), margin 1.6s var(--ease);
  text-shadow: 0 0 40px rgba(56, 189, 248, 0.25);
}
#card.show h1 { opacity: 1; filter: none; transform: none; letter-spacing: 0.18em; margin-right: -0.18em; }
#card-small, #card-note { opacity: 0; transform: translateY(10px); transition: opacity 0.8s, transform 0.8s var(--ease); }
#card.show #card-small { opacity: 1; transform: none; transition-delay: 0.5s; }
#card.show #card-note { opacity: 1; transform: none; transition-delay: 0.9s; }
#card-small { margin-top: 18px; font: 400 clamp(14px, 1.6vw, 20px)/1.4 var(--sans); color: var(--muted); letter-spacing: 0.06em; }
#card-note { margin-top: 26px; font: 400 11px/1.4 var(--mono); color: rgba(244, 247, 251, 0.45); letter-spacing: 0.12em; }

/* ------------------------------------------------------------ bediening */
#controls {
  position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%);
  width: min(760px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px 6px 6px;
  background: rgba(10, 14, 20, 0.6); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 12px;
  z-index: 5; transition: opacity 0.5s;
}
body.idle #controls { opacity: 0; }
body.idle { cursor: none; }
button {
  flex: none; width: 34px; height: 34px; border: 0; border-radius: 8px;
  background: none; color: var(--ink); display: grid; place-items: center; cursor: pointer;
}
button:hover { background: rgba(255, 255, 255, 0.08); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button svg { width: 16px; height: 16px; fill: currentColor; }
#play .i-play { display: none; }
#play.paused .i-play { display: block; }
#play.paused .i-pause { display: none; }

#timeline { flex: 1; min-width: 0; display: flex; gap: 3px; height: 24px; align-items: center; cursor: pointer; margin-left: 6px; }
.seg { position: relative; height: 4px; flex-basis: 0; background: rgba(255, 255, 255, 0.18); border-radius: 2px; transition: height 0.2s; }
#timeline:hover .seg { height: 7px; }
.seg i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--ink); border-radius: 2px; }
.seg.cur i { background: var(--accent); }
.seg span {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  padding: 4px 7px; border-radius: 4px; background: rgba(0, 0, 0, 0.75);
  font: 500 10px/1 var(--mono); letter-spacing: 0.1em; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.seg:hover span { opacity: 1; }
#time { flex: none; min-width: 84px; text-align: right; font: 500 11px/1 var(--mono); color: var(--muted); }

#paused-hint {
  position: fixed; left: 50%; bottom: 72px; transform: translateX(-50%);
  font: 400 11px/1.4 var(--mono); letter-spacing: 0.08em; color: var(--muted);
  background: rgba(0, 0, 0, 0.55); padding: 6px 10px; border-radius: 6px;
  opacity: 0; pointer-events: none; transition: opacity 0.3s; z-index: 5; white-space: nowrap;
}
body.is-paused #paused-hint { opacity: 1; }

#error { position: fixed; inset: 0; display: grid; place-content: center; padding: 24px; text-align: center; color: var(--muted); z-index: 10; }
#error[hidden] { display: none; }

@keyframes blink { 50% { opacity: 0; } }
@keyframes warn { 50% { background: rgba(251, 146, 60, 0.25); } }

@media (max-width: 600px) {
  #time { display: none; }
  #rec { left: 16px; }
  #hud { right: 16px; }
  #hud li { font-size: 9px; padding: 5px 8px; }
  #paused-hint { white-space: normal; width: calc(100vw - 32px); text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  #hud li, #lower *, #card * { transition-duration: 0.01s !important; }
}
