:root {
  --bg: #101216; --panel: #1a1d23; --panel2: #22262e; --ink: #e9ecf1; --mute: #8b929d;
  --line: #2c313a; --line-strong: #3a404b;
  --accent: #3d8bfd; --accent-soft: rgba(61, 139, 253, .12);
  --good: #2f9e63; --good-soft: rgba(47, 158, 99, .14);
  --amber: #d69a2e; --amber-soft: rgba(214, 154, 46, .14);
  --bad: #d64541; --bad-soft: rgba(214, 69, 65, .14);
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .18);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { max-width: 780px; margin: 0 auto; padding-bottom: 48px;
  font-size: 15px; line-height: 1.55; }

button { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h2 { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; margin: 0 0 8px; }
h3 { font-size: 15px; font-weight: 650; margin: 16px 0 4px; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 5;
  background: rgba(16, 18, 22, .88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px;
  font-weight: 650; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap;
  color: inherit; text-decoration: none; }
.brand img { width: 22px; height: 22px; border-radius: 6px; display: block; }
.tabs { display: flex; gap: 2px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 3px; }
.tab { background: transparent; color: var(--mute); border: none;
  padding: 6px 13px; border-radius: 7px; font-size: 13.5px; font-weight: 550;
  cursor: pointer; transition: color .12s, background .12s; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); background: var(--panel2);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }

.view { padding: 20px 16px; }

/* stimulus */
.stimulus { position: relative; border-radius: var(--radius); overflow: hidden;
  background: #000; aspect-ratio: 1280 / 600;
  border: 1px solid var(--line); box-shadow: var(--shadow); }
#clip, #stillimg, #exclip, #exstill { width: 100%; height: 100%; object-fit: cover; display: block; }
#clip[hidden], #stillimg[hidden], #exclip[hidden], #exstill[hidden], #replay[hidden] { display: none; }
.replay { position: absolute; right: 12px; bottom: 12px; background: rgba(12, 14, 17, .72);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  color: #fff; border: 1px solid rgba(255, 255, 255, .18); border-radius: 999px;
  padding: 7px 14px; font-size: 13px; font-weight: 550; cursor: pointer;
  transition: background .12s, border-color .12s; }
.replay:hover { background: rgba(12, 14, 17, .88); border-color: rgba(255, 255, 255, .34); }
.clipmeta { position: absolute; left: 12px; top: 12px; background: rgba(12, 14, 17, .66);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  color: #cfd4db; font-size: 11px; font-weight: 550; letter-spacing: .02em;
  padding: 4px 10px; border-radius: 999px; }

/* question + options */
.prompt { font-size: 19px; font-weight: 650; letter-spacing: -0.01em;
  line-height: 1.4; margin: 20px 2px 14px; }
.options { display: grid; gap: 10px; }
.opt { text-align: left; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 16px;
  font-size: 15px; line-height: 1.45; cursor: pointer;
  transition: background .12s, border-color .12s, opacity .12s; }
.opt:hover:not(:disabled) { background: var(--panel2); border-color: var(--line-strong); }
.opt:disabled { cursor: default; }
.opt.correct { background: var(--good-soft); border-color: var(--good);
  box-shadow: inset 0 0 0 1px var(--good); }
.opt.wrong { background: var(--bad-soft); border-color: var(--bad);
  box-shadow: inset 0 0 0 1px var(--bad); }
.opt.dim { opacity: .45; }

/* feedback */
.feedback { margin-top: 20px; padding: 16px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); }
.verdict { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.verdict.ok { color: #63c98f; }
.verdict.no { color: #ec8580; }
.explanation { color: #c7ccd4; line-height: 1.6; margin: 0 0 4px; }
/* primary-source citation under the explanation — deliberately quiet: it must be
   checkable without competing with the answer itself */
.sources { color: var(--mute); font-size: 12px; margin: 6px 0 0; line-height: 1.5; }
.sources a { color: #9fb4d4; text-decoration: underline; text-underline-offset: 2px; }
.sources a:hover { color: #c7d7ee; }
.sources .verified { opacity: .72; }
.whytags { color: var(--mute); font-size: 12px; margin: 10px 0 16px; }
.btn-primary { background: var(--accent); color: #fff; border: none;
  border-radius: var(--radius-sm); padding: 12px 20px; font-size: 15px; font-weight: 600;
  cursor: pointer; width: 100%; transition: filter .12s; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { filter: brightness(.95); }
.btn-ghost { background: transparent; color: var(--mute); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 9px 15px; margin-top: 24px; cursor: pointer;
  font-size: 14px; font-weight: 550; transition: color .12s, border-color .12s, background .12s; }
.btn-ghost:hover { color: var(--ink); border-color: var(--line-strong); background: var(--panel); }

/* report */
.report-head { display: flex; align-items: baseline; justify-content: space-between; }
.overall { font-weight: 700; font-variant-numeric: tabular-nums; }
.muted { color: var(--mute); margin-top: 2px; }
.domains { margin: 20px 0; display: grid; gap: 12px; }
.domain { display: grid; grid-template-columns: 150px 1fr auto; gap: 12px; align-items: center; }
.domain .name { font-size: 13.5px; font-weight: 600; }
.bar { background: var(--panel2); border-radius: 999px; height: 10px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px;
  transition: width .4s ease; }
.domain .pct { font-size: 13px; font-weight: 650; min-width: 66px; text-align: right;
  font-variant-numeric: tabular-nums; }
.report-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 16px; }
.list { list-style: none; padding: 0; margin: 8px 0; }
.list li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.list li:last-child { border-bottom: none; }
.list li .sub { color: var(--mute); font-size: 12px; }
.empty { color: var(--mute); }
@media (max-width: 520px) {
  .report-cols { grid-template-columns: 1fr; }
  .domain { grid-template-columns: 110px 1fr auto; }
  .domain .name { font-size: 12px; }
  .tab { padding: 6px 9px; font-size: 12.5px; }
  .brand span { display: none; }
}

/* order (sleepvraag) widget */
.opt .ordbadge { display: inline-block; min-width: 24px; height: 24px; line-height: 24px;
  margin-right: 10px; border-radius: 999px; background: var(--accent); color: #fff;
  text-align: center; font-weight: 700; font-size: 13px; }
.opt .ordbadge.empty { background: var(--panel2); color: var(--mute); border: 1px dashed var(--line-strong); }
.ordhint { color: var(--mute); font-size: 13px; margin: 8px 2px 0; }

/* exam mode */
.exambar { display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; color: var(--mute); font-size: 13.5px; font-weight: 550; }
.examtimer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 12px; font-size: 13px; }
.examtimer.low { color: #ec8580; border-color: var(--bad); }
.examnav { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.examnav .btn-ghost { margin-top: 0; }
.examnav .btn-primary { margin-left: auto; width: auto; padding: 9px 22px; }
.opt.selected { border-color: var(--accent); background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent); }
.opt.marked-flag { }
.examgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 8px; margin: 14px 0; }
.examgrid button { padding: 10px 0; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); cursor: pointer; font-weight: 550;
  font-variant-numeric: tabular-nums; transition: background .12s, border-color .12s; }
.examgrid button:hover { border-color: var(--line-strong); }
.examgrid button.answered { background: var(--good-soft); border-color: var(--good); }
.examgrid button.marked { border-color: var(--amber); box-shadow: inset 0 0 0 1px var(--amber); }
.examgrid button.current { outline: 2px solid var(--accent); outline-offset: 1px; }
.overviewpanel { padding: 4px 2px; }
#exam-review .rev { border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel); padding: 12px 14px; margin: 8px 0; }
#exam-review .rev.good { border-left: 3px solid var(--good); }
#exam-review .rev.bad { border-left: 3px solid var(--bad); }
#exam-review .rev .sub { color: var(--mute); font-size: 13px; }

/* ── item report ("dit lijkt me fout") — see server/telemetry.py ── */
.reportbox { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--line); }
.reportbox .linkish { background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--mute); font-size: 13px; text-decoration: underline dotted; }
.reportbox .linkish:hover { color: var(--ink); }
.reportbox .rlead { font-size: 13px; color: var(--mute); margin: 2px 0 8px; }
.reportbox .rsns { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.reportbox .rsn { padding: 6px 10px; font-size: 13px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--panel); color: var(--ink); cursor: pointer; }
.reportbox .rsn:hover { border-color: var(--line-strong); }
.reportbox .rsn.sel { border-color: var(--accent); background: var(--accent-soft); }
.reportbox textarea { width: 100%; box-sizing: border-box; padding: 8px 10px; font: inherit;
  font-size: 13px; color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm); resize: vertical; }
.reportbox .btn-secondary { margin-top: 8px; padding: 7px 16px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--ink); }
.reportbox .rthanks { font-size: 13px; color: var(--good); margin: 4px 0 0; }
.focusnote { font-size: 13px; color: var(--mute); margin: 0 0 8px; }
.focusnote a { color: var(--accent); }
