* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    min-height: 100%;

    background: #050505;
}

body {
    overflow: hidden;

    color: #fff;

    font-family:
        Impact,
        "Arial Narrow",
        Arial,
        sans-serif;

    -webkit-font-smoothing: antialiased;
}

button,
a {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}


/* =========================================================
   TITLE SCREEN
========================================================= */

.title-screen {
    position: fixed;
    inset: 0;

    z-index: 1000;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    background: #050505;
}


.arcade-video {
    position: absolute;

    width: 100%;
    height: 100%;

    object-fit: contain;

    background: #050505;
}


.arcade-vignette {
    position: absolute;
    inset: 0;

    pointer-events: none;

    background:
        radial-gradient(
            circle at center,
            transparent 50%,
            rgba(0,0,0,.2) 74%,
            rgba(0,0,0,.72) 110%
        );
}


.press-start {
    position: absolute;

    left: 50%;
    top: 51%;

    transform:
        translate(-50%, -50%);

    z-index: 5;

    padding:
        12px 20px;

    border: none;

    background: transparent;

    color: #fff;

    font-family:
        "Courier New",
        monospace;

    font-size:
        clamp(19px, 2vw, 32px);

    font-weight: 900;

    letter-spacing: .15em;

    text-shadow:
        0 0 7px #fff,
        3px 0 #ae5cff,
        -3px 0 #42dfe8;

    animation:
        pressGlitch
        1.2s
        steps(2)
        infinite;
}


@keyframes pressGlitch {

    0%,
    84%,
    100% {
        opacity: .95;

        transform:
            translate(-50%, -50%);
    }

    87% {
        opacity: .45;

        transform:
            translate(
                calc(-50% - 3px),
                calc(-50% + 1px)
            );
    }

    91% {
        opacity: 1;

        transform:
            translate(
                calc(-50% + 4px),
                calc(-50% - 2px)
            );
    }

}


.title-back {
    position: absolute;

    z-index: 6;

    left: 22px;
    bottom: 22px;

    color:
        rgba(255,255,255,.65);

    text-decoration: none;

    font-family: Arial, sans-serif;

    font-size: 11px;

    letter-spacing: .12em;
}


/* =========================================================
   PAGE
========================================================= */

.racer-page {
    min-height: 100vh;
}


.game-shell {
    width: 100vw;
    min-height: 100vh;

    background: #080808;
}


.game-stage {
    position: relative;

    width: 100vw;

    height:
        calc(100vh - 78px);

    min-height: 580px;

    overflow: hidden;

    background: #1d2022;

    isolation: isolate;

    touch-action: none;
}


/* =========================================================
   FIENDZWORLD BACKGROUND
========================================================= */

.world-background {
    position: absolute;

    inset: 0;

    z-index: 1;

    background-image:
        linear-gradient(
            rgba(13,13,13,.18),
            rgba(13,13,13,.38)
        ),
        url("/assets/games/image0.jpg");

    background-size: cover;

    background-position:
        center center;

    transform:
        scale(1.04);

    filter:
        saturate(.78)
        contrast(1.08)
        brightness(.77);
}


/* =========================================================
   WARP PORTAL
========================================================= */

.warp-portal {
    position: absolute;

    z-index: 2;

    width:
        clamp(150px, 18vw, 300px);

    aspect-ratio: 1 / 1;

    right: 15%;
    top: 9%;

    overflow: hidden;

    border-radius: 50%;

    opacity: .7;

    mix-blend-mode: screen;

    pointer-events: none;

    filter:
        blur(.2px)
        contrast(1.25)
        saturate(1.2);

    box-shadow:
        0 0 30px
        rgba(145,91,255,.22),
        0 0 70px
        rgba(74,201,255,.11);

    animation:
        portalFloat
        5s
        ease-in-out
        infinite;
}


.warp-portal::after {
    content: "";

    position: absolute;

    inset: 0;

    border-radius: inherit;

    box-shadow:
        inset 0 0 35px
        rgba(0,0,0,.75);
}


.warp-portal video {
    width: 100%;
    height: 100%;

    object-fit: cover;

    transform:
        scale(1.22);
}


@keyframes portalFloat {

    0%,
    100% {
        transform:
            translateY(0)
            scale(1);
    }

    50% {
        transform:
            translateY(-7px)
            scale(1.025);
    }

}


.game-stage.nitro-active
.warp-portal {
    opacity: .95;

    filter:
        contrast(1.5)
        saturate(1.65)
        brightness(1.25);

    box-shadow:
        0 0 40px
        rgba(172,91,255,.55),
        0 0 100px
        rgba(74,201,255,.3);

    transform:
        scale(1.08);
}


/* =========================================================
   SMOKE
========================================================= */

.world-smoke {
    position: absolute;

    z-index: 3;

    left: 0;
    bottom: 0;

    width: 100%;
    height: 100%;

    object-fit: cover;

    pointer-events: none;

    opacity: .22;

    mix-blend-mode: screen;

    filter:
        grayscale(.3)
        contrast(.8);
}


/* =========================================================
   CANVAS
========================================================= */

.game-canvas {
    position: absolute;

    inset: 0;

    z-index: 10;

    width: 100%;
    height: 100%;

    display: block;
}


/* =========================================================
   ATMOSPHERE
========================================================= */

.game-grain,
.game-vignette {
    position: absolute;

    inset: 0;

    pointer-events: none;
}


.game-grain {
    z-index: 70;

    opacity: .035;

    background:
        repeating-radial-gradient(
            circle,
            rgba(255,255,255,.75)
            0 1px,
            transparent
            1px 4px
        );

    animation:
        grainMove
        .16s
        steps(2)
        infinite;
}


@keyframes grainMove {

    0% {
        transform: translate(0);
    }

    33% {
        transform:
            translate(-2px, 1px);
    }

    66% {
        transform:
            translate(2px, -1px);
    }

}


.game-vignette {
    z-index: 69;

    box-shadow:
        inset 0 0 170px
        rgba(0,0,0,.58);
}


/* =========================================================
   HUD
========================================================= */

.hud {
    position: absolute;

    z-index: 50;

    left: 22px;
    right: 22px;
    top: 18px;

    display: grid;

    grid-template-columns:
        1fr auto 1fr;

    align-items: start;

    pointer-events: none;
}


.hud-main {
    display: flex;

    gap: 12px;
}


.hud-right {
    justify-content: flex-end;

    padding-right: 170px;
}


.hud-stat,
.hud-score {
    min-width: 120px;

    padding:
        11px 15px;

    border:
        2px solid
        rgba(255,255,255,.22);

    background:
        rgba(10,10,10,.72);

    box-shadow:
        5px 5px 0
        rgba(0,0,0,.45);

    backdrop-filter:
        blur(7px);
}


.hud-stat > span,
.hud-score > span {
    display: block;

    margin-bottom: 3px;

    color: #d6c693;

    font-family: Arial, sans-serif;

    font-size: 10px;

    font-weight: 900;

    letter-spacing: .18em;
}


.hud-stat strong {
    color: #fff;

    font-size:
        clamp(25px,2.5vw,38px);

    line-height: 1;
}


.hud-stat small {
    color:
        rgba(255,255,255,.55);

    font-size: 9px;
}


.hud-score strong {
    display: block;

    color: #fff;

    font-size:
        clamp(25px,2.5vw,38px);

    line-height: 1;

    letter-spacing: .04em;
}


.hud-meow strong {
    color: #e4ba4e;
}


.hud-center {
    padding:
        10px 24px;

    display: flex;

    flex-direction: column;

    align-items: center;

    background:
        rgba(8,8,8,.6);

    border:
        2px solid
        rgba(255,255,255,.14);

    backdrop-filter:
        blur(7px);
}


.hud-center strong {
    color: #fff;

    font-size:
        clamp(15px,1.6vw,25px);

    letter-spacing: .1em;
}


.hud-center span {
    margin-top: 3px;

    color: #d3b85b;

    font-family: Arial, sans-serif;

    font-size: 9px;

    font-weight: 900;

    letter-spacing: .14em;
}


/* =========================================================
   MENU BUTTONS
========================================================= */

.game-menu-buttons {
    position: absolute;

    z-index: 55;

    right: 22px;
    top: 18px;

    display: flex;

    gap: 7px;
}


.game-menu-buttons button {
    min-height: 45px;

    padding:
        0 14px;

    border:
        2px solid
        rgba(255,255,255,.25);

    background:
        rgba(8,8,8,.82);

    color: #fff;

    font-family: Arial, sans-serif;

    font-size: 9px;

    font-weight: 900;

    letter-spacing: .09em;

    backdrop-filter:
        blur(6px);
}


/* =========================================================
   METERS
========================================================= */

.bottom-meter-panel {
    position: absolute;

    z-index: 50;

    left: 22px;
    bottom: 20px;

    width: min(460px,45%);

    display: flex;

    gap: 18px;
}


.meter {
    flex: 1;

    display: grid;

    grid-template-columns:
        52px 1fr;

    align-items: center;

    gap: 8px;
}


.meter > span {
    color: #fff;

    font-family: Arial, sans-serif;

    font-size: 9px;

    font-weight: 900;

    letter-spacing: .13em;
}


.meter-track {
    height: 12px;

    overflow: hidden;

    border:
        2px solid
        rgba(255,255,255,.2);

    background:
        rgba(0,0,0,.65);
}


.meter-fill {
    width: 100%;
    height: 100%;

    transition:
        width .08s linear;
}


.health-fill {
    background:
        linear-gradient(
            90deg,
            #9f2e25,
            #dc6338,
            #efb54e
        );
}


.nitro-fill {
    background:
        linear-gradient(
            90deg,
            #fb497b,
            #ad66e8,
            #4ddbec
        );
}


/* =========================================================
   EVENTS
========================================================= */

.event-message {
    position: absolute;

    z-index: 65;

    left: 50%;
    top: 24%;

    opacity: 0;

    color: #fff;

    font-size:
        clamp(34px,6vw,82px);

    font-weight: 900;

    white-space: nowrap;

    pointer-events: none;

    text-shadow:
        5px 5px #000,
        -3px 0 #d753f3,
        3px 0 #46e5df;

    transform:
        translateX(-50%)
        rotate(-3deg);
}


.event-message.show {
    animation:
        eventShow
        .85s
        ease
        forwards;
}


@keyframes eventShow {

    0% {
        opacity: 0;

        transform:
            translate(-50%,20px)
            scale(.65)
            rotate(-7deg);
    }

    20% {
        opacity: 1;

        transform:
            translate(-50%,0)
            scale(1.08)
            rotate(-3deg);
    }

    72% {
        opacity: 1;
    }

    100% {
        opacity: 0;

        transform:
            translate(-50%,-55px)
            rotate(2deg);
    }

}


/* =========================================================
   OVERLAYS
========================================================= */

.overlay {
    position: absolute;

    z-index: 100;

    inset: 0;

    padding: 25px;

    display: flex;

    justify-content: center;
    align-items: center;

    background:
        rgba(8,7,10,.87);

    backdrop-filter:
        blur(10px);
}


.menu-panel,
.inventory-panel {
    width:
        min(660px,100%);

    max-height:
        90%;

    overflow-y: auto;

    padding:
        38px;

    border:
        2px solid
        rgba(255,255,255,.24);

    background:
        linear-gradient(
            145deg,
            rgba(54,31,66,.95),
            rgba(17,24,29,.97)
        );

    box-shadow:
        9px 9px 0
        rgba(0,0,0,.5);
}


.menu-label {
    color: #ddbc64;

    font-family: Arial, sans-serif;

    font-size: 10px;

    font-weight: 900;

    letter-spacing: .17em;
}


.menu-panel h2,
.inventory-header h2 {
    margin:
        8px 0 25px;

    color: #fff;

    font-size:
        clamp(55px,8vw,100px);

    line-height: .78;

    letter-spacing: -.04em;

    text-shadow:
        5px 5px #000;
}


.menu-panel p {
    color:
        rgba(255,255,255,.65);

    font-family: Arial, sans-serif;

    font-size: 12px;
}


.menu-primary,
.menu-secondary,
.menu-danger,
.menu-link {
    width: 100%;

    min-height: 54px;

    margin-top: 8px;

    display: flex;

    align-items: center;
    justify-content: center;

    border:
        2px solid
        rgba(255,255,255,.22);

    text-decoration: none;

    font-family: Arial, sans-serif;

    font-size: 11px;

    font-weight: 900;

    letter-spacing: .11em;
}


.menu-primary {
    background:
        linear-gradient(
            90deg,
            #d953f3,
            #53d8e2
        );

    color: #101014;
}


.menu-secondary {
    background:
        rgba(255,255,255,.08);

    color: #fff;
}


.menu-danger {
    background:
        rgba(179,54,56,.28);

    color: #fff;
}


.menu-link {
    border-color: transparent;

    background: transparent;

    color:
        rgba(255,255,255,.5);
}


/* =========================================================
   INVENTORY
========================================================= */

.inventory-panel {
    width:
        min(900px,100%);
}


.inventory-header {
    display: flex;

    justify-content: space-between;

    gap: 20px;
}


.close-button {
    width: 48px;
    height: 48px;

    border:
        2px solid
        rgba(255,255,255,.25);

    background: #111;

    color: #fff;

    font-size: 24px;
}


.inventory-tabs {
    display: flex;

    gap: 7px;

    margin-bottom: 15px;
}


.inventory-tab {
    min-height: 45px;

    padding:
        0 20px;

    border:
        2px solid
        rgba(255,255,255,.15);

    background: #151515;

    color:
        rgba(255,255,255,.6);

    font-family: Arial, sans-serif;

    font-size: 10px;

    font-weight: 900;
}


.inventory-tab.active {
    background: #e2c05f;

    color: #141414;
}


.inventory-grid {
    display: grid;

    grid-template-columns:
        repeat(3,1fr);

    gap: 10px;
}


.inventory-item {
    min-height: 165px;

    padding: 15px;

    display: flex;

    flex-direction: column;

    gap: 8px;

    align-items: center;

    justify-content: center;

    border:
        2px solid
        rgba(255,255,255,.13);

    background:
        rgba(0,0,0,.28);

    color: #fff;
}


.inventory-item.selected {
    border-color: #e7c459;

    box-shadow:
        inset 0 0 22px
        rgba(231,196,89,.12);
}


.inventory-item.locked {
    opacity: .4;
}


.inventory-item strong {
    font-size: 19px;
}


.inventory-item span,
.inventory-item small {
    font-family: Arial, sans-serif;

    font-size: 9px;

    font-weight: 900;

    letter-spacing: .1em;

    color:
        rgba(255,255,255,.58);
}


.item-preview {
    width: 72px;
    height: 72px;

    border-radius: 50%;

    margin-bottom: 5px;
}


.fire-preview {
    background:
        radial-gradient(
            circle at 50% 70%,
            #fff2a6,
            #ff7a35 30%,
            #c52b24 57%,
            transparent 72%
        );

    filter:
        drop-shadow(
            0 0 12px #ff5b35
        );
}


.bubbles-preview {
    background:
        radial-gradient(
            circle at 35% 32%,
            #fff,
            #8deaff 18%,
            transparent 22%
        ),
        radial-gradient(
            circle at 68% 52%,
            #fff,
            #db88ff 16%,
            transparent 20%
        ),
        radial-gradient(
            circle at 40% 76%,
            #fff,
            #7df6da 14%,
            transparent 18%
        );
}


.locked-preview {
    display: flex;

    align-items: center;
    justify-content: center;

    background: #111;

    font-size: 30px;
}


.trick-card {
    min-height: 140px;
}


.key-combo {
    padding:
        7px 10px;

    background: #111;

    border:
        1px solid
        rgba(255,255,255,.17);
}


.inventory-help {
    margin-top: 20px;

    padding-top: 15px;

    display: flex;

    flex-wrap: wrap;

    justify-content: center;

    gap: 15px;

    border-top:
        1px solid
        rgba(255,255,255,.14);
}


.inventory-help span {
    display: flex;

    flex-direction: column;

    align-items: center;

    color: #e7c460;

    font-family: Arial, sans-serif;

    font-size: 9px;

    font-weight: 900;
}


.inventory-help strong {
    margin-top: 3px;

    color:
        rgba(255,255,255,.55);

    font-size: 8px;
}


/* =========================================================
   MOBILE
========================================================= */

.mobile-controls {
    height: 78px;

    padding: 6px;

    display: none;

    grid-template-columns:
        repeat(5,1fr);

    gap: 5px;

    background: #090909;
}


.mobile-controls button {
    border:
        2px solid
        rgba(255,255,255,.18);

    background: #181818;

    color: #fff;

    font-family: Arial, sans-serif;

    font-size: 9px;

    font-weight: 900;

    touch-action: manipulation;
}


.mobile-drive {
    background: #d8b34f !important;

    color: #151515 !important;
}


.mobile-nitro {
    background:
        linear-gradient(
            135deg,
            #d64ee9,
            #3acfdc
        ) !important;

    color: #111 !important;
}


/* =========================================================
   MOBILE RESPONSIVE
========================================================= */

@media (max-width: 760px) {

    .game-stage {
        height:
            calc(100svh - 72px);

        min-height: 420px;
    }


    .mobile-controls {
        display: grid;
    }


    .hud {
        left: 7px;
        right: 7px;
        top: 7px;

        grid-template-columns:
            auto 1fr auto;
    }


    .hud-main {
        gap: 4px;
    }


    .hud-right {
        padding-right: 0;
    }


    .hud-score {
        display: none;
    }


    .hud-stat {
        min-width: 68px;

        padding:
            7px 9px;
    }


    .hud-stat > span {
        font-size: 7px;
    }


    .hud-stat strong {
        font-size: 19px;
    }


    .hud-center {
        justify-self: center;

        padding:
            7px 10px;
    }


    .hud-center strong {
        font-size: 10px;
    }


    .hud-center span {
        display: none;
    }


    .game-menu-buttons {
        right: 7px;
        top: 76px;
    }


    .game-menu-buttons button {
        min-height: 36px;

        padding:
            0 8px;

        font-size: 7px;
    }


    .bottom-meter-panel {
        left: 8px;
        bottom: 8px;

        width: 62%;
    }


    .meter {
        grid-template-columns:
            34px 1fr;
    }


    .meter > span {
        font-size: 7px;
    }


    .inventory-grid {
        grid-template-columns:
            repeat(2,1fr);
    }


    .inventory-panel,
    .menu-panel {
        padding: 22px;
    }


    .press-start {
        top: 50%;
    }

}