:root {
  --achter1: #ffe3ee;
  --achter2: #d9f1ff;
  --tekst: #4a2f45;
  --zacht: #8b6d84;
  --knop: #ff5c93;
  --knop2: #ff8fb5;
  --kaart: #ffffff;
  --wafel: #e9a95b;
  --wafel2: #c9843a;
  --s: 44px; /* bolletje, gezet door game.js */
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--tekst);
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,.7) 0 2px, transparent 3px) 0 0 / 38px 38px,
    linear-gradient(160deg, var(--achter1), var(--achter2));
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
svg { width: 1em; height: 1em; fill: currentColor; }

#app { position: relative; height: 100%; max-width: 1100px; margin: 0 auto; }
.scherm { position: absolute; inset: 0; display: none; flex-direction: column; padding: max(10px, env(safe-area-inset-top)) 14px max(10px, env(safe-area-inset-bottom)); }
.scherm.actief { display: flex; }

/* Start */
#start { align-items: center; justify-content: center; gap: 14px; }
.logo { text-align: center; margin-bottom: 18px; }
.logo h1 {
  margin: 6px 0 0; font-size: clamp(48px, 13vw, 88px); line-height: 1; letter-spacing: .5px;
  color: #ff5c93; text-shadow: 0 4px 0 #fff, 0 7px 0 rgba(255,92,147,.25);
}
.logo .sub { margin: 10px 0 0; color: var(--zacht); font-size: 17px; }
.logo-ijs { position: relative; width: 96px; height: 130px; margin: 0 auto; animation: wiebel 3.2s ease-in-out infinite; }
.logo-ijs .b { position: absolute; width: 56px; height: 56px; border-radius: 50%; left: 20px; box-shadow: inset -6px -8px 0 rgba(0,0,0,.08), inset 6px 6px 0 rgba(255,255,255,.35); }
.logo-ijs .b1 { top: 50px; background: #5fd3a6; }
.logo-ijs .b2 { top: 22px; background: #ffe9b0; }
.logo-ijs .b3 { top: -6px; background: #ff6b9a; }
.logo-ijs .hoorn { position: absolute; left: 24px; top: 84px; width: 48px; height: 48px; clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: repeating-linear-gradient(45deg, var(--wafel) 0 6px, var(--wafel2) 6px 8px), var(--wafel); }
@keyframes wiebel { 50% { transform: rotate(-4deg) translateY(-4px); } }

.knop { min-width: 220px; padding: 15px 26px; border-radius: 999px; font-size: 21px; font-weight: 800;
  background: linear-gradient(180deg, var(--knop2), var(--knop)); color: #fff; box-shadow: 0 5px 0 #d63c72, 0 10px 20px rgba(214,60,114,.25); }
.knop:active { transform: translateY(3px); box-shadow: 0 2px 0 #d63c72; }
.knop.licht { background: #fff; color: var(--knop); box-shadow: 0 5px 0 #f3c3d6; font-size: 18px; }

/* Balk */
.balk { display: flex; align-items: center; gap: 10px; min-height: 52px; }
.balk h2 { flex: 1; margin: 0; font-size: 22px; text-align: center; }
.balk .info { flex: 1; text-align: center; line-height: 1.15; }
.balk .info strong { display: block; font-size: 21px; }
.balk .info span { color: var(--zacht); font-size: 15px; }
.rond { width: 46px; height: 46px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 22px; box-shadow: 0 3px 0 #f3c3d6; flex: none; }
.rond:active { transform: translateY(2px); box-shadow: none; }
.totaal { min-width: 46px; font-weight: 800; text-align: right; color: #f0a500; }

/* Levels */
.raster { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; padding: 10px 2px 20px; align-content: start; }
.lv { aspect-ratio: 1; border-radius: 18px; background: #fff; box-shadow: 0 4px 0 #f3c3d6; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; }
.lv small { display: flex; gap: 1px; font-size: 11px; color: #f0a500; margin-top: 2px; }
.lv small svg.leeg { color: #eadde4; }
.lv.dicht { background: rgba(255,255,255,.5); color: #c9b4c2; box-shadow: none; }
.lv.dicht svg { font-size: 18px; }
.lv.nu { outline: 3px solid var(--knop); }

/* Bord */
.bord { flex: 1; position: relative; display: flex; flex-direction: column; justify-content: center; gap: calc(var(--s) * .45); min-height: 0; }
.rij { display: flex; justify-content: center; gap: calc(var(--s) * .32); }
.hoorntje { position: relative; width: calc(var(--s) * 1.12); height: calc(var(--s) * (var(--cap) * .74 + .55) + var(--s) * 1.05); cursor: pointer; transition: transform .15s; }
.hoorntje .wafel { position: absolute; left: 50%; bottom: 0; width: calc(var(--s) * .92); height: calc(var(--s) * 1.15); transform: translateX(-50%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: repeating-linear-gradient(45deg, transparent 0 calc(var(--s)*.14), var(--wafel2) calc(var(--s)*.14) calc(var(--s)*.18)),
              repeating-linear-gradient(-45deg, transparent 0 calc(var(--s)*.14), var(--wafel2) calc(var(--s)*.14) calc(var(--s)*.18)), var(--wafel); }
.hoorntje .plek { position: absolute; left: 50%; width: var(--s); height: var(--s); margin-left: calc(var(--s) * -.5); border-radius: 50%; border: 2px dashed rgba(139,109,132,.18); }
.hoorntje.gekozen { transform: translateY(calc(var(--s) * -.12)); }
.hoorntje.vol .wafel { filter: saturate(1.2) brightness(1.05); }
.hoorntje.vol::after { content: ""; position: absolute; left: 50%; width: calc(var(--s) * .34); height: calc(var(--s) * .34); margin-left: calc(var(--s) * -.17);
  bottom: calc(var(--s) * 1.05 + var(--s) * (var(--cap) * .74 + .05)); border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ff8a8a, #e0213d 70%);
  box-shadow: 0 0 0 2px #fff; animation: kers .35s ease-out; }
.hoorntje.vol::before { content: ""; position: absolute; left: 50%; width: 2px; height: calc(var(--s) * .3); background: #6b8e23; transform: rotate(18deg);
  bottom: calc(var(--s) * 1.05 + var(--s) * (var(--cap) * .74 + .3)); }
@keyframes kers { from { transform: scale(0) translateY(-20px); } }
.hoorntje.schud { animation: schud .3s; }
@keyframes schud { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.bol { position: absolute; left: 50%; width: var(--s); height: var(--s); margin-left: calc(var(--s) * -.5); border-radius: 50%;
  display: grid; place-items: center; color: rgba(255,255,255,.62); font-size: calc(var(--s) * .42);
  box-shadow: inset calc(var(--s)*-.1) calc(var(--s)*-.14) 0 rgba(0,0,0,.1), inset calc(var(--s)*.1) calc(var(--s)*.1) 0 rgba(255,255,255,.3), 0 2px 3px rgba(74,47,69,.15);
  transition: transform .15s; }
.bol::after { content: ""; position: absolute; left: 8%; right: 8%; bottom: -6%; height: 26%; border-radius: 0 0 50% 50% / 0 0 100% 100%;
  background: inherit; filter: brightness(.93); z-index: -1; }
.bol.op { transform: translateY(calc(var(--s) * -.55)); }
.f-a { background-color: #ff6b9a; }
.f-b { background-color: #4ccf9e; }
.f-c { background-color: #8a5a3b; }
.f-d { background-color: #ffeab5; color: rgba(160,120,60,.55); }
.f-e { background-color: #7468ff; }
.f-f { background-color: #ffd84d; color: rgba(170,120,0,.5); }
.f-g { background-color: #ff9a3c; }
.f-h { background-color: #a4d65e; }
.f-i { background-color: #3b3b4f; color: rgba(255,255,255,.5); }
.f-j { background-color: #6fd0ff; }
.bol.geheim { background: repeating-linear-gradient(135deg, #e4edf5 0 6px, #d3e0ec 6px 12px); color: #9fb2c4; font-weight: 900; font-size: calc(var(--s) * .5); }
.bol.geheim::before { content: "?"; }
.bol.onthul { animation: onthul .4s ease-out; }
@keyframes onthul { 0% { transform: scale(.6) rotate(-20deg); } 70% { transform: scale(1.15); } }

.melding { position: absolute; left: 50%; bottom: 96px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #4a2f45; color: #fff; padding: 10px 16px; border-radius: 14px; font-size: 15px; text-align: center; max-width: 90%; transition: .25s; }
.melding.zicht { opacity: 1; transform: translate(-50%, 0); }

.knoppen { display: flex; justify-content: center; gap: 12px; padding-top: 8px; }
.actie { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 84px; padding: 8px 10px; border-radius: 18px;
  background: #fff; box-shadow: 0 4px 0 #f3c3d6; font-size: 13px; font-weight: 700; }
.actie > svg { font-size: 26px; color: var(--knop); }
.actie:active { transform: translateY(2px); box-shadow: 0 2px 0 #f3c3d6; }
.actie[disabled] { opacity: .45; }
.teller { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: var(--knop); color: #fff; font-size: 12px; display: grid; place-items: center; }
.teller.video { background: #f0a500; }
.teller:empty { display: none; }

/* Gewonnen */
.laag { position: absolute; inset: 0; background: rgba(74,47,69,.35); display: grid; place-items: center; padding: 16px; z-index: 5; }
.laag[hidden] { display: none; }
.kaart { background: var(--kaart); border-radius: 28px; padding: 26px 22px 22px; width: min(360px, 100%); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; animation: pop .35s ease-out; }
.kaart h2 { margin: 0; font-size: 30px; color: var(--knop); }
.kaart p { margin: 0; color: var(--zacht); }
.sterren { display: flex; gap: 6px; font-size: 52px; color: #eadde4; }
.sterren svg.aan { color: #ffbf1f; animation: pop .4s ease-out backwards; }
.sterren svg.aan:nth-child(2) { animation-delay: .15s; }
.sterren svg.aan:nth-child(3) { animation-delay: .3s; }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.1); } }

.confetti { position: absolute; width: 9px; height: 9px; border-radius: 2px; pointer-events: none; z-index: 6; }

@media (max-height: 560px) {
  .logo-ijs { transform: scale(.7); margin-bottom: -30px; }
  .logo { margin-bottom: 4px; }
  .knop { padding: 11px 22px; }
  .actie { flex-direction: row; gap: 6px; padding: 6px 12px; }
  .actie > svg { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
