:root {
  --ink: #2b2350;
  --muted: #6c6790;
  --purple: #7c4dff;
  --pink: #ff6fa8;
  --yellow: #ffc93c;
  --green: #35b96b;
  --orange: #ff9f43;
  --blue: #3d8bff;
  --card: #ffffff;
  --shadow: 0 8px 24px rgba(60, 40, 120, 0.14);
  --read: Arial, "Helvetica Neue", Helvetica, sans-serif; /* zoals in het boek */
  --ui: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--ui);
  color: var(--ink);
  background: linear-gradient(160deg, #dff3ff 0%, #f1e6ff 55%, #ffe9f3 100%) fixed;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.hidden { display: none !important; }
.spacer { flex: 1; }
button { font-family: inherit; color: inherit; cursor: pointer; border: 0; }

/* ---------- kop ---------- */
.top, .ptop { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.icon-btn {
  width: 48px; height: 48px; border-radius: 16px; font-size: 24px;
  background: #fff; box-shadow: var(--shadow);
}
.counter {
  background: #fff; border-radius: 999px; padding: 8px 16px; font-size: 24px; font-weight: 800;
  box-shadow: var(--shadow); display: inline-flex; gap: 6px; align-items: center;
}
.counter b { min-width: 1.2ch; text-align: right; font-variant-numeric: tabular-nums; }
.counter.bump { animation: bump 0.5s ease; }
@keyframes bump { 40% { transform: scale(1.3); } }
.offline { font-size: 22px; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }

.steps { display: flex; gap: 8px; flex: 1; max-width: 420px; margin-left: 4px; }
.pill { flex: 1; height: 14px; border-radius: 999px; background: rgba(124, 77, 255, 0.18); overflow: hidden; }
.pill.active { background: rgba(124, 77, 255, 0.28); }
.pill-fill { height: 100%; background: linear-gradient(90deg, var(--purple), var(--pink)); border-radius: 999px; transition: width 0.5s ease; }

main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.screen { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 8px 20px 24px; overflow-y: auto; }
h1 { font-size: clamp(30px, 5vw, 52px); margin: 8px 0 4px; text-align: center; }
.lead { font-size: clamp(18px, 2.6vw, 26px); margin: 0 0 24px; color: var(--muted); text-align: center; }

/* ---------- startscherm ---------- */
.pages {
  display: grid; gap: 20px; width: min(100%, 900px);
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.page-card {
  position: relative; background: var(--card); border-radius: 28px; box-shadow: var(--shadow);
  padding: 20px 12px 16px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: transform 0.15s;
}
.page-card:active { transform: scale(0.94); }
.pc-letter { font-family: var(--read); font-size: 64px; font-weight: 700; color: var(--purple); line-height: 1; }
.pc-emoji { font-size: 52px; }
.pc-nr { font-size: 18px; color: var(--muted); font-weight: 700; }
.pc-badge {
  position: absolute; top: -8px; right: -6px; background: #e6fbff; border-radius: 999px;
  padding: 4px 10px; font-weight: 800; font-size: 18px; box-shadow: var(--shadow);
}
.page-card.resume { outline: 4px solid var(--yellow); }
.pc-resume { font-size: 15px; font-weight: 800; color: #b07800; }

/* ---------- oefenscherm ---------- */
.stage { width: min(100%, 980px); margin: auto 0; }
.cols { display: flex; justify-content: center; gap: clamp(10px, 3vw, 44px); flex-wrap: nowrap; }
.col { display: flex; flex-direction: column; gap: clamp(8px, 1.6vw, 18px); align-items: center; }

.w {
  position: relative; font-family: var(--read); font-weight: 500;
  font-size: clamp(26px, 5.4vw, 58px); line-height: 1.1;
  padding: 0.12em 0.4em; border-radius: 0.4em; background: rgba(255, 255, 255, 0.7);
  transition: transform 0.25s, background 0.25s, color 0.25s, box-shadow 0.25s;
}
.w.cur {
  background: var(--yellow); transform: scale(1.22); z-index: 2;
  box-shadow: 0 10px 26px rgba(255, 170, 0, 0.5); animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.3); } }
.w.done { background: #dff7e8; color: #1f8f4e; }
.w.done::after { content: "⭐"; position: absolute; top: -0.45em; right: -0.3em; font-size: 0.45em; }
.w.skipped { opacity: 0.45; }
.wobble { animation: wobble 0.6s ease; }
@keyframes wobble { 20% { transform: rotate(-6deg) scale(1.2); } 45% { transform: rotate(6deg) scale(1.2); } 70% { transform: rotate(-3deg) scale(1.2); } }

.textcard {
  background: var(--card); border-radius: 32px; box-shadow: var(--shadow);
  padding: clamp(18px, 4vw, 40px); display: flex; gap: clamp(16px, 4vw, 40px); align-items: center; justify-content: space-between;
}
.lines { display: flex; flex-direction: column; gap: 10px; }
.line {
  margin: 0; font-family: var(--read); font-size: clamp(28px, 6vw, 62px); line-height: 1.2;
  padding: 0.1em 0.3em; border-radius: 0.35em; transition: all 0.25s;
}
.line.cur { background: var(--yellow); transform: scale(1.04) translateX(1%); box-shadow: 0 8px 22px rgba(255, 170, 0, 0.45); animation: pulseLine 1.6s ease-in-out infinite; }
@keyframes pulseLine { 50% { transform: scale(1.07) translateX(1%); } }
.line.done { color: #1f8f4e; background: #dff7e8; }
.line.done::after { content: " ⭐"; font-size: 0.55em; }
.line.skipped { opacity: 0.45; }
.pic { text-align: center; border: 4px solid var(--ink); border-radius: 22px; padding: 12px 20px 8px; background: #fffbe8; }
.pic-emoji { font-size: clamp(64px, 14vw, 140px); line-height: 1.1; }
.pic-cap { font-family: var(--read); font-size: clamp(22px, 4vw, 36px); font-weight: 700; margin-top: 4px; }

.fly-star { position: fixed; z-index: 50; font-size: 44px; pointer-events: none; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }

/* ---------- eenhoorn + spraakwolkje ---------- */
.mascot-bar { display: flex; align-items: center; gap: 14px; padding: 8px 20px 16px; justify-content: center; }
.mascot { font-size: 64px; background: none; line-height: 1; padding: 0; -webkit-touch-callout: none; }
.mascot.bounce { animation: hop 0.7s ease; }
.mascot.sad { animation: tilt 0.8s ease; }
@keyframes hop { 30% { transform: translateY(-22px) rotate(-8deg); } 60% { transform: translateY(0) rotate(6deg); } 80% { transform: translateY(-8px); } }
@keyframes tilt { 40% { transform: rotate(-14deg); } 70% { transform: rotate(8deg); } }
.bubble {
  position: relative; background: #fff; border-radius: 22px; padding: 12px 20px; font-size: clamp(18px, 2.8vw, 26px);
  font-weight: 700; box-shadow: var(--shadow); min-height: 52px; display: flex; align-items: center; max-width: 620px;
}
.bubble::before { content: ""; position: absolute; left: -10px; top: 50%; margin-top: -10px; border: 10px solid transparent; border-left: 0; border-right-color: #fff; }

/* ---------- blad klaar ---------- */
.done-card { margin: auto; text-align: center; display: flex; flex-direction: column; align-items: center; }
.big-diamond { font-size: clamp(120px, 28vw, 240px); line-height: 1.1; filter: drop-shadow(0 12px 24px rgba(61, 219, 217, 0.5)); }
.big-diamond.pop { animation: diamond 1.4s cubic-bezier(.2,1.4,.4,1) both, shine 2.4s 1.4s ease-in-out infinite; }
@keyframes diamond { 0% { transform: scale(0) rotate(-40deg); } 60% { transform: scale(1.25) rotate(8deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes shine { 50% { transform: scale(1.08) rotate(-4deg); } }
.big-btn {
  margin-top: 8px; padding: 18px 40px; font-size: 26px; font-weight: 800; color: #fff; border-radius: 999px;
  background: linear-gradient(135deg, var(--purple), var(--pink)); box-shadow: var(--shadow);
}
.big-btn:active { transform: scale(0.96); }

/* ---------- verborgen paneel op de iPad ---------- */
.panel { position: fixed; inset: 0; background: rgba(43, 35, 80, 0.5); display: flex; align-items: center; justify-content: center; z-index: 60; }
.panel-card { background: #fff; border-radius: 28px; padding: 24px; width: min(92vw, 420px); text-align: center; }
.panel-label { font-family: var(--read); font-size: 44px; margin: 0 0 16px; }
.panel-btns { display: flex; flex-direction: column; gap: 12px; }

/* ---------- knoppen (ouder + paneel) ---------- */
.btn {
  width: 100%; padding: 22px 16px; font-size: 26px; font-weight: 800; color: #fff; border-radius: 22px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.18); transition: transform 0.08s, box-shadow 0.08s, opacity 0.2s;
}
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18); }
.btn:disabled { opacity: 0.35; box-shadow: none; }
.btn.ok { background: var(--green); }
.btn.almost { background: var(--orange); }
.btn.again { background: var(--blue); }
.link-btn { background: none; color: var(--muted); font-size: 17px; font-weight: 700; padding: 12px; text-decoration: underline; }
.link-btn:disabled { opacity: 0.35; }

/* ---------- ouderpagina ---------- */
body.parent { background: #f4f2fb; }
.ptop { background: var(--ink); color: #fff; }
.ptop .counter { background: rgba(255, 255, 255, 0.14); box-shadow: none; color: #fff; font-size: 20px; padding: 6px 12px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #999; }
.dot.on { background: #4cd97b; }
.dot.off { background: #ff5d5d; }
.parent main { padding: 16px; gap: 14px; max-width: 520px; width: 100%; margin: 0 auto; overflow-y: auto; }
.now { background: #fff; border-radius: 26px; padding: 22px 18px; text-align: center; box-shadow: var(--shadow); }
.where { margin: 0; color: var(--muted); font-weight: 700; font-size: 16px; }
.label { font-family: var(--read); font-size: 76px; margin: 10px 0 4px; line-height: 1.1; word-break: break-word; user-select: text; }
.label.long { font-size: 40px; }
.attempt { margin: 0; min-height: 1.3em; color: var(--muted); font-weight: 700; }
.verdicts { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.verdicts .link-btn { align-self: center; }
.toast { min-height: 1.4em; margin: 0; text-align: center; font-weight: 700; color: var(--purple); }
.card { background: #fff; border-radius: 22px; padding: 14px 16px; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 8px; font-size: 18px; }
.hard { list-style: none; margin: 0; padding: 0; }
.hard li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid #eee; font-size: 16px; }
.hard li:first-child { border-top: 0; }
.hard li b { font-family: var(--read); font-size: 20px; }
.hard li span { color: var(--muted); text-align: right; }
.muted { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .w.cur, .line.cur, .big-diamond.pop { animation: none; }
}
