/* De kast is het aangeleverde beeld; het scherm ligt exact in de uitsparing. */
.speelhal-scherm {
    font-family: 'Baloo 2', sans-serif;
}
.hal-achtergrond {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(#54317d, #c08dc5 65%, #795da4);
}
.hal-achtergrond > .spel-beeld,
.hal-achtergrond img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.hal-achtergrond .beeld-terugval { display: none; }
.speelhal-scherm > .wereld-titel,
.speelhal-scherm > .hud,
.speelhal-scherm > .volledig { z-index: 4; }
.speelhal-scherm > .tank {
    top: 13vh;
    left: 24vw;
    right: 24vw;
    height: auto;
    min-height: 11vh;
    padding: 1vh 2vw;
    border-radius: 3vh;
    background: #fffbfff2;
    color: var(--inkt);
    text-shadow: none;
}
.speelhal-scherm > .tank p { color: var(--inkt); margin: 0; line-height: 1.25; }
.speelhal-scherm > .tank .snoepknop { height: 4.5vh; font-size: 2.2vh; }
.hal-kasten {
    position: absolute;
    inset: 29vh 8vw 6vh;
    display: grid;
    grid-template-columns: repeat(var(--kasten, 3), minmax(0, 1fr));
    align-items: end;
    z-index: 2;
    touch-action: pan-y;
}
.speelhal-scherm .speelkast {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 62vh;
    padding: 0;
    gap: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    transform: none;
    transition: filter .35s;
    cursor: pointer;
    text-align: center;
}
.speelhal-scherm .speelkast[hidden] { display: none; }
.speelhal-scherm .speelkast::after { content: none; }
.speelhal-scherm .speelkast:focus-visible { outline: .15vh solid white; box-shadow: 0 0 .4vh .4vh white; outline-offset: .4vh; border-radius: 2vh; }
.kast-beeld {
    position: relative;
    height: 44vh;
    width: calc(44vh * 700 / 1018);
    max-width: 100%;
    flex: none;
    filter: drop-shadow(0 1.5vh 1vh #2e176050);
}
.kast-beeld > .spel-beeld { position: absolute; inset: 0; width: 100%; height: 100%; }
.kast-beeld > .spel-beeld img { width: 100%; height: 100%; object-fit: contain; }
.speelhal-scherm .kast-scherm {
    position: absolute;
    left: 24.4%;
    top: 30.2%;
    width: 51.1%;
    height: 23.5%;
    border: 0;
    border-radius: 7%;
    overflow: hidden;
    box-shadow: 0 0 1vh #FF8FC755;
    background: #543179;
}
.speelhal-scherm .kast-scherm > .spel-beeld {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    animation: none;
}
.kast-scherm img { width: 100%; height: 100%; object-fit: cover; }
.gekozen .kast-scherm { filter: brightness(1.16); box-shadow: 0 0 2.8vh #FFD84D99; }
.kast-bijschrift {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35vh;
    width: 92%;
    min-height: 16vh;
    padding: 1.2vh 1vw;
    border-radius: 42% 38% 30% 35% / 18% 24% 25% 22%;
    background: #fffbfff2;
    box-shadow: 0 .5vh 0 #c8a3de80;
    color: var(--inkt);
}
.kast-bijschrift h2 {
    font: 800 3.2vh/1.1 'Baloo 2', sans-serif;
    color: var(--inkt);
    -webkit-text-stroke: 0;
    margin: 0;
}
.speelhal-scherm .kast-bijschrift p,
.speelhal-scherm .kast-bijschrift strong {
    font-size: 1.95vh;
    line-height: 1.2;
    margin: 0;
    max-width: none;
    color: var(--inkt);
    text-shadow: none;
}
.kast-record { font-variant-numeric: tabular-nums; }
.kast-bijschrift .snoepknop { height: 4.5vh; margin-top: .4vh; font-size: 2.3vh; }
.speelhal-scherm .kast-binnenkort { padding-top: 1vh; }
.hal-hint { position: absolute; bottom: 1vh; left: 12vw; right: 12vw; z-index: 3; color: var(--inkt); text-align: center; font-size: 2vh; }
.hal-pijlen { position: absolute; inset: 56vh 1vw auto; display: flex; justify-content: space-between; z-index: 3; pointer-events: none; }
.hal-pijlen button { pointer-events: auto; }

/* Alle maten hieronder volgen de logische hoogte van 900. */
.canvas-spel {
    --kader-pop: 40vh;       /* 360 */
    --kader-titel: 13.333vh; /* 120 */
    --kader-toets: 7.778vh;  /* 70 */
    font-family: 'Baloo 2', sans-serif;
    background: #f5ddf6;
}
.spel-canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; outline: none; }
.spel-canvas:focus-visible { box-shadow: inset 0 0 0 .3vh var(--citroen); }
.canvas-spel[data-spelfase="begin"] .spel-canvas { opacity: .28; }
.canvas-spel[data-spelfase="einde"] .spel-canvas,
.canvas-spel[data-spelfase="pauze"] .spel-canvas { filter: blur(.9vh); opacity: .18; }
.spel-kader {
    position: absolute;
    inset: 10vh 4vw 6vh;
    display: grid;
    grid-template-columns: 29% minmax(0, 1fr);
    align-items: center;
    gap: 3vw;
    border: 0;
    background: none;
    text-align: center;
}
.spel-kader[hidden] { display: none; }
.spel-portret { width: 100%; height: var(--kader-pop); }
.spel-portret > .spel-beeld,
.spel-portret img { width: 100%; height: 100%; object-fit: contain; }
.spel-inhoud { display: flex; flex-direction: column; align-items: center; gap: 1.8vh; min-width: 0; }
.spel-kader h1 { font: 800 var(--kader-titel)/1 'Baloo 2', sans-serif; margin: 0; }
.spel-kader p { font-size: 3vh; line-height: 1.3; max-width: 100%; margin: 0; color: var(--inkt); text-shadow: none; }
.spel-kader .spel-record { font-size: 2.8vh; }
.spel-toetsen { display: flex; justify-content: center; flex-wrap: wrap; gap: .8vh; width: 100%; }
.spel-toetsen kbd {
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--kader-toets);
    min-width: var(--kader-toets);
    font: 800 3.1vh/1.1 'Baloo 2', sans-serif;
    color: var(--inkt);
    background: linear-gradient(#fff, #e9dcff);
    border: 0;
    border-radius: 2vh;
    padding: 0 1.1vh;
    box-shadow: inset 0 -.6vh 0 #bea1e5, 0 .4vh 0 #7b4ddb66;
}
.spel-kader .knoppen { display: flex; flex-wrap: wrap; justify-content: center; gap: 1vh 1vw; margin-top: 1vh; }
.spel-kader .snoepknop { font-size: 2.6vh; }
.spel-lint { font: 800 3vh/1.3 'Baloo 2', sans-serif; padding: .2vh 3vw; background: #FFD84D; clip-path: polygon(0 0,100% 0,97% 50%,100% 100%,0 100%,3% 50%); transform: rotate(-3deg); }
.spel-score { display: flex; flex-direction: column; align-items: center; }
.spel-kader .spel-eindpunten { font-size: 10vh; line-height: 1; font-variant-numeric: tabular-nums; min-width: 7ch; }
.spel-score > span { font-size: 2vh; }
.spel-eindtank { width: 100%; }
.spel-eindtank:empty { display: none; }
.spel-eindtank > .tank { position: static; width: 100%; height: auto; font-size: 2vh; gap: .8vh 1vw; }
.spel-eindtank .tank p { grid-column: 1 / -1; font-size: 2vh; line-height: 1.3; }
.spel-eindtank .tank .snoepknop { height: 5vh; font-size: 2.2vh; }
.canvas-spel[data-spelfase="einde"] .spel-kader { inset: 8vh 6vw 5vh; }
.canvas-spel[data-spelfase="einde"] .spel-inhoud { gap: 1.2vh; }
.canvas-spel[data-spelfase="einde"] .spel-kader h1 { font-size: 7vh; }
.spel-kader .spel-medailles { display: flex; flex-wrap: wrap; justify-content: center; gap: .4vh 1vw; }
.spel-medailles:empty { display: none; }
.spel-kader .medaille { width: 6vh; height: 7vh; }
.spel-kader [data-na] { visibility: hidden; }
.spel-kader [data-na][data-zichtbaar] { visibility: visible; }
@media (prefers-reduced-motion: reduce) {
    .speelhal-scherm .speelkast { transition: none; }
}

/* De drie keuzes na een level zijn ronde spelplaatjes. */
.spelkeuze .dok-rond { overflow: hidden; }
.spelkeuze .dok-rond .spel-beeld { width: 100%; height: 100%; margin: 0; }
.spelkeuze .dok-rond img { object-fit: cover; }

.sprint-getallen { display: flex; gap: 1.5vw; justify-content: center; font-size: 2.3vh; color: var(--inkt); }
.sprint-historie { width: 85%; }
.spel-kader .sprint-historie p { font-size: 2vh; }
.sprint-historie > div { display: flex; height: 9vh; gap: .6vw; justify-content: center; align-items: end; }
.sprint-historie span { width: 5%; height: 100%; display: flex; flex-direction: column; justify-content: end; font-size: 1.8vh; }
.sprint-historie i { height: calc(var(--staaf) * 6vh); background: linear-gradient(#FFD84D, #FF5FA8); border-radius: .6vh .6vh 0 0; }
.sprint-einde .spel-inhoud { gap: .7vh !important; }
.sprint-einde .spel-kader .spel-eindpunten { font-size: 7vh; }

.speelkast.dicht .kast-beeld { filter: grayscale(.8) brightness(.78); }
.kast-slot { margin-top: .6vh; }
.oefenbaan-scherm .laag-lucht, .oefenronde .laag-lucht {
    background-image: url('../assets/img/wereld-geel.webp') !important;
}
.oefenbaan-scherm .landdecor, .oefenronde .landdecor { visibility: hidden; }
.spel-portret > .raket-met-piloot { width: 100%; height: 100%; }
.canvas-spel > #spel-geluid { position: absolute; top: 13vh; right: 3vh; }
.korte-spelronde { position: absolute; inset: 0; z-index: 5; }
.spel-doelen-over {
    position: absolute;
    top: calc(var(--spel-stappen-top, 2.6vh) + 5.1vh);
    left: var(--spel-midden, 50%);
    transform: translateX(-50%);
    font-size: 3.3vh;
    white-space: nowrap;
    pointer-events: none;
}

.klein-dashboard { margin: 0; text-align: center; }
.klein-bord { position: relative; width: 35.2vh; height: 24vh; margin: auto; }
.klein-bord .dashboard {
    top: 0; bottom: auto; width: 88vh;
    transform: translateX(-50%) scale(.4); transform-origin: top center;
    transition: none; overflow: visible;
    border-radius: 4vh;
}
.klein-bord .dashboard .rij .toets:not(.spatiebalk) { width: 6.4vh; }
.klein-bord .dashboard .spatiebalk { width: 40vh; }
.klein-bord .loper { display: none; }
.klein-dashboard figcaption { font: 700 2.5vh/1.3 var(--praat); margin-top: 1vh; }
.canvas-spel[data-spelfase="begin"] .spel-inhoud { gap: 1.2vh; }
.oefenwereld > .klein-dashboard { position: absolute; top: 48vh; left: 34vw; }
.oefenwereld > .grafiek { left: max(58vw, calc(35vw + 35.2vh)); }
.level-wereld > .klein-dashboard { position: absolute; left: 50%; top: 49vh; transform: translateX(-50%); }
.level-wereld:not([data-fase="spel-uitleg"]) > .klein-dashboard { display: none; }
