html, body {
    margin: 0;
    padding: 0;
    background: #023839;
    color: #ccc;
    font-family: monospace;
    overflow: hidden;
}

.game-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 8px;
}

.game-header a {
    color: #888;
    text-decoration: none;
    font-size: 14px;
    padding: 4px 8px;
}

.game-header a:hover {
    color: #ccc;
}

.game-header select {
    background: #222;
    color: #ccc;
    border: 1px solid #555;
    padding: 4px 8px;
    font-family: monospace;
    font-size: 14px;
}

.game-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: calc(100vh - 40px);
    outline: none;
}

.game-container canvas {
    width: 1024px;
    height: 512px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.hud {
    position: absolute;
    bottom: calc(50% - 256px - 37px);
    left: 50%;
    transform: translateX(-50%);
    width: 1024px;
    display: flex;
    justify-content: space-between;
    padding: 4px 12px;
    font-size: 14px;
    color: #ff0;
    pointer-events: none;
}

.hud-left, .hud-center, .hud-right {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hud-center {
    align-items: center;
}

.hud-right {
    align-items: flex-end;
}

.hud .boost-active {
    color: #0ff;
}

.hud .off-track {
    color: #f44;
}

.hud .race-finished {
    color: #0f0;
}

/* ─── Touch Controls ──────────────────────────────────────────────────────── */
/* Gamepad-style layout with buttons on arcs centered at the lower corners.   */
/*   Left pad  – D-pad: Steer Left (upper-left) / Steer Right (lower-right)  */
/*   Right pad – Acc (upper-left) / Boost (middle, bigger) / Brake (lower-right) */

.touch-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.touch-pad {
    position: absolute;
    bottom: 0;
    pointer-events: none;
}

.touch-pad.touch-pad-left  { left: 0; }
.touch-pad.touch-pad-right { right: 0; }

.touch-zone {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: monospace;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 8px;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

/* ── Left pad: D-pad on arc from bottom-left corner ── */
/* Arc radius ~14dvmin. Steer-left at ~65°, steer-right at ~25°.             */
.touch-pad-dpad {
    width: min(40dvmin, 200px);
    height: min(40dvmin, 200px);
}

.touch-zone.dpad-left,
.touch-zone.dpad-right {
    width: min(18vw, 100px);
    height: min(14dvmin, 70px);
    font-size: 24px;
}

/* ~65° from horizontal: close to left edge, high up */
.touch-zone.dpad-left {
    bottom: min(14dvmin, 70px);
    left: min(2dvmin, 10px);
}

/* ~25° from horizontal: further right, close to bottom */
.touch-zone.dpad-right {
    bottom: min(2dvmin, 10px);
    left: min(14dvmin, 70px);
}

/* ── Right pad: action buttons on arc from bottom-right corner ── */
/* Arc radius ~18dvmin. Acc at ~72°, boost at ~45°, brake at ~18°.           */
.touch-pad-actions {
    width: min(50dvmin, 250px);
    height: min(50dvmin, 250px);
}

/* Acc and brake: standard size */
.touch-zone.action-gas,
.touch-zone.action-brake {
    width: min(22vw, 120px);
    height: min(12dvmin, 60px);
}

/* Boost: larger — the primary action button */
.touch-zone.action-boost {
    width: min(26vw, 145px);
    height: min(15dvmin, 75px);
    font-size: 16px;
    color: rgba(0, 255, 255, 0.35);
}

/* ~72°: top of arc, near right edge, high up */
.touch-zone.action-gas {
    bottom: min(24dvmin, 120px);
    right: min(2dvmin, 10px);
}

/* ~45°: middle of arc, diagonal */
.touch-zone.action-boost {
    bottom: min(13dvmin, 65px);
    right: min(10dvmin, 50px);
}

/* ~18°: bottom of arc, further left, near bottom */
.touch-zone.action-brake {
    bottom: min(2dvmin, 10px);
    right: min(20dvmin, 100px);
    color: rgba(255, 100, 100, 0.35);
}

.touch-zone.active {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.3);
}

.touch-zone.action-boost.active {
    background: rgba(0, 255, 255, 0.2);
    color: rgba(0, 255, 255, 0.8);
    border-color: rgba(0, 255, 255, 0.3);
}

.touch-zone.action-brake.active {
    background: rgba(255, 100, 100, 0.2);
    color: rgba(255, 100, 100, 0.8);
    border-color: rgba(255, 100, 100, 0.3);
}

/* ─── Info Page ───────────────────────────────────────────────────────────── */

.info-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 16px 48px;
    overflow-y: auto;
    height: 100vh;
    box-sizing: border-box;
}

.info-page h1 {
    color: #ff0;
    font-size: 24px;
    margin: 0 0 4px;
}

.info-page .subtitle {
    color: #888;
    margin: 0 0 24px;
}

.info-page h2 {
    color: #0ff;
    font-size: 16px;
    border-bottom: 1px solid #333;
    padding-bottom: 4px;
    margin: 24px 0 8px;
}

.info-page p {
    line-height: 1.6;
    margin: 8px 0;
}

.info-page ul {
    padding-left: 20px;
    line-height: 1.8;
}

.info-page table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
}

.info-page td, .info-page th {
    text-align: left;
    padding: 4px 12px 4px 0;
    border-bottom: 1px solid #222;
}

.info-page th {
    color: #888;
}

.info-page .revision-table td:first-child,
.info-page .revision-table th:first-child {
    white-space: nowrap;
    width: 80px;
    color: #888;
}

.info-page .video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    margin: 12px 0;
}

.info-page .video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 1px solid #333;
}

.info-page .back-link {
    margin-top: 32px;
    text-align: center;
}

.info-page .back-link a {
    color: #ff0;
    text-decoration: none;
}

.info-page .back-link a:hover {
    text-decoration: underline;
}

.info-page a {
    color: #0ff;
}
