:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1b2140;
  --muted: #5d6585;
  --line: #e1e5f0;
  --accent: #2f54d6;
  --accent-ink: #ffffff;
  --accent-soft: #e8edff;
  --b: #7a3fd1;
  --b-soft: #f1e9ff;
  --warn: #9a5b00;
  --warn-soft: #fff1d6;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20, 30, 70, .06), 0 8px 24px rgba(20, 30, 70, .06);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1324;
    --card: #181d33;
    --ink: #e8ebf7;
    --muted: #9aa2c2;
    --line: #2a3150;
    --accent: #7b96ff;
    --accent-ink: #0f1324;
    --accent-soft: #232c55;
    --b: #b58cff;
    --b-soft: #2d2350;
    --warn: #ffc56b;
    --warn-soft: #3a2c12;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; margin-top: 1.4em; }
p { margin: 0 0 1em; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.lead { font-size: 1.08rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--accent); margin-bottom: .4em; }
.hl { color: var(--accent); }
.empty { color: var(--muted); font-style: italic; padding: 12px 0; }

/* ---------- kader ---------- */

.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 760px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 1.5rem; font-weight: 700; }
.brand strong { display: block; font-size: .98rem; }
.brand-sub { display: block; font-size: .8rem; color: var(--muted); }

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 20px 16px 32px; flex: 1; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 16px; border-top: 1px solid var(--line); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 16px; }
@media (max-width: 520px) { .card { padding: 18px; } }

/* ---------- stappen ---------- */

.stepper { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 16px; }
.stepper li { flex: 1; display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); padding: 8px 10px; border-radius: 10px; background: transparent; }
.stepper .dot { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; border: 2px solid var(--line); }
.stepper .active { color: var(--ink); background: var(--card); box-shadow: var(--shadow); font-weight: 600; }
.stepper .active .dot { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.stepper .done .dot { border-color: var(--accent); color: var(--accent); }
@media (max-width: 520px) { .stepper li:not(.active) .txt { display: none; } .stepper li:not(.active) { flex: none; } }

/* ---------- knoppen ---------- */

.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 10px 18px; border-radius: 12px; min-height: 44px;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; min-height: 36px; font-size: .875rem; }
.btn.big { padding: 14px 28px; font-size: 1.05rem; margin: 8px 0 14px; }
.btn:focus-visible, .choice:focus-visible, .chip:focus-visible, .icon:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }

/* ---------- invoer ---------- */

.add-row { display: flex; gap: 8px; margin: 16px 0 12px; }
.add-row input { flex: 1; min-width: 0; }
input {
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; min-height: 44px;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 12px 0; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 6px 6px 6px 14px; border-radius: 999px; background: var(--accent-soft); color: var(--ink); font-weight: 600; font-size: .95rem; }
.chip.add { font: inherit; font-size: .875rem; font-weight: 500; padding: 5px 12px; border: 1px dashed var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.chip.add:hover { color: var(--accent); border-color: var(--accent); }
.chip-x, .icon { font: inherit; border: 0; background: transparent; color: var(--muted); cursor: pointer; width: 28px; height: 28px; border-radius: 50%; font-size: 1.15rem; line-height: 1; }
.chip-x:hover, .icon:hover { background: var(--line); color: var(--ink); }
.suggest .muted { margin-right: 4px; }
.inspire { margin: 8px 0; }
.inspire summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: .95rem; }
.count { margin-top: 12px; }

.ctx-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.ctx-list li { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 6px; border: 1px solid var(--line); border-radius: 12px; }
.ctx-list input { flex: 1; min-width: 0; border-color: transparent; background: transparent; font-weight: 600; }
.ctx-list input:hover { border-color: var(--line); }

/* ---------- intro ---------- */

.how { list-style: none; counter-reset: s; padding: 0; margin: 20px 0; display: grid; gap: 12px; }
.how li { counter-increment: s; display: grid; grid-template-columns: 36px 1fr; column-gap: 12px; }
.how li::before { content: counter(s); grid-row: span 2; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; display: grid; place-items: center; }
.how span { color: var(--muted); }

/* ---------- dilemma ---------- */

.meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: .85rem; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-bottom: 22px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .25s; }

.notice {
  margin: -6px 0 18px; padding: 10px 14px; border-radius: 12px;
  background: var(--warn-soft); color: var(--warn); font-size: .92rem; text-align: center;
  animation: pop .25s ease-out;
}
.question { font-size: clamp(1.15rem, 3.4vw, 1.4rem); text-align: center; margin: 8px 0 22px; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.choices.list { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
@media (max-width: 560px) { .choices { grid-template-columns: 1fr; } }

.choice {
  font: inherit; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 12px;
  padding: 22px 20px; min-height: 92px;
  border-radius: var(--radius); border: 2px solid var(--line); background: var(--card); color: var(--ink);
  transition: border-color .15s, background .15s, transform .08s;
  animation: pop .22s ease-out;
}
.choice:hover { border-color: var(--accent); background: var(--accent-soft); }
.choice:active { transform: scale(.98); }
.choices.list .choice { min-height: 60px; padding: 14px 16px; }
.letter { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 1.15rem; background: var(--accent); color: var(--accent-ink); }
.choice[data-i="1"] .letter { background: var(--b); }
.choice[data-i="1"]:hover { border-color: var(--b); background: var(--b-soft); }
.dash { color: var(--muted); font-weight: 600; }
.choice .label { font-size: 1.2rem; font-weight: 700; overflow-wrap: anywhere; }
.choices.list .label { font-size: 1.05rem; }
kbd { font: inherit; font-size: .8rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 0 6px; }
@media (pointer: coarse) { .kbd-hint { display: none; } }

@keyframes pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .choice, .bar span { animation: none; transition: none; } }

.picked { margin: 0 0 4px; padding-left: 1.4em; font-weight: 600; }

/* ---------- resultaat ---------- */

.results { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.results .card { margin-bottom: 0; }
.results + .card { margin-top: 16px; }
.result-head .actions { margin-top: 4px; }
.rank { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.rank li { display: grid; grid-template-columns: 32px 1fr 70px; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rank li:last-child { border-bottom: 0; }
.rank li:first-child .pos { background: var(--accent); color: var(--accent-ink); }
.pos { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; display: grid; place-items: center; font-size: .9rem; }
.name { font-weight: 600; overflow-wrap: anywhere; }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; color: var(--warn); background: var(--warn-soft); padding: 1px 8px; border-radius: 99px; margin-left: 4px; vertical-align: middle; }
.score { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.score span { display: block; height: 100%; background: var(--accent); }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; }
td:first-child { font-weight: 600; }

/* ---------- melding ---------- */

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  max-width: calc(100% - 32px); background: var(--ink); color: var(--bg);
  padding: 12px 18px; border-radius: 12px; font-size: .95rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); z-index: 10;
}

/* ---------- afdrukken ---------- */

@media print {
  body { background: #fff; color: #000; }
  .top #restart, .stepper, .actions, .nav, .toast { display: none !important; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .results { grid-template-columns: 1fr 1fr; }
}
