body {
    background:#111;
    color:white;
    font-family:monospace;
    display:flex;
    flex-direction:column;
    align-items:center;
    touch-action: none;
}
html, body {
    margin: 0;
    width: 100%;
    height: 100%;
}
#trackMenu h2 { display: none; }


/* ===== TRACKMENU: center + gelijke knoppen ===== */

/* Zorg dat de 2 kolommen mooi gecentreerd staan */
#trackMenu > div {
width: min(900px, 92vw) !important;
margin: 0 auto !important;
justify-content: center !important;
}

/* Elke kolom: center inhoud */
#trackMenu > div > div {
display: flex;
flex-direction: column;
align-items: center;   /* <-- dit fixeert left-aligned look */
}

/* UL moet volle breedte van de kolom gebruiken */
#trackMenu ul {
width: 100%;
margin: 0;
padding: 0;
align-items: center;   /* center de LI's */
}

/* LI mag volle breedte nemen */
#trackMenu li {
width: 100%;
display: flex;
justify-content: center; /* center de button */
}

/* Button: zelfde breedte + zelfde hoogte + tekst gecentreerd */
#trackMenu button {
width: 100% !important;
max-width: 420px;       /* match je kolom max */
box-sizing: border-box;

min-height: 78px;       /* <-- maakt ze allemaal even groot */
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;

text-align: center;
line-height: 1.1;
}

/* ===== TOPBAR===== */
#topBar {
width: 100%;
height: 48px;
background: rgba(0,0,0,0.85);
border-bottom: 2px solid #333;
display: flex;
justify-content: center; /*alles in het midden */
align-items: center;
box-sizing: border-box;
}

#centerBar {
display: flex;
align-items: center;
gap: 20px;              /* ruimte tussen laps | scoreboard | hud */
}
#lapContainer input {
width: 50px;
}
/* HUD gecentreerd */
#hud {
display: flex;
flex-direction: column;
align-items: flex-start;
font-size: 14px;
white-space: nowrap;
}

#overlay {

top:0; left:0; right:0; bottom:0;
background:rgba(0,0,0,0.85);
color:white;

display:flex;
flex-direction:column;
justify-content:center;
align-items:center;
z-index:30;
gap:20px;
}



.stick {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    pointer-events: auto;
    touch-action: none;
}

#stickP1 { margin-left: 10px; }
#stickP2 { margin-right: 10px; }

.knob {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.7);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

#minigameOverlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: none;
pointer-events: none;
z-index: 25;
}

.minigamePanel {
    position: absolute;
    flex-direction: column;
    align-items: center;
    background: rgba(0,0,0,0.75);
    border: 2px solid white;
    padding: 6px;
    pointer-events: auto;
    min-width: 20px;
    min-height: 80px;
    width: 100%; /* default */
    height: auto; /* default */
    max-height: 80%;
    display: none;
    box-sizing: border-box;
}

#scoreboardButtonContainer {
display: flex;
align-items: center;
justify-content: center;
margin: 0 10px; /* beetje ruimte tussen lap counter en HUD */
}



.menuOverlay{
    background:rgba(0,0,0,0.9);
    color:#fff;

    flex-direction:column;
    justify-content:center;
    align-items:center;
    gap:20px;
    padding:20px;
}

.menuGrid{
    width:min(900px, 92vw);
    display:grid;
    grid-template-columns: 1fr 1fr;
    gap:18px;
}

.menuSection{
    border:1px solid rgba(255,255,255,0.15);
    border-radius:14px;
    padding:16px;
    background:rgba(255,255,255,0.05);
}

.menuSection h2{
    margin:0 0 12px 0;
    font-size:18px;
    letter-spacing:1px;
    opacity:0.9;
}

.menuButtons{
    display:flex;
    flex-direction:column;
    gap:12px;
}






.scoreboardButton {
    display: inline-block;
    padding: 8px 15px;
    font-size: 1.2rem; /* kleiner dan game-knop, past beter */
    font-weight: bold;
    color: #ffcc00;             /* gele letters */
    background-color: red;  /* rood */
    border: 2px solid #ffff66;
    border-radius: 8px;
    text-decoration: none;
    box-shadow: 0 0 15px #ffff66;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.3s;
}

.playerRow {
    display: flex;
    align-items: center;
    gap: 6px;
}

.playerRow label {
    width: 28px;
    text-align: right;
}

.playerRow input {
    width: 60px;
}

.stats {
    min-width: 420px;
    font-family: monospace;
}

.scoreboardButton:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px #ffff66;
    background-color: green; /* groen bij hover */
}

.scoreboardButton:active {
    transform: scale(1.1);
    box-shadow: 0 0 20px #ffff66;
    background-color: green; /* groen bij hover */
}

/* Responsive tweaks */
@media(max-width:900px){
    .scoreboardButton {
        font-size: 1rem;
        padding: 6px 12px;
    }
}

#gameWrapper {
position: relative;
width: 100%;
height: calc(100vh - 48px);
max-height: calc(100vh - 48px);

display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
z-index: 10;
}

#levelSelect {
display : none;
position: absolute;
z-index: 100;
}



#game {
max-width: 100%;
max-height: 100%;
image-rendering: pixelated;
}

#newGameBtn {
font-size:24px;
padding:10px 20px;
cursor:pointer;
}

#boostControls {
display: none; /* default hidden */
position: absolute;
pointer-events: auto;
z-index: 20;
}
#boostControls button {
padding: 15px 20px;
font-size: 18px;
}
/*PHONE/TABLET CONTROLLERS*/
@media (max-width: 900px) and (orientation: landscape) {
    #mobileControls {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    pointer-events: auto;   /* ✅ FIX: was none */
    z-index: 20;
    }

    .stick {
        pointer-events: auto;   /* ok */
    }
}
@media (max-width: 600px) and (orientation: landscape) {

    .stick {
        width: 120px;
        height: 120px;
    }
    #topBar {
    font-size: 11px;
    }
}
@media (min-width: 900px) and (max-width: 1200px) {
    /* tablet fine-tuning */
}


@media (max-width: 720px){
    #trackMenu button{
    font-size: 20px;
    padding: 22px 14px;
    }
}



/* =========================================================
 * S COREBOARD-PAGI*NA EXTRA CSS (past bij jouw look)
 * (alles onder #sbPage zodat er zo weinig mogelijk botst)
 * ========================================================= */
#sbPage{
width: 100%;
height: calc(100vh - 48px);
display:flex;
justify-content:center;
align-items:flex-start;
overflow:hidden;
}

#sbPanel{
width: min(980px, 96vw);
height: 100%;
padding: 12px;
box-sizing: border-box;
display:flex;
flex-direction:column;
gap: 10px;
}




/* Tabs (Home / X-mass Tree Race) */
#sbTabs{
display:flex;
justify-content:center;
gap: 10px;
flex-wrap: wrap;
}
.sbTab{
    cursor:pointer;
    user-select:none;
    padding: 6px 12px;
    border-radius: 10px;
    border: 2px solid #333;
    background: rgba(255,255,255,0.06);
    color: white;
    font-size: 14px;
    font-weight: 700;
}
.sbTab.active{
    border-color: #ffff66;
    box-shadow: 0 0 12px rgba(255,255,102,0.35);
}

/* Sections */
.sbSection{
    display:none;
    width:100%;
    flex: 1 1 auto;
    overflow:hidden;
}
.sbSection.active{ display:block; }

#sbHomeCard, #sbRaceCard{
width:100%;
height: 100%;
border: 2px solid #333;
background: rgba(0,0,0,0.55);
border-radius: 12px;
box-sizing: border-box;
padding: 12px;
overflow:hidden;
}

/* Home boodschap */
#sbHomeCard{
display:flex;
align-items:center;
justify-content:center;
text-align:center;
}
#sbHomeMsg{
font-size: 18px;
line-height: 1.4;
font-weight: 800;
}
#sbHomeMsg small{
display:block;
margin-top: 8px;
opacity: 0.9;
font-weight: 700;
}

/* Year picker */
#sbYearRow{
display:flex;
justify-content:center;
align-items:center;
gap: 10px;
flex-wrap: wrap;
margin-bottom: 10px;
}
.sbYearBtn{
    cursor:pointer;
    user-select:none;
    padding: 6px 10px;
    border-radius: 10px;
    border: 2px solid #333;
    background: rgba(255,255,255,0.06);
    color: white;
    font-size: 14px;
    font-weight: 800;
}
.sbYearBtn.active{
    border-color: #ffff66;
    box-shadow: 0 0 12px rgba(255,255,102,0.35);
}

/* Score container: scrollbaar, want html/body overflow hidden */
#sbScoreContainer{
height: calc(100% - 55px);
overflow:auto;
border: 2px solid #333;
border-radius: 12px;
background: rgba(0,0,0,0.55);
}

/* Score row */
.sbRow{
    display:flex;
    gap: 10px;
    align-items:center;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-size: 14px;
}
.sbRow strong{ color: #ffcc00; }
.sbName{
    flex:1;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}
.sbTime{
    font-variant-numeric: tabular-nums;
    opacity: 0.95;
}

/* kleine helper text */
#sbHint{
margin-top: 8px;
opacity: 0.85;
font-size: 12px;
}
/*  */
/* ==============================
 *   WINNER OVERLAY: altijd passend
 *   ============================== */

#overlay{
position: fixed;
inset: 0;
z-index: 30;

display: none;                 /* jij zet hem op flex in JS */
align-items: center;
justify-content: center;

padding: 14px;
box-sizing: border-box;
background: rgba(0,0,0,0.85);

/* geen scroll nodig */
overflow: hidden;
}

/* Maak winnaar content een card die altijd in viewport past */
#winnerText{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;

width: min(92vw, 760px);
max-height: 92vh;

border: 2px solid rgba(255,255,255,0.25);
border-radius: 14px;
background: rgba(0,0,0,0.55);
padding: 14px;
gap: 10px;

box-sizing: border-box;

/* tekst schaalt mee */
font-size: clamp(16px, 2.6vw, 26px);
line-height: 1.15;
text-align: center;
}

/* De grote titel binnen winnerText (jouw innerHTML eerste div) */
#winnerText > div:first-child{
font-size: clamp(22px, 6vw, 54px);
font-weight: 900;
margin-bottom: 6px;
}

/* Zet knoppen mooi naast elkaar (NEW GAME + SCOREBOARD) */
#overlay .overlayActions{
display: flex;
gap: 10px;
width: 100%;
justify-content: center;
align-items: center;
flex-wrap: nowrap;           /* geen wrap = geen scroll */
}

/* Maak overlay knoppen compacter en consistent */
#overlay .scoreboardButton{
font-size: clamp(14px, 3.4vw, 18px);
padding: 10px 12px;
border-radius: 10px;
white-space: nowrap;

/* zorg dat 2 knoppen naast elkaar passen */
flex: 1 1 0;
max-width: 260px;
text-align: center;
}

/* Landscape: nog compacter zodat het 100% past */
@media (max-width: 900px) and (orientation: landscape){
    #winnerText{
    width: min(96vw, 900px);
    padding: 10px;
    gap: 8px;
    }
    #winnerText > div:first-child{
    font-size: clamp(20px, 5vw, 44px);
    margin-bottom: 2px;
    }
    #overlay .scoreboardButton{
    padding: 8px 10px;
    max-width: 240px;
    }
}



















/* =========================
 *  STARTMENU (CLEAN + MOBILE OK)
 *  ========================= */

/* Startmenu bovenaan, niet center, en mag scrollen als nodig */


/* Titel iets compacter */
#startMenu > h1{
margin: 0 !important;
font-size: 28px;
line-height: 1;
}

/* License card: 2 kolommen op desktop, 1 kolom op mobile */
#licenseCard{
width: min(980px, 96vw);
display: grid;
grid-template-columns: 1fr 1fr;
gap: 14px;

/* ✅ vaste "ruimte in viewport" zodat de card niet instort */
height: calc(100dvh - 140px);
min-height: 0;                               /* ✅ essentieel in grid */
align-items: stretch;
}

/* Beide kolommen mogen vullen */
#licenseCard > .menuSection{
height: 100%;
min-height: 0;                               /* ✅ essentieel */
overflow: hidden;
box-sizing: border-box;
}

/* Linkerkolom: inhoud moet altijd zichtbaar zijn => scroll IN de kolom */
#licenseCard > .menuSection:first-child{
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}

/* Rechterkolom driver: center */
#driverSection{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
overflow: hidden;
}

/* Driver image */
#driverImg{
width: 100%;
max-width: 360px;
max-height: 40dvh;
height: auto;
object-fit: contain;
display: block;

image-rendering: pixelated;
border-radius: 14px;
border: 2px solid rgba(255,255,255,0.2);
background: rgba(0,0,0,0.35);
padding: 10px;
}

/* Buttons */
#startMenuButtons{
width: min(980px, 96vw);
display: flex;
justify-content: center;
gap: 12px;
}

/* ✅ Mobile: 1 kolom (alles onder elkaar) zodat links nooit kan "instorten" */
@media (max-width: 900px){
    #licenseCard{
    height: auto;                               /* card mag mee groeien */
    max-height: calc(100dvh - 140px);
    }

    #licenseCard > .menuSection{
    height: auto;
    }

    #licenseCard > .menuSection:first-child{
    max-height: 40dvh;                          /* rijbewijs blok scrollt */
    }

    #driverImg{
    max-height: 32dvh;
    }
}

/* Startmenu: override .menuOverlay centering echt hard */
#startMenu.menuOverlay{
flex-direction: column !important;
justify-content: flex-start !important;
align-items: center !important;
}

/* rechterkolom driver center */
#driverSection{
display: flex;
justify-content: center;
align-items: center;
min-height: 0;
}



/* Buttons onderaan altijd zichtbaar */
#startMenuButtons{
width: min(980px, 96vw);
display: flex;
justify-content: center;
gap: 12px;
padding-bottom: 10px;
}

/* Mobile: 1 kolom zodat niets “instort” */
@media (max-width: 900px){
    #licenseCard{

    max-height: none;               /* card mag groeien */
    }

    #driverImg{
    max-height: 28vh;
    }
}





/* =========================
 *  STARTMENU (ONE TRUE VERSION)
 *  ========================= */

/* laat JS display regelen (NIET in CSS!) */
#startMenu{
justify-content: flex-start !important;
align-items: center !important;
padding: 12px !important;
gap: 12px !important;
overflow-y: auto !important;
-webkit-overflow-scrolling: touch;
}

/* titel */
#startMenu > h1{
margin: 0 !important;
font-size: 28px;
line-height: 1;
}

/* card */
#licenseCard{
width: min(980px, 96vw);
display: grid;
grid-template-columns: 1fr 1fr;
gap: 14px;

/* belangrijkste: laat grid children kunnen krimpen */
min-height: 0;
align-items: stretch;

/* stabiel op mobiel, maar geen fullscreen blokker */
max-height: 65vh;
overflow: hidden;
}

/* beide kolommen */
#licenseCard > .menuSection{
min-height: 0;           /* 🔑 cruciaal */
overflow: hidden;
}

/* linkerkolom scrollbaar */
#licenseCard > .menuSection:first-child{
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}

/* driver kolom */
#driverSection{
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
min-height: 0;
overflow: hidden;
}

#driverImg{
width: 100%;
max-width: 360px;
max-height: 32vh;
height: auto;
object-fit: contain;
display: block;

image-rendering: pixelated;
border-radius: 14px;
border: 2px solid rgba(255,255,255,0.2);
background: rgba(0,0,0,0.35);
padding: 10px;
}

/* knoppen */
#startMenuButtons{
width: min(980px, 96vw);
display: flex;
justify-content: center;
gap: 12px;
padding-bottom: 10px;
}

/* mobile: 1 kolom */
@media (max-width: 900px){
    #licenseCard{

    max-height: none;
    }

    /* laat rijbewijs blok scrollen, driver zichtbaar */
    #licenseCard > .menuSection:first-child{
    max-height: 42vh;
    }

    #driverImg{
    max-height: 28vh;
    }
}


#carSelectMenu{ pointer-events: auto; }



/* ========= OVERLAYS: 1 systeem ========= */
.menuOverlay,
#trackMenu,
#rotateWarning,
#overlay,
#carSelectMenu,
#statsMenu,
#startMenu{
position: fixed;
inset: 0;
}

/* overlays zijn standaard UIT, JS zet ze aan */
#startMenu,
#statsMenu,
#carSelectMenu,
#trackMenu,
#overlay{
display: none;
}

/* z-index ladder (belangrijk!) */
#startMenu{ z-index: 50; }
#statsMenu{ z-index: 60; }
#carSelectMenu{ z-index: 70; }
#trackMenu{ z-index: 80; }
#overlay{ z-index: 90; }
#rotateWarning{ z-index: 10000; }



#mobileControls {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 140px;   /* vaste hoogte */
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 20px;
z-index: 20;
}



@media (max-width: 900px) and (orientation: landscape){
    #winnerText{
    width: 96vw;
    max-height: 86vh;      /* iets kleiner */
    padding: 10px;
    gap: 6px;
    font-size: clamp(12px, 2.2vw, 16px); /* kleiner body tekst */
    }

    /* "SBE Wins!" regel (jouw grote titel) */
    #winnerText > div:first-child{
    font-size: clamp(18px, 4.2vw, 28px); /* ✅ veel kleiner dan 44px */
    margin: 6px 0 2px 0;
    }
}


/* Stats menu volledig centreren */
#statsMenu{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}

/* container */
#statsList{
width: min(500px, 90vw);
text-align: center;
}

/* blok per level */
.statBlock{
    margin: 20px 0;
}

/* titel geel */
.statLvlTitle{
    color: #ffff66;
    font-weight: 900;
    font-size: 22px;
    margin-bottom: 10px;
}

/* lijnen onder elkaar en gecentreerd */
.statLine{
    display: block;
    font-size: 15px;
    margin: 4px 0;
}

/* ASCII lijn */
.statAsciiSep{
    margin-top: 10px;
    opacity: 0.7;
    font-family: monospace;
}


/* ===== TRACK MENU SCROLL FIX ===== */

#trackMenu{
position: fixed;
inset: 0;

display: none;           /* JS zet hem op flex */
flex-direction: column;
align-items: center;
justify-content: flex-start;   /* 🔥 niet meer center */

padding: 20px;
box-sizing: border-box;

overflow-y: auto;              /* 🔥 SCROLL */
-webkit-overflow-scrolling: touch;
}

/* content blok centreren */
#trackMenu > div{
margin-top: 40px;              /* ruimte bovenaan */
}
