:root {
  --bg: #eef2f6;
  --surface: #ffffff;
  --ink: #10202e;
  --muted: #5b6b7a;
  --line: #d5dde6;
  --accent: #1e4fd8;
  --accent-ink: #ffffff;
  --good: #17734a;
  --good-bg: #e0f3e9;
  --bad: #b3261e;
  --bad-bg: #fbe5e3;
  --rule: #cfe0f5;
  --margin: #e8a3a0;
  --radius: 14px;
  font-family: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1620; --surface: #16222e; --ink: #e8eef4; --muted: #93a3b3; --line: #2a3a49;
    --accent: #6d92ff; --accent-ink: #0b1220; --good: #62d19a; --good-bg: #15382a;
    --bad: #ff8d84; --bad-bg: #3d1d1b; --rule: #24384d; --margin: #7a4543;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font-size: 17px; line-height: 1.4;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-text-size-adjust: 100%;
}
h1, h2 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0.4rem 0; }
a { color: inherit; }
.wrap { max-width: 640px; margin: 0 auto; padding: 16px 16px 110px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.error { color: var(--bad); font-weight: 600; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; min-height: 44px; }
.top h1 { font-size: 1.25rem; }
.link { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 600; padding: 10px 0; cursor: pointer; text-decoration: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: var(--radius);
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--bad); }
.btn.big { width: 100%; min-height: 54px; font-size: 1.05rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.field { display: block; font-weight: 600; margin-bottom: 14px; }
input[type=text], input[type=password], select {
  display: block; width: 100%; min-height: 48px; margin-top: 6px; padding: 0 14px;
  font: inherit; font-size: 16px; font-weight: 400; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius);
}
.login { padding-top: 15vh; }
.login h1 { margin-bottom: 24px; font-size: 2rem; }

.list { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 10px; }
.item { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 16px; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); text-decoration: none; }
.item .name { font-weight: 600; }
.item .count { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }

.mode { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.mode p { color: var(--muted); margin: 4px 0 12px; }
.mode .field { margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-weight: 400; min-height: 32px; }
.check input { width: 22px; height: 22px; }
details { margin: 8px 0 18px; }
summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
.wordtable { width: 100%; border-collapse: collapse; }
.wordtable td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
.row { display: flex; gap: 10px; }
.row .btn { flex: 1; }

/* bewerken */
.colhead, .rowedit { display: grid; grid-template-columns: 1fr 1fr 44px; gap: 8px; align-items: center; }
.colhead { font-weight: 600; color: var(--muted); font-size: 0.9rem; margin: 18px 0 6px; }
.rowedit { margin-bottom: 8px; }
.rowedit input { margin: 0; min-width: 0; }
.rowedit input.bad { border-color: var(--bad); }
.rowedit .x { height: 44px; border: 0; background: none; color: var(--muted); font-size: 1.6rem; cursor: pointer; }
.scan { background: var(--surface); border: 1.5px dashed var(--accent); border-radius: var(--radius); padding: 14px; }
.scan .btn { width: 100%; }
.savebar { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); }
.savebar > * { max-width: 608px; margin-left: auto; margin-right: auto; }
.savebar .error { margin-bottom: 8px; min-height: 0; }

.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 10px 0; }
.bar > div { height: 100%; width: 0; background: var(--accent); transition: width 0.25s; }

/* leerschermen: kaart als steekkaart met lijntjes en rode kantlijn */
.qcard {
  position: relative; display: block; width: 100%; min-height: 220px; margin: 14px 0 18px;
  padding: 24px 22px 24px 40px; text-align: left; color: var(--ink); font: inherit;
  background-color: var(--surface);
  background-image: repeating-linear-gradient(to bottom, transparent 0 35px, var(--rule) 35px 36px);
  background-position: 0 14px;
  border: 1.5px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; justify-content: center;
}
.qcard::before { content: ""; position: absolute; left: 24px; top: 0; bottom: 0; width: 1.5px; background: var(--margin); }
button.qcard { cursor: pointer; }
.qcard.back { background-image: none; background-color: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.qcard.back::before { background: rgba(255, 255, 255, 0.35); }
.qcard .dirlabel { font-size: 0.85rem; color: var(--muted); margin-bottom: 8px; }
.qcard.back .dirlabel { color: inherit; opacity: 0.8; }
.qcard .q { font-size: 2rem; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.qcard.pop { animation: pop 0.18s ease-out; }
@keyframes pop { from { transform: scale(0.98); opacity: 0.6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .qcard.pop { animation: none; } .bar > div { transition: none; } }

.fb { min-height: 52px; margin: 12px 0; padding: 12px 14px; border-radius: var(--radius); font-weight: 600; }
.fb:empty { visibility: hidden; }
.fb.good { background: var(--good-bg); color: var(--good); }
.fb.bad { background: var(--bad-bg); color: var(--bad); }
.meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.9rem; }

.result-score { font-size: 3rem; font-weight: 800; margin: 8px 0; }
.score-row { display: flex; gap: 12px; margin: 10px 0 22px; }
.score-row > div { flex: 1; padding: 14px; border-radius: var(--radius); font-weight: 600; }
.score-row .g { background: var(--good-bg); color: var(--good); }
.score-row .b { background: var(--bad-bg); color: var(--bad); }
.score-row strong { display: block; font-size: 1.8rem; }
.wrong-item { padding: 14px; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.wrong-item .dir { color: var(--muted); font-size: 0.82rem; }
.wrong-item .given { color: var(--bad); text-decoration: line-through; }
.wrong-item .right { color: var(--good); font-weight: 600; }
.actions { display: grid; gap: 10px; margin-top: 20px; }
[hidden]{display:none!important}
