:root {
  --bg: #0a0a0a;
  --bg-raised: #111111;
  --text: #f2f2f2;
  --text-2: #b3b3b3;      /* secundaire tekst, contrast > 8:1 */
  --dim: #5c5c5c;         /* gedimde woorden in koppen */
  --line: #262626;
  --line-strong: #3d3d3d;
  --white: #ffffff;
  --wait: #f5c26b;
  --busy: #7cc4ff;
  --done: #6ee7a0;
  --err: #ff7a7a;
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { font-size: 18px; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--mono); font-weight: 400; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 1040px; margin: 0 auto; padding: 2rem 24px 5rem; }
h1, h2 { font-weight: 300; letter-spacing: -0.02em; line-height: 1.15; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: .3rem 0 .8rem; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin: .3rem 0 1.4rem; }
a { color: var(--white); text-underline-offset: 4px; }
strong { font-weight: 500; }
.lead { font-size: 1.05rem; color: var(--text-2); margin-top: 0; }
.muted { color: var(--text-2); }
:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; }

.label {
  display: flex; align-items: center; gap: .6rem;
  font-size: .72rem; letter-spacing: .28em; text-transform: uppercase; color: #8a8a8a; margin-bottom: .6rem;
}
.headline { font-weight: 300; color: var(--dim); }
.headline em { font-style: normal; color: var(--white); font-weight: 400; }
.dot {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none;
  background: var(--c, #fff); box-shadow: 0 0 12px var(--c, #fff);
}

/* ---------- Bovenbalk ---------- */
.topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 24px;
}
body:not(.page-home) .topbar { position: relative; border-bottom: 1px solid var(--line); }
.topbar nav { display: flex; gap: .5rem; align-items: center; }
.topbar form { margin: 0; }
.logo {
  display: inline-flex; align-items: center; gap: .6rem; text-decoration: none;
  font-weight: 500; letter-spacing: .35em; font-size: .95rem;
}
.logo-dot { width: 8px; height: 8px; background: #fff; border-radius: 50%; box-shadow: 0 0 10px #fff; }

/* ---------- Knoppen ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: inherit; font-size: 1rem; font-weight: 500; text-decoration: none; cursor: pointer;
  padding: .8rem 1.4rem; min-height: 52px; border-radius: 0;
  background: var(--white); color: #000; border: 1px solid var(--white);
  transition: background .15s, color .15s;
}
.btn:hover { background: #d9d9d9; border-color: #d9d9d9; }
.btn.ghost { background: transparent; color: var(--white); }
.btn.ghost:hover { background: var(--white); color: #000; }
.btn.small { font-size: .85rem; min-height: 40px; padding: .4rem .9rem; }
.btn.big { font-size: 1.1rem; min-height: 60px; padding: 1rem 1.8rem; }
.btn.danger { background: transparent; color: var(--err); border-color: var(--err); }
.btn.danger:hover { background: var(--err); color: #000; }
.btn:disabled { opacity: .55; cursor: wait; }
.linklike { font: inherit; color: var(--white); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.6rem; }
.actions form { margin: 0; }

/* ---------- Hero met 3D-scène ---------- */
.hero { position: relative; height: min(88vh, 860px); min-height: 560px; overflow: hidden; background: var(--bg); }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero.no-3d {
  /* Terugval zonder WebGL: stil sterrenveld in CSS */
  background:
    radial-gradient(1px 1px at 12% 18%, #fff8, transparent), radial-gradient(1px 1px at 32% 8%, #fff6, transparent),
    radial-gradient(1px 1px at 58% 22%, #fff7, transparent), radial-gradient(1px 1px at 78% 12%, #fff5, transparent),
    radial-gradient(1px 1px at 90% 30%, #fff6, transparent), radial-gradient(ellipse 120% 40% at 50% 100%, #1d1d1d, transparent),
    var(--bg);
}
.hero.no-3d canvas, .hero.no-3d .hero-hint { display: none; }
.hero::after {  /* zachte overgang naar de inhoud */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 120px; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--bg));
}
.hero-text {
  position: absolute; z-index: 5; left: 0; right: 0; top: 16%;
  max-width: 1040px; margin: 0 auto; padding: 0 24px; pointer-events: none;
}
.hero-text > * { pointer-events: auto; }
.hero-text .headline { font-size: clamp(2.1rem, 5.6vw, 4.4rem); max-width: 14em; margin: .2rem 0 1.8rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; }
.hero-hint {
  position: absolute; z-index: 5; bottom: 28px; left: 0; right: 0; text-align: center; margin: 0;
  font-size: .72rem; letter-spacing: .28em; text-transform: uppercase; color: #8a8a8a;
}
.hero-labels { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.figure-label {
  position: absolute; transform: translate(-50%, 0); pointer-events: auto; cursor: pointer;
  font: inherit; font-size: .78rem; letter-spacing: .08em; color: #d0d0d0; white-space: nowrap;
  background: none; border: 0; padding: .35rem .5rem; transition: color .2s, opacity .3s;
}
.figure-label::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: .5em;
  vertical-align: middle; background: var(--c); box-shadow: 0 0 8px var(--c);
}
.figure-label.is-hover, .figure-label:hover, .figure-label:focus-visible { color: #fff; }
.figure-label .state { color: var(--c); margin-left: .5em; }
body.figure-hover #scene { cursor: pointer; }

/* ---------- Secties ---------- */
.section { padding: 2.5rem 0 1rem; }
.section + .section { border-top: 1px solid var(--line); margin-top: 2.5rem; }

/* Lijst met agents (werkt altijd, ook zonder 3D) */
.agent-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.agent-row {
  display: flex; align-items: center; gap: 1.2rem; padding: 1.3rem .8rem; min-height: 84px;
  text-decoration: none; border-bottom: 1px solid var(--line); transition: background .15s;
}
.agent-row:hover, .agent-row:focus-visible { background: var(--bg-raised); }
.agent-row .dot { width: 16px; height: 16px; }
.agent-row-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.agent-row-name { font-size: 1.2rem; font-weight: 500; }
.agent-row-desc { color: var(--text-2); }
.agent-row-arrow { font-size: 1.4rem; color: var(--text-2); transition: transform .15s, color .15s; }
.agent-row:hover .agent-row-arrow { transform: translateX(4px); color: var(--c); }

/* Opdrachten */
.tasks { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.task {
  display: flex; align-items: center; gap: 1rem; padding: 1.1rem .8rem; text-decoration: none;
  border-bottom: 1px solid var(--line); transition: background .15s;
}
.task:hover { background: var(--bg-raised); }
.task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.task-prompt { overflow-wrap: anywhere; }
.task-meta { color: var(--text-2); font-size: .85rem; }
.empty { color: var(--text-2); }

.status {
  display: inline-flex; align-items: center; gap: .5em; white-space: nowrap;
  font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; padding: .35rem .7rem;
  border: 1px solid currentColor;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.big { font-size: .9rem; padding: .5rem .9rem; }
.status-wachtend { color: var(--wait); }
.status-bezig { color: var(--busy); }
.status-bezig::before { animation: blink 1.2s ease-in-out infinite; }
.status-klaar { color: var(--done); }
.status-fout { color: var(--err); }
@keyframes blink { 50% { opacity: .2; } }

/* ---------- Formulieren ---------- */
.stack { display: flex; flex-direction: column; gap: .6rem; }
label { font-size: 1rem; color: var(--text); margin-top: .6rem; }
input, textarea {
  font: inherit; font-size: 1.05rem; width: 100%; padding: .9rem 1rem; color: var(--text);
  background: var(--bg-raised); border: 1px solid var(--line-strong); border-radius: 0;
}
input:focus, textarea:focus { outline: none; border-color: var(--white); }
textarea { resize: vertical; min-height: 10rem; line-height: 1.5; }
::placeholder { color: #8a8a8a; }
input.file { padding: 1rem; border-style: dashed; cursor: pointer; }
input.file::file-selector-button {
  font: inherit; font-weight: 500; margin-right: 1rem; padding: .5rem 1rem; border: 0; border-radius: 0;
  background: #fff; color: #000; cursor: pointer;
}
.agent-form .btn.big { margin-top: .8rem; align-self: flex-start; }

.alert { border: 1px solid var(--err); color: #ffd0d0; padding: 1rem 1.1rem; background: #1a0d0d; }
.ok { border: 1px solid var(--done); color: #d6ffe6; padding: 1rem 1.1rem; background: #0c1710; }

/* ---------- Losse pagina's ---------- */
.narrow { max-width: 480px; margin: 3rem auto; }
.page-section { max-width: 820px; }
.back { display: inline-block; margin-bottom: 1.6rem; text-decoration: none; color: var(--text-2); }
.back:hover { color: var(--white); }
.task-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.task-head h1 { margin-bottom: 0; }
.question { border-left: 2px solid var(--c, #fff); background: var(--bg-raised); padding: 1rem 1.2rem; margin: 1.6rem 0 2rem; }
.question .label { margin-bottom: .3rem; }
.question-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.question-file { margin-top: .5rem; color: var(--text-2); }
.delete { margin-top: 3rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.code {
  font-size: 2.8rem; font-weight: 300; letter-spacing: .5rem; text-align: center; padding: 1.2rem;
  border: 1px dashed var(--line-strong); margin: .6rem 0 1.4rem;
}

.waiting { text-align: center; padding: 2rem .5rem; }
.orbit { position: relative; width: 64px; height: 64px; margin: 0 auto 1.4rem; animation: spin 2.4s linear infinite; }
.orbit span { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--c, #fff); box-shadow: 0 0 10px var(--c, #fff); }
.orbit span:nth-child(1) { top: 0; left: 28px; }
.orbit span:nth-child(2) { bottom: 6px; left: 4px; opacity: .6; }
.orbit span:nth-child(3) { bottom: 6px; right: 4px; opacity: .3; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .orbit, .status-bezig::before { animation: none; } }

/* Resultaat */
.result { overflow-wrap: anywhere; }
.result h1, .result h2, .result h3 { font-size: 1.25rem; font-weight: 500; margin: 1.8rem 0 .6rem; letter-spacing: 0; }
.result table { border-collapse: collapse; width: 100%; margin: 1.2rem 0; display: block; overflow-x: auto; }
.result th, .result td { border-bottom: 1px solid var(--line-strong); padding: .7rem .8rem; text-align: left; vertical-align: top; }
.result th { font-size: .75rem; letter-spacing: .2em; text-transform: uppercase; color: #8a8a8a; font-weight: 400; }
.result pre { background: var(--bg-raised); padding: 1rem; overflow-x: auto; }
.result hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.result li { margin: .25rem 0; }

/* ---------- Inschuifpaneel ---------- */
.panel-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.55); opacity: 0; transition: opacity .3s; }
.panel-backdrop.open { opacity: 1; }
.side-panel {
  position: fixed; z-index: 50; top: 0; right: 0; bottom: 0; width: min(560px, 100vw);
  background: #050505; border-left: 1px solid var(--line-strong); overflow-y: auto;
  transform: translateX(100%); transition: transform .35s cubic-bezier(.2,.7,.2,1);
}
.side-panel.open { transform: none; }
@media (prefers-reduced-motion: reduce) { .side-panel, .panel-backdrop { transition: none; } }
.panel-inner { padding: 3.2rem 32px 3rem; }
.panel-inner h2 { margin-bottom: .4rem; }
.panel-close {
  position: absolute; top: 12px; right: 12px; width: 52px; height: 52px; cursor: pointer;
  font: inherit; font-size: 1.3rem; color: #fff; background: transparent; border: 1px solid var(--line-strong); border-radius: 0;
}
.panel-close:hover { background: #fff; color: #000; }
.panel-tasks-label { margin-top: 2.6rem; }
.mini-tasks { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.mini-tasks a { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 0; text-decoration: none; border-bottom: 1px solid var(--line); }
.mini-tasks a:hover .mini-prompt { text-decoration: underline; }
.mini-prompt { min-width: 0; overflow-wrap: anywhere; }
body.panel-open { overflow: hidden; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); margin-top: 3rem; }
.footer-grid {
  max-width: 1040px; margin: 0 auto; padding: 2.4rem 24px 3rem;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem;
}
.footer-grid > div { border-left: 1px solid var(--line); padding-left: 1.2rem; }
.footer p, .footer li { color: var(--text-2); font-size: .9rem; margin: 0 0 .5rem; }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer a, .footer .linklike { color: var(--text-2); font-size: .9rem; text-decoration: none; }
.footer a:hover, .footer .linklike:hover { color: var(--white); }

/* ---------- Gsm ---------- */
@media (max-width: 760px) {
  main { padding: 1.4rem 16px 4rem; }
  .topbar { padding: .9rem 16px; }
  .hero { height: 82vh; min-height: 520px; }
  .hero-text { top: 11%; padding: 0 16px; }
  .hero-text .headline { margin-bottom: 1.2rem; }
  .hero-actions .btn.ghost { display: none; }
  .figure-label { font-size: .7rem; }
  .figure-label .state { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; padding: 2rem 16px; }
  .task { flex-wrap: wrap; }
  .task .status { margin-left: calc(12px + 1rem); }
  .agent-form .btn.big { align-self: stretch; }
  .panel-inner { padding: 4rem 18px 2.5rem; }
  .side-panel { border-left: 0; }
}
@media (max-width: 420px) {
  .footer-grid { grid-template-columns: 1fr; }
}
