/* Basisstijl van de OJW-tools. Kleuren per tool via de variabelen in body. */
:root {
  --bg1: #e0f2fe; --bg2: #f0f9ff;
  --ink: #0f172a; --muted: #475569;
  --a: #0284c7; --a2: #0369a1; --a-licht: #e0f2fe;
  --card: #ffffff; --line: #cbd5e1;
  --good: #16a34a; --good-licht: #dcfce7;
  --bad: #dc2626; --bad-licht: #fee2e2;
  --gold: #f59e0b;
  --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--bg2) linear-gradient(180deg, var(--bg1), var(--bg2) 360px) no-repeat; min-height: 100%; }
body {
  color: var(--ink);
  font-family: "Nunito", "Segoe UI Rounded", "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 18px; line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { cursor: default; }
.hidden { display: none !important; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 18px; background: var(--a); color: #fff;
  position: sticky; top: 0; z-index: 20; height: 58px; box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.logo { font-weight: 900; font-size: 23px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 8px; }
.top-btn { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35); border-radius: 12px; padding: 7px 12px; font-size: 16px; font-weight: 800; color: #fff; white-space: nowrap; }
.top-btn:hover { background: rgba(255,255,255,.3); }

main { max-width: 1000px; margin: 0 auto; padding: 16px; }

/* ---------- menu ---------- */
.intro { text-align: center; margin: 6px 0 18px; }
.intro h1 { margin: 0 0 6px; font-size: 32px; line-height: 1.15; }
.intro p { margin: 0 auto; color: var(--muted); max-width: 640px; }
.meta { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.pill { background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 3px 12px; font-size: 15px; font-weight: 800; color: var(--a2); }
.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.lv {
  position: relative; display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.lv:not(.dicht):hover { transform: translateY(-2px); border-color: var(--a); box-shadow: 0 6px 16px rgba(0,0,0,.08); }
.lv.gehaald { border-color: color-mix(in srgb, var(--a) 45%, var(--line)); }
.lv.dicht { opacity: .55; }
.lv-num { flex: 0 0 46px; height: 46px; border-radius: 14px; background: var(--a); color: #fff; font-weight: 900; font-size: 22px; display: grid; place-items: center; }
.lv.dicht .lv-num { background: #94a3b8; font-size: 18px; }
.lv-txt { flex: 1; min-width: 0; }
.lv-txt b { display: block; font-size: 18px; line-height: 1.2; }
.lv-txt small { display: block; color: var(--muted); font-size: 14px; line-height: 1.25; margin-top: 2px; }
.lv-st { color: var(--gold); font-size: 20px; letter-spacing: 1px; white-space: nowrap; }
.lv-tijd { position: absolute; top: -9px; right: 10px; font-size: 16px; background: var(--card); border-radius: 99px; padding: 0 4px; }
.menu-actions { text-align: center; margin: 20px 0 8px; }
.howto { margin-top: 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; }
.howto h2 { margin: 0 0 10px; font-size: 20px; }
.howto-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.howto-grid b { display: block; }
.howto-grid span { color: var(--muted); font-size: 15px; }
.note { color: var(--muted); font-size: 14px; margin: 10px 0 0; }

/* ---------- knoppen ---------- */
.big-btn {
  background: var(--a); color: #fff; border-radius: 16px; padding: 13px 26px; font-weight: 900; font-size: 20px;
  box-shadow: 0 4px 0 var(--a2); transition: transform .08s, box-shadow .08s;
}
.big-btn:hover { filter: brightness(1.06); }
.big-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--a2); }
.big-btn.ghost { background: var(--card); color: var(--a2); border: 2px solid var(--a); box-shadow: 0 4px 0 var(--line); }
.big-btn:disabled { opacity: .55; filter: grayscale(.5); }
.link-btn { color: var(--a2); text-decoration: underline; font-weight: 700; margin-top: 12px; }
.start-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: 0 4px 18px rgba(15,23,42,.05); }

/* ---------- uitleg vooraf ---------- */
.intro-card { max-width: 860px; margin: 0 auto; }
.lv-kop { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.lv-kop h1 { margin: 0; font-size: 28px; }
.lv-badge { background: var(--a); color: #fff; border-radius: 99px; padding: 3px 12px; font-weight: 900; font-size: 15px; }
.ontdek p { margin: 8px 0; }
.ontdek .tip { background: var(--a-licht); border-left: 5px solid var(--a); border-radius: 10px; padding: 10px 14px; margin: 12px 0; }
.ontdek .let-op { background: #fef3c7; border-left: 5px solid var(--gold); border-radius: 10px; padding: 10px 14px; margin: 12px 0; }
.regels { display: flex; gap: 8px 18px; flex-wrap: wrap; justify-content: center; margin-top: 14px; color: var(--muted); font-weight: 700; font-size: 16px; }

/* ---------- spel ---------- */
.spel { position: relative; max-width: 900px; margin: 0 auto; }
.hud { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 8px 14px; }
.hud-lv { flex: 1; min-width: 0; }
.hud-lv small { display: block; color: var(--muted); font-size: 13px; font-weight: 800; }
.hud-lv b { display: block; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-nr { font-weight: 900; color: var(--a2); white-space: nowrap; }
.hud-hart { font-size: 18px; white-space: nowrap; }
.hud-punt { font-weight: 900; white-space: nowrap; min-width: 92px; text-align: right; }
.progress { height: 10px; background: rgba(15,23,42,.08); border-radius: 99px; margin: 8px 2px 0; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--good); border-radius: 99px; transition: width .4s; }
.tijd { height: 8px; background: rgba(15,23,42,.08); border-radius: 99px; margin: 6px 2px 0; overflow: hidden; }
.tijd-fill { height: 100%; width: 100%; background: var(--a); border-radius: 99px; }
.tijd-fill.bijna { background: var(--bad); }
.vraag { text-align: center; font-size: 23px; font-weight: 900; margin: 14px 8px 10px; line-height: 1.25; min-height: 1.25em; }
.vraag small { display: block; font-size: 16px; font-weight: 700; color: var(--muted); margin-top: 4px; }
.stage { position: relative; }

.opties { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-top: 12px; }
.optie {
  background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px;
  font-weight: 800; font-size: 18px; text-align: center; box-shadow: 0 3px 0 var(--line);
  transition: border-color .1s, background .1s, transform .08s;
}
.optie:hover:not(:disabled) { border-color: var(--a); }
.optie:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.optie.goed { background: var(--good-licht); border-color: var(--good); }
.optie.fout { background: var(--bad-licht); border-color: var(--bad); }
.optie small { display: block; font-weight: 600; color: var(--muted); font-size: 14px; }

.feedback {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 30;
  width: min(680px, calc(100% - 24px)); border-radius: 18px; padding: 14px 18px;
  box-shadow: 0 10px 30px rgba(15,23,42,.25); animation: omhoog .22s ease-out;
  display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; align-items: center;
}
@keyframes omhoog { from { transform: translate(-50%, 30px); opacity: 0; } }
.feedback.goed { background: var(--good-licht); border: 2px solid var(--good); }
.feedback.fout { background: #fff; border: 3px solid var(--bad); }
.fb-kop { font-weight: 900; font-size: 20px; grid-column: 1; }
.feedback.goed .fb-kop { color: #15803d; }
.feedback.fout .fb-kop { color: var(--bad); }
.fb-tekst { grid-column: 1; font-size: 17px; }
.verder { grid-column: 2; grid-row: 1 / span 3; background: var(--a); color: #fff; border-radius: 12px; padding: 10px 16px; font-weight: 900; white-space: nowrap; }
.feedback.goed .verder { background: var(--good); }

/* ---------- einde ---------- */
.einde { max-width: 560px; margin: 20px auto; text-align: center; }
.einde h1 { margin: 6px 0; }
.einde-emoji { font-size: 64px; }
.sterren-groot { color: var(--gold); font-size: 52px; letter-spacing: 6px; line-height: 1; margin: 6px 0; }

/* ---------- diploma ---------- */
.dip-bar { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.naam-in { font: inherit; font-size: 20px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 12px; min-width: 260px; }
.diploma {
  max-width: 720px; margin: 0 auto; background: #fff; border: 10px double var(--a); border-radius: 12px;
  padding: 28px 34px; text-align: center;
}
.dip-emoji { font-size: 56px; }
.dip-titel { font-size: 46px; font-weight: 900; color: var(--a2); letter-spacing: 2px; }
.dip-sub { font-size: 22px; font-weight: 800; margin-bottom: 16px; }
.dip-naam { font-size: 34px; font-weight: 900; border-bottom: 2px dashed var(--line); margin: 6px auto 12px; max-width: 460px; min-height: 48px; }
.dip-lijst { list-style: none; padding: 0; margin: 10px auto; max-width: 460px; text-align: left; }
.dip-lijst li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid #e2e8f0; padding: 4px 0; }
.dip-lijst b { color: var(--gold); }
.dip-voet { display: flex; justify-content: space-between; margin-top: 16px; font-weight: 700; color: var(--muted); }
.dip-site { margin-top: 10px; font-size: 13px; color: var(--muted); }
@media print {
  .top, .no-print { display: none !important; }
  body { background: #fff; }
  main { padding: 0; }
  .diploma { border-color: #333; }
}

@media (max-width: 640px) {
  body { font-size: 17px; }
  .top { padding: 8px 12px; height: 52px; }
  .logo { font-size: 19px; }
  .bt { display: none; }
  main { padding: 10px; }
  .intro h1 { font-size: 26px; }
  .hud { flex-wrap: wrap; gap: 4px 10px; padding: 6px 10px; }
  .hud-lv { flex-basis: 100%; }
  .hud-lv b { font-size: 15px; }
  .hud-punt { min-width: 0; margin-left: auto; }
  .vraag { font-size: 20px; }
  .opties { grid-template-columns: 1fr 1fr; }
  .optie { font-size: 16px; padding: 10px 8px; }
  .feedback { grid-template-columns: 1fr; bottom: 8px; }
  .verder { grid-column: 1; grid-row: auto; justify-self: end; }
  .dip-titel { font-size: 34px; }
  .diploma { padding: 18px 14px; }
}
/* ---------- Stroomlab ---------- */
:root { --bg1: #e9e3fb; --bg2: #f7f5ff; --a: #6d28d9; --a2: #4c1d95; --a-licht: #ede9fe; --line: #d6ccf3; }
.bord-plek { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bord { width: 100%; max-width: 420px; height: auto; display: block; user-select: none; -webkit-user-select: none; }
.bord.klein { max-width: 240px; }
.bord-bg { fill: #1e1b4b; }
.teg-bg { fill: #2e2a6b; }
.draaibaar .teg-bg { fill: #3b3590; cursor: pointer; }
.draaibaar:hover .teg-bg { fill: #4a43ad; }
.klikbaar { cursor: pointer; }
.klikbaar .teg-bg { fill: #4a43ad; }
.tegel { cursor: default; }
.draaibaar, .klikbaar { cursor: pointer; }
.draai { transform-origin: 40px 40px; transition: transform .2s ease-out; }
.draad { stroke: #94a3b8; stroke-width: 9; stroke-linecap: round; }
.draad-knoop { fill: #94a3b8; }
.stroom .draad { stroke: #facc15; }
.stroom .draad-knoop { fill: #facc15; }
.kort .draad { stroke: #f87171; animation: flits .4s infinite alternate; }
.kort .bat { fill: #b91c1c; }
@keyframes flits { to { stroke: #fde68a; } }
.peer { fill: #475569; stroke: #e2e8f0; stroke-width: 3; }
.gloeidraad { fill: none; stroke: #e2e8f0; stroke-width: 2.5; }
.gloed { fill: #fde047; opacity: 0; }
.aan .peer { fill: #fde047; stroke: #fff7c2; fill-opacity: var(--licht, 1); }
.aan .gloed { opacity: calc(var(--licht, 1) * .45); filter: blur(4px); }
.aan .gloeidraad { stroke: #f97316; }
.kapot { stroke: #ef4444; stroke-width: 5; stroke-linecap: round; }
.bat { fill: #334155; stroke: #e2e8f0; stroke-width: 2.5; }
.bat-plus { fill: #ef4444; }
.bat-txt { fill: #fff; font-weight: 900; font-size: 18px; text-anchor: middle; pointer-events: none; }
.pool { fill: #e2e8f0; }
.hendel { stroke: #f472b6; stroke-width: 7; stroke-linecap: round; }
.stroom .hendel { stroke: #facc15; }
.klem { fill: #cbd5e1; }
.mat-e { font-size: 30px; text-anchor: middle; pointer-events: none; }
.mat-vraag { font-size: 26px; font-weight: 900; text-anchor: middle; fill: #fff; }
.lamp-naam, .schak-naam { fill: #fff; font-weight: 900; font-size: 15px; text-anchor: middle; pointer-events: none; }
.schak-naam { fill: #f9a8d4; }
.bord-status { min-height: 1.4em; font-weight: 800; text-align: center; }
.bord-status.waarschuwing { color: var(--bad); }
.opties.twee { grid-template-columns: 1fr 1fr; max-width: 560px; margin: 12px auto 0; }
.groot-knop { font-size: 21px; padding: 16px 10px; }
.twee-borden { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.twee-borden .bord { max-width: 300px; }
.band-rij { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 16px; align-items: center; }
.band { position: relative; height: 150px; background: linear-gradient(#e5e7eb, #e5e7eb) bottom / 100% 26px no-repeat; border-radius: 14px; overflow: hidden; }
.band-rollen { position: absolute; left: 0; right: 0; bottom: 0; height: 26px; background: repeating-linear-gradient(90deg, #64748b 0 18px, #94a3b8 18px 36px); animation: rol 1s linear infinite; }
@keyframes rol { to { background-position: 36px 0; } }
.band-ding { position: absolute; bottom: 30px; left: 0; display: flex; flex-direction: column; align-items: center; width: 150px; animation: over linear forwards; }
.band-ding span { font-size: 64px; line-height: 1; }
.band-ding small { font-weight: 800; font-size: 15px; background: #fff; border-radius: 99px; padding: 1px 10px; border: 1px solid var(--line); white-space: nowrap; }
@keyframes over { from { left: -150px; } to { left: 100%; } }
.legenda { display: flex; gap: 14px; flex-wrap: wrap; background: #1e1b4b; color: #fff; border-radius: 14px; padding: 8px 12px; margin-bottom: 10px; }
.legenda span { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 15px; }
.legenda svg { width: 40px; height: 40px; }
@media (max-width: 640px) {
  .bord { max-width: 340px; }
  .band-rij { grid-template-columns: 1fr; }
  .band { height: 130px; }
  .bord-plek.klein .bord { max-width: 180px; }
  .twee-borden .bord { max-width: 170px; }
  .opties.twee { grid-template-columns: 1fr 1fr; }
}
