/* balkenrace/style.css */

:root {
    --bg1: #0f1a2e;
    --bg2: #1a2a4e;
    --accent: #ff7043;
    --accent2: #ffca28;
    --gold: #ffd54f;
    --text: #e8eaf6;
    --text-dim: #aab6d0;
    --panel: rgba(255,255,255,0.08);
    --panel-border: rgba(255,255,255,0.18);
}

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

html, body { height: 100%; }

body {
    background: linear-gradient(135deg, var(--bg1), var(--bg2));
    color: var(--text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}

.back-btn {
    position: fixed; top: 12px; left: 12px; z-index: 100;
    background: rgba(0,0,0,0.4); backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2); border-radius: 12px;
    color: var(--text); text-decoration: none; padding: 8px 16px;
    font-size: 14px; transition: all 0.2s;
}
.back-btn:hover { background: rgba(255,255,255,0.2); }

#top-buttons {
    position: fixed; top: 12px; right: 12px; z-index: 100;
    display: flex; gap: 8px;
}
.icon-btn {
    background: rgba(0,0,0,0.4); backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2); border-radius: 12px;
    color: var(--text); font-size: 18px; line-height: 1;
    padding: 7px 10px; cursor: pointer; transition: all 0.2s;
    font-family: inherit;
}
.icon-btn:hover { background: rgba(255,255,255,0.2); }

#game-container { position: relative; width: 100%; height: 100%; }

#gameCanvas {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    display: block;
    touch-action: none;
}

#fxCanvas {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 70;
    pointer-events: none;
}

/* === HUD === */
#hud {
    position: fixed;
    top: 12px; left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex; flex-direction: column; align-items: center;
    gap: 6px;
    pointer-events: none;
}

#hud-main {
    display: flex; align-items: center; gap: 14px;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(10px);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 15px; font-weight: 600;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
#hud-pos {
    font-size: 22px; font-weight: 900; color: var(--gold);
    min-width: 40px; text-align: center;
}
#hud-pos.bump { animation: posBump 0.35s ease; }
@keyframes posBump {
    0% { transform: scale(1); }
    40% { transform: scale(1.5); }
    100% { transform: scale(1); }
}
#hud-coins { color: var(--gold); }
#hud-time { color: var(--text-dim); min-width: 52px; text-align: right; }

#powerups { display: flex; gap: 8px; min-height: 34px; }
.pu {
    display: none; align-items: center; gap: 6px;
    background: rgba(0,0,0,0.55);
    border: 2px solid var(--accent2);
    border-radius: 16px;
    padding: 3px 10px 3px 8px;
    font-size: 18px;
    animation: puPop 0.3s ease;
}
.pu.on { display: flex; }
.pu-bar {
    width: 54px; height: 8px;
    background: rgba(255,255,255,0.18);
    border-radius: 4px; overflow: hidden;
}
.pu-bar > div {
    height: 100%; width: 100%;
    background: linear-gradient(90deg, var(--accent2), var(--accent));
    border-radius: 4px;
}
@keyframes puPop {
    0% { transform: scale(0.4); }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* === OVERLAYS === */
.overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 60;
    display: flex; flex-direction: column; align-items: center;
    background: rgba(10,15,30,0.82);
    backdrop-filter: blur(6px);
    text-align: center;
    padding: 56px 16px 24px;
    overflow-y: auto;
    touch-action: pan-y;
}
.overlay > :first-child { margin-top: auto; }
.overlay > :last-child { margin-bottom: auto; }

.overlay h1 {
    font-size: clamp(30px, 6vw, 52px);
    margin-bottom: 10px;
    text-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.overlay p {
    font-size: clamp(14px, 2.5vw, 17px);
    color: var(--text-dim);
    max-width: 520px;
    margin-bottom: 14px;
    line-height: 1.5;
}
.overlay p b { color: var(--accent2); }

#coin-total {
    font-size: 18px; font-weight: 700; color: var(--gold);
    margin-bottom: 14px;
}

#race-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    width: 100%; max-width: 720px;
    margin-bottom: 16px;
}

.race-btn {
    background: var(--panel);
    border: 2px solid var(--panel-border);
    border-radius: 14px;
    color: var(--text);
    font-family: inherit;
    padding: 10px 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    min-height: 96px;
}
.race-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.16);
    transform: translateY(-2px);
}
.race-btn.next {
    border-color: var(--accent);
    background: rgba(255,112,67,0.2);
    box-shadow: 0 4px 20px rgba(255,112,67,0.35);
}
.race-btn:disabled { opacity: 0.45; cursor: default; }
.race-dist { font-size: 22px; font-weight: 900; }
.race-name { font-size: 12px; color: var(--text-dim); }
.race-medal { font-size: 20px; min-height: 26px; }
.race-best { font-size: 12px; color: var(--gold); min-height: 15px; }

#shirt-row {
    display: flex; align-items: center; gap: 10px;
    flex-wrap: wrap; justify-content: center;
    margin-bottom: 6px;
}
#shirt-label { font-size: 14px; color: var(--text-dim); }
#shirt-list { display: flex; gap: 8px; }
.shirt-btn {
    width: 38px; height: 38px; border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.25);
    cursor: pointer; font-size: 11px; font-weight: 700;
    color: #fff; font-family: inherit;
    display: flex; align-items: center; justify-content: center;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    transition: all 0.2s;
}
.shirt-btn.active { border-color: #fff; transform: scale(1.15); }
.shirt-btn:disabled { opacity: 0.45; cursor: default; }

#controls-info { margin-top: 10px; color: var(--text-dim); font-size: 14px; }
#controls-info p { font-size: 14px; margin-bottom: 6px; }
#controls-info kbd {
    display: inline-block;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 5px;
    padding: 2px 8px; margin: 0 2px;
    font-family: inherit; font-size: 13px;
}

.action-btn {
    background: linear-gradient(135deg, var(--accent), #e64a19);
    border: none; border-radius: 14px;
    color: white; font-family: inherit;
    font-size: 18px; font-weight: 700;
    padding: 13px 30px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 20px rgba(255,112,67,0.4);
    margin: 6px;
}
.action-btn:hover { transform: translateY(-2px); }
.action-btn:active { transform: translateY(0); }
.action-btn.secondary {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    box-shadow: none;
    font-size: 16px; padding: 11px 22px;
}

/* Aftellen */
#countdown {
    position: fixed; inset: 0; z-index: 55;
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: 22vh;
    pointer-events: none;
}
#countdown-text {
    font-size: clamp(60px, 16vw, 130px);
    font-weight: 900;
    color: #fff;
    text-shadow: 0 6px 0 var(--accent), 0 10px 30px rgba(0,0,0,0.6);
}
#countdown-text.pop { animation: countPop 0.5s ease; }
@keyframes countPop {
    0% { transform: scale(2.2); opacity: 0; }
    40% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* Uitslag */
#podium {
    display: flex; align-items: flex-end; justify-content: center;
    gap: 6px; margin: 6px 0 14px;
}
.pod {
    display: flex; flex-direction: column; align-items: center;
    width: 98px;
}
.pod-name {
    font-size: 13px; font-weight: 700; margin-bottom: 4px;
    max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pod-name.me { color: var(--gold); }
.pod-face { font-size: 30px; line-height: 1.1; }
.pod-shirt {
    width: 30px; height: 22px; border-radius: 7px 7px 3px 3px;
    margin-bottom: 2px; border: 2px solid rgba(255,255,255,0.6);
    font-size: 11px; font-weight: 800; color: #fff;
    display: flex; align-items: center; justify-content: center;
    text-shadow: 0 1px 2px rgba(0,0,0,0.7);
}
.pod-block {
    width: 100%;
    border-radius: 8px 8px 0 0;
    display: flex; align-items: flex-start; justify-content: center;
    font-size: 26px; padding-top: 4px;
    animation: podRise 0.6s ease backwards;
}
.pod-1 .pod-block { height: 84px; background: linear-gradient(#ffd54f, #f9a825); }
.pod-2 .pod-block { height: 60px; background: linear-gradient(#cfd8dc, #90a4ae); animation-delay: 0.15s; }
.pod-3 .pod-block { height: 42px; background: linear-gradient(#d7a36b, #a1662f); animation-delay: 0.3s; }
@keyframes podRise {
    0% { height: 0; }
}

#result-list {
    width: 100%; max-width: 360px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    padding: 6px 12px;
    margin-bottom: 12px;
    font-variant-numeric: tabular-nums;
}
.res-row {
    display: flex; justify-content: space-between; gap: 10px;
    padding: 4px 0; font-size: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.res-row:last-child { border-bottom: none; }
.res-row.me { color: var(--gold); font-weight: 800; }
.res-row span:first-child { text-align: left; }

#result-stats {
    font-size: 16px; color: var(--text); margin-bottom: 10px; line-height: 1.6;
}
#result-stats .record { color: var(--accent2); font-weight: 800; }
#result-buttons { display: flex; flex-wrap: wrap; justify-content: center; }

@media (max-width: 600px) {
    #race-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #hud { top: 56px; }
    #hud-main { gap: 9px; padding: 5px 12px; font-size: 13px; }
    #hud-pos { font-size: 19px; min-width: 32px; }
    .back-btn { padding: 8px 12px; }
    .race-btn { min-height: 86px; padding: 8px 4px; }
    .pod { width: 88px; }
}

@media (max-height: 460px) {
    .overlay { padding-top: 12px; }
    .overlay h1 { font-size: 26px; margin-bottom: 4px; }
    .overlay p { margin-bottom: 8px; font-size: 13px; }
    #race-list { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 620px; }
    .race-btn { min-height: 70px; padding: 5px 4px; }
    #controls-info { display: none; }
    .pod-1 .pod-block { height: 52px; }
    .pod-2 .pod-block { height: 38px; }
    .pod-3 .pod-block { height: 26px; }
    #hud { top: 8px; }
}
