@font-face {
  font-family: 'Luckiest Guy';
  src: url('assets/lettertype/luckiest-guy-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Fredoka';
  src: url('assets/lettertype/fredoka-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Fredoka';
  src: url('assets/lettertype/fredoka-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Fredoka';
  src: url('assets/lettertype/fredoka-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --inkt: #3a1c10;
  --room: #fff7e6;
  --tomaat: #ff5a4e;
  --munt: #2fbf8f;
  --zon: #ffcf3f;
  --lucht: #3d8bfd;
  --roze: #ff7aa8;
  --tekst: #3a1c10;
  --zacht: #7a5a48;
  --rand: 3px;
  --schaduw: 0 4px 0 var(--inkt);
  --veilig-boven: env(safe-area-inset-top, 0px);
  --veilig-onder: env(safe-area-inset-bottom, 0px);
  --tekstgrootte: 1;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #f6dfb4;
  color: var(--tekst);
  font-family: 'Fredoka', 'Trebuchet MS', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

#achtergrond {
  position: absolute;
  inset: 0;
  background: #f6dfb4 url('assets/achtergrond/staand.webp') center bottom / cover no-repeat;
}
@media (min-aspect-ratio: 1/1) {
  #achtergrond { background-image: url('assets/achtergrond/liggend.webp'); }
}

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  top: calc(var(--veilig-boven) + 10px);
  left: 10px;
  right: 10px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  z-index: 5;
  pointer-events: none;
}
.hud[hidden] { display: none; }
.hud-blok {
  background: var(--room);
  border: var(--rand) solid var(--inkt);
  border-radius: 16px;
  box-shadow: var(--schaduw);
  padding: 4px 12px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  min-width: 78px;
}
.hud-getal {
  font-family: 'Luckiest Guy', system-ui, sans-serif;
  font-size: 26px;
  color: var(--tomaat);
  letter-spacing: 0.5px;
}
.hud-reeks .hud-getal { color: var(--lucht); }
.hud-blok small {
  font-size: 11px;
  font-weight: 600;
  color: var(--zacht);
  margin-top: 1px;
}
.hud-blok.pop { animation: pop 0.35s ease-out; }
.hud-reeks { position: relative; }
/* The earned hula hoop hangs under the streak box. */
.hoepel {
  position: absolute;
  right: 4px;
  bottom: -25px;
  width: 42px;
  rotate: -10deg;
}
.hoepel[hidden] { display: none; }
.hoepel.pop { animation: pop 0.45s ease-out; }
.hoepel svg { display: block; width: 100%; height: auto; overflow: visible; }
.hoepel ellipse { fill: none; }
.hoepel .rand { stroke: var(--inkt); stroke-width: 8; }
.hoepel .basis { stroke: var(--roze); stroke-width: 4.5; }
.hoepel .streep { stroke: var(--zon); stroke-width: 4.5; stroke-dasharray: 6 6; }
.hud-stand {
  text-align: center;
  font-family: 'Luckiest Guy', system-ui, sans-serif;
  font-size: 15px;
  color: var(--inkt);
  text-shadow: 0 1px 0 var(--room), 0 -1px 0 var(--room), 1px 0 0 var(--room), -1px 0 0 var(--room);
}
.balk {
  height: 12px;
  margin-top: 3px;
  background: var(--room);
  border: var(--rand) solid var(--inkt);
  border-radius: 999px;
  overflow: hidden;
}
.balk i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--zon), var(--tomaat));
  transition: width 0.5s ease-out;
}

.vraag {
  position: absolute;
  top: calc(var(--veilig-boven) + 76px);
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  font-family: 'Luckiest Guy', system-ui, sans-serif;
  font-size: calc(22px * var(--tekstgrootte));
  color: var(--room);
  -webkit-text-stroke: 5px var(--inkt);
  paint-order: stroke fill;
  letter-spacing: 0.5px;
  z-index: 4;
  pointer-events: none;
}
.vraag[hidden] { display: none; }

/* ---------- Choice cards ---------- */
.keuze {
  position: absolute;
  z-index: 4;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  border-radius: 18px;
  outline: none;
}
.keuze[hidden] { display: none; }
.keuze:focus-visible .kaart { outline: 4px solid var(--lucht); outline-offset: 3px; }
.kaart {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
  background: var(--room);
  border: var(--rand) solid var(--inkt);
  border-radius: 14px;
  box-shadow: var(--schaduw);
  padding: 6px 6px 5px;
  transition: transform 0.15s ease-out, background-color 0.2s;
  line-height: 1.12;
  text-wrap: balance;
}
.keuze:hover .kaart, .keuze.wijs .kaart { transform: translateY(-3px); }
.keuze:active .kaart { transform: translateY(1px); }
.naam {
  font-weight: 700;
  font-size: calc(17px * var(--tekstgrootte));
}
/* Portion and amount get their own line, big enough to read at a glance. */
.portie {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 3px 5px;
}
.maat {
  font-size: calc(15px * var(--tekstgrootte));
  font-weight: 700;
  color: var(--tekst);
}
.hoeveel {
  font-size: calc(14px * var(--tekstgrootte));
  font-weight: 700;
  color: var(--inkt);
  background: #ffe7a3;
  border: 2px solid var(--inkt);
  border-radius: 999px;
  padding: 0 7px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.kcal {
  font-size: calc(14px * var(--tekstgrootte));
  font-weight: 700;
  color: var(--zacht);
}
.kcal b {
  font-family: 'Luckiest Guy', system-ui, sans-serif;
  font-weight: 400;
  font-size: calc(23px * var(--tekstgrootte));
  color: var(--inkt);
  letter-spacing: 0.5px;
}
.keuze.goed .kaart { background: #d6f7e8; }
.keuze.goed .kcal b { color: #158a5f; }
.keuze.fout .kaart { background: #ffe1db; }
.keuze.fout .kcal b { color: #d63a2c; }
.keuze.uit { pointer-events: none; }
.teken {
  position: absolute;
  top: -6px;
  right: -4px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: var(--rand) solid var(--inkt);
  display: none;
  place-items: center;
  font-family: 'Luckiest Guy', system-ui, sans-serif;
  font-size: 24px;
  line-height: 1;
  color: #fff;
  box-shadow: 0 3px 0 var(--inkt);
}
.keuze.goed .teken { display: grid; background: var(--munt); }
.keuze.goed .teken::before { content: '\2713'; }
.keuze.fout .teken { display: grid; background: var(--tomaat); }
.keuze.fout .teken::before { content: '\2715'; }

/* ---------- Toasts ---------- */
.weetje {
  position: absolute;
  left: 50%;
  bottom: calc(var(--veilig-onder) + 14px);
  transform: translateX(-50%);
  max-width: min(92vw, 520px);
  margin: 0;
  background: var(--room);
  border: var(--rand) solid var(--inkt);
  border-radius: 14px;
  box-shadow: var(--schaduw);
  padding: 8px 12px;
  text-align: center;
  font-weight: 600;
  font-size: calc(14px * var(--tekstgrootte));
  z-index: 6;
  animation: omhoog 0.25s ease-out;
}
.weetje[hidden] { display: none; }
.weetje .strik { color: var(--tomaat); font-family: 'Luckiest Guy', system-ui, sans-serif; display: block; font-size: 16px; }

.banner {
  position: absolute;
  left: 0;
  right: 0;
  top: 38%;
  margin: 0;
  text-align: center;
  font-family: 'Luckiest Guy', system-ui, sans-serif;
  font-size: clamp(40px, 12vw, 84px);
  color: var(--zon);
  -webkit-text-stroke: 8px var(--inkt);
  paint-order: stroke fill;
  transform: rotate(-6deg);
  z-index: 7;
  padding: 0 14px;
  line-height: 1.05;
  pointer-events: none;
  animation: banner 1.3s ease-out forwards;
}
.banner[hidden] { display: none; }
.banner.lang { animation-name: banner-lang; animation-duration: 2.6s; }
.banner-sub {
  display: block;
  margin-top: 0.12em;
  font-size: 0.55em;
  color: #fff;
  -webkit-text-stroke: 6px var(--inkt);
}

/* ---------- Hoop pop-up ---------- */
.uitleg {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(58, 28, 16, 0.35);
}
.uitleg[hidden] { display: none; }
.uitleg-kaart {
  width: min(100%, 360px);
  background: var(--room);
  border: var(--rand) solid var(--inkt);
  border-radius: 22px;
  box-shadow: 0 6px 0 var(--inkt);
  padding: 14px 18px 16px;
  text-align: center;
  animation: uitleg-in 0.35s ease-out;
}
.uitleg-hoepel { display: block; width: 96px; margin: 0 auto 2px; overflow: visible; }
.uitleg-hoepel ellipse { fill: none; }
.uitleg-hoepel .rand { stroke: var(--inkt); stroke-width: 8; }
.uitleg-hoepel .basis { stroke: var(--roze); stroke-width: 4.5; }
.uitleg-hoepel .streep { stroke: var(--zon); stroke-width: 4.5; stroke-dasharray: 6 6; }
.uitleg-titel {
  margin: 0 0 6px;
  font-family: 'Luckiest Guy', system-ui, sans-serif;
  font-weight: 400;
  font-size: 40px;
  line-height: 1;
  color: var(--roze);
  -webkit-text-stroke: 6px var(--inkt);
  paint-order: stroke fill;
  transform: rotate(-3deg);
}
.uitleg-tekst { margin: 0; font-weight: 700; font-size: calc(17px * var(--tekstgrootte)); line-height: 1.3; }
.uitleg-klein { margin: 8px 0 14px; font-weight: 600; color: var(--zacht); font-size: calc(14px * var(--tekstgrootte)); }

/* ---------- Screens ---------- */
.scherm {
  position: absolute;
  inset: 0;
  z-index: 10;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  user-select: text;
}
.scherm[hidden] { display: none; }

.start {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--veilig-boven) + 18px) 16px calc(var(--veilig-onder) + 16px);
  pointer-events: none;
}
.start > * { pointer-events: auto; }
.logo {
  margin: 0;
  font-family: 'Luckiest Guy', system-ui, sans-serif;
  font-weight: 400;
  font-size: clamp(64px, 20vw, 120px);
  line-height: 0.9;
  color: var(--zon);
  -webkit-text-stroke: 10px var(--inkt);
  paint-order: stroke fill;
  text-shadow: 0 7px 0 var(--inkt);
  transform: rotate(-4deg);
  letter-spacing: 2px;
  text-align: center;
}
.logo span { display: block; }
.logo span:first-child { font-size: 0.62em; margin-bottom: -0.06em; }
.kop { display: flex; flex-direction: column; align-items: center; }
/* The motto: a sticker slapped on under the logo, tilted the other way. */
.motto {
  margin: 4px 0 0;
  padding: 5px 14px 2px;
  font-family: 'Luckiest Guy', system-ui, sans-serif;
  font-size: clamp(18px, 5.4vw, 30px);
  line-height: 1.1;
  letter-spacing: 1px;
  color: var(--room);
  background: var(--tomaat);
  border: var(--rand) solid var(--inkt);
  border-radius: 12px;
  box-shadow: var(--schaduw);
  transform: rotate(3deg);
}
.ondertitel {
  margin: 0 0 4px;
  font-weight: 700;
  font-size: calc(17px * var(--tekstgrootte));
  line-height: 1.25;
}
.regel {
  margin: 0 0 12px;
  font-weight: 600;
  color: var(--zacht);
  font-size: calc(14px * var(--tekstgrootte));
}
.regel-boven { margin-bottom: 2px; }
.start-kaart, .einde-kaart {
  width: min(100%, 440px);
  background: var(--room);
  border: var(--rand) solid var(--inkt);
  border-radius: 22px;
  box-shadow: 0 6px 0 var(--inkt);
  padding: 14px 16px 12px;
  text-align: center;
}
.knop {
  font-family: 'Luckiest Guy', system-ui, sans-serif;
  font-size: 22px;
  letter-spacing: 0.5px;
  color: #fff;
  background: var(--tomaat);
  border: var(--rand) solid var(--inkt);
  border-radius: 16px;
  box-shadow: 0 5px 0 var(--inkt);
  padding: 10px 22px 7px;
  cursor: pointer;
  -webkit-text-stroke: 1.5px var(--inkt);
  paint-order: stroke fill;
}
.knop:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--inkt); }
.knop:focus-visible { outline: 4px solid var(--lucht); outline-offset: 3px; }
.knop-groot { width: 100%; font-size: 30px; padding: 12px 22px 9px; }
.knop-zacht { background: var(--zon); color: var(--inkt); -webkit-text-stroke: 0; font-size: 18px; }
.beste-regel { margin: 10px 0 0; font-weight: 700; font-size: calc(15px * var(--tekstgrootte)); }
.klein { margin: 10px 0 0; font-size: calc(12.5px * var(--tekstgrootte)); color: var(--zacht); font-weight: 600; }
.colofon { margin: 8px 0 0; font-size: calc(11px * var(--tekstgrootte)); color: var(--zacht); }
.opties { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; margin-top: 10px; }
.schakel { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; font-size: calc(14px * var(--tekstgrootte)); cursor: pointer; }
.schakel input { width: 18px; height: 18px; accent-color: var(--tomaat); }

/* Text size picker: four A's from small to big. */
.tekstkeuze {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
  font-weight: 700;
  font-size: calc(14px * var(--tekstgrootte));
}
.tekstkeuze span { margin-right: 4px; }
.tk {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 2px solid var(--inkt);
  background: #fff;
  color: var(--inkt);
  font-family: 'Fredoka', system-ui, sans-serif;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.tk[data-grootte="0"] { font-size: 13px; }
.tk[data-grootte="1"] { font-size: 16px; }
.tk[data-grootte="2"] { font-size: 20px; }
.tk[data-grootte="3"] { font-size: 25px; }
.tk[aria-pressed="true"] { background: var(--zon); box-shadow: 0 3px 0 var(--inkt); }
.tk:focus-visible { outline: 3px solid var(--lucht); outline-offset: 2px; }

/* The end: the card sits above (portrait) or beside (wide) Fien and the table.
   Only the card catches taps; taps elsewhere go to the table on the canvas. */
.einde {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: calc(var(--veilig-boven) + 10px) 12px 0;
  pointer-events: none;
}
/* In portrait the card leaves at least 42% of the height to Fien and the table (layout.js counts on it); it scrolls when it needs more. */
.einde-kaart { pointer-events: auto; padding: 10px 14px; max-height: min(calc(100% - 20px), 58vh); overflow-y: auto; }
.einde-kaart.verstopt { visibility: hidden; }
.einde-kaart.verschijn { animation: omhoog 0.35s ease-out; }
.einde-titel {
  margin: 0;
  font-family: 'Luckiest Guy', system-ui, sans-serif;
  font-weight: 400;
  font-size: 44px;
  line-height: 1;
  color: var(--tomaat);
  -webkit-text-stroke: 6px var(--inkt);
  paint-order: stroke fill;
  transform: rotate(-3deg);
}
.einde-label { margin: 4px 0 0; font-weight: 700; color: var(--zacht); font-size: calc(16px * var(--tekstgrootte)); }
.einde-score { font-family: 'Luckiest Guy', system-ui, sans-serif; font-weight: 400; font-size: 34px; color: var(--inkt); vertical-align: -3px; }
.einde-sub { margin: 2px 0 0; font-weight: 600; font-size: calc(14px * var(--tekstgrootte)); }
.record {
  display: inline-block;
  margin: 6px 0 0;
  background: var(--zon);
  border: 2px solid var(--inkt);
  border-radius: 999px;
  padding: 3px 12px 1px;
  font-family: 'Luckiest Guy', system-ui, sans-serif;
  animation: pop 0.6s ease-out 0.3s both;
}
.record[hidden] { display: none; }
.knoppen { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 4px; }
.knoppen .knop-groot { grid-column: 1 / -1; }
.einde-klein { margin: 4px 0 0; font-weight: 600; color: var(--zacht); font-size: calc(13.5px * var(--tekstgrootte)); line-height: 1.3; }
/* Not on screen, still read by screen readers. */
.verborgen { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* The speech bubble above a tapped dish on the table. */
.ballon {
  position: absolute;
  z-index: 12;
  translate: -50% -100%;
  margin: 0;
  max-width: 220px;
  padding: 6px 12px 5px;
  background: var(--room);
  border: var(--rand) solid var(--inkt);
  border-radius: 14px;
  box-shadow: var(--schaduw);
  text-align: center;
  font-weight: 700;
  font-size: calc(14px * var(--tekstgrootte));
  line-height: 1.2;
  pointer-events: none;
  animation: pop 0.25s ease-out;
}
.ballon[hidden] { display: none; }
.ballon small { display: block; font-weight: 600; color: var(--zacht); }
.ballon b { display: block; font-family: 'Luckiest Guy', system-ui, sans-serif; font-weight: 400; color: var(--tomaat); }
.ballon::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -11px;
  translate: -50% 0;
  border: 8px solid transparent;
  border-top-color: var(--inkt);
  border-bottom: 0;
}
/* Wide screens: the card on the left, Fien and the table beside it (the layout uses the same 1:1 switch). */
@media (min-aspect-ratio: 1/1) {
  .einde { justify-content: flex-start; padding-left: 16px; }
  .einde-kaart { width: min(380px, 34vw); max-height: calc(100% - 20px); }
}
/* Low screens: a tighter card leaves more room for Fien and the table. */
@media (max-height: 720px) {
  .einde-kaart { padding: 8px 12px; }
  .einde-titel { font-size: 34px; }
  .einde-score { font-size: 27px; }
  .einde .record { margin-top: 4px; }
  .einde .knoppen { gap: 6px; margin: 8px 0 2px; }
  .einde .knop-groot { font-size: 24px; padding: 8px 18px 6px; }
  .einde .knop-zacht { font-size: 16px; padding-top: 6px; padding-bottom: 4px; }
  .einde-klein { font-size: calc(12.5px * var(--tekstgrootte)); }
}

.rond-knop {
  position: absolute;
  right: 10px;
  bottom: calc(var(--veilig-onder) + 10px);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--room);
  border: var(--rand) solid var(--inkt);
  box-shadow: 0 3px 0 var(--inkt);
  z-index: 8;
  cursor: pointer;
  padding: 7px;
}
.rond-knop[hidden] { display: none; }
.rond-knop.rond-links { right: auto; left: 10px; padding: 0; font-family: 'Fredoka', system-ui, sans-serif; font-weight: 700; font-size: 18px; color: var(--inkt); }
.rond-knop:focus-visible { outline: 3px solid var(--lucht); outline-offset: 2px; }
.rond-knop svg { width: 100%; height: 100%; fill: none; stroke: var(--inkt); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.rond-knop .speaker { fill: var(--inkt); }
.rond-knop .kruis { display: none; }
.rond-knop.stil .golf { display: none; }
.rond-knop.stil .kruis { display: inline; }

@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
@keyframes omhoog {
  from { transform: translate(var(--tx, 0), 14px); opacity: 0; }
  to { transform: translate(var(--tx, 0), 0); opacity: 1; }
}
.weetje { --tx: -50%; }
@keyframes infaden { from { opacity: 0; } to { opacity: 1; } }
@keyframes uitleg-in {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes banner-lang {
  0% { transform: rotate(-6deg) scale(0.2); opacity: 0; }
  10% { transform: rotate(-6deg) scale(1.15); opacity: 1; }
  18% { transform: rotate(-6deg) scale(1); }
  88% { opacity: 1; }
  100% { transform: rotate(-6deg) scale(1) translateY(-30px); opacity: 0; }
}
@keyframes banner {
  0% { transform: rotate(-6deg) scale(0.2); opacity: 0; }
  18% { transform: rotate(-6deg) scale(1.15); opacity: 1; }
  30% { transform: rotate(-6deg) scale(1); }
  80% { opacity: 1; }
  100% { transform: rotate(-6deg) scale(1) translateY(-30px); opacity: 0; }
}

body.minder-beweging *, body.minder-beweging *::before { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media (min-aspect-ratio: 1/1) {
  .vraag { top: calc(var(--veilig-boven) + 80px); font-size: 28px; }
  .hud { left: 50%; right: auto; width: min(640px, 94vw); transform: translateX(-50%); }
  .naam { font-size: 17px; }
}
