/* Stijl voor de letter-minigames (keuze-pagina, Katapult, Fotograaf, Parelduiker, Letterbrug).
   Hergebruikt de design tokens (var(--...)) en .g-icon-btn uit style.css. De klassenamen
   chase-* zijn historisch (gedeelde spelchrome: kop, veld, knoppen, eindkaart). */

#gamestage.screen { position: fixed; inset: 0; z-index: 50; background: var(--cream); }
html.gamestage-active, html.gamestage-active body { overflow: hidden; height: 100%; }

.chase-screen {
  height: 100dvh; display: flex; flex-direction: column; overflow: hidden;
  touch-action: none; -webkit-user-select: none; user-select: none;
}

/* Minimaal gehouden (sectie 21 V3: "de wereld is de interface") — één dunne
   balk, geen dashboard, geen kaart-in-kaart. */
.chase-head {
  flex: none; display: flex; align-items: center; gap: 8px;
  padding: calc(7px + env(safe-area-inset-top)) 10px 7px;
  background: rgba(253, 246, 230, .88); backdrop-filter: blur(2px); border-bottom: 2px solid var(--gold-light);
}
.chase-replay {
  flex: none; width: 36px; height: 36px; border-radius: 50%; border: none;
  background: #fff; color: var(--gold); font-size: 16px; display: grid; place-items: center;
  box-shadow: 0 3px 0 var(--gold-light), 0 6px 12px rgba(120, 80, 20, .15);
}
.chase-replay:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--gold-light); }
.chase-replay.is-playing { color: var(--color-secondary); animation: chaseReplayPulse .9s ease-in-out infinite; }
.chase-replay:disabled { opacity: .9; }
@keyframes chaseReplayPulse { 0%, 100% { box-shadow: 0 3px 0 var(--gold-light), 0 6px 12px rgba(120, 80, 20, .15); } 50% { box-shadow: 0 3px 0 var(--gold-light), 0 0 0 7px rgba(58, 143, 217, .25); } }
.chase-instr { flex: 1; display: flex; align-items: baseline; justify-content: center; gap: 8px; min-width: 0; }
.chase-instr-text { font-weight: 800; font-size: clamp(15px, 3.6vw, 19px); color: var(--color-text); }
.chase-instr-letter { font-family: "Amiri", serif; font-weight: 700; font-size: clamp(26px, 7vw, 34px); color: var(--color-character-accent); }
.chase-dots { display: flex; gap: 6px; flex: none; }
.chase-dots i { width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 2px solid var(--gold-light); display: block; }
.chase-dots i.done { background: var(--color-success); border-color: var(--color-success-strong); }

.chase-field {
  position: relative; flex: 1; min-height: 0; overflow: hidden;
  background: linear-gradient(180deg, #bfe4f5 0%, #e7f4de 62%, #ead9a6 100%);
  touch-action: none;
}
.chase-phaser-mount { position: absolute; inset: 0; }
.chase-phaser-mount canvas { display: block; touch-action: none; }

.chase-btn {
  width: 64px; height: 64px; border-radius: 20px; border: none; flex: none;
  background: linear-gradient(180deg, #fff, #fdf6e6); color: var(--gold);
  box-shadow: 0 4px 0 var(--gold-light), 0 8px 16px rgba(120, 80, 20, .18);
  display: grid; place-items: center; touch-action: none; -webkit-tap-highlight-color: transparent;
}
.chase-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--gold-light); }
.chase-btn svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }


.chase-overlay {
  position: absolute; inset: 0; z-index: 10; display: grid; place-items: center;
  background: rgba(60, 39, 18, .4); padding: 16px;
}
.chase-card {
  background: #fff; border-radius: 24px; padding: 30px 24px 24px; text-align: center;
  box-shadow: var(--shadow-card); max-width: 320px; width: 100%;
}
.chase-card h2 { margin: 0 0 10px; font-size: 21px; color: var(--color-text); }
.chase-card-letter { display: block; font-family: "Amiri", serif; font-weight: 700; font-size: 56px; color: var(--color-character-accent); line-height: 1; }
.chase-card-score { font-size: 24px; font-weight: 800; color: var(--color-success-strong); margin: 10px 0 18px; }
.chase-cta { display: block; width: 100%; border: none; border-radius: 16px; padding: 14px; font-weight: 800; font-size: 16px; margin-top: 10px; }
.chase-cta-primary { background: var(--color-success); color: #fff; box-shadow: 0 4px 0 var(--color-success-strong); }
.chase-cta-ghost { background: transparent; color: var(--color-text-muted); }

/* RTL spiegelt alleen tekst/UI-iconen (de terug-pijl); spelrichting en alfabetvolgorde blijven fysiek. */
html[dir="rtl"] .chase-head .g-icon-btn svg { transform: scaleX(-1); }

/* Letter Slingshot (slingshot.js) — hergebruikt de chase-klassen hierboven. */
.sling-hint {
  flex: none; text-align: center; font-weight: 700; font-size: 14px; color: var(--color-text-muted);
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--gold-soft); border-top: 3px solid var(--gold-light);
}
.sling-help.is-used { background: #fff3c2; box-shadow: 0 0 0 4px rgba(255, 213, 74, .6); }
#slMount canvas { touch-action: none; }

/* Letter Photographer (photographer.js) + spelletjes-keuze (minigames.js) */
.photo-frame { position: absolute; z-index: 3; pointer-events: none; box-shadow: 0 0 0 9999px rgba(40, 25, 5, .16); border-radius: 10px; }
.photo-frame i { position: absolute; width: 26px; height: 26px; border: 4px solid #fff; }
.photo-frame i:nth-child(1) { left: -2px; top: -2px; border-right: 0; border-bottom: 0; border-top-left-radius: 10px; }
.photo-frame i:nth-child(2) { right: -2px; top: -2px; border-left: 0; border-bottom: 0; border-top-right-radius: 10px; }
.photo-frame i:nth-child(3) { left: -2px; bottom: -2px; border-right: 0; border-top: 0; border-bottom-left-radius: 10px; }
.photo-frame i:nth-child(4) { right: -2px; bottom: -2px; border-left: 0; border-top: 0; border-bottom-right-radius: 10px; }
.photo-flash { position: absolute; inset: 0; z-index: 4; background: #fff; opacity: 0; pointer-events: none; }
.photo-flash.is-on { animation: photoFlash .35s ease-out; }
@keyframes photoFlash { 0% { opacity: .85; } 100% { opacity: 0; } }
.photo-toast { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 5; background: rgba(60, 39, 18, .88); color: #fff; font-weight: 800; padding: 10px 16px; border-radius: 999px; font-size: 15px; pointer-events: none; text-align: center; max-width: 90%; }
.photo-controls { flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--gold-soft); border-top: 3px solid var(--gold-light); touch-action: none; }
.photo-hint { margin: 0; font-size: 13px; font-weight: 700; color: var(--color-text-muted); text-align: center; }
.photo-btns { display: flex; align-items: center; gap: 18px; direction: ltr; }
.photo-shutter { width: 76px; height: 76px; border-radius: 50%; font-size: 30px; background: linear-gradient(180deg, #7fd3e3, #3a8fd9); box-shadow: 0 4px 0 #2a6fb0, 0 8px 16px rgba(30, 80, 140, .3); }
@media (min-width: 1024px) { .photo-shutter { width: 60px; height: 60px; font-size: 24px; } }

/* Feedbackbord (goed/fout), letter-groepen, Pearl Diver en Letter Bridge */
.fb-banner { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 6; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 16px 30px; border-radius: 28px; pointer-events: none; color: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); animation: fbPop .35s cubic-bezier(.2, 1.4, .4, 1); }
.fb-banner.is-ok { background: linear-gradient(180deg, #62d33a, #3fa51c); }
.fb-banner.is-no { background: linear-gradient(180deg, #ffb347, #f08a1c); }
.fb-icon { font-size: 54px; font-weight: 900; line-height: 1; }
.fb-letter { font-family: "Amiri", serif; font-weight: 700; font-size: 60px; line-height: 1.6; padding: 0 6px; }
.fb-text { font-weight: 800; font-size: 20px; }
@keyframes fbPop { 0% { transform: translate(-50%, -50%) scale(.4); opacity: 0; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }


.dv-need { font-weight: 900; font-size: 22px; color: var(--color-success-strong); }

.br-field { display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 10px 12px; background: linear-gradient(180deg, #cfeefa 0%, #8fd6ea 55%, #5bb8d8 100%); }
.br-scene { position: relative; width: 100%; flex: 1; display: flex; align-items: center; justify-content: center; }
.br-row { display: flex; gap: 6px; padding: 10px 14px; background: repeating-linear-gradient(90deg, rgba(122, 74, 36, .0) 0 12px, rgba(122, 74, 36, .0) 12px 24px); border-top: 4px solid #8a5a2b; border-bottom: 4px solid #8a5a2b; direction: rtl; }
.br-plank { width: clamp(48px, 13vw, 78px); height: clamp(60px, 16vw, 92px); border: 3px solid #b3803a; border-radius: 12px; background: linear-gradient(180deg, #e8b873, #cf9650); font-family: "Amiri", serif; font-weight: 700; font-size: clamp(28px, 8vw, 46px); color: #3a2410; display: grid; place-items: center; box-shadow: 0 4px 0 #8a5a2b; touch-action: none; user-select: none; transition: transform .15s, background .2s; }
.br-plank.br-gap { background: rgba(255, 255, 255, .35); border: 3px dashed #fff; color: #fff; box-shadow: none; font-family: inherit; font-size: 32px; }
.br-plank.br-fixed { opacity: .95; }
.br-plank.is-ok { background: linear-gradient(180deg, #9be37a, #62c244); border-color: #3f9a24; }
.br-plank.is-bad { background: linear-gradient(180deg, #ffb347, #f08a1c); border-color: #c9650c; transform: rotate(-12deg) translateY(10px); }
.br-plank.is-help { animation: brHelp .8s ease-in-out infinite; box-shadow: 0 0 0 5px rgba(255, 213, 74, .85); }
@keyframes brHelp { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
.br-tray { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; min-height: 96px; }
.br-tray-plank.is-selected { transform: translateY(-8px); box-shadow: 0 4px 0 #8a5a2b, 0 0 0 4px rgba(58, 143, 217, .6); }
.br-tray-plank.is-used { visibility: hidden; }
.br-ghost { position: fixed; z-index: 100; transform: translate(-50%, -60%) scale(1.1); pointer-events: none; opacity: .9; }
.br-cross { width: auto; padding: 12px 30px; margin: 0; }
.br-cross:disabled { opacity: .5; }
.br-explorer { position: absolute; font-size: 38px; transform: translate(-50%, -100%); transition: left .6s ease-in-out, top .3s; opacity: 0; pointer-events: none; z-index: 5; }
.br-explorer.is-slip { animation: brSlip .9s ease-in forwards; }
@keyframes brSlip { 0% { transform: translate(-50%, -100%) rotate(0); } 100% { transform: translate(-50%, 20%) rotate(40deg); opacity: .5; } }
@media (min-width: 1024px) { .chase-btn { width: 40px; height: 40px; border-radius: 12px; } .chase-btn svg { width: 18px; height: 18px; } }

/* Keuze-pagina van de minigames: oase-achtergrond, gecentreerde inhoud, grote kaarten */
.games-screen { position: relative; background: #f6e7bf url("assets/worlds/oasis/background.jpg") center / cover no-repeat; }
.games-screen::before { content: ""; position: absolute; inset: 0; z-index: 0; background: linear-gradient(180deg, rgba(255, 248, 228, .82) 0%, rgba(255, 246, 222, .62) 55%, rgba(255, 240, 205, .72) 100%); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.games-screen > * { position: relative; z-index: 1; }
.games-screen .chase-head { background: rgba(255, 248, 228, .8); }
.games-hub { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 22px 20px 34px; display: flex; flex-direction: column; gap: 22px; overflow: auto; touch-action: pan-y; }
.games-levels-wrap { background: rgba(255, 255, 255, .72); border: 2px solid rgba(233, 195, 105, .8); border-radius: 24px; padding: 16px 18px 18px; box-shadow: 0 8px 22px rgba(120, 80, 20, .12); }
.games-levels-title { margin: 0 0 12px; font-weight: 800; color: var(--color-text); font-size: 16px; text-align: center; }
.games-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; }
.games-card { --accent: #f0a63a; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; min-height: 210px; padding: 28px 18px 24px; border-radius: 28px; background: rgba(255, 255, 255, .9); text-decoration: none; color: var(--color-text); border: 3px solid #fff; box-shadow: 0 6px 0 var(--accent), 0 16px 30px rgba(90, 60, 10, .2); overflow: hidden; transition: transform .15s, box-shadow .15s; }
.games-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 8px; background: var(--accent); }
.games-card:hover { transform: translateY(-5px); box-shadow: 0 10px 0 var(--accent), 0 22px 34px rgba(90, 60, 10, .24); }
.games-card:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--accent); }
.games-card:nth-child(1) { --accent: #f08a3a; }
.games-card:nth-child(2) { --accent: #4a9be8; }
.games-card:nth-child(3) { --accent: #2fb5a5; }
.games-card:nth-child(4) { --accent: #9a6ad8; }
.games-icon { font-size: 62px; line-height: 1.1; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .15)); }
.games-title { font-weight: 800; font-size: 23px; }
.games-sub { font-size: 15px; line-height: 1.4; color: var(--color-text-muted); max-width: 22ch; }
@media (max-width: 640px) { .games-hub { padding: 14px 14px 26px; gap: 16px; } .games-grid { grid-template-columns: 1fr 1fr; gap: 12px; } .games-card { min-height: 170px; padding: 20px 10px 16px; } .games-icon { font-size: 48px; } .games-title { font-size: 18px; } .games-sub { font-size: 13px; } .games-level { font-size: 22px; padding: 6px 12px; } }
.chase-card-level { margin: 0 0 4px; font-weight: 800; font-size: 14px; color: var(--color-text-muted); letter-spacing: .04em; text-transform: uppercase; }

/* Niveau-route (vervangt de losse lettergroepen) */
.route-now { margin: 0 0 14px; text-align: center; font-weight: 700; color: var(--color-text-muted); font-size: 15px; }
.route-now b { font-family: "Amiri", serif; font-size: 22px; color: var(--color-character-accent); }
.route-path { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 8px; position: relative; direction: rtl; } /* Arabische leesrichting: niveau 1 rechts, ongeacht de interfacetaal */
.route-node { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 96px; padding: 8px 14px 9px; border: 2px solid var(--gold-light); border-radius: 18px; background: #fff; color: var(--color-text); transition: transform .12s, box-shadow .12s; }
.route-num { width: 24px; height: 24px; border-radius: 50%; background: var(--gold-light); color: #7a5410; font-weight: 900; font-size: 13px; display: grid; place-items: center; }
.route-letters { font-family: "Amiri", serif; font-weight: 700; font-size: 24px; line-height: 1.5; }
.route-node i { position: absolute; top: -9px; right: -7px; font-style: normal; font-size: 13px; font-weight: 900; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--color-success); color: #fff; }
.route-node.is-locked i { background: #cfc5b0; font-size: 11px; }
.route-node.is-done { border-color: var(--color-success); background: #f3fbea; }
.route-node.is-done .route-num { background: var(--color-success); color: #fff; }
.route-node.is-open:hover, .route-node.is-done:hover { transform: translateY(-2px); }
.route-node.is-current { border-color: var(--color-secondary); background: #eef7ff; box-shadow: 0 0 0 4px rgba(58, 143, 217, .28); transform: scale(1.06); }
.route-node.is-current .route-num { background: var(--color-secondary); color: #fff; }
.route-node.is-locked { opacity: .55; background: #f4efe3; border-style: dashed; cursor: not-allowed; }
@media (max-width: 640px) { .route-node { min-width: 74px; padding: 6px 9px 7px; } .route-letters { font-size: 20px; } .route-now { font-size: 14px; } }
.chase-card-coins { margin: -6px 0 10px; font-weight: 900; color: #7a5410; font-size: 18px; }
.chase-card-shop { display: block; margin: 0 0 12px; padding: 9px 12px; border-radius: 14px; background: #eef7ff; border: 2px solid #b9dcf7; color: #2d5f8f; font-weight: 800; font-size: 14px; text-decoration: none; }
.games-top { display: flex; align-items: center; gap: 8px; }
.games-coins { background: #fff3c2; border: 2px solid #f0cf6a; color: #7a5410; font-weight: 900; border-radius: 999px; padding: 5px 11px; font-size: 14px; }
.games-card.is-locked { filter: grayscale(.8); opacity: .65; cursor: default; }
.games-card.is-locked:hover { transform: none; }
