/* WSV De Breek — CWO 1 toets
 * Light mode, mobile-first. WSV brand: deep blue + warm yellow.
 * Aimed at 8-12y olds: friendly but not childish, calm not loud.
 */

:root {
  --brand: #2f5597;
  --brand-soft: #4a7bc4;
  --brand-deep: #1f3d75;
  --accent: #fbae02;
  --accent-soft: #ffd067;
  --bg: #f4f8fc;
  --bg-card: #ffffff;
  --bg-soft: #eaf1f9;
  --text: #1a2540;
  --text-muted: #5a6b85;
  --border: #dde5ef;
  --border-strong: #b8c7dc;
  --ok: #4a8a5e;
  --ok-bg: #e6f1ea;
  --err: #b85858;
  --err-bg: #f6e6e6;
  --warn: #c89200;
  --warn-bg: #fbf1d8;
  --shadow: 0 1px 3px rgba(31, 61, 117, 0.08);
  --shadow-md: 0 4px 14px rgba(31, 61, 117, 0.10);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image:
    radial-gradient(ellipse at 50% -20%, rgba(74, 123, 196, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
  background-attachment: fixed;
}

a {
  color: var(--brand);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* Header */
.site-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.site-header img.logo {
  width: 40px; height: 40px;
  border-radius: 8px;
  object-fit: contain;
  background: white;
}
.site-header .titlewrap { display: flex; flex-direction: column; line-height: 1.2; }
.site-header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--brand-deep);
}
.site-header .sub {
  font-size: 13px;
  color: var(--text-muted);
}
.site-header nav {
  margin-left: auto;
  display: flex;
  gap: 14px;
  font-size: 14px;
}
.site-header nav a {
  color: var(--text-muted);
  font-weight: 500;
  padding: 4px 0;
}
.site-header nav a.active {
  color: var(--brand);
  border-bottom: 2px solid var(--accent);
}

main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
  color: var(--brand-deep);
}
.card p { margin: 8px 0; color: var(--text-muted); }
.card p.lead { color: var(--text); font-size: 16px; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  background: var(--brand);
  color: white;
  text-align: center;
  transition: background 150ms ease-out, transform 100ms ease-out;
  text-decoration: none;
}
.btn:hover { background: var(--brand-deep); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.secondary {
  background: var(--bg-card);
  border-color: var(--border-strong);
  color: var(--brand);
}
.btn.secondary:hover { background: var(--bg-soft); }
.btn.accent {
  background: var(--accent);
  color: var(--brand-deep);
}
.btn.accent:hover { background: #e69e00; }
.btn:disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}
.btn-row {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-top: 14px;
}

/* Landing page mode chooser */
.modes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 600px) {
  .modes { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
  .modes.three-up { grid-template-columns: 1fr 1fr 1fr; }
}
.mode-card.theorie .icon { color: var(--brand-soft); }
.mode-card {
  display: block;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 150ms ease-out, box-shadow 150ms ease-out;
  color: var(--text);
}
.mode-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.mode-card .icon {
  width: 56px; height: 56px;
  margin-bottom: 12px;
  color: var(--brand);
}
.mode-card.examen .icon { color: var(--accent); }
.mode-card h3 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
  color: var(--brand-deep);
}
.mode-card p {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

/* Forms */
label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
input[type="text"], input[type="password"], input[type="number"], select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  transition: border-color 150ms ease-out, box-shadow 150ms ease-out;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 85, 151, 0.15);
}
.form-row { margin-bottom: 14px; }

/* Topic chooser chips */
.chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 8px 0 16px;
}
.chip {
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: all 150ms ease-out;
}
.chip:hover { background: var(--bg-soft); }
.chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

/* Question card */
.q-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.q-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
}
.q-bar > div {
  height: 100%;
  background: var(--accent);
  transition: width 200ms ease-out;
}

.q-text {
  font-size: 18px;
  font-weight: 500;
  margin: 0 0 16px;
  color: var(--text);
  line-height: 1.4;
}
.q-image {
  display: block;
  max-width: 100%;
  max-height: 320px;
  width: auto;
  margin: 0 auto 16px;
  background: #ffffff;
  border-radius: var(--radius-sm);
  padding: 8px;
  border: 1px solid var(--border);
  image-rendering: -webkit-optimize-contrast;
}

.options {
  display: flex; flex-direction: column; gap: 10px;
}
.option {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 16px;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  transition: all 150ms ease-out;
  width: 100%;
}
.option:hover {
  background: var(--bg-soft);
  border-color: var(--brand-soft);
}
.option .letter {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--brand-deep);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  margin-right: 12px;
}
.option.selected {
  background: var(--bg-soft);
  border-color: var(--brand);
}
.option.selected .letter {
  background: var(--brand);
  color: white;
}
.option.correct {
  background: var(--ok-bg);
  border-color: var(--ok);
  color: var(--text);
}
.option.correct .letter {
  background: var(--ok);
  color: white;
}
.option.wrong {
  background: var(--err-bg);
  border-color: var(--err);
}
.option.wrong .letter {
  background: var(--err);
  color: white;
}
.option:disabled { cursor: default; }

.feedback {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  line-height: 1.5;
}
.feedback.ok { background: var(--ok-bg); border-left: 3px solid var(--ok); }
.feedback.err { background: var(--err-bg); border-left: 3px solid var(--err); }
.feedback strong { color: var(--brand-deep); }

/* Score / result */
.score-big {
  text-align: center;
  padding: 24px 16px;
}
.score-big .number {
  font-size: 56px;
  font-weight: 600;
  color: var(--brand);
  line-height: 1;
}
.score-big .total { color: var(--text-muted); font-size: 22px; }
.score-big .label {
  margin-top: 8px;
  font-size: 16px;
  color: var(--text-muted);
}
.score-big .verdict {
  display: inline-block;
  margin-top: 14px;
  padding: 6px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
}
.score-big .verdict.passed { background: var(--ok-bg); color: var(--ok); }
.score-big .verdict.failed { background: var(--warn-bg); color: var(--warn); }

.flag-row {
  display: flex; justify-content: center; gap: 4px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.flag {
  width: 16px; height: 22px;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 60%, 80% 80%, 100% 100%, 0 100%);
  opacity: 0.85;
}
.flag.dim { background: var(--border); }

/* Examens overview table */
.examens-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.examens-table th, .examens-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.examens-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-soft);
}
.examens-table td.score { font-weight: 600; }
.examens-table .pass { color: var(--ok); }
.examens-table .fail { color: var(--err); }

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
  font-size: 15px;
}

footer {
  padding: 16px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

/* Result review (per-question after exam) */
.review-q {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.review-q:last-child { border-bottom: none; }
.review-q .badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 6px;
}
.review-q .badge.ok { background: var(--ok-bg); color: var(--ok); }
.review-q .badge.err { background: var(--err-bg); color: var(--err); }

/* Hidden helper */
.hidden { display: none !important; }

/* Loading */
.loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

/* Discrete docent link on landing */
.docent-link {
  text-align: center;
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-muted);
}
.docent-link a { color: var(--text-muted); }

/* Vragen-overzicht (examinator) page */
.vragen-page main { max-width: 880px; }

.vragen-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.vragen-actions { display: flex; gap: 8px; }
.legend {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.legend .badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 4px;
}
.legend .badge.ok { background: var(--ok-bg); color: var(--ok); }
.legend .badge.exam { background: var(--accent-soft); color: var(--brand-deep); }
.muted { color: var(--text-muted); }

.topic-section { margin-bottom: 24px; }
.topic-header {
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 10px 0 8px;
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 600;
  color: var(--brand-deep);
  border-bottom: 2px solid var(--accent);
  z-index: 5;
}
.topic-header .topic-count {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 10px;
}

.vraag-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  page-break-inside: avoid;
  break-inside: avoid;
}
.vraag-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
.vraag-num {
  font-weight: 600;
  color: var(--brand-deep);
  font-size: 15px;
}
.vraag-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  background: var(--bg-soft);
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: auto;
}
.badge.exam {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--brand-deep);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.vraag-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.vraag-card.has-image .vraag-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 700px) {
  .vraag-card.has-image .vraag-body {
    grid-template-columns: 220px 1fr;
    align-items: start;
  }
}
.vraag-image {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vraag-image img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  image-rendering: -webkit-optimize-contrast;
}

.vraag-text {
  margin: 4px 0 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}
.vraag-options {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
}
.vraag-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  font-size: 14px;
  color: var(--text);
  border-radius: 4px;
  margin-bottom: 2px;
}
.vraag-option .letter {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
}
.vraag-option .letter.ok {
  background: var(--ok);
  color: white;
}
.vraag-option.correct {
  background: var(--ok-bg);
  font-weight: 500;
}
.vraag-option .text { flex: 1; }
.vraag-option .ok-check {
  color: var(--ok);
  font-weight: 700;
}

.explanation {
  margin: 8px 0 4px;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text);
  background: var(--bg-soft);
  border-left: 3px solid var(--brand-soft);
  border-radius: 3px;
  line-height: 1.5;
}
.source {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* Theorie — chapter index + reading view */
.theorie-page main { max-width: 760px; }

.chapter-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
@media (min-width: 600px) {
  .chapter-grid { grid-template-columns: 1fr 1fr; }
}
.chapter-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  color: var(--text);
  transition: transform 150ms ease-out, box-shadow 150ms ease-out;
}
.chapter-card:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.chapter-card .num {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--brand-deep);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chapter-card .title {
  font-weight: 500;
  color: var(--brand-deep);
}

/* Reading view */
.reading {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
}
.reading h1 {
  font-size: 28px;
  font-weight: 600;
  color: var(--brand-deep);
  margin: 0 0 16px;
  line-height: 1.25;
  scroll-margin-top: 80px;
}
.reading h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--brand-deep);
  margin: 28px 0 10px;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 4px;
  scroll-margin-top: 80px;
}
.reading h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--brand);
  margin: 20px 0 6px;
  scroll-margin-top: 80px;
}
.reading p { margin: 10px 0; }
.reading ul, .reading ol { margin: 10px 0; padding-left: 24px; }
.reading li { margin: 4px 0; }
.reading hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0 12px;
}
.reading hr + p, .reading hr ~ p:last-child em {
  font-size: 13px;
  color: var(--text-muted);
}
.reading blockquote {
  margin: 16px 0;
  padding: 12px 18px;
  background: var(--bg-soft);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  font-size: 15px;
  color: var(--text);
}
.reading blockquote strong { color: var(--brand-deep); }
.reading a {
  color: var(--brand);
  text-decoration: underline;
}
.reading strong { font-weight: 600; color: var(--text); }

/* Chapter prev/next nav */
.chapter-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  margin: 8px 0 24px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.chapter-nav .prev { text-align: left; }
.chapter-nav .next { text-align: right; }
.chapter-nav .up {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.chapter-nav a { color: var(--brand); }

/* "Lees meer" link in quiz feedback */
.feedback .read-more {
  display: inline-block;
  margin-top: 8px;
  font-size: 14px;
  color: var(--brand);
  text-decoration: underline;
}

/* Vragen-overzicht: chapter link */
.vraag-card .chapter-link {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}
.vraag-card .chapter-link a { color: var(--brand); }

/* Print styles — examinator afdrukken */
@media print {
  :root {
    --bg: #ffffff;
    --bg-card: #ffffff;
    --bg-soft: #f5f5f5;
    --border: #cccccc;
    --text: #000000;
    --text-muted: #444444;
    --shadow: none;
    --shadow-md: none;
  }
  body {
    background: white !important;
    background-image: none !important;
    color: black;
    font-size: 11pt;
  }
  .no-print { display: none !important; }
  main { max-width: 100% !important; padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd; padding: 12px; margin-bottom: 8px; }
  .topic-header {
    position: static;
    background: white;
    page-break-after: avoid;
    break-after: avoid;
  }
  .vraag-card {
    box-shadow: none !important;
    border: 1px solid #ddd;
    padding: 8px 10px;
    margin-bottom: 6px;
  }
  .vraag-text { font-size: 11pt; }
  .vraag-option { font-size: 10pt; padding: 3px 6px; }
  .vraag-card.has-image .vraag-body {
    grid-template-columns: 180px 1fr;
  }
  .vraag-image {
    background: white !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    border: 1px solid #ddd;
  }
  .vraag-image img {
    max-height: 130px;
    width: auto;
    margin: 0 auto;
  }
  .vraag-option.correct { background: #f0f8f3 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .vraag-option .letter.ok { background: #4a8a5e !important; color: white !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .badge.exam { background: #fbe7a8 !important; color: #1f3d75 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .explanation { background: #f5f5f5 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; font-size: 10pt; }
  .source { font-size: 9pt; }
  footer { display: none; }
  a { color: black; text-decoration: none; }
  /* Theorie reading: clean print, full-width */
  .reading {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    font-size: 11pt;
    line-height: 1.55;
  }
  .reading h1, .reading h2, .reading h3 {
    page-break-after: avoid;
    break-after: avoid;
  }
  .reading h2 { border-bottom: 1px solid #999 !important; }
  .reading blockquote {
    background: #f5f5f5 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .chapter-nav { display: none !important; }
  .chapter-grid { display: block; }
  .chapter-card {
    box-shadow: none !important;
    border: 1px solid #ddd;
    margin-bottom: 4px;
  }
}
