* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    text-align: center;
    background: #000000;
    overflow-x: clip;
}

.centered-container {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    bottom: 0;
    overflow: hidden;
}

.game-container {
    /* the game handles touches itself: pinch zooms the game (FR-242), not the page */
    touch-action: none;
    position: absolute;
    bottom: 0;
    top: 0;
    left: 0;
    right: 0;
}

@media (min-width: 600px) {

    .desktop .game-container {
        top: 50px;
        left: 50px;
        right: 50px;
        bottom: 100px;
    }
}

.freerider-canvas-container {
    background: #FFFFFF;
}


.play-area {
    position: relative;
    height: 100vh;
    height: 100dvh;
    min-height: 210px;
    background: #000;
}

.play-area .game-container { bottom: 32px; }
.footer { display: none; }
.page-links {
    position: absolute;
    bottom: 0;
    inset-inline: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    font: 14px/22px Arial, sans-serif;
}
.page-links a { padding: 5px 10px; color: white; text-decoration: none; }
.page-links a:hover { text-decoration: underline; }
.page-links a + a { border-left: 1px solid rgba(255, 255, 255, 0.35); }
.footer img { display: block; width: 135px; height: 40px; }
.footer a:focus-visible, .page-links a:focus-visible { outline: 2px solid #3bc9ff; outline-offset: 2px; }

@media (min-width: 600px) {
    .desktop .game-container { bottom: 100px; }
    .desktop .footer {
        display: flex;
        align-items: center;
        gap: clamp(8px, 1.5vw, 20px);
        justify-content: flex-end;
        position: absolute;
        bottom: 32px;
        width: 100%;
        height: 68px;
        padding: 0 clamp(8px, calc((100vw - 580px) / 4), 50px);
        background: #000;
    }
    .footer .footer-discord-badge { margin-right: auto; }
}

/* Fullscreen button (FR-230): top right of the game, on every screen */
.game-buttons {
    position: absolute;
    top: max(8px, env(safe-area-inset-top, 0px));
    right: max(8px, env(safe-area-inset-right, 0px));
    z-index: 5;
    display: flex;
    gap: 8px;
}

.game-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    color: #fff;
    background: rgba(0, 0, 0, 0.45);
    border: 0;
    border-radius: 8px;
    cursor: pointer;
}

.game-button:hover { background: rgba(0, 0, 0, 0.65); }
.game-button:focus-visible { outline: 2px solid #3bc9ff; outline-offset: 2px; }

/* While fullscreen the page shows only the game */
body.fullscreen-active { overflow: hidden; }
body.fullscreen-active .play-area .game-container,
body.fullscreen-active.desktop .play-area .game-container { top: 0; left: 0; right: 0; bottom: 0; }
body.fullscreen-active .footer,
body.fullscreen-active .page-links { display: none !important; }

/* A short note when the browser refuses fullscreen */
.fullscreen-note {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 20;
    max-width: min(90vw, 420px);
    padding: 10px 16px;
    font: 15px/1.4 Arial, sans-serif;
    color: #fff;
    background: rgba(0, 0, 0, 0.85);
    border-radius: 8px;
    opacity: 0;
    transform: translateX(-50%);
    transition: opacity 0.2s;
    pointer-events: none;
}

.fullscreen-note.show { opacity: 1; }

/* Numbered steps sheet: Home Screen and install steps (FR-230, FR-231) */
.steps-overlay {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.55);
}

.steps-dialog {
    max-width: 380px;
    padding: 20px 22px;
    font: 16px/1.45 Arial, sans-serif;
    color: #111;
    text-align: left;
    background: #fff;
    border-radius: 12px;
}

.steps-dialog h2 { margin: 0 0 8px; font-size: 20px; }
.steps-dialog p { margin: 0 0 10px; }
.steps-dialog ol { margin: 0 0 16px; padding-left: 22px; }
.steps-dialog li { margin-bottom: 6px; }

.steps-close {
    display: block;
    width: 100%;
    min-height: 44px;
    font: bold 16px Arial, sans-serif;
    color: #fff;
    background: #1a73e8;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
}

/* Screen reader only text: the ride result announcement (FR-235) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.game-container:focus { outline: none; }
.game-container:focus-visible { outline: 2px solid #3bc9ff; outline-offset: -2px; }

/* The footer badges also sit in the guide below the game, where the footer isn't shown (phones, narrow windows) */
.home-guide .guide-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 4px 0 18px;
}
.guide-badges img { display: block; width: 135px; height: 40px; }
.guide-badges a:focus-visible { outline: 2px solid #3bc9ff; outline-offset: 2px; }
@media (min-width: 600px) {
    .desktop .home-guide .guide-badges { display: none; }
}
