*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #FFF8F3;
  --text: #3A2E2E;
  --pink: #FF6B9D;
  --muted: #9E8080;
  --purple: #9B72CF;
  --teal: #06D6A0;
  --orange: #FF9F43;
  --blue: #4361EE;
  --card-shadow: 0 6px 20px rgba(0,0,0,0.10);
  --game-accent-1: #FF6B9D;
  --game-accent-2: #FF9F43;
}

[data-theme="dark"] {
  --bg: #1a1a2a;
  --text: #e8ddd8;
  --muted: #a09090;
}

[data-game-theme="oceaan"]        { --game-accent-1: #00B4D8; --game-accent-2: #4361EE; }
[data-game-theme="zonsondergang"] { --game-accent-1: #FF6B5B; --game-accent-2: #FFD166; }
[data-game-theme="bos"]           { --game-accent-1: #06D6A0; --game-accent-2: #2FA84F; }
[data-game-theme="ruimte"]        { --game-accent-1: #9B72CF; --game-accent-2: #4361EE; }

/* ── Achtergrond-cosmetica ── */
body[data-game-bg]::before,
body[data-game-bg]::after {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; display: none;
}

body[data-game-bg="sterretjes"]::before,
body[data-game-bg="sterretjes"]::after {
  display: block;
  background-repeat: repeat;
  opacity: 0.6;
  animation: sterretjes-twinkle 2.4s ease-in-out infinite;
}
body[data-game-bg="sterretjes"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90' viewBox='0 0 90 90'%3E%3Cg transform='translate(14,20) scale(0.8)'%3E%3Cpath d='M12 0 L14.5 9.5 L24 12 L14.5 14.5 L12 24 L9.5 14.5 L0 12 L9.5 9.5 Z' fill='%23FFD166'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 90px 90px;
  background-position: 10px 20px;
}
body[data-game-bg="sterretjes"]::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cg transform='translate(38,30) scale(0.5)'%3E%3Cpath d='M12 0 L14.5 9.5 L24 12 L14.5 14.5 L12 24 L9.5 14.5 L0 12 L9.5 9.5 Z' fill='%23FF6B9D'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 60px 60px;
  background-position: 45px 60px;
  animation-delay: 1.2s;
}
@keyframes sterretjes-twinkle {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.9; }
}

body[data-game-bg="bubbels"]::before {
  display: block;
  background-image:
    radial-gradient(circle, rgba(0,180,216,0.28) 18px, transparent 19px),
    radial-gradient(circle, rgba(67,97,238,0.22) 26px, transparent 27px),
    radial-gradient(circle, rgba(6,214,160,0.24) 12px, transparent 13px);
  background-size: 140px 160px, 220px 240px, 90px 100px;
  background-position: 10px 20px, 120px 80px, 60px 140px;
  animation: bubbels-float 16s linear infinite;
}
@keyframes bubbels-float {
  0%   { background-position: 10px 20px, 120px 80px, 60px 140px; }
  100% { background-position: 10px -140px, 120px -160px, 60px -100px; }
}

/* Losse, verschillend gedraaide snippers i.p.v. een regelmatig blokjespatroon */
body[data-game-bg="confetti"]::before {
  display: block;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Crect x='10' y='15' width='10' height='5' fill='%23FF6B9D' transform='rotate(25 15 17)'/%3E%3Crect x='60' y='30' width='8' height='4' fill='%23FF9F43' transform='rotate(-40 64 32)'/%3E%3Crect x='100' y='10' width='9' height='5' fill='%2306D6A0' transform='rotate(60 104 12)'/%3E%3Crect x='30' y='70' width='7' height='4' fill='%239B72CF' transform='rotate(15 33 72)'/%3E%3Crect x='90' y='80' width='10' height='5' fill='%23FF6B9D' transform='rotate(-20 95 82)'/%3E%3Crect x='120' y='100' width='8' height='4' fill='%23FF9F43' transform='rotate(50 124 102)'/%3E%3Crect x='15' y='110' width='9' height='5' fill='%2306D6A0' transform='rotate(-55 19 112)'/%3E%3Crect x='55' y='115' width='7' height='4' fill='%239B72CF' transform='rotate(35 58 117)'/%3E%3Crect x='115' y='50' width='8' height='4' fill='%23FF6B9D' transform='rotate(-10 119 52)'/%3E%3Crect x='45' y='40' width='9' height='5' fill='%23FF9F43' transform='rotate(70 49 42)'/%3E%3C/svg%3E");
  background-size: 140px 140px;
  background-repeat: repeat;
  opacity: 0.6;
  animation: confetti-drift 14s linear infinite;
}
@keyframes confetti-drift {
  0%   { background-position: 0 0; }
  100% { background-position: 40px 140px; }
}

body[data-game-bg="wolken"]::before {
  display: block;
  background-image:
    radial-gradient(ellipse 60px 24px at center, rgba(255,255,255,0.7) 60%, transparent 70%),
    radial-gradient(ellipse 40px 18px at center, rgba(255,255,255,0.55) 60%, transparent 70%),
    radial-gradient(ellipse 50px 20px at center, rgba(255,255,255,0.6) 60%, transparent 70%);
  background-size: 260px 200px, 220px 260px, 300px 220px;
  background-position: 20px 40px, 180px 160px, 90px 260px;
  background-repeat: repeat;
  animation: wolken-drift 40s linear infinite;
}
@keyframes wolken-drift {
  0%   { background-position: 20px 40px, 180px 160px, 90px 260px; }
  100% { background-position: 280px 40px, 440px 160px, 390px 260px; }
}

/* ── Animatie-cosmetica: elke stap voelbaar anders dan de vorige ── */

/* Subtiel (standaard): rustige schaalpuls zonder kleurflits of gloed */
[data-game-anim="subtiel"] .sum-display.pulse-small,
[data-game-anim="subtiel"] .sum-display.pulse-medium,
[data-game-anim="subtiel"] .sum-display.pulse-big {
  animation-name: pulse-subtiel;
}
@keyframes pulse-subtiel {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Fonkelend: twinkelende sterretjes naast de som, bovenop de gewone puls */
[data-game-anim="fonkelend"] .sum-display { position: relative; }
[data-game-anim="fonkelend"] .sum-display::before,
[data-game-anim="fonkelend"] .sum-display::after {
  content: '✦'; position: absolute; font-size: 18px; line-height: 1;
  opacity: 0; pointer-events: none;
}
[data-game-anim="fonkelend"] .sum-display::before { top: -8px; left: -16px; color: var(--game-accent-1); }
[data-game-anim="fonkelend"] .sum-display::after  { bottom: -8px; right: -16px; color: var(--game-accent-2); }
[data-game-anim="fonkelend"] .sum-display.pulse-small::before,
[data-game-anim="fonkelend"] .sum-display.pulse-medium::before,
[data-game-anim="fonkelend"] .sum-display.pulse-big::before,
[data-game-anim="fonkelend"] .sum-display.pulse-small::after,
[data-game-anim="fonkelend"] .sum-display.pulse-medium::after,
[data-game-anim="fonkelend"] .sum-display.pulse-big::after {
  animation: fonkelend-sparkle 1.3s ease;
}
[data-game-anim="fonkelend"] .sum-display.pulse-small,
[data-game-anim="fonkelend"] .sum-display.pulse-medium,
[data-game-anim="fonkelend"] .sum-display.pulse-big {
  filter: drop-shadow(0 0 8px var(--game-accent-1));
}
@keyframes fonkelend-sparkle {
  0%   { opacity: 0; transform: scale(0.3) rotate(0deg); }
  40%  { opacity: 1; transform: scale(1.15) rotate(20deg); }
  100% { opacity: 0; transform: scale(0.6) rotate(35deg); }
}

[data-game-anim="feestelijk"] .sum-display.pulse-small,
[data-game-anim="feestelijk"] .sum-display.pulse-medium,
[data-game-anim="feestelijk"] .sum-display.pulse-big {
  filter: drop-shadow(0 0 14px var(--game-accent-1)) drop-shadow(0 0 6px var(--game-accent-2));
  animation-name: pulse-feestelijk;
}
@keyframes pulse-feestelijk {
  0%   { transform: scale(1) rotate(0deg); }
  30%  { transform: scale(1.22) rotate(-4deg); }
  60%  { transform: scale(1.1) rotate(3deg); }
  100% { transform: scale(1) rotate(0deg); }
}

html, body { height: 100%; }

body {
  font-family: 'Nunito', 'Trebuchet MS', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.2s;
}

.screen { display: none; min-height: 100vh; min-height: 100dvh; }
.screen.active { display: block; }

.container { max-width: 480px; margin: 0 auto; padding: 0 16px 40px; }
.container.narrow { max-width: 420px; }

/* ── Dark toggle ── */
.dark-toggle {
  position: fixed; top: calc(14px + env(safe-area-inset-top)); right: 14px;
  background: rgba(255,255,255,0.85); border: none; font-size: 20px;
  cursor: pointer; padding: 8px 10px; border-radius: 50px; line-height: 1;
  z-index: 50; box-shadow: 0 2px 8px rgba(0,0,0,0.10); backdrop-filter: blur(4px);
}
[data-theme="dark"] .dark-toggle { background: rgba(40,40,60,0.85); }

/* ── Offline-indicator ── */
.offline-pill {
  position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  z-index: 60; padding: 8px 16px; border-radius: 50px;
  font-weight: 800; font-size: 13px; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15); backdrop-filter: blur(4px);
}
.offline-pill[hidden] { display: none; }
.offline-pill.offline { background: rgba(255,159,67,0.95); color: #3A2E2E; }
.offline-pill.syncing { background: rgba(67,97,238,0.92); color: #fff; }
[data-theme="dark"] .offline-pill.offline { background: rgba(255,159,67,0.85); }
[data-theme="dark"] .offline-pill.syncing { background: rgba(67,97,238,0.85); }

/* ── Profielscherm ── */
.brand { text-align: center; padding: 40px 0 24px; }
.brand-icon { font-size: 56px; display: block; margin-bottom: 8px; filter: drop-shadow(0 6px 12px rgba(255,107,157,0.25)); }
.brand h1 { font-size: 30px; font-weight: 900; color: var(--pink); letter-spacing: -0.5px; }
.brand .subtitle { font-size: 15px; color: var(--muted); font-weight: 700; margin-top: 4px; }

.profile-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.profile-card {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border: none; border-radius: 18px; padding: 14px 18px;
  box-shadow: var(--card-shadow); cursor: pointer; font-family: inherit; text-align: left;
  min-height: 56px; -webkit-tap-highlight-color: transparent;
}
.profile-card:active { transform: scale(0.98); }
[data-theme="dark"] .profile-card { background: #2a2a3e; }
.profile-avatar { font-size: 30px; }
.profile-name { flex: 1; font-weight: 800; font-size: 16px; }
.profile-level { font-size: 12px; font-weight: 700; color: var(--purple); background: rgba(155,114,207,0.12); padding: 4px 10px; border-radius: 50px; }

.new-profile-card {
  background: #fff; border-radius: 20px; padding: 20px; box-shadow: var(--card-shadow); margin-bottom: 20px;
}
[data-theme="dark"] .new-profile-card { background: #2a2a3e; }
.new-profile-title { font-weight: 800; font-size: 15px; margin-bottom: 12px; }
.avatar-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.avatar-choice {
  font-size: 24px; width: 46px; height: 46px; border-radius: 14px; border: 2px solid transparent;
  background: rgba(155,114,207,0.08); cursor: pointer;
}
.avatar-choice.active { border-color: var(--pink); background: rgba(255,107,157,0.14); }

.text-input {
  width: 100%; padding: 13px 16px; border: 2px solid rgba(155,114,207,0.2); border-radius: 14px;
  font-family: inherit; font-size: 16px; outline: none; margin-bottom: 14px;
}
.text-input:focus { border-color: var(--pink); }
[data-theme="dark"] .text-input { background: #1a1a2a; color: var(--text); }

.btn-primary {
  width: 100%; padding: 15px; background: linear-gradient(135deg, var(--pink), var(--orange));
  color: #fff; border: none; border-radius: 16px; font-family: inherit; font-size: 16px;
  font-weight: 800; cursor: pointer; min-height: 52px; box-shadow: 0 4px 14px rgba(255,107,157,0.3);
}
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  width: 100%; padding: 14px; background: transparent; color: var(--text);
  border: 2px solid rgba(155,114,207,0.3); border-radius: 16px; font-family: inherit;
  font-size: 15px; font-weight: 700; cursor: pointer; margin-top: 10px; min-height: 48px;
}

.link-modules {
  display: block; text-align: center; margin-top: 24px; color: var(--muted);
  text-decoration: none; font-weight: 700; font-size: 14px;
}

/* ── Categorie-scherm ── */
.player-bar {
  display: flex; align-items: center; gap: 14px; padding: 20px 0 18px;
}
.avatar-btn {
  width: 56px; height: 56px; border-radius: 50%; border: none; font-size: 28px;
  background: linear-gradient(135deg, var(--pink), var(--orange)); cursor: pointer; flex-shrink: 0;
}
.player-info { flex: 1; min-width: 0; }
.player-name { font-weight: 900; font-size: 18px; margin-bottom: 4px; }
.xp-bar { height: 8px; border-radius: 4px; background: rgba(155,114,207,0.15); overflow: hidden; margin-bottom: 4px; }
.xp-fill { height: 100%; background: linear-gradient(90deg, var(--pink), var(--purple)); border-radius: 4px; transition: width .4s ease; }
.level-label { font-size: 12px; font-weight: 700; color: var(--muted); }

.section-heading { font-size: 16px; font-weight: 800; margin: 8px 0 14px; }
.section-heading.small { font-size: 14px; margin-top: 24px; }

.category-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.cat-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: none; border-radius: 22px; padding: 22px 12px; min-height: 120px; color: #fff;
  cursor: pointer; font-family: inherit; box-shadow: 0 4px 14px rgba(0,0,0,0.12);
  outline: 3px solid transparent; outline-offset: 2px; -webkit-tap-highlight-color: transparent;
}
.cat-tile.active { outline-color: rgba(0,0,0,0.25); }
.cat-optellen  { background: linear-gradient(145deg, #06D6A0 0%, #00B4D8 100%); }
.cat-aftrekken { background: linear-gradient(145deg, #FF6B5B 0%, #FF9F43 100%); }
.cat-tafels    { background: linear-gradient(145deg, #9B72CF 0%, #FF6B9D 100%); }
.cat-mix       { background: linear-gradient(145deg, #4361EE 0%, #9B72CF 100%); }
.cat-icon { font-size: 34px; margin-bottom: 8px; }
.cat-name { font-weight: 900; font-size: 16px; }
.cat-desc { font-weight: 700; font-size: 11px; opacity: 0.85; margin-top: 2px; }

.btn-play { margin-bottom: 8px; }

.cosmetics-section { margin-top: 8px; }
.cosmetic-group { margin-bottom: 16px; }
.cosmetic-group-label { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.3px; }
.cosmetic-options { display: flex; flex-wrap: wrap; gap: 8px; }
.cosmetic-option {
  min-width: 44px; height: 44px; padding: 0 12px; border-radius: 12px; border: 2px solid rgba(155,114,207,0.15);
  background: #fff; font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
[data-theme="dark"] .cosmetic-option { background: #2a2a3e; color: var(--text); }
.cosmetic-option.active { border-color: var(--pink); background: rgba(255,107,157,0.14); }
.cosmetic-option.locked { opacity: 0.4; cursor: not-allowed; }

/* ── Spelscherm ──
   Een eigen numeriek toetsenbord vervangt het systeem-toetsenbord: het
   antwoordveld is een niet-focusbaar weergave-element, dus iOS opent nooit
   het native keyboard en er is geen resize/scroll-gevecht meer. Het scherm
   staat vast op 100dvh in drie zones: header, gecentreerde som/antwoord, keypad. */
#game-screen { display: none; position: relative; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
#game-screen.active { display: flex; }
.game-wrap {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 0 20px; width: 100%; min-height: 0;
}

.stop-btn {
  position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 14px; z-index: 20;
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: rgba(0,0,0,0.08); color: var(--text); font-size: 16px; cursor: pointer;
}
[data-theme="dark"] .stop-btn { background: rgba(255,255,255,0.12); }

.streak-sidebar {
  position: fixed; right: 10px; top: calc(210px + env(safe-area-inset-top)); z-index: 20;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: rgba(255,107,157,0.10); border-radius: 14px; padding: 10px 8px;
  min-width: 52px; transition: transform 0.15s ease;
}
[data-theme="dark"] .streak-sidebar { background: rgba(255,255,255,0.08); }
.streak-sidebar.pop { transform: scale(1.12); }
.streak-label { font-size: 9px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.3px; }
.streak-count { font-size: 20px; font-weight: 900; color: var(--pink); line-height: 1.1; white-space: nowrap; }
.streak-next { font-size: 10px; font-weight: 700; color: var(--muted); text-align: center; line-height: 1.25; max-width: 62px; }

.game-header {
  flex-shrink: 0; z-index: 5;
  background: linear-gradient(to bottom, var(--bg) 75%, transparent);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: 100%; padding-top: calc(18px + env(safe-area-inset-top)); padding-bottom: 4px;
}
.game-topbar { display: flex; align-items: center; gap: 14px; }
.score-badge {
  display: flex; flex-direction: column; align-items: center; background: rgba(255,107,157,0.10);
  padding: 8px 20px; border-radius: 16px;
}
.score-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
#scoreValue { font-size: 26px; font-weight: 900; color: var(--pink); line-height: 1.1; }
.combo-badge {
  background: linear-gradient(135deg, var(--orange), var(--pink)); color: #fff; font-weight: 900;
  padding: 6px 16px; border-radius: 50px; font-size: 18px; animation: combo-pop 0.3s ease;
}
@keyframes combo-pop { 0% { transform: scale(0.7); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }

.timer-wrap { position: relative; width: 100px; height: 100px; }
.timer-ring { width: 100px; height: 100px; transform: rotate(-90deg); }
.timer-ring-bg { fill: none; stroke: rgba(155,114,207,0.15); stroke-width: 8; }
.timer-ring-fg {
  fill: none; stroke: var(--game-accent-1); stroke-width: 8; stroke-linecap: round;
  stroke-dasharray: 326.7; stroke-dashoffset: 0;
}
.timer-ring-fg.urgent { stroke: #E5484D; }
.timer-seconds {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 900; color: var(--text);
}

.sum-display {
  font-size: 36px; font-weight: 900; text-align: center; letter-spacing: -1px;
  min-height: 44px; display: flex; align-items: center; justify-content: center;
}
@keyframes pulse-small { 0% { transform: scale(1); } 40% { transform: scale(1.08); color: var(--teal); } 100% { transform: scale(1); } }
@keyframes pulse-medium { 0% { transform: scale(1); } 40% { transform: scale(1.16); color: var(--orange); } 100% { transform: scale(1); } }
@keyframes pulse-big { 0% { transform: scale(1); } 30% { transform: scale(1.28); color: var(--pink); } 60% { transform: scale(1.1); } 100% { transform: scale(1); } }
.sum-display.pulse-small { animation: pulse-small 0.6s ease; }
.sum-display.pulse-medium { animation: pulse-medium 0.8s ease; }
.sum-display.pulse-big { animation: pulse-big 1.1s ease; }

.answer-display {
  width: 180px; min-height: 56px; padding: 12px; font-size: 30px; font-weight: 900; text-align: center;
  border: 3px solid rgba(155,114,207,0.25); border-radius: 16px; font-family: inherit;
  background: #fff; color: var(--text);
  display: flex; align-items: center; justify-content: center;
}
.answer-display.locked { opacity: 0.7; }
[data-theme="dark"] .answer-display { background: #2a2a3e; }

/* ── Keypad ── */
.keypad-wrap {
  flex-shrink: 0; display: flex; flex-direction: column; gap: 8px;
  width: 100%; max-width: 340px; margin: 0 auto; padding: 8px 16px calc(10px + env(safe-area-inset-bottom));
}
.keypad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%;
}
.keypad-key {
  min-height: 56px; border: none; border-radius: 14px; background: rgba(155,114,207,0.08);
  color: var(--text); font-family: inherit; font-size: 24px; font-weight: 800; cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease, background 0.08s ease;
}
[data-theme="dark"] .keypad-key { background: rgba(255,255,255,0.08); }
.keypad-key:active { transform: scale(0.94); background: rgba(255,107,157,0.18); }
.keypad-key-backspace { font-size: 20px; color: var(--muted); }

.enter-btn {
  min-height: 64px; border: none; border-radius: 16px; width: 100%;
  background: linear-gradient(135deg, var(--game-accent-1), var(--game-accent-2));
  color: #fff; font-family: inherit; font-size: 22px; font-weight: 900; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2); touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease;
}
.enter-btn:active { transform: scale(0.97); }

.feedback-badge { min-height: 32px; font-size: 22px; font-weight: 900; }
.feedback-correct { color: var(--teal); }
.feedback-wrong { color: var(--muted); }

.explain-hint { min-height: 22px; font-size: 15px; font-weight: 700; color: var(--muted); text-align: center; padding: 0 12px; }

.next-btn {
  border: none; border-radius: 16px; padding: 14px 32px; font-size: 17px; font-weight: 800;
  font-family: inherit; color: #fff; cursor: pointer; min-height: 48px;
  background: linear-gradient(135deg, var(--game-accent-1), var(--game-accent-2));
  box-shadow: 0 4px 14px rgba(0,0,0,0.15); -webkit-tap-highlight-color: transparent;
}
.next-btn[hidden] { display: none; }

.coach-toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 30;
  transform: translateX(-50%) translateY(20px);
  background: rgba(255,255,255,0.96); color: var(--text); padding: 10px 18px;
  border-radius: 50px; font-weight: 800; font-size: 13px; text-align: center;
  max-width: 86vw; box-shadow: var(--card-shadow); pointer-events: none;
  opacity: 0; transition: opacity 0.35s ease, transform 0.35s ease;
}
[data-theme="dark"] .coach-toast { background: rgba(42,42,62,0.96); }
.coach-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.reward-layer { position: fixed; inset: 0; pointer-events: none; z-index: 15; }
.reward-particle {
  position: absolute; font-size: 24px; opacity: 0.95;
  animation: reward-float 1.6s ease-out forwards;
}
@keyframes reward-float {
  0% { transform: translate(0, 0) scale(0.6); opacity: 0; }
  15% { opacity: 1; }
  75% { opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(1.1); opacity: 0; }
}

/* ── Sessie-samenvatting ── */
#summary-screen .container { padding-top: 60px; }
.summary-card {
  background: #fff; border-radius: 24px; padding: 32px 24px; text-align: center; box-shadow: var(--card-shadow);
}
[data-theme="dark"] .summary-card { background: #2a2a3e; }
.summary-emoji { font-size: 56px; margin-bottom: 8px; }
.summary-card h2 { font-size: 24px; font-weight: 900; color: var(--pink); margin-bottom: 20px; }
.summary-stats { display: flex; justify-content: center; gap: 20px; margin-bottom: 18px; }
.summary-stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.summary-stat span:first-child { font-size: 26px; font-weight: 900; color: var(--purple); }
.summary-stat span:last-child { font-size: 12px; font-weight: 700; color: var(--muted); }
.summary-records { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.record-pill {
  background: linear-gradient(135deg, rgba(255,209,102,0.25), rgba(255,107,157,0.2));
  border-radius: 50px; padding: 10px 16px; font-weight: 800; font-size: 14px;
}

@media (min-width: 420px) {
  .answer-display { width: 220px; }
  .keypad-wrap { max-width: 420px; }
}

/* ── Landscape (iPhone) ── smalle hoogte: keypad naast score/som i.p.v. eronder */
@media (orientation: landscape) and (max-height: 520px) {
  #game-screen.active { flex-direction: row; }
  .game-wrap { flex: 1; gap: 8px; padding: 8px 12px; }
  .game-header { padding-top: calc(8px + env(safe-area-inset-top)); gap: 4px; }
  .timer-wrap { width: 72px; height: 72px; }
  .timer-ring { width: 72px; height: 72px; }
  .sum-display { font-size: 28px; min-height: 32px; }
  .keypad-wrap {
    flex-shrink: 0; width: 220px; max-width: none; height: 100%;
    padding: 8px calc(12px + env(safe-area-inset-right)) 8px 8px;
  }
  .keypad { flex: 1; grid-template-rows: repeat(4, 1fr); align-content: center; }
  .keypad-key { min-height: 0; }
  .enter-btn { flex-shrink: 0; min-height: 0; height: 52px; font-size: 18px; }
}
