@font-face { font-family: 'DM Sans'; src: url('../fonts/dmsans.woff2') format('woff2'); font-weight: 500 700; font-display: swap; }

/* Alleen een licht thema (bewuste keuze voor deze app): ook als de iPad in donkere modus staat. */
:root {
  color-scheme: light;
  --bg: #f6fbff;
  --bg-2: #fff9ee;
  --bg-3: #f2fff6;
  --surface: #ffffff;
  --surface-2: #f7f9fe;
  --text: #34395a;
  --text-soft: #7a82a1;
  --border: #e4eaf5;
  --shadow: 0 5px 0 rgba(52, 57, 90, .07), 0 10px 24px rgba(52, 57, 90, .05);
  --good: #3cc47c;
  --bad: #ff6b6b;
  --star: #ffc93c;
  --start-dot: #31c46b;
  --lock: #c9d0e3;
  --tr-line: #cfd8eb;
  --tr-zone: #f5f8ff;
  --tr-track: #e2e8f4;
  --tr-guide: #9aa6c2;
  --tr-ink: #3a3f58;
  --accent: #ff9466;
  --radius: 28px;
  --font: 'DM Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
body {
  background: var(--bg);
  background-image: radial-gradient(circle at 12% 8%, var(--bg-2) 0, transparent 38%),
                    radial-gradient(circle at 88% 90%, var(--bg-3) 0, transparent 36%);
  color: var(--text);
  font-family: var(--font);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  touch-action: manipulation;
}
#app { position: fixed; inset: 0; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }

/* ---------- schoolletters (zelfde vorm als bij het overtrekken) ---------- */
.gl { height: 1.5em; vertical-align: middle; overflow: visible; fill: currentColor; stroke: currentColor;
  stroke-width: 0.21; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.gl polyline { fill: none; }
.gl circle { stroke: none; }

/* ---------- algemene bouwstenen ---------- */
.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; animation: in .35s ease both; }
@keyframes in { from { opacity: 0; transform: translateY(14px); } }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 18px; }
.topbar .grow { flex: 1; }
.round { width: 72px; height: 72px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow);
  font-size: 34px; display: grid; place-items: center; transition: transform .12s; flex: none; }
.round:active, .big:active, .tile:active, .bubble:active { transform: scale(.92); }
.pill { background: var(--surface); box-shadow: var(--shadow); border-radius: 999px; padding: 10px 20px; font-size: 26px; font-weight: 700; }
.big { background: var(--accent); color: #fff; font-size: 34px; font-weight: 700; border-radius: 999px;
  padding: 18px 44px; box-shadow: 0 7px 0 rgba(0, 0, 0, .18); transition: transform .12s; }
.steps { display: flex; gap: 10px; }
.steps i { width: 18px; height: 18px; border-radius: 50%; background: var(--border); }
.steps i.on { background: var(--accent); }
.steps i.done { background: var(--good); }
.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-12px); } 40%, 80% { transform: translateX(12px); } }
.pop { animation: pop .4s ease; }
@keyframes pop { 50% { transform: scale(1.25); } }

/* ---------- start ---------- */
.start { flex: 1; display: grid; place-items: center; text-align: center; gap: 0; }
.start h1 { font-size: clamp(70px, 13vw, 130px); margin: 0; display: flex; gap: .12em; justify-content: center; color: var(--accent); }
.start h1 span { display: inline-block; animation: bob 2.4s ease-in-out infinite; }
.start h1 span:nth-child(2) { animation-delay: .2s; } .start h1 span:nth-child(3) { animation-delay: .4s; } .start h1 span:nth-child(4) { animation-delay: .6s; }
@keyframes bob { 50% { transform: translateY(-14px); } }
.start .big { font-size: 40px; padding: 24px 64px; margin-top: 30px; }

/* ---------- kaart ---------- */
.map { flex: 1; overflow-y: auto; padding: 4px 18px 60px; -webkit-overflow-scrolling: touch; }
.island { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px 24px;
  margin: 0 auto 22px; max-width: 900px; border-top: 12px solid var(--k); position: relative; }
.island h2 { margin: 0 0 14px; font-size: 26px; color: var(--text-soft); font-weight: 700; }
.island.locked { opacity: .55; }
.island.locked::after { content: '🔒'; position: absolute; right: 22px; top: 14px; font-size: 34px; }
.letters { display: flex; flex-wrap: wrap; gap: 16px; }
.lbtn { width: 104px; height: 104px; border-radius: 50%; background: var(--surface-2); border: 5px solid var(--k);
  font-size: 46px; display: grid; place-items: center; position: relative; transition: transform .12s; }
.lbtn:active { transform: scale(.92); }
.lbtn.done { background: var(--k); color: #fff; }
.lbtn.next { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.08); box-shadow: 0 0 0 10px color-mix(in srgb, var(--k) 25%, transparent); } }
.lbtn .st { position: absolute; bottom: -12px; font-size: 18px; letter-spacing: -2px; }
.games { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.gbtn { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 22px; padding: 12px 20px 12px 14px;
  font-size: 24px; font-weight: 700; box-shadow: var(--shadow); }
.gbtn b { font-size: 40px; }
.gbtn[disabled] { opacity: .4; }
.special { display: flex; gap: 14px; max-width: 900px; margin: 0 auto 22px; flex-wrap: wrap; }

/* ---------- les en schrijven ---------- */
.stage { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 0 18px 18px; }
.hero-letter { font-size: min(22vh, 190px); line-height: 1; color: var(--k, var(--accent)); }
.example { display: flex; align-items: center; gap: 24px; font-size: 50px; }
.example .emo { font-size: 90px; }
.tracer-wrap { flex: 1; width: 100%; max-width: 1100px; min-height: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); position: relative; }
.tracer { position: absolute; inset: 0; }
.tracer canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.tracer .tr-ink { touch-action: none; }
.tr-dot { position: absolute; display: none; border-radius: 50%; background: var(--start-dot); transform: translate(-50%, -50%);
  box-shadow: 0 0 0 0 rgba(49, 196, 107, .5); animation: dot 1.4s ease-out infinite; pointer-events: none; }
@keyframes dot { 0% { box-shadow: 0 0 0 0 rgba(49, 196, 107, .55); } 100% { box-shadow: 0 0 0 26px rgba(49, 196, 107, 0); } }
.tr-dot.nudge { animation: nudge .5s ease, dot 1.4s ease-out infinite; }
@keyframes nudge { 30% { transform: translate(-50%, -50%) scale(1.8); } }
.tr-pen { position: absolute; left: 0; top: 0; display: none; font-size: 54px; pointer-events: none; margin: -50px 0 0 -6px; }
.tools { display: flex; gap: 14px; }
.pic { font-size: min(14vh, 110px); line-height: 1; }
.tracer-wrap.woord { max-height: 62vh; }
.zinregel { display: flex; gap: .45em; flex-wrap: wrap; justify-content: center; font-size: clamp(30px, 4.5vw, 44px); color: var(--lock); }
.zinregel .zw.on { color: var(--k, var(--accent)); }
.zinregel .zw.done { color: var(--text); }

/* ---------- spelletjes ---------- */
.prompt-emoji { font-size: min(26vh, 200px); line-height: 1; }
.choices { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; }
.bubble { width: 150px; height: 150px; border-radius: 50%; font-size: 60px; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #ffffffcc 0 12%, transparent 13%), var(--b, #8fd3ff); color: #24304f;
  box-shadow: inset -8px -10px 0 rgba(0, 0, 0, .08), var(--shadow); animation: float 3s ease-in-out infinite; transition: transform .15s; }
.bubble:nth-child(2) { animation-delay: .5s; } .bubble:nth-child(3) { animation-delay: 1s; } .bubble:nth-child(4) { animation-delay: 1.5s; }
@keyframes float { 50% { transform: translateY(-16px); } }
.bubble.gone { animation: burst .35s ease forwards; }
@keyframes burst { to { transform: scale(1.6); opacity: 0; } }
.slots, .tiles { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.slot { min-width: 110px; height: 120px; border-radius: 22px; border: 5px dashed var(--border); display: grid; place-items: center; font-size: 56px; padding: 0 12px; }
.slot.filled { border-style: solid; border-color: var(--k, var(--accent)); background: var(--surface); }
.slot.lit { background: var(--k, var(--accent)); color: #fff; }
.tile { min-width: 100px; height: 110px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); font-size: 52px; padding: 0 14px; transition: transform .12s, opacity .2s; display: grid; place-items: center; }
.tile.used { opacity: .15; pointer-events: none; }
.sentence { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; font-size: clamp(40px, 6vw, 62px); max-width: 1000px; }
.sentence .w { padding: 4px 14px; border-radius: 18px; transition: background .15s, color .15s; }
.sentence .w.lit { background: var(--k, var(--accent)); color: #fff; }
.sentence .w.blank { min-width: 120px; min-height: 1.6em; border-bottom: 6px solid var(--border); border-radius: 0; }
.word-chips { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.word-chips .tile { font-size: 42px; }

/* ---------- beloning en stickerboek ---------- */
.reward { flex: 1; display: grid; place-items: center; text-align: center; }
.reward .sticker { font-size: min(30vh, 240px); animation: spin-in .8s cubic-bezier(.2, 1.6, .5, 1) both; }
@keyframes spin-in { from { transform: scale(0) rotate(-200deg); } }
.reward .stars { font-size: 70px; letter-spacing: 6px; }
.book { flex: 1; overflow-y: auto; padding: 0 18px 40px; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 16px; align-content: start; }
.book .card { background: var(--surface); border-radius: 24px; box-shadow: var(--shadow); aspect-ratio: 1; display: grid; place-items: center; text-align: center; }
.book .card .e { font-size: 60px; line-height: 1; }
.book .card .l { font-size: 28px; color: var(--text-soft); }
.book .card.empty { opacity: .35; }

/* ---------- ouders ---------- */
.parent { flex: 1; overflow-y: auto; padding: 0 24px 40px; font-size: 20px; max-width: 900px; margin: 0 auto; width: 100%; }
.parent h2 { margin: 26px 0 10px; }
.parent table { width: 100%; border-collapse: collapse; background: var(--surface); }
.parent td, .parent th { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.parent .row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.parent .btn { background: var(--surface); border: 2px solid var(--border); border-radius: 14px; padding: 10px 18px; font-size: 20px; }
.parent .btn.danger { border-color: var(--bad); color: var(--bad); }
.parent p { color: var(--text-soft); line-height: 1.5; }
.gate { flex: 1; display: grid; place-items: center; text-align: center; font-size: 30px; }
.gate .choices button { font-size: 40px; width: 110px; height: 90px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }

@media (max-width: 700px) {
  .lbtn { width: 84px; height: 84px; font-size: 36px; }
  .bubble { width: 118px; height: 118px; font-size: 46px; }
  .round { width: 60px; height: 60px; font-size: 28px; }
}
.book button.card { border: 0; font: inherit; color: inherit; }
.book .card.naam { background: var(--bg-2); }
.book .card.known { box-shadow: 0 0 0 4px var(--good), var(--shadow); }
.tabs { display: flex; gap: 10px; flex-wrap: wrap; }
.tab { width: 64px; height: 64px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); font-size: 30px; display: grid; place-items: center; transition: transform .12s; }
.tab.on { box-shadow: 0 0 0 4px var(--accent), var(--shadow); transform: scale(1.06); }
.book .card { position: relative; }
.done-star { position: absolute; top: 8px; right: 10px; font-size: 22px; }
.examples { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.ex { display: flex; flex-direction: column; align-items: center; gap: 6px; background: var(--surface); border-radius: 24px; box-shadow: var(--shadow); padding: 14px 22px 10px; font-size: 34px; }
.ex .emo { font-size: 64px; line-height: 1; }

/* schrijfboek: ruimte zodat de rand van de bovenste kaarten niet wordt afgesneden; lange woorden schalen mee */
.book { padding-top: 10px; }
.book .card .l { width: 100%; padding: 0 10px; }
.book .card .gl { max-width: 100%; height: auto; }
