@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;600;700;900&family=Inter:wght@400;500&display=swap');

:root {
    --red:  #e10600;
    --gold: #ffd700;
    --bg:   #07070f;
}

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

html, body {
    height: 100%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-family: 'Orbitron', monospace;
}

#wrapper {
    position: relative;
    width: 900px;
    height: 580px;
    flex-shrink: 0;
}

canvas {
    display: block;
    border-radius: 6px;
    box-shadow:
        0 0 0 2px rgba(255,255,255,0.06),
        0 0 60px rgba(225,6,0,0.18),
        0 0 120px rgba(0,0,0,0.9);
}

/* ── HUD ─────────────────────────────────────── */
#hud {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex;
    justify-content: space-between;
    padding: 12px 14px;
    pointer-events: none;
    gap: 10px;
}

.hud-box {
    background: rgba(0,0,0,0.75);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 8px 16px;
    backdrop-filter: blur(8px);
    text-align: center;
    min-width: 112px;
}

.hud-label {
    font-size: 0.5rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: rgba(255,255,255,0.38);
    display: block;
    margin-bottom: 2px;
}

#speed-value {
    display: block;
    font-size: 2.3rem;
    font-weight: 900;
    color: var(--red);
    line-height: 1;
    margin-bottom: 1px;
}

.hud-lap {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.hud-sep {
    color: rgba(255,255,255,0.35);
    margin: 0 3px;
}

#lap-time {
    font-size: 0.78rem;
    color: var(--gold);
    margin-top: 4px;
    font-weight: 600;
    letter-spacing: 0.05em;
}

#best-lap {
    font-size: 0.88rem;
    color: #7fff7f;
    margin-top: 4px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

/* ── OVERLAY ─────────────────────────────────── */
#overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(4,4,14,0.9);
    backdrop-filter: blur(12px);
    border-radius: 6px;
    justify-content: center;
    align-items: center;
    z-index: 100;
}
#overlay.active { display: flex; }

#overlay-content {
    text-align: center;
    padding: 24px;
    max-width: 440px;
}

.overlay-logo {
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    background: var(--red);
    color: #fff;
    width: 78px; height: 78px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    box-shadow: 0 0 0 4px rgba(225,6,0,0.25), 0 0 40px rgba(225,6,0,0.35);
}

#overlay-content h1 {
    font-size: 2.8rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: 0.26em;
    margin-bottom: 10px;
    text-shadow: 0 0 50px rgba(225,6,0,0.3);
}

#overlay-content p {
    color: rgba(255,255,255,0.55);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.controls-info {
    display: inline-block;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.13);
    border-radius: 4px;
    padding: 8px 22px;
    margin: 14px 0 20px;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.65);
    letter-spacing: 0.12em;
}

#start-btn {
    background: var(--red);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 14px 48px;
    font-family: 'Orbitron', monospace;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 22px rgba(225,6,0,0.4);
    display: inline-block;
    margin-top: 6px;
}
#start-btn:hover {
    background: #ff1a0e;
    transform: translateY(-2px);
    box-shadow: 0 6px 32px rgba(225,6,0,0.55);
}
#start-btn:active { transform: translateY(0); }

.finish-time {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--gold);
    margin: 12px 0;
    letter-spacing: 0.1em;
}
.finish-best {
    color: rgba(255,255,255,0.55);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    margin-bottom: 4px;
}
.finish-best strong {
    font-family: 'Orbitron', monospace;
    color: #7fff7f;
    font-size: 1rem;
}

/* ── RESPONSIVE ──────────────────────────────── */
@media (max-width: 930px) {
    #wrapper { transform: scale(0.88); transform-origin: center center; }
}
@media (max-width: 820px) {
    #wrapper { transform: scale(0.72); transform-origin: center center; }
}
@media (max-width: 680px) {
    #wrapper { transform: scale(0.56); transform-origin: center center; }
}