:root {
  --paper: #f3f5f7;
  --card: #ffffff;
  --ink: #1d2a39;
  --muted: #5b6878;
  --line: #d4dae1;
  --accent: #2f5da8;
  --accent-ink: #ffffff;
  --accent-soft: #e3ebf7;
  --warn: #9a6200;
  --warn-soft: #fdf1d8;
  --bad: #b3261e;
  --ok: #2f7d4f;
  --radius-lg: 14px;
  --radius-sm: 7px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #151b23; --card: #1d2530; --ink: #e6ebf1; --muted: #9aa6b4; --line: #313c4a;
    --accent: #7aa5ec; --accent-ink: #0f1722; --accent-soft: #23324a;
    --warn: #f0b44c; --warn-soft: #3a2e17; --bad: #ff8a80; --ok: #6fcf97;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  padding-bottom: 96px;
}
h1, h2 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
button, input, select { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.top {
  max-width: 1160px; margin: 0 auto; padding: 28px 20px 8px;
  display: flex; gap: 14px; align-items: flex-start;
}
.top img { border-radius: 10px; flex: none; }
.promise { margin: 4px 0 0; color: var(--muted); max-width: 62ch; }

main { max-width: 1160px; margin: 0 auto; padding: 12px 20px; }

/* Stappen */
.setup { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; }
.num {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--ink); color: var(--paper); font-size: .85rem; font-weight: 700; flex: none;
}
.hint { color: var(--muted); font-size: .9rem; margin: 8px 0 0; }

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 190px; padding: 24px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line); border-radius: var(--radius-sm);
  background:
    linear-gradient(var(--card), var(--card)) padding-box,
    repeating-linear-gradient(135deg, transparent 0 10px, color-mix(in srgb, var(--line) 35%, transparent) 10px 11px);
  transition: border-color .15s, background-color .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-main { font-size: 1.15rem; font-weight: 600; }
.drop-sub { color: var(--muted); }
.linkish { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; }

.modes { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.modes label, .seg label { position: relative; }
.modes input, .seg input { position: absolute; opacity: 0; pointer-events: none; }
.modes span {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px 8px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; font-size: .92rem;
}
.modes input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); font-weight: 600; }
.modes input:focus-visible + span, .seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
/* Kleine stalen die laten zien wat elke modus met een gezicht doet */
.sw { width: 34px; height: 34px; border-radius: 5px; display: block; }
.sw-overlay { background: #fff url(assets/overlay.png) center / 30px no-repeat; border: 1px solid var(--line); border-radius: 50%; }
.sw-pixel { background: conic-gradient(#c9a58c 25%, #8c6b58 0 50%, #b48f78 0 75%, #6e5243 0) 0 0 / 11px 11px; }
.sw-blur { background: radial-gradient(circle at 50% 40%, #d9b8a0, #9a7a66 70%); filter: blur(2px); }
.sw-black { background: #000; }

.overlay-row { display: flex; gap: 12px; align-items: center; margin-top: 14px; }
.overlay-row[hidden] { display: none; }
.overlay-row img { width: 44px; height: 44px; object-fit: contain; border-radius: 6px; background: repeating-conic-gradient(#8883 0 25%, transparent 0 50%) 0 0 / 10px 10px; }
.overlay-row div { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
button {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 6px 12px; cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
.inline { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.inline input, .range input { accent-color: var(--accent); }

.range { display: grid; grid-template-columns: 120px 1fr 48px; gap: 10px; align-items: center; margin-top: 14px; }
.range output { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

.more { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.more summary { cursor: pointer; font-weight: 600; }
.seg { border: 0; padding: 0; margin: 12px 0 0; display: flex; gap: 0; }
.seg legend { font-size: .9rem; color: var(--muted); margin-bottom: 6px; }
.seg span { display: block; padding: 6px 14px; border: 1px solid var(--line); cursor: pointer; margin-left: -1px; }
.seg label:first-of-type span { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.seg label:last-of-type span { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.seg input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); position: relative; }
#redetect { margin-top: 12px; }

/* Contactvel */
.results { margin-top: 26px; }
.results-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.results-head h2 { margin-bottom: 4px; }
.summary { margin: 0; color: var(--muted); }
.check-hint { margin: 0 0 12px; }
.sheet {
  list-style: none; margin: 12px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px;
}
.print {
  background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 8px 8px 10px;
  width: 100%; text-align: left; display: flex; flex-direction: column; gap: 8px; cursor: pointer;
}
.print:disabled { cursor: progress; opacity: 1; }
.print .frame { aspect-ratio: 4 / 3; background: var(--paper); display: grid; place-items: center; overflow: hidden; border-radius: 2px; }
.print img { max-width: 100%; max-height: 100%; display: block; }
.print .name { font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.print .state { font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.print .state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.print.ok .state::before { background: var(--ok); }
.print.checked .state::before { background: var(--accent); }
.print.warn { border-color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn); background: var(--warn-soft); }
.print.warn .state { color: var(--warn); font-weight: 600; }
.print.warn .state::before { background: var(--warn); }
.print.error { border-color: var(--bad); }
.print.error .state { color: var(--bad); }
.print.error .state::before { background: var(--bad); }
.print.busy .frame { background: repeating-linear-gradient(90deg, var(--paper) 0 20px, var(--line) 20px 21px); }

/* Onderbalk */
.bar {
  position: fixed; inset: auto 0 0 0; background: var(--card); border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 12px max(20px, calc((100vw - 1160px) / 2 + 20px));
}
.bar[hidden] { display: none; }
.bar p { margin: 0; flex: 1; min-width: 0; color: var(--muted); }
.progress { position: absolute; inset: -1px 0 auto 0; height: 3px; background: transparent; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; padding: 9px 16px; }
.ghost { background: transparent; }

/* Nalopen */
dialog {
  width: min(1200px, 96vw); height: min(900px, 94vh); padding: 0; border: 1px solid var(--line);
  border-radius: var(--radius-lg); background: var(--card); color: var(--ink);
}
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgb(10 15 22 / .7); }
.review-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.review-head h2 { margin: 0; flex: 1; font-size: 1rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-head #prev, .review-head #next { font-size: 1.4rem; line-height: 1; padding: 2px 12px; }
.close { font-size: 1.4rem; line-height: 1; padding: 2px 10px; }
.review-help { margin: 8px 14px 0; color: var(--muted); font-size: .9rem; }
.stage {
  position: relative; flex: 1 1 0; min-height: 0; margin: 10px 14px 14px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  touch-action: none; user-select: none;
}
.stage img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.boxes { position: absolute; cursor: crosshair; }
.box {
  position: absolute; border: 2px dashed var(--ok); border-radius: 3px; cursor: pointer;
  background: transparent; padding: 0;
}
.box.manual { border-color: var(--warn); }
.box:hover { background: rgb(179 38 30 / .25); border-style: solid; border-color: var(--bad); }
.box.draft { border-style: solid; border-color: var(--warn); pointer-events: none; }

.noscript { max-width: 600px; margin: 40px auto; }

@media (max-width: 820px) {
  .setup { grid-template-columns: 1fr; }
  .modes { grid-template-columns: repeat(2, 1fr); }
  .sheet { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .bar { flex-wrap: wrap; padding: 10px 16px; }
  .bar p { flex-basis: 100%; }
  main, .top { padding-left: 16px; padding-right: 16px; }
  .range { grid-template-columns: 100px 1fr 44px; }
  .review-head { flex-wrap: wrap; }
  .review-head h2 { order: -1; flex-basis: 100%; }
  .review-head .close { margin-left: auto; }
  dialog { width: 100vw; height: 100dvh; max-width: none; max-height: none; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
