:root {
  --paper: #fff6e3;
  --card: #fffdf7;
  --ink: #1c1b3a;
  --ink-2: #55536f;
  --tomato: #ff5a4f;
  --sun: #ffc531;
  --mint: #22c08a;
  --sky: #3aa0ff;
  --grape: #8a5cf6;
  --pink: #ff7ab6;
  --ok: #128a60;
  --bad: #d4352b;
  --line: 3px solid var(--ink);
  --r: 18px;
  --shadow: 5px 5px 0 var(--ink);
  --shadow-s: 3px 3px 0 var(--ink);
  --display: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Segoe UI Black", "Trebuchet MS", sans-serif;
  --body: ui-rounded, "SF Pro Rounded", "Segoe UI", "Trebuchet MS", Verdana, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  background-image: radial-gradient(rgba(28, 27, 58, .09) 1.5px, transparent 1.5px);
  background-size: 22px 22px;
  color: var(--ink);
  font: 500 18px/1.55 var(--body);
}
main { flex: 1; }
h1, h2, h3 { font-family: var(--display); line-height: 1.12; margin: 0 0 .5em; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: clamp(2.2rem, 6.4vw, 4rem); }
h2 { font-size: clamp(1.6rem, 3.6vw, 2.3rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
a { color: inherit; }
ul { padding-left: 1.2em; margin: 0 0 1em; }
li { margin-bottom: .35em; }
code { font-family: var(--mono); background: var(--ink); color: #6dffc4; padding: .08em .4em; border-radius: 6px; font-size: .92em; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 4px solid var(--grape); outline-offset: 2px; border-radius: 6px; }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(760px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 10px; z-index: 20; }
.skip:focus { left: 8px; }

/* Kop */
.site-header { background: var(--card); border-bottom: var(--line); position: sticky; top: 0; z-index: 10; }
.bar { display: flex; align-items: center; gap: 14px; min-height: 68px; flex-wrap: wrap; padding-block: 8px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font: 800 1.35rem var(--display); }
.brand b { color: var(--tomato); }
.brand-mark { width: 40px; height: 44px; }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a { text-decoration: none; font-weight: 700; padding: 6px 12px; border-radius: 12px; border: 3px solid transparent; }
.nav a:hover { background: var(--paper); }
.nav a[aria-current] { background: var(--sun); border-color: var(--ink); }
.lang { display: flex; gap: 2px; border: var(--line); border-radius: 12px; padding: 2px; background: var(--paper); }
.lang a { text-decoration: none; font: 800 .8rem/1 var(--mono); padding: 7px 7px; border-radius: 8px; }
.lang a:hover { background: #fff0c4; }
.lang a[aria-current="true"] { background: var(--ink); color: #fff; }
.star-count { font-weight: 800; background: var(--ink); color: #fff; padding: 5px 12px; border-radius: 99px; white-space: nowrap; }

@media (max-width: 720px) {
  .bar { gap: 8px 10px; }
  .site-header { position: static; }
  .nav { order: 3; width: 100%; margin: 0; justify-content: space-between; flex-wrap: nowrap; gap: 2px; }
  .nav a { padding: 3px 6px; font-size: .86rem; white-space: nowrap; }
  .lang { margin-left: auto; }
  .brand-mark { width: 32px; height: 36px; }
  .brand { font-size: 1.1rem; }
  .star-count { padding: 4px 10px; }
}

/* Knoppen */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; min-height: 48px;
  font-weight: 800; text-decoration: none; cursor: pointer;
  background: var(--sun); border: var(--line); border-radius: 14px; box-shadow: var(--shadow-s);
  transition: transform .08s, box-shadow .08s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: var(--shadow-s); }
.btn-ghost { background: var(--card); }
.btn-go { background: var(--mint); }
.btn-sm { padding: 6px 12px; min-height: 40px; font-size: .95rem; }

/* Hero */
.hero { padding: clamp(32px, 6vw, 72px) 0 28px; }
.hero-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 28px; align-items: center; }
.hero h1 mark { background: var(--sun); color: inherit; padding: 0 .18em; border-radius: 12px; }
.hero p { font-size: 1.2rem; max-width: 34em; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-art { position: relative; justify-self: center; }
.hero-art .bitje { width: min(250px, 58vw); height: auto; animation: bob 3.2s ease-in-out infinite; display: block; }
.bubble { position: absolute; top: -8px; left: -46px; max-width: 170px; background: var(--card); border: var(--line); border-radius: 16px 16px 16px 4px; padding: 8px 12px; font-weight: 700; font-size: .95rem; box-shadow: var(--shadow-s); transform: rotate(-4deg); }
.bitje-eyes { animation: blink 4.5s infinite; transform-origin: 60px 55px; }
@keyframes bob { 50% { transform: translateY(-10px) rotate(1.5deg); } }
@keyframes blink { 0%, 95%, 100% { transform: scaleY(1); } 97.5% { transform: scaleY(.1); } }
@media (max-width: 760px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { display: flex; flex-direction: column; align-items: center; gap: 12px; }
  .bubble { position: static; max-width: none; }
  .hero-art .bitje { width: min(190px, 50vw); }
}

.ticker { font-family: var(--mono); font-weight: 700; background: var(--ink); color: #6dffc4; padding: 8px 0; overflow: hidden; white-space: nowrap; border-block: var(--line); }
.ticker span { display: inline-block; animation: slide 40s linear infinite; }
@keyframes slide { to { transform: translateX(-50%); } }

/* Werelden */
.section { padding: 44px 0; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.section-head h2, .section-head p { margin-bottom: 0; }
.muted { color: var(--ink-2); }
.worlds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.world {
  position: relative; display: flex; flex-direction: column; gap: 4px;
  background: var(--card); border: var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  text-decoration: none; overflow: hidden; transition: transform .12s, box-shadow .12s;
}
.world:hover { transform: translate(-2px, -3px) rotate(-.4deg); box-shadow: 8px 9px 0 var(--ink); }
.world-top { display: flex; justify-content: space-between; align-items: center; background: var(--c); border-bottom: var(--line); padding: 14px 16px; }
.world-emoji { font-size: 2.6rem; line-height: 1; }
.world-num { font: 800 .9rem var(--mono); background: var(--card); border: var(--line); border-radius: 99px; padding: 2px 10px; }
.world-body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.world-body h3 { font-size: 1.35rem; margin-bottom: .3em; }
.world-body p { font-size: 1rem; color: var(--ink-2); margin-bottom: .8em; flex: 1; }
.stars { font-size: 1.15rem; letter-spacing: 2px; filter: grayscale(1) opacity(.35); }
.stars.has { filter: none; }
.world-final { grid-column: 1 / -1; flex-direction: row; }
.world-final .world-top { flex-direction: column; justify-content: center; gap: 8px; border-bottom: 0; border-right: var(--line); padding-inline: 26px; }
@media (max-width: 900px) { .worlds { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 580px) {
  .worlds { grid-template-columns: 1fr; }
  .world-final { flex-direction: column; }
  .world-final .world-top { flex-direction: row; border-right: 0; border-bottom: var(--line); }
}

/* Rugzak met badges */
.backpack { background: var(--grape); color: #fff; border-block: var(--line); }
.badges { display: flex; flex-wrap: wrap; gap: 12px; }
.badge { background: var(--card); color: var(--ink); border: var(--line); border-radius: 16px; padding: 10px 14px; font-weight: 800; display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow-s); }
.badge span { font-size: 1.5rem; }
.badge.locked { background: transparent; color: #fff; border-style: dashed; border-color: rgba(255, 255, 255, .75); box-shadow: none; }
.badge.locked span { filter: grayscale(1) brightness(1.6); opacity: .65; }

/* Kaarten */
.card { background: var(--card); border: var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: clamp(18px, 3vw, 28px); }
.page-head { padding: 36px 0 18px; }
.page-head h1 { font-size: clamp(2rem, 5vw, 3.1rem); }

/* Les */
.lesson { padding: 22px 0 56px; }
.lesson-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.lesson-head .world-emoji { background: var(--c); border: var(--line); border-radius: 14px; padding: 8px; font-size: 1.9rem; }
.lesson-head h1 { font-size: clamp(1.4rem, 4vw, 2rem); margin: 0; }
.progress { height: 18px; background: var(--card); border: var(--line); border-radius: 99px; overflow: hidden; margin-bottom: 18px; }
.progress i { display: block; height: 100%; width: 0; background: var(--c); border-right: var(--line); transition: width .25s; }
.step { margin-bottom: 18px; }
.step h2 { font-size: clamp(1.4rem, 3.4vw, 1.9rem); }
.step-emoji { font-size: 3rem; line-height: 1; display: block; margin-bottom: 8px; }
.tip { background: var(--paper); border: 3px dashed var(--ink); border-radius: 14px; padding: 10px 14px; margin: 0 0 1em; }
.lesson-nav { display: flex; justify-content: space-between; gap: 12px; }
html:not(.js) .lesson-nav, html:not(.js) .progress { display: none; }

/* Quiz */
.opts { display: grid; gap: 10px; margin-bottom: 12px; }
.opt { text-align: left; padding: 12px 16px; font-weight: 700; background: var(--card); border: var(--line); border-radius: 14px; cursor: pointer; box-shadow: var(--shadow-s); }
.opt:hover:not([disabled]) { background: var(--paper); }
.opt[disabled] { cursor: default; box-shadow: none; }
.opt.right { background: #bff3dd; }
.opt.wrong { background: #ffd2cd; }
.why { font-weight: 700; }
.why.good { color: var(--ok); }
.why.oops { color: var(--bad); }
.result { text-align: center; }
.result-stars { font-size: 3rem; letter-spacing: 6px; margin-bottom: 6px; }
.result-badge { display: inline-flex; margin-bottom: 18px; }
.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Activiteiten */
.act { border: var(--line); border-radius: 16px; padding: 14px; background: var(--paper); }
.act-msg { font-weight: 800; min-height: 1.6em; margin: 10px 0 0; }
.act-msg.good { color: var(--ok); }
.act-msg.oops { color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 12px; min-height: 44px; font-weight: 700; background: var(--card); border: var(--line); border-radius: 12px; cursor: pointer; }
.chip:hover:not([disabled]) { background: #fff0c4; }
.chip[aria-pressed="true"] { background: var(--sun); }
.chip.done { background: #bff3dd; }
.chip.gone { opacity: .35; }
.chip.shake { animation: shake .3s; background: #ffd2cd; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match .chips { flex-direction: column; }
.match .chip { width: 100%; text-align: left; }

.bits-target { font: 800 1.3rem var(--display); margin-bottom: 10px; }
.bits { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.bit { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; background: var(--card); border: var(--line); border-radius: 12px; cursor: pointer; min-width: 0; font-family: var(--mono); }
.bit b { font-size: 1.5rem; }
.bit small { font-size: .78rem; color: var(--ink-2); }
.bit[aria-pressed="true"] { background: var(--sun); }
.bits-sum { font: 800 1.1rem var(--mono); margin-top: 10px; }

.sort-card { font: 800 1.1rem var(--display); background: var(--card); border: var(--line); border-radius: 14px; padding: 14px; text-align: center; margin-bottom: 10px; }
.sort-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.robot { display: grid; grid-template-columns: minmax(0, 300px) 1fr; gap: 16px; }
.grid5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; background: var(--ink); border: var(--line); border-radius: 12px; padding: 3px; aspect-ratio: 1; }
.cell { background: var(--card); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: clamp(1.1rem, 5vw, 1.8rem); }
.cell.wall { background: #6f6d8b; }
.cell.trail { background: #fff0c4; }
.program { display: flex; flex-wrap: wrap; gap: 5px; min-height: 52px; background: var(--card); border: 3px dashed var(--ink); border-radius: 12px; padding: 6px; margin: 10px 0; align-content: flex-start; }
.block { background: var(--sky); border: 2px solid var(--ink); border-radius: 8px; padding: 2px 8px; font-weight: 800; }
.block.on { background: var(--sun); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
@media (max-width: 620px) { .robot { grid-template-columns: 1fr; } .grid5 { max-width: 300px; } }

.meter { height: 20px; background: var(--card); border: var(--line); border-radius: 99px; overflow: hidden; margin: 10px 0 6px; }
.meter i { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }
.text-input { width: 100%; padding: 11px 14px; background: var(--card); border: var(--line); border-radius: 12px; min-height: 48px; }

.prompt-out { font-family: var(--mono); background: var(--ink); color: #6dffc4; padding: 12px 14px; border-radius: 12px; margin: 12px 0 8px; font-size: .95rem; }
.group-label { font-weight: 800; margin: 12px 0 6px; }

/* AI-lab */
.lab-list { display: grid; gap: 26px; padding-bottom: 56px; }
.lab-title { display: flex; gap: 12px; align-items: center; margin-bottom: 6px; }
.lab-title span { font-size: 2.2rem; }
.lab-title h2 { margin: 0; }
.how { margin-top: 14px; }
.how summary { font-weight: 800; cursor: pointer; }

.draw { display: grid; grid-template-columns: auto 1fr; gap: 18px; }
.draw canvas { width: 240px; height: 240px; max-width: 100%; background: #fff; border: var(--line); border-radius: 14px; touch-action: none; cursor: crosshair; display: block; }
.vote { margin-top: 10px; }
.vote-row { display: grid; grid-template-columns: 2em 1fr 3.4em; gap: 8px; align-items: center; margin-bottom: 6px; font-weight: 800; }
.bar-track { height: 18px; background: var(--card); border: 2px solid var(--ink); border-radius: 99px; overflow: hidden; }
.bar-track i { display: block; height: 100%; background: var(--mint); width: 0; transition: width .25s; }
.count { font-family: var(--mono); font-weight: 700; }
@media (max-width: 620px) { .draw { grid-template-columns: 1fr; } }

.sentence { font: 800 1.3rem var(--display); background: var(--card); border: var(--line); border-radius: 14px; padding: 12px 14px; min-height: 58px; margin-bottom: 10px; }
.next-row { display: grid; grid-template-columns: minmax(90px, 150px) 1fr 3.4em; gap: 10px; align-items: center; margin-bottom: 8px; }

.fruit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; }
.fruit { background: var(--card); border: var(--line); border-radius: 12px; padding: 8px; text-align: center; font-weight: 800; font-size: .88rem; }
.fruit span { display: block; font-size: 1.8rem; line-height: 1.2; }
.fruit.right { background: #bff3dd; }
.fruit.wrong { background: #ffd2cd; }
.chip .e { font-size: 1.3rem; }

/* Chat */
.chat-page { padding-bottom: 56px; }
.chat { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--sky); border-bottom: var(--line); font-weight: 800; }
.chat-head .bitje { width: 42px; height: 46px; }
.chat-head small { display: block; font-weight: 700; }
.chat-log { padding: 16px; height: min(52vh, 460px); overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 84%; padding: 10px 14px; border: var(--line); border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.bot { align-self: flex-start; background: var(--paper); border-bottom-left-radius: 4px; }
.msg.me { align-self: flex-end; background: var(--sun); border-bottom-right-radius: 4px; }
.msg.warn { align-self: stretch; max-width: none; background: #ffd2cd; font-weight: 700; }
.msg.typing { color: var(--ink-2); font-weight: 700; }
.chat-suggest { padding: 0 16px 12px; }
.chat-form { display: flex; gap: 8px; padding: 12px 16px; border-top: var(--line); background: var(--card); }
.chat-form input { flex: 1; min-width: 0; }
.gate { display: grid; gap: 10px; }
.gate label { font-weight: 800; }
.rules { margin-top: 18px; }

/* Voet */
.site-footer { background: var(--ink); color: #fff; padding: 22px 0; }
.foot { display: flex; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; font-size: .92rem; }
.foot p { margin: 0; }

.confetti { position: fixed; top: -20px; width: 12px; height: 16px; z-index: 50; pointer-events: none; animation: fall 1.7s ease-in forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(620deg); opacity: .8; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .confetti { display: none; }
}
