:root {
  --green-50: #EBFCF2; --green-100: #D3F9E2; --green-200: #A8F2C6; --green-300: #6DEA9F;
  --green-400: #19E36B; --green-500: #12C65B; --green-600: #0BA44A; --green-700: #0A7F3B; --green-800: #0B5A2D; --green-900: #0A3A20;
  --ink-100: #EAF0EB; --ink-200: #DFE6E0; --ink-300: #A9B3AC; --ink-400: #7C877F; --ink-500: #566058; --ink-700: #25332A; --ink-800: #14231A; --ink-900: #07140C;
  --paper: #F1F7F2; --white: #fff; --sun: #FFC93C; --sun-soft: #FFF1C7; --red-500: #D93A2B; --red-50: #FDECEA;
  --brand: var(--green-400);
  --font-body: "Wix Madefor Text", system-ui, sans-serif;
  --font-display: "Wix Madefor Display", system-ui, sans-serif;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-ui: cubic-bezier(.23, 1, .32, 1);
  --shadow-2: 0 2px 4px rgb(7 20 12 / .04), 0 8px 20px rgb(7 20 12 / .07);
  --shadow-3: 0 4px 8px rgb(7 20 12 / .05), 0 20px 44px rgb(7 20 12 / .12);
  color-scheme: light;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body { background: var(--paper); color: var(--ink-900); font-family: var(--font-body); -webkit-font-smoothing: antialiased; overflow: hidden; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img, svg { display: block; }

/* ---------- layout ---------- */
.app { height: 100dvh; display: grid; grid-template-columns: 1fr; }
.rail { display: none; }
.viewer { display: grid; grid-template-rows: auto 1fr auto; height: 100dvh; min-width: 0; padding-top: env(safe-area-inset-top); }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px 8px; }
.chip-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 14px; border-radius: 999px; background: var(--white); box-shadow: inset 0 0 0 1px var(--ink-200); font-size: 14px; font-weight: 500; max-width: 64vw; transition: transform 160ms var(--ease-ui); }
.chip-btn:active { transform: scale(.97); }
.chip-btn-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.stage-wrap { position: relative; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.stage { position: absolute; left: 50%; top: 50%; width: 1080px; height: 1920px; transform-origin: 0 0; background: var(--paper); overflow: hidden; border-radius: 0; }
.scene-host, .scene { position: absolute; inset: 0; }

.controls { padding: 6px 16px calc(10px + env(safe-area-inset-bottom)); }
.progress { position: relative; display: flex; gap: 4px; height: 22px; align-items: center; cursor: pointer; touch-action: none; }
.seg { position: relative; height: 5px; border-radius: 3px; background: var(--ink-200); overflow: hidden; flex: 1 1 0; transition: height 160ms var(--ease-ui); }
.seg i { position: absolute; inset: 0; background: var(--ink-900); transform-origin: 0 50%; transform: scaleX(0); }
.seg.is-locked { background: repeating-linear-gradient(90deg, var(--ink-200) 0 4px, transparent 4px 7px); flex-grow: .35; }
@media (hover: hover) and (pointer: fine) { .progress:hover .seg { height: 8px; } }
.controls-row { display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.ctl { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 999px; transition: transform 160ms var(--ease-ui), background-color 160ms ease; }
.ctl:active { transform: scale(.94); }
@media (hover: hover) and (pointer: fine) { .ctl:hover { background: var(--ink-100); } }
.ctl-main { width: 52px; height: 52px; background: var(--ink-900); color: var(--white); }
@media (hover: hover) and (pointer: fine) { .ctl-main:hover { background: var(--ink-800); } }
.ctl-main .i-pause { display: none; }
.app.is-playing .ctl-main .i-play { display: none; }
.app.is-playing .ctl-main .i-pause { display: block; }
.ctl-text { width: auto; min-width: 44px; padding: 0 10px; font-size: 14px; font-weight: 700; color: var(--ink-500); }
.ctl-text.is-on { color: var(--ink-900); }
.time { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--ink-500); margin-left: 8px; }
.spacer { flex: 1; }

/* ---------- desktop ---------- */
@media (min-width: 960px) {
  .app { grid-template-columns: 340px 1fr; }
  .rail { display: flex; flex-direction: column; gap: 20px; padding: 40px 28px; border-right: 1px solid var(--ink-200); overflow-y: auto; }
  .rail-eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--green-700); }
  .topbar { display: none; }
  .viewer { padding: 28px 40px 8px; grid-template-rows: 1fr auto; }
  .stage { border-radius: 28px; box-shadow: var(--shadow-3), 0 0 0 1px var(--ink-200); }
  .controls { width: min(560px, 100%); margin: 0 auto; }
}

/* ---------- chapter list ---------- */
.chapters { list-style: none; padding: 0; display: grid; gap: 2px; }
.ch { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 10px; border-radius: 14px; transition: background-color 160ms ease, transform 160ms var(--ease-ui); }
.ch:active { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) { .ch:not(:disabled):hover { background: var(--white); } }
.ch-num { width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center; font-size: 13px; font-weight: 700; box-shadow: inset 0 0 0 1.5px var(--ink-300); color: var(--ink-500); font-variant-numeric: tabular-nums; }
.ch-text { display: grid; gap: 1px; min-width: 0; }
.ch-label { font-size: 15px; font-weight: 700; }
.ch-sub { font-size: 13px; color: var(--ink-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-dur { font-size: 12px; color: var(--ink-400); font-variant-numeric: tabular-nums; }
.ch.is-done .ch-num { background: var(--brand); box-shadow: none; color: var(--ink-900); }
.ch.is-current { background: var(--white); box-shadow: var(--shadow-2); }
.ch.is-current .ch-num { background: var(--ink-900); color: var(--white); box-shadow: none; }
.ch:disabled { cursor: default; }
.ch:disabled .ch-label { color: var(--ink-400); font-weight: 500; }
.ch:disabled .ch-num { box-shadow: inset 0 0 0 1.5px var(--ink-200); color: var(--ink-300); }
.ch-lock { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-400); background: var(--ink-100); padding: 3px 7px; border-radius: 6px; }
.chapters-divider { font-size: 12px; color: var(--ink-400); padding: 14px 10px 4px; }

/* ---------- sheet (mobile) ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet[hidden] { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgb(7 20 12 / .4); animation: fade 200ms ease-out; }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 82dvh; overflow-y: auto; background: var(--paper); border-radius: 24px 24px 0 0; padding: 8px 12px calc(16px + env(safe-area-inset-bottom)); animation: up 320ms cubic-bezier(.32, .72, 0, 1); }
.sheet.is-closing .sheet-panel { transform: translateY(100%); transition: transform 200ms ease-out; }
.sheet.is-closing .sheet-backdrop { opacity: 0; transition: opacity 200ms ease-out; }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--ink-300); margin: 4px auto 6px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 4px 8px 10px; font-size: 17px; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

/* ---------- stage furniture (stage px, 1080×1920) ---------- */
.eyebrow { font-family: var(--font-body); font-size: 30px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--green-700); }
.poster, .endcard { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; padding: 120px 88px 110px; background: var(--paper); }
.poster-title { font-family: var(--font-display); font-weight: 800; font-size: 104px; line-height: 1.02; letter-spacing: -.025em; margin-top: 28px; }
.poster-title #posterHi { color: var(--green-600); }
.poster-mascot { flex: 1; display: grid; place-items: center; }
.poster-mascot svg { width: 360px; height: auto; }
.play-big { display: flex; align-items: center; gap: 32px; padding: 26px 48px 26px 26px; border-radius: 999px; background: var(--ink-900); color: var(--white); text-align: left; box-shadow: var(--shadow-3); transition: transform 160ms var(--ease-ui); align-self: stretch; }
.play-big:active { transform: scale(.97); }
.play-big-icon { width: 124px; height: 124px; border-radius: 999px; background: var(--brand); color: var(--ink-900); display: grid; place-items: center; flex: none; }
.play-big-icon svg { width: 60px; height: 60px; }
.play-big-text { display: grid; gap: 6px; }
.play-big-text strong { font-family: var(--font-display); font-size: 54px; font-weight: 700; letter-spacing: -.01em; }
.play-big-text small { font-size: 32px; color: var(--ink-300); }
.poster-note { text-align: center; margin-top: 36px; font-size: 30px; color: var(--ink-500); }
.app:not([data-state="poster"]) .poster { display: none; }

.endcard { justify-content: center; gap: 0; }
.end-mascot { display: grid; place-items: start; margin-bottom: 56px; }
.end-mascot svg { width: 220px; height: auto; }
.end-title { font-family: var(--font-display); font-weight: 800; font-size: 96px; line-height: 1.03; letter-spacing: -.025em; margin: 24px 0 32px; }
.end-sub { font-size: 40px; line-height: 1.4; color: var(--ink-700); max-width: 860px; }
.end-actions { display: flex; flex-direction: column; gap: 22px; margin-top: 72px; }
.btn { display: flex; align-items: center; justify-content: center; height: 128px; border-radius: 999px; font-family: var(--font-display); font-weight: 700; font-size: 44px; text-decoration: none; transition: transform 160ms var(--ease-ui); }
.btn:active { transform: scale(.97); }
.btn-brand { background: var(--brand); color: var(--ink-900); box-shadow: 0 8px 22px rgb(25 227 107 / .32); }
.btn-ghost { box-shadow: inset 0 0 0 3px var(--ink-900); }
.end-help { margin-top: 64px; font-size: 32px; color: var(--ink-500); line-height: 1.4; }

.tap-zone { position: absolute; inset: 0; z-index: 4; cursor: pointer; }
.app[data-state="poster"] .tap-zone, .app[data-state="end"] .tap-zone, .app[data-state="interact"] .tap-zone { display: none; }
.pause-badge { position: absolute; z-index: 5; left: 50%; top: 50%; width: 200px; height: 200px; margin: -100px 0 0 -100px; border-radius: 999px; background: rgb(7 20 12 / .78); color: var(--white); display: grid; place-items: center; opacity: 0; transform: scale(.9); transition: opacity 200ms ease-out, transform 200ms var(--ease-ui); pointer-events: none; }
.pause-badge svg { width: 88px; height: 88px; }
.app[data-state="paused"] .pause-badge { opacity: 1; transform: scale(1); }

.caption { position: absolute; z-index: 3; left: 64px; right: 64px; bottom: 64px; text-align: center; pointer-events: none; }
.caption span { display: inline; font-family: var(--font-body); font-weight: 500; font-size: 42px; line-height: 1.55; color: var(--white); background: rgb(7 20 12 / .86); padding: 8px 20px; border-radius: 14px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.caption.is-empty, .app.no-cc .caption, .app[data-state="poster"] .caption, .app[data-state="end"] .caption { opacity: 0; }

/* paused: freeze ambient loops */
.app:not(.is-playing) .scene * { animation-play-state: paused !important; }

/* ---------- scene building blocks ---------- */
.scene { font-family: var(--font-body); }
.s-head { position: absolute; left: 88px; right: 88px; top: 120px; }
.s-title { font-family: var(--font-display); font-weight: 800; font-size: 92px; line-height: 1.03; letter-spacing: -.025em; margin-top: 22px; }
.s-title em { font-style: normal; color: var(--green-600); }
.card { position: absolute; background: var(--white); border-radius: 36px; box-shadow: var(--shadow-2), 0 0 0 1px var(--ink-200); }
.chip { position: absolute; display: inline-flex; align-items: center; gap: 16px; white-space: nowrap; padding: 18px 30px 18px 22px; border-radius: 999px; background: var(--white); box-shadow: var(--shadow-2), 0 0 0 1px var(--ink-200); font-size: 36px; font-weight: 700; }
.chip .dot { width: 46px; height: 46px; border-radius: 999px; display: grid; place-items: center; background: var(--brand); flex: none; }
.chip .dot svg { width: 26px; height: 26px; }
.chip.dark { background: var(--ink-900); color: var(--white); box-shadow: var(--shadow-3); }
.chip.warn .dot { background: var(--sun); }
.chip.no .dot { background: var(--red-50); color: var(--red-500); }
.row { position: absolute; display: grid; grid-template-columns: 76px 1fr; align-items: center; gap: 26px; padding: 26px 30px; border-radius: 30px; background: var(--white); box-shadow: 0 0 0 1px var(--ink-200); font-size: 38px; font-weight: 700; line-height: 1.2; }
.row small { display: block; font-size: 30px; font-weight: 500; color: var(--ink-500); margin-top: 6px; }
.row .ico { width: 76px; height: 76px; border-radius: 22px; background: var(--green-50); color: var(--green-700); display: grid; place-items: center; }
.row .ico svg { width: 42px; height: 42px; }
.row.is-on { box-shadow: 0 0 0 4px var(--brand), var(--shadow-2); }
.row.is-on .ico { background: var(--brand); color: var(--ink-900); }
.big-num { font-family: var(--font-display); font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }

/* ambient loops (CSS, paused with player) */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes dash { to { stroke-dashoffset: -60; } }
@keyframes bob { 50% { transform: translateY(-10px); } }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: .9; } 50% { transform: scale(1.12); opacity: .5; } }
.flow { stroke-dasharray: 2 28; stroke-linecap: round; animation: dash .9s linear infinite; }
.flow.slow { animation-duration: 1.8s; }
.sun-rays { transform-box: fill-box; transform-origin: center; animation: spin 24s linear infinite; }

/* mascot */
.vonkje { overflow: visible; }
.vonkje .v-torso { transform-origin: 0 100px; animation: v-breathe 3.2s cubic-bezier(.65,0,.35,1) infinite; }
.vonkje .v-zig { transform-origin: 0 -110px; animation: v-spring 3.2s cubic-bezier(.65,0,.35,1) infinite; }
.vonkje .v-eyes { transform-origin: 0 -12px; animation: v-blink 4.6s linear infinite; }
.vonkje .v-arm-r { transform-origin: 72px 46px; }
.vonkje.waving .v-arm-r { animation: v-wave 1.4s cubic-bezier(.65,0,.35,1) infinite; }
@keyframes v-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(.985, 1.025); } }
@keyframes v-spring { 0%, 100% { transform: scaleY(1) rotate(0); } 40% { transform: scaleY(1.07) rotate(2deg); } 70% { transform: scaleY(.96) rotate(-1.5deg); } }
@keyframes v-blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.08); } }
@keyframes v-wave { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-16deg); } }

/* interaction overlay (stap 1 quiz) */
.quiz-cta { position: absolute; left: 88px; right: 88px; bottom: 96px; z-index: 7; display: none; gap: 20px; flex-direction: column; }
.app[data-state="interact"] .quiz-cta { display: flex; }
.app[data-state="interact"] .row.tappable { cursor: pointer; z-index: 7; }
.app[data-state="interact"] .row.tappable:active { transform: scale(.98); }
.quiz-hint { font-size: 34px; color: var(--ink-500); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .flow, .sun-rays, .vonkje *, .sheet-panel { animation: none !important; }
}
.endcard[hidden] { display: none; }

.ch-num svg { width: 16px; height: 16px; }
