:root {
  --ink: #4A3B6B;
  --pink: #FF6BAE;
  --shadow: #D9C7F5;
  --tile: clamp(44px, 10vmin, 96px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(16px, 2.6vmin, 26px);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, #ffffffb0 0 6vmin, transparent 6.2vmin),
    radial-gradient(circle at 19% 20%, #ffffffb0 0 4.5vmin, transparent 4.7vmin),
    radial-gradient(circle at 84% 30%, #ffffff90 0 5vmin, transparent 5.2vmin),
    radial-gradient(circle at 90% 32%, #ffffff90 0 3.6vmin, transparent 3.8vmin),
    linear-gradient(180deg, #BFE3FF 0%, #E6D4FF 55%, #FFD6EC 100%);
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
  user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
button:active { transform: scale(.95); }
svg { display: block; }

/* ---------- bovenbalk ---------- */
#bar {
  display: flex; align-items: center; gap: 12px;
  padding: max(8px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 6px max(14px, env(safe-area-inset-left));
  flex: 0 0 auto;
}
#menuBtn { width: 56px; height: 56px; border-radius: 28px; background: var(--pink); color: #fff; font-size: 28px; font-weight: 800; box-shadow: 0 4px 0 #D94A8F; display: grid; place-items: center; }
#home, #stars {
  height: 56px; border-radius: 28px; background: #fff; box-shadow: 0 4px 0 var(--shadow);
  display: grid; place-items: center; font-size: 26px;
}
#home { width: 56px; }
#stars { padding: 0 18px; font-weight: 800; display: flex; gap: 8px; cursor: pointer; }
#flags { margin-left: auto; display: flex; gap: 10px; }
#flags button {
  width: 60px; height: 42px; border-radius: 10px; overflow: hidden; background: #fff;
  border: 3px solid #fff; opacity: .5; box-shadow: 0 3px 0 var(--shadow); transition: transform .15s, opacity .15s;
}
#flags button svg { width: 100%; height: 100%; }
#flags button.on { opacity: 1; transform: scale(1.12); border-color: var(--pink); }

/* ---------- schermen ---------- */
#app { flex: 1 1 auto; min-height: 0; display: flex; overflow-x: hidden; overflow-y: auto; }
#app > section {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(10px, 2.6vh, 28px);
  padding: 6px 16px max(18px, env(safe-area-inset-bottom));
}
h1 { margin: 0; text-align: center; font-size: clamp(26px, 5.6vmin, 56px); line-height: 1.1; color: #7A4FD0; text-shadow: 0 3px 0 #fff; }
h2 { margin: 0; text-align: center; font-size: clamp(22px, 4.4vmin, 42px); }

.duo { display: flex; align-items: flex-end; justify-content: center; gap: 1vmin; }
.duo .emilia svg { height: min(38vh, 50vw); width: auto; }
.duo .unicorn { position: relative; }
.duo .unicorn svg { height: min(31vh, 42vw); width: auto; }
.tag {
  position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  background: #fff; border-radius: 99px; padding: 2px 14px; font-weight: 800; white-space: nowrap;
  box-shadow: 0 3px 0 var(--shadow);
}
.twinkle { animation: twinkle 1.4s ease-in-out infinite; }

.play, .nextbtn, .okbtn {
  width: clamp(84px, 18vmin, 150px); aspect-ratio: 1; border-radius: 50%;
  background: var(--pink); color: #fff; font-size: clamp(36px, 8vmin, 70px);
  box-shadow: 0 8px 0 #D94A8F; display: grid; place-items: center;
}
.play { animation: pulse 1.4s ease-in-out infinite; }
.okbtn { background: #4FC9A4; box-shadow: 0 8px 0 #32A683; width: 72px; font-size: 34px; flex: 0 0 auto; }
.okbtn:disabled { opacity: .35; }

/* naam kiezen */
.name .unicorn.solo svg { height: min(30vh, 50vw); width: auto; }
.names { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; max-width: 640px; }
.nm { background: #fff; border-radius: 99px; padding: .45em 1.1em; font-size: clamp(22px, 4.4vmin, 40px); font-weight: 800; box-shadow: 0 5px 0 var(--shadow); }
.nm.on { background: #FFF3B8; box-shadow: 0 5px 0 #FFD23F; }
.ownrow { display: flex; gap: 14px; align-items: center; }
.own {
  font: inherit; font-weight: 800; font-size: clamp(20px, 3.6vmin, 32px); color: var(--ink); text-align: center;
  width: min(60vw, 280px); padding: .5em; border-radius: 99px; border: 3px dashed #C9A0FF; background: #ffffffb0;
  user-select: text; -webkit-user-select: text;
}

/* kaart */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(10px, 2vmin, 20px); width: min(100%, 620px); }
.card {
  position: relative; border-radius: 28px; padding: clamp(10px, 2.2vmin, 22px);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: #fff; box-shadow: 0 7px 0 #0000001c;
}
.card .ico { font-size: clamp(40px, 9vmin, 84px); line-height: 1.15; }
.card .name { font-weight: 800; font-size: clamp(16px, 2.9vmin, 27px); }
.card .lvl {
  position: absolute; top: 10px; right: 12px; width: 1.9em; height: 1.9em; border-radius: 50%;
  background: #FFD23F; display: grid; place-items: center; font-weight: 800; font-size: .85em;
}
.c-math { background: #FFF4D6; } .c-spell { background: #E4F3FF; } .c-chest { background: #E3FAEC; }
.c-memory { background: #FFE6F2; }
.c-wardrobe { background: #F1E6FF; grid-column: 1 / -1; flex-direction: row; justify-content: center; gap: 14px; }
.map .duo .emilia svg { height: min(27vh, 40vw); }
.map .duo .unicorn svg { height: min(22vh, 34vw); }

/* gedeeld in de spellen */
.dots { display: flex; gap: 10px; }
.dots i { width: 18px; height: 18px; border-radius: 50%; background: #ffffff90; border: 3px solid #fff; }
.dots i.on { background: #FFD23F; }
.speak {
  width: 64px; height: 64px; border-radius: 50%; background: #fff; font-size: 30px;
  box-shadow: 0 5px 0 var(--shadow); flex: 0 0 auto; display: grid; place-items: center;
}
.emo { line-height: 1.15; }
.shake { animation: shake .4s; }
.pop { animation: pop .35s; }

/* regenboogbrug */
.bridge { position: relative; width: min(92vw, 62vh, 560px); }
.bridge svg { width: 100%; height: auto; }
.band { opacity: .13; transition: opacity .6s; }
.band.on { opacity: 1; }
.runner { position: absolute; left: 0; bottom: 6%; width: 21%; }
.runner svg { width: 100%; height: auto; }
.runner.cross { animation: cross 2.7s ease-in-out forwards; }
.sum { display: flex; align-items: center; gap: .32em; font-size: clamp(40px, 10vmin, 96px); font-weight: 800; line-height: 1; }
.sum .op { color: #9B6BE8; }
.sum .ans { min-width: 1.35em; text-align: center; background: #fff; border-radius: .22em; padding: .05em .15em; color: var(--pink); }
.sum .speak { margin-left: .3em; }
.objwrap { min-height: clamp(34px, 6.5vmin, 60px); display: grid; place-items: center; }
.objs { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5em; font-size: clamp(22px, 4.6vmin, 44px); }
.objs .grp { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: .08em; max-width: 7.2em; }
.objs b { color: #9B6BE8; }
.objs .gone { opacity: .3; position: relative; }
.objs .gone::after { content: ''; position: absolute; left: 0; right: 0; top: 46%; height: 4px; border-radius: 2px; background: #E0457B; transform: rotate(-35deg); }
.opts { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(12px, 3vmin, 28px); }
.opt {
  width: clamp(76px, 17vmin, 150px); aspect-ratio: 1; border-radius: 50%; background: #fff;
  font-size: clamp(34px, 8vmin, 72px); font-weight: 800; box-shadow: 0 8px 0 var(--shadow);
}
.opt.right { background: #B8F3CE; box-shadow: 0 8px 0 #7BD9A2; }
.opt:disabled { opacity: .3; }

/* toverletters */
.pic { display: flex; align-items: center; gap: 18px; }
.pic .emo { font-size: clamp(84px, 23vmin, 210px); }
.slots, .tiles { font-size: min(clamp(34px, 8vmin, 76px), calc(90vw / var(--n, 3) * .62)); display: flex; justify-content: center; gap: .16em; }
.tiles { flex-wrap: wrap; gap: .26em; max-width: 96vw; }
.slot, .tile { width: 1.28em; height: 1.5em; border-radius: .24em; display: grid; place-items: center; font-weight: 800; line-height: 1; }
.slot { background: #ffffff80; border: 4px dashed #C9A0FF; }
.slot.ghost { color: #CDBFE6; }
.slot.filled { background: #fff; border-style: solid; border-color: #FF8FC7; animation: pop .3s; }
.slots.done .slot { background: #FFF3B8; border-color: #FFD23F; }
.tile { background: #fff; box-shadow: 0 .1em 0 var(--shadow); }
.tile.used { visibility: hidden; }
.tile.hint { background: #FFF3B8; animation: wiggle .7s ease-in-out infinite; }

/* schatkist */
.ask { display: flex; align-items: center; gap: clamp(12px, 3vmin, 26px); }
.gem { font-size: clamp(40px, 9vmin, 84px); }
.flag svg { border-radius: 8px; box-shadow: 0 0 0 3px #fff; }
.flag.big svg { width: clamp(72px, 14vmin, 126px); height: auto; border-radius: 12px; }
.speak.huge { width: clamp(84px, 18vmin, 150px); height: auto; aspect-ratio: 1; font-size: clamp(40px, 9vmin, 76px); animation: pulse 1.6s ease-in-out infinite; }
.stage { display: grid; place-items: center; width: 100%; }
.choices.pics { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(12px, 3vmin, 28px); }
.pics .choice { width: clamp(104px, 24vmin, 220px); aspect-ratio: 1; border-radius: 28px; background: #fff; box-shadow: 0 8px 0 var(--shadow); font-size: clamp(60px, 15vmin, 140px); }
.choice:disabled { opacity: .3; }
.wordlist { display: flex; flex-direction: column; gap: clamp(10px, 2vmin, 18px); width: min(92vw, 520px); }
.wrow { display: flex; gap: 12px; }
.wrow .choice { flex: 1; min-width: 0; border-radius: 22px; background: #fff; padding: .3em .6em; font-size: clamp(28px, 6vmin, 54px); font-weight: 800; box-shadow: 0 6px 0 var(--shadow); }
.ear { width: 68px; border-radius: 22px; background: #E4F3FF; font-size: 28px; box-shadow: 0 6px 0 #BFDDF7; }
.reveal { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: clamp(14px, 4vmin, 40px); }
.emo.big { font-size: clamp(84px, 22vmin, 200px); }
.tri { display: flex; flex-direction: column; gap: 10px; }
.trirow {
  display: flex; align-items: center; gap: 16px; background: #fff; border-radius: 20px; padding: .3em .8em;
  font-size: clamp(26px, 5.4vmin, 48px); font-weight: 800; box-shadow: 0 5px 0 var(--shadow); transition: transform .2s, background .2s;
}
.trirow .flag svg { width: 1.5em; height: auto; }
.trirow.live { background: #FFF3B8; transform: scale(1.07); }

/* memory */
.grid { display: grid; gap: clamp(8px, 2vmin, 18px); max-width: 900px; }
.grid.cols3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols4 { grid-template-columns: repeat(4, 1fr); }
.grid.n6 { width: min(92vw, 112vh); }
.grid.n8 { width: min(94vw, 144vh); }
.grid.n12 { width: min(94vw, 100vh); }
.grid.n16 { width: min(94vw, 74vh); }
.mcard {
  width: 100%; aspect-ratio: 1; border-radius: 22px; background: linear-gradient(135deg, #C9A0FF, #FF8FC7);
  box-shadow: 0 6px 0 #0000001f; display: grid; place-items: center; overflow: hidden;
  container-type: inline-size; transition: transform .2s;
}
.mcard .back { font-size: clamp(34px, 9vmin, 90px); font-size: 52cqw; }
.mcard .face { display: none; }
.mcard.open { background: #fff; animation: pop .3s; }
.mcard.open .back { display: none; }
.mcard.open .face { display: grid; place-items: center; }
.mcard .face .emo { font-size: clamp(38px, 10vmin, 104px); font-size: 58cqw; }
.mcard .face .w { font-size: clamp(15px, 3.2vmin, 32px); font-size: 15.5cqw; font-weight: 800; padding: 0 .2em; overflow-wrap: anywhere; text-align: center; }
.mcard.done { background: #E3FAEC; box-shadow: 0 0 0 5px #7BE0AD inset; }

/* einde van de ronde */
.earned { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; font-size: clamp(34px, 8vmin, 72px); min-height: 1.2em; }
.earned span { animation: pop .5s both; }
.btns { display: flex; gap: clamp(16px, 4vmin, 36px); }
.rbtn { width: clamp(80px, 16vmin, 128px); aspect-ratio: 1; border-radius: 50%; background: #fff; font-size: clamp(34px, 7.4vmin, 62px); box-shadow: 0 8px 0 var(--shadow); display: grid; place-items: center; }
.rbtn.gift { background: #FFF3B8; animation: pulse 1.2s ease-in-out infinite; }
.dance .emilia { animation: bob .7s ease-in-out infinite alternate; }
.dance .unicorn { animation: bob .7s ease-in-out .35s infinite alternate; }

/* kleedkamer */
.racks { display: flex; flex-direction: column; gap: clamp(8px, 1.8vmin, 16px); align-items: center; }
.rack { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(8px, 2vmin, 16px); background: #ffffffa8; border-radius: 26px; padding: clamp(8px, 1.8vmin, 14px); }
.sw {
  position: relative; width: clamp(58px, 11.5vmin, 96px); aspect-ratio: 1; border-radius: 50%;
  border: 5px solid #fff; font-size: clamp(24px, 5.4vmin, 44px); display: grid; place-items: center; box-shadow: 0 5px 0 var(--shadow);
}
.sw.on { border-color: var(--pink); transform: scale(1.08); }
.sw.locked { filter: saturate(.45); opacity: .8; }
.lock { display: grid; place-items: center; line-height: 1; font-size: .72em; }
.lock small { font-size: .5em; font-weight: 800; background: #fff; border-radius: 99px; padding: 1px 6px; margin-top: 2px; }

/* liggend scherm: figuren links, spel rechts */
@media (orientation: landscape) {
  #app > section.map, #app > section.ward { flex-direction: row; gap: 4vw; }
  .map .hero { flex: 0 1 36%; }
  .map .duo .emilia svg, .ward .duo .emilia svg { height: min(54vh, 26vw); }
  .map .duo .unicorn svg, .ward .duo .unicorn svg { height: min(44vh, 22vw); }
  .map .cards { width: min(56vw, 620px); }
  .done .duo .emilia svg { height: min(36vh, 24vw); }
  .done .duo .unicorn svg { height: min(29vh, 20vw); }
  .g-math .bridge { width: min(46vw, 48vh, 480px); }
  .pic .emo { font-size: clamp(70px, 20vmin, 170px); }
}

/* sterrenregen */
#fx { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.particle { position: absolute; font-size: 28px; animation: fly .9s ease-out forwards; }

@keyframes fly {
  from { transform: translate(-50%, -50%) scale(.4); opacity: 1; }
  to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.25); opacity: 0; }
}
@keyframes pulse { 50% { transform: scale(1.08); } }
@keyframes pop { 0% { transform: scale(.5); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg) scale(1.08); } }
@keyframes bob { to { transform: translateY(-14px); } }
@keyframes twinkle { 50% { opacity: .35; } }
@keyframes cross {
  0% { left: 0; bottom: 6%; }
  50% { left: 39.5%; bottom: 76%; }
  100% { left: 79%; bottom: 6%; }
}
@media (prefers-reduced-motion: reduce) {
  .play, .speak.huge, .rbtn.gift, .dance .emilia, .dance .unicorn, .twinkle { animation: none; }
}

/* ---------- 3D-wereld ---------- */
#world { position: fixed; inset: 0; width: 100%; height: 100%; display: none; z-index: 0; touch-action: none; }
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 1; display: none; overflow: hidden; }
#bar, #app { position: relative; z-index: 2; }
body.has3d { background: #D9D2FF; }
body.has3d #world { display: block; }
body.has3d #labels.show { display: block; }
body.has3d #app { pointer-events: none; overflow: hidden; }
body.has3d #app button, body.has3d #app input, body.has3d #app .emo { pointer-events: auto; }
.isle-label {
  position: absolute; left: 0; top: 0; background: #ffffffec; border-radius: 18px; padding: 4px 14px 7px;
  text-align: center; font-weight: 800; white-space: nowrap; font-size: clamp(14px, 2.5vmin, 24px);
  box-shadow: 0 4px 0 #0000001a; will-change: transform;
}
.isle-label .sub { display: flex; gap: 4px; justify-content: center; margin-top: 3px; font-size: .82em; }
.isle-label .sub i { width: .62em; height: .62em; border-radius: 50%; background: #E4DAF3; }
.isle-label .sub i.on { background: #FFD23F; }
.isle-label.locked { background: #ffffffb8; color: #8A7FA6; }
.badge { background: #FFF3B8; border-radius: 99px; padding: .2em .9em; font-weight: 800; font-size: clamp(22px, 4.6vmin, 40px); box-shadow: 0 5px 0 #FFD23F; animation: pop .5s both; }
.card.closed { filter: saturate(.3); opacity: .8; }
.card .lvl.wide { width: auto; padding: 0 .5em; border-radius: 99px; }

/* in 3D staat de wereld boven (staand) of links (liggend), de knoppen in de rest van het scherm */
body.has3d #app > section.start { justify-content: space-between; padding-top: 1vh; padding-bottom: 5vh; }
body.has3d #app > section.game, body.has3d #app > section.ward,
body.has3d #app > section.done, body.has3d #app > section.name { justify-content: flex-end; padding-top: 44vh; }
body.has3d .pic .emo { font-size: clamp(64px, 15vmin, 140px); }
body.has3d .pics .choice { width: clamp(96px, 20vmin, 180px); font-size: clamp(54px, 12vmin, 112px); }
body.has3d .wrow .choice { font-size: clamp(24px, 4.8vmin, 44px); }
body.has3d .speak.huge { width: clamp(72px, 14vmin, 120px); font-size: clamp(34px, 7vmin, 60px); }
@media (orientation: landscape) {
  body.has3d #app > section.game, body.has3d #app > section.ward,
  body.has3d #app > section.done, body.has3d #app > section.name { justify-content: center; padding-top: 6px; padding-left: 50vw; }
  body.has3d .sum { font-size: clamp(34px, min(10vmin, 5.4vw), 80px); }
  body.has3d .opt { width: clamp(70px, min(17vmin, 10vw), 130px); font-size: clamp(30px, min(8vmin, 4.6vw), 62px); }
  body.has3d .slots, body.has3d .tiles { font-size: min(clamp(30px, 7vmin, 66px), calc(46vw / var(--n, 3) * .62)); }
  body.has3d .tiles { max-width: 48vw; }
  body.has3d .pics .choice { width: clamp(90px, min(20vmin, 13vw), 170px); font-size: clamp(50px, min(12vmin, 8vw), 104px); }
  body.has3d .wordlist { width: 44vw; }
  body.has3d .names { max-width: 46vw; }
  body.has3d .racks { max-width: 47vw; }
}

/* ---------- Get Started, accounts, menu ---------- */
.getstarted {
  background: var(--pink); color: #fff; font-weight: 800; font-size: clamp(26px, 5.2vmin, 46px);
  padding: .5em 1.3em; border-radius: 99px; box-shadow: 0 8px 0 #D94A8F; display: flex; align-items: center; gap: .5em;
  animation: pulse 1.6s ease-in-out infinite;
}
.getstarted span { font-size: .8em; }
.panel { gap: clamp(12px, 3vh, 30px); }
.panel h2, .account h2 { color: #7A4FD0; text-shadow: 0 3px 0 #fff; }
.plist { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(12px, 2.6vmin, 24px); max-width: 900px; }
.pcard {
  position: relative; width: clamp(130px, 24vmin, 200px); padding: clamp(12px, 2.4vmin, 22px) 10px; border-radius: 28px;
  background: #ffffffee; box-shadow: 0 8px 0 var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: clamp(18px, 3.2vmin, 28px);
}
.pcard .av { font-size: clamp(50px, 11vmin, 92px); line-height: 1.15; }
.pcard b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .st { font-size: .75em; font-weight: 800; color: #8A7FA6; }
.pcard.new { background: #ffffff9c; border: 4px dashed #C9A0FF; box-shadow: none; }
.pcard.new b { font-size: .8em; white-space: normal; }
.pcard .del { position: absolute; top: -10px; right: -10px; background: #FF6B8B; color: #fff; border-radius: 99px; padding: 4px 10px; font-size: .7em; font-weight: 800; box-shadow: 0 3px 0 #D9456A; }
.manage { width: 52px; height: 52px; border-radius: 50%; background: #ffffffb8; font-size: 24px; }
.manage.on { background: #FFF3B8; }
.own.big { width: min(76vw, 420px); font-size: clamp(24px, 4.6vmin, 40px); }
.avatars { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 560px; }
.avb { width: clamp(58px, 11vmin, 88px); aspect-ratio: 1; border-radius: 50%; background: #fff; font-size: clamp(30px, 6.4vmin, 52px); box-shadow: 0 5px 0 var(--shadow); border: 4px solid #fff; }
.avb.on { border-color: var(--pink); transform: scale(1.1); background: #FFF3B8; }
.backbtn { width: 72px; aspect-ratio: 1; border-radius: 50%; background: #fff; font-size: 30px; box-shadow: 0 8px 0 var(--shadow); }

#menu {
  position: fixed; inset: 0; z-index: 30; display: none; place-items: center;
  background: #4a3b6b59; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
#menu.open { display: grid; animation: fadein .2s both; }
.sheet {
  position: relative; background: #fffffff2; border-radius: 36px; padding: clamp(18px, 4vmin, 36px);
  box-shadow: 0 20px 60px #4a3b6b55; width: min(92vw, 720px); animation: sheetin .35s cubic-bezier(.2, .9, .3, 1.25) both;
}
.mgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(10px, 2.2vmin, 20px); }
.mitem {
  position: relative; border-radius: 24px; background: #F6EEFF; padding: clamp(10px, 2vmin, 18px) 6px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  box-shadow: 0 6px 0 var(--shadow); animation: rise .4s cubic-bezier(.2, .9, .3, 1.25) both;
}
.mitem .ico { font-size: clamp(36px, 8vmin, 68px); line-height: 1.15; }
.mitem .lb { font-weight: 800; font-size: clamp(13px, 2.3vmin, 21px); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mitem.here { background: #FFF3B8; box-shadow: 0 6px 0 #FFD23F; }
.mitem.closed { filter: saturate(.3); opacity: .75; }
.mitem .need { position: absolute; top: 6px; right: 8px; font-size: .7em; font-weight: 800; background: #fff; border-radius: 99px; padding: 1px 7px; }
.mclose { position: absolute; top: -18px; right: -14px; width: 56px; height: 56px; border-radius: 50%; background: var(--pink); color: #fff; font-size: 24px; box-shadow: 0 5px 0 #D94A8F; }
@media (max-width: 560px) { .mgrid { grid-template-columns: repeat(3, 1fr); } }

/* stukje van de som dat nu wordt uitgesproken */
.sum [data-p] { transition: transform .15s, color .15s; display: inline-block; }
.sum [data-p].say { transform: scale(1.22); color: var(--pink); }

/* alles op het scherm komt soepel binnen */
#app > section > * { animation: rise .45s cubic-bezier(.2, .9, .3, 1.2) both; }
#app > section > *:nth-child(2) { animation-delay: .06s; }
#app > section > *:nth-child(3) { animation-delay: .12s; }
#app > section > *:nth-child(4) { animation-delay: .18s; }
#app > section > *:nth-child(5) { animation-delay: .24s; }
.opt, .tile, .choice, .sw, .nm, .rbtn { transition: transform .12s cubic-bezier(.3, 1.6, .5, 1), box-shadow .12s; }
button:active { transform: scale(.93); }
@keyframes rise { from { opacity: 0; transform: translateY(22px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetin { from { opacity: 0; transform: translateY(40px) scale(.92); } to { opacity: 1; transform: none; } }

body.has3d #app > section.profiles { justify-content: center; }
body.has3d #app > section.account { justify-content: flex-end; padding-top: 40vh; }
@media (orientation: landscape) {
  body.has3d #app > section.account { justify-content: center; padding-top: 6px; padding-left: 50vw; }
  body.has3d .avatars { max-width: 46vw; }
  body.has3d .own.big { width: min(40vw, 420px); }
}
@media (prefers-reduced-motion: reduce) {
  #app > section > *, .mitem, .sheet, .getstarted { animation: none; }
}

/* in een spel komt een nieuwe vraag snel binnen, zodat beeld en stem samen starten */
#app > section.game > * { animation-duration: .26s; animation-delay: 0s; }

/* ---------- doelenlijstje linksboven ---------- */
#app > section.hub, #app > section.map { position: relative; }
.goals {
  position: absolute; left: max(12px, env(safe-area-inset-left)); top: 4px; z-index: 3;
  width: clamp(190px, 25vw, 290px); display: flex; flex-direction: column; gap: clamp(6px, 1.2vmin, 10px);
}
.goal {
  display: flex; align-items: center; gap: 10px; text-align: left; width: 100%;
  background: #ffffffe8; border-radius: 20px; padding: clamp(6px, 1.3vmin, 11px) 12px;
  box-shadow: 0 5px 0 #0000001a; font-size: clamp(14px, 2.2vmin, 21px);
}
.goal .gi { font-size: 1.7em; line-height: 1; flex: 0 0 auto; }
.goal .gt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.goal .gt b { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goal .gt small { font-size: .68em; font-weight: 800; color: #8A7FA6; text-transform: uppercase; letter-spacing: .04em; }
.goal .gn { flex: 0 0 auto; font-weight: 800; font-size: .8em; color: #7A4FD0; white-space: nowrap; }
.g-stars .gt b { font-size: 1.5em; line-height: 1; }
.gbar { display: block; height: .55em; border-radius: 99px; background: #E9E0F7; overflow: hidden; }
.gbar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #FFD23F, #FF8FC7); transition: width .6s; }
.bands { display: flex; gap: 3px; }
.bands i { flex: 1; height: .5em; border-radius: 99px; background: #E9E0F7; }
.bands .b0 { background: #FF6B8B; } .bands .b1 { background: #FFA24D; } .bands .b2 { background: #FFE066; } .bands .b3 { background: #7BE0AD; }
.bands .b4 { background: #6FC3FF; } .bands .b5 { background: #7C8CFF; } .bands .b6 { background: #C89BFF; }
.pips { display: flex; gap: 5px; }
.pips i { width: .8em; height: .8em; border-radius: 50%; background: #E9E0F7; }
.pips i.on { background: #FFD23F; }
#app > section.map .goals { position: static; flex-direction: row; flex-wrap: wrap; width: min(100%, 620px); }
#app > section.map .goal { width: auto; flex: 1 1 45%; }
@media (orientation: portrait) {
  /* staand: twee naast elkaar over de hele breedte, zodat het lijstje laag blijft */
  .goals { width: calc(100vw - 24px); flex-direction: row; flex-wrap: wrap; }
  .goal { width: auto; flex: 1 1 46%; }
}

/* ---------- doelenlijstje als strook boven de eilanden (de wereld blijft in het midden) ---------- */
.goals { left: 12px; right: 12px; width: auto; flex-direction: row; flex-wrap: wrap; }
.goal { width: auto; flex: 1 1 0; min-width: 170px; }
.goal.can { background: #FFF3B8; animation: pulse 1.4s ease-in-out infinite; }
.g-stars { flex: 0 1 150px; min-width: 130px; }
@media (orientation: portrait) {
  .goals { width: auto; }
  .goal, .g-stars { flex: 1 1 46%; }
}

/* ---------- winkel ---------- */
.tabs { display: flex; gap: clamp(8px, 1.8vmin, 16px); }
.tab { width: clamp(64px, 12vmin, 100px); aspect-ratio: 1.25; border-radius: 22px 22px 10px 10px; background: #ffffffa8; font-size: clamp(28px, 6vmin, 50px); box-shadow: 0 5px 0 var(--shadow); }
.tab.on { background: #fff; box-shadow: 0 5px 0 var(--pink); transform: translateY(-4px); }
.shop {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(8px, 2vmin, 16px);
  background: #ffffffa8; border-radius: 26px; padding: clamp(10px, 2vmin, 16px); width: min(94vw, 500px);
}
.shop .sw { width: 100%; }
.sw .face { line-height: 1; }
.sw .price { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); background: #fff; border-radius: 99px; padding: 1px 8px; font-size: .42em; font-weight: 800; white-space: nowrap; box-shadow: 0 2px 0 var(--shadow); }
.sw.buy { animation: pulse 1.4s ease-in-out infinite; }
.sw.buy .price { background: #FFF3B8; }
.sw.locked .face { opacity: .55; }
@media (orientation: landscape) {
  body.has3d .shop { width: min(46vw, 500px); }
}

/* winkel in 3D: tabbladen boven het rek, samen in het vak naast (liggend) of onder (staand) de figuren */
body.has3d #app > section.ward { flex-direction: column; gap: clamp(8px, 1.8vmin, 16px); }

/* ---------- doelenlijstje als smalle kolom links; de wereld blijft in het midden van het scherm ---------- */
.goals { left: max(10px, env(safe-area-inset-left)); right: auto; top: 4px; width: clamp(136px, 15.5vw, 184px); flex-direction: column; flex-wrap: nowrap; gap: clamp(5px, 1vmin, 9px); }
.goal, .g-stars { flex: 0 0 auto; min-width: 0; width: 100%; display: grid; grid-template-columns: auto 1fr; column-gap: 8px; row-gap: 1px; align-items: center; padding: clamp(5px, 1.1vmin, 9px) 10px; font-size: clamp(13px, 2vmin, 19px); }
.goal .gi { grid-row: 1 / span 2; font-size: 1.6em; }
.goal .gt { grid-column: 2; }
.goal .gn { grid-column: 2; text-align: right; font-size: .78em; }
.g-stars .gt b { font-size: 1.4em; }
@media (orientation: portrait) {
  .goals { width: clamp(140px, 22vw, 190px); }
  .goal, .g-stars { flex: 0 0 auto; }
}
#app > section.map .goals { position: static; flex-direction: row; flex-wrap: wrap; width: min(100%, 620px); }
#app > section.map .goal { flex: 1 1 45%; }
