/* Wolkenhopper — vormgeving.
 *
 * De lucht is één hoog kleurverloop (dag onder, nacht boven). --hoog loopt van
 * 0 naar 1 terwijl je klimt en schuift dat verloop omlaag; zon, maan, sterren
 * en heuvels luisteren naar dezelfde variabele.
 */

:root {
  --inkt: #2b2440;
  --hoog: 0;
  --wolk-b: min(29vw, 190px, 30vh);
  --wolk-h: calc(var(--wolk-b) * 0.6);
  --held-b: calc(var(--wolk-b) * 0.72);
  font-family: ui-rounded, "Nunito", "Arial Rounded MT Bold", "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: #c9ecff;
  color: var(--inkt);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--inkt); outline-offset: 3px; }
h1, h2, p { margin: 0; }

/* ---------- de lucht ---------- */
#lucht {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background-image: linear-gradient(to bottom,
    #0b1030 0%, #1d1650 14%, #43237a 27%,
    #8a3f9a 40%, #e86a92 50%, #ffa97a 58%,
    #ffd7a0 64%, #a9dcff 76%, #8fd0ff 88%, #c9ecff 100%);
  background-size: 100% 400%;
  background-position: 0 calc((1 - var(--hoog)) * 100%);
  transition: background-position 1.1s ease;
}
#sterrenlucht { position: absolute; inset: 0; opacity: calc(var(--hoog) * 3 - 1.5); transition: opacity 1.1s ease; }
#sterrenlucht i {
  position: absolute;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: #fff;
  animation: twinkel 2.4s ease-in-out infinite;
}
#zon {
  position: absolute;
  right: 8%; top: 21%;
  width: clamp(56px, 13vmin, 104px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #fffbe0, #ffe27a 60%, #ffcf4a);
  box-shadow: 0 0 0 14px rgba(255, 236, 150, .35), 0 0 60px 24px rgba(255, 220, 110, .45);
  opacity: calc(1 - var(--hoog) * 2.4);
  transform: translateY(calc(var(--hoog) * 70vh));
  transition: transform 1.1s ease, opacity 1.1s ease;
}
#maan {
  position: absolute;
  left: 8%; top: 22%;
  width: 1em;
  font-size: clamp(50px, 11vmin, 90px);
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: inset -.28em -.1em 0 0 #fff3c4;
  opacity: calc(var(--hoog) * 4 - 2.6);
  transition: opacity 1.1s ease;
}
.drijfwolk {
  position: absolute;
  left: -40%;
  width: max(22vmin, 120px);
  height: max(6.4vmin, 35px);
  background: #fff;
  border-radius: 999px;
  opacity: calc(.62 - var(--hoog) * .42);
  animation: drijf 80s linear infinite;
  transition: opacity 1.1s ease;
}
.drijfwolk::before, .drijfwolk::after { content: ""; position: absolute; background: #fff; border-radius: 50%; aspect-ratio: 1; }
.drijfwolk::before { width: 45%; left: 16%; bottom: 30%; }
.drijfwolk::after { width: 34%; right: 18%; bottom: 35%; }
.d1 { top: 20%; animation-delay: -20s; }
.d2 { top: 54%; animation-duration: 115s; animation-delay: -70s; scale: .7; }
.d3 { top: 68%; animation-duration: 96s; animation-delay: -45s; scale: .85; }
#heuvels {
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 20vh;
  transform: translateY(calc(var(--hoog) * 400%));
  transition: transform 1.1s ease;
}

/* ---------- het speelvlak ---------- */
#wereld {
  position: relative;
  width: min(100vw, 720px);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
}
.scherm {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: max(14px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
  overflow-y: auto;
  scrollbar-width: thin;
  text-align: center;
}
.scherm[hidden], .overlay[hidden] { display: none; }

.titel {
  margin-top: 6px;
  font-size: clamp(38px, 10.5vw, 66px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: .01em;
  color: #fff;
  text-shadow: 0 3px 0 #3f7fc4, 0 7px 14px rgba(30, 60, 120, .35);
}
.titel span { color: #ffe27a; }
.titel.klein { font-size: clamp(30px, 8vw, 46px); }
.ondertitel { font-size: 18px; font-weight: 800; color: #1f4f80; }
.groet { font-size: 20px; font-weight: 800; }

/* ---------- held op een wolk (start en held-scherm) ---------- */
.podium {
  --b: clamp(120px, 19vh, 190px);
  position: relative;
  flex: none;
  width: var(--b);
  height: calc(var(--b) * 1.2);
  padding: 0;
  border: 0;
  background: none;
}
.podium.klein { --b: clamp(105px, 16vh, 150px); }
.podium-wolk { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--b) * .6); }
.podium-held {
  position: absolute;
  left: 19%;
  bottom: calc(var(--b) * .6 * .78);
  z-index: 1;
  width: 62%;
  animation: dobber 2.6s ease-in-out infinite;
}
.wolk-svg { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 6px 8px rgba(30, 50, 90, .16)); }
.wolk-svg .vorm { fill: var(--vulling, #fff); transition: fill .35s ease; }
.wolk-svg .schaduw { fill: var(--schaduw, #cfe2f5); transition: fill .35s ease; }
.held-svg { display: block; width: 100%; height: auto; overflow: visible; }

/* Eén gezicht tegelijk. */
.held-svg .ogen-blij, .held-svg .ogen-sip, .held-svg .mond-blij, .held-svg .mond-sip { display: none; }
.held-svg[data-stemming="blij"] .ogen-gewoon, .held-svg[data-stemming="blij"] .mond-gewoon,
.held-svg[data-stemming="sip"] .ogen-gewoon, .held-svg[data-stemming="sip"] .mond-gewoon { display: none; }
.held-svg[data-stemming="blij"] .ogen-blij, .held-svg[data-stemming="blij"] .mond-blij,
.held-svg[data-stemming="sip"] .ogen-sip, .held-svg[data-stemming="sip"] .mond-sip { display: inline; }

/* ---------- panelen en knoppen ---------- */
.paneel {
  width: min(100%, 440px);
  padding: 14px 16px 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 6px 0 rgba(43, 36, 64, .1);
}
.paneel h2 { margin: 14px 0 9px; font-size: 18px; font-weight: 900; }
.paneel h2:first-child { margin-top: 0; }

.knop {
  flex: none;
  border: 0;
  border-radius: 999px;
  padding: 13px 32px;
  font-size: 21px;
  font-weight: 900;
  color: #fff;
  background: #ff7a59;
  box-shadow: 0 6px 0 #d4532f, 0 10px 18px rgba(212, 83, 47, .28);
  transition: transform .08s, box-shadow .08s;
}
.knop:active { transform: translateY(4px); box-shadow: 0 2px 0 #d4532f; }
.knop.groot { padding: 15px 58px; font-size: 28px; }
.knop.tweede {
  padding: 10px 20px;
  font-size: 17px;
  color: var(--inkt);
  background: #fff;
  box-shadow: 0 5px 0 #c3cfe4;
}
.knop.tweede:active { box-shadow: 0 1px 0 #c3cfe4; }
.link { border: 0; background: none; padding: 6px 8px; font-size: 15px; font-weight: 800; color: #4a31b5; text-decoration: underline; text-underline-offset: 3px; }

.tafels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.tafel {
  height: 52px;
  border: 3px solid #d6dcea;
  border-radius: 16px;
  background: #fff;
  font-size: 23px;
  font-weight: 900;
  color: #8a90a6;
  transition: transform .1s;
}
.tafel[aria-pressed="true"] {
  border-color: #5b3fd0;
  background: #7c5cf0;
  color: #fff;
  box-shadow: 0 4px 0 #4a31b5;
  transform: translateY(-2px);
}
.tafel.nee { animation: nee .35s; }
.snelkeuze { display: flex; justify-content: center; gap: 10px; margin-top: 8px; }

.onder { display: flex; align-items: center; gap: 12px; }
.sterteller {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px 6px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  font-size: 19px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 3px 0 rgba(43, 36, 64, .12);
}
.sterteller.plop { animation: plop .35s; }
.icoon { display: block; flex: none; width: 24px; height: 24px; }
.icoon.ster { fill: #ffc21a; stroke: #d99a00; stroke-width: 1.3; stroke-linejoin: round; }
.icoon.hart { fill: #ff4d6d; transition: fill .25s, transform .25s; }
.icoon.hart.kwijt { fill: #c5ccd9; transform: scale(.82); }

.volgende { width: min(100%, 320px); font-size: 16px; font-weight: 700; color: #1f4f80; }
.volgende p { display: flex; justify-content: center; align-items: center; gap: 5px; flex-wrap: wrap; }
.volgende .icoon { width: 19px; height: 19px; }
.balk { height: 12px; margin-top: 7px; border: 2px solid #fff; border-radius: 999px; background: rgba(255, 255, 255, .6); overflow: hidden; }
.balk i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #ffd23f, #ff9f45); }

/* ---------- held maken ---------- */
.dieren { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.dier, .ding {
  padding: 6px 2px 5px;
  border: 3px solid transparent;
  border-radius: 16px;
  background: #f1f4fb;
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.15;
}
.dier[aria-pressed="true"], .ding[aria-pressed="true"] { border-color: #5b3fd0; background: #ebe5ff; }
.dier .held-svg, .ding .held-svg { width: 84%; margin: 0 auto 2px; }
.kleuren { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }
.kleur {
  width: 42px; height: 42px;
  padding: 0;
  border: 4px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #cfd6e6;
}
.kleur[aria-pressed="true"] { box-shadow: 0 0 0 4px var(--inkt); transform: scale(1.08); }
.naamrij { display: flex; gap: 8px; align-items: center; }
.naamrij input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border: 3px solid #d6dcea;
  border-radius: 16px;
  font: inherit;
  font-size: 20px;
  font-weight: 800;
  color: var(--inkt);
  background: #fff;
  -webkit-user-select: text;
  user-select: text;
}
.naamrij .knop { padding: 10px 14px; font-size: 15px; }
.spullen { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ding:disabled { cursor: default; color: #8a90a6; }
.ding .slot { display: grid; place-items: center; aspect-ratio: 140 / 156; width: 84%; margin: 0 auto 2px; }
.ding .slot svg { width: 46%; fill: #b9c1d3; }
.ding .prijs { display: flex; justify-content: center; align-items: center; gap: 2px; }
.ding .prijs .icoon { width: 15px; height: 15px; }

/* ---------- het spel ---------- */
.spel { padding: 0; overflow: hidden; }
.hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: max(8px, env(safe-area-inset-top)) 10px 0;
}
.rond {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 3px 0 rgba(43, 36, 64, .15);
}
.rond svg { width: 23px; height: 23px; fill: var(--inkt); stroke: var(--inkt); stroke-width: 0; }
.rond svg .streep { fill: none; stroke-width: 2.2; stroke-linecap: round; }
.harten { display: flex; gap: 2px; padding: 6px 9px; border-radius: 999px; background: rgba(255, 255, 255, .92); box-shadow: 0 3px 0 rgba(43, 36, 64, .12); }
.voortgang { flex: 1; min-width: 30px; height: 15px; border: 2px solid rgba(255, 255, 255, .95); border-radius: 999px; background: rgba(255, 255, 255, .5); overflow: hidden; }
.voortgang i { display: block; width: 0; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #ffd23f, #ff9f45); transition: width .6s ease; }

.som {
  position: absolute;
  top: calc(58px + 1.5vh);
  left: 50%;
  z-index: 4;
  display: flex;
  align-items: baseline;
  gap: .22em;
  padding: .12em .62em .16em;
  border-radius: .5em;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 6px 0 rgba(43, 36, 64, .14);
  font-size: clamp(28px, min(8.5vh, 11vw), 62px);
  font-weight: 900;
  line-height: 1.15;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transform: translateX(-50%);
}
.som .keer { color: #7c5cf0; }
.som .is { color: #1c9b5f; }
.som.fout .is { color: #e0465f; }

.veld { position: absolute; inset: 0; }
.wolk {
  position: absolute;
  width: var(--wolk-b);
  height: var(--wolk-h);
  margin-left: calc(var(--wolk-b) / -2);
  padding: 0;
  border: 0;
  background: none;
}
.wolk-in { position: absolute; inset: 0; display: block; animation: dobber 3.4s ease-in-out infinite; }
.antwoord { z-index: 2; }
.antwoord[data-plek="0"] { left: 18%; top: 44%; }
.antwoord[data-plek="1"] { left: 50%; top: 35%; }
.antwoord[data-plek="2"] { left: 82%; top: 44%; }
.antwoord[data-plek="1"] .wolk-in { animation-delay: -1.1s; }
.antwoord[data-plek="2"] .wolk-in { animation-delay: -2.2s; }
.antwoord.nieuw { animation: daal .42s cubic-bezier(.2, .9, .3, 1.25) both; }
.antwoord.vast .wolk-in, .basis .wolk-in { animation: none; }
.antwoord:disabled { cursor: default; }
.basis { left: 50%; top: 76%; z-index: 1; pointer-events: none; }
.getal {
  position: absolute;
  left: 0; right: 0; top: 60%;
  font-size: calc(var(--wolk-b) * .3);
  font-weight: 900;
  line-height: 1;
  color: var(--inkt);
  font-variant-numeric: tabular-nums;
  transform: translateY(-50%);
}
.antwoord.goed { --vulling: #ffe27a; --schaduw: #f0c040; }
.antwoord.fout { --vulling: #a9b4c6; --schaduw: #8792a6; opacity: .8; }
.antwoord.fout .getal { color: #fff; text-decoration: line-through; text-decoration-thickness: .09em; }
.regen { position: absolute; left: 22%; right: 22%; top: 96%; display: none; justify-content: space-around; }
.antwoord.fout .regen { display: flex; }
.regen i { width: 5px; height: 12px; border-radius: 3px; background: #6fb8ff; animation: drup .7s linear infinite; }
.regen i:nth-child(2) { animation-delay: -.25s; }
.regen i:nth-child(3) { animation-delay: -.5s; }

.held {
  position: absolute;
  left: 50%; top: 76%;
  z-index: 3;
  width: var(--held-b);
  /* voeten net in de bovenkant van de wolk */
  margin: calc(var(--wolk-h) * .2 - var(--held-b) * 1.114) 0 0 calc(var(--held-b) / -2);
  pointer-events: none;
}
.held-bob { animation: dobber 2.6s ease-in-out infinite; }
.held.schud .held-bob { animation: schud .5s; }

.plus {
  position: absolute;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 11px 3px 8px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 3px 0 rgba(43, 36, 64, .15);
  font-size: 20px;
  font-weight: 900;
  white-space: nowrap;
  pointer-events: none;
  animation: stijg 1.1s ease-out forwards;
}
.plus.snel { background: #fff3c4; }
.tip {
  position: absolute;
  left: 50%; bottom: max(18px, 4vh);
  z-index: 4;
  width: max-content;
  max-width: 92%;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  font-size: 17px;
  font-weight: 800;
  transform: translateX(-50%);
}
.tip[hidden] { display: none; }

/* ---------- einde van een ronde ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(20, 20, 50, .38);
}
.kaart {
  width: min(100%, 420px);
  max-height: 100%;
  overflow-y: auto;
  padding: 22px 20px 24px;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 10px 0 rgba(43, 36, 64, .18);
  text-align: center;
  animation: plop .4s cubic-bezier(.2, .9, .3, 1.3);
}
.kaart h2 { font-size: 30px; font-weight: 900; line-height: 1.1; }
.kaart p { margin-top: 6px; font-size: 18px; font-weight: 700; text-wrap: balance; }
.grote-sterren { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 12px; font-size: 46px; font-weight: 900; }
.grote-sterren .icoon { width: 46px; height: 46px; }
.kaart .bonus { color: #1c9b5f; }
.kaart .bonus:empty { display: none; }
.nieuw-ding {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 14px;
  padding: 8px 12px;
  border: 3px solid #5b3fd0;
  border-radius: 20px;
  background: #ebe5ff;
  font-size: 17px;
  font-weight: 800;
  text-align: left;
}
.nieuw-ding .held-svg { flex: none; width: 64px; }
.nieuw-ding small { display: block; font-size: 14px; font-weight: 700; color: #4a31b5; }
.oefenen { margin-top: 14px; padding: 10px 12px; border-radius: 18px; background: #f1f4fb; }
.oefenen h3 { margin: 0 0 6px; font-size: 16px; font-weight: 900; }
.oefenen ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.oefenen li { padding: 4px 11px; border-radius: 999px; background: #fff; font-size: 18px; font-weight: 900; font-variant-numeric: tabular-nums; }
.knoppen { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 18px; padding-bottom: 6px; }

.confetti { position: absolute; inset: 0; z-index: 11; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 15px; border-radius: 3px; animation: val linear forwards; }

/* ---------- beweging ---------- */
@keyframes dobber { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes daal { from { opacity: 0; transform: translateY(-46px) scale(.8); } to { opacity: 1; transform: none; } }
@keyframes drijf { to { translate: 180vw 0; } }
@keyframes twinkel { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes drup { from { transform: translateY(0); opacity: 1; } to { transform: translateY(22px); opacity: 0; } }
@keyframes schud { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-9px) rotate(-5deg); } 40% { transform: translateX(8px) rotate(4deg); } 60% { transform: translateX(-6px) rotate(-3deg); } 80% { transform: translateX(4px); } }
@keyframes nee { 0%, 100% { translate: 0; } 25% { translate: -5px 0; } 75% { translate: 5px 0; } }
@keyframes plop { from { transform: scale(.7); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } to { transform: scale(1); } }
@keyframes stijg { from { transform: translate(-50%, 0) scale(.6); opacity: 0; } 20% { transform: translate(-50%, -14px) scale(1.1); opacity: 1; } 70% { opacity: 1; } to { transform: translate(-50%, -70px) scale(1); opacity: 0; } }
@keyframes val { to { transform: translate(var(--zwaai), 110vh) rotate(var(--draai)); } }

@media (prefers-reduced-motion: reduce) {
  .podium-held, .wolk-in, .held-bob, .drijfwolk, #sterrenlucht i { animation: none; }
}
