@import url('https://fonts.googleapis.com/css2?family=Lilita+One&family=Montserrat:ital,wght@1,800&display=swap');

* {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    margin: 0;
    padding: 0;
}

body,
html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #4bb3ff;
    font-family: 'Lilita One', cursive;
}

#game-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
}

#damage-flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 0, 0, 0.5);
    z-index: 5;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s ease-out;
}

#damage-flash.active {
    opacity: 1;
    transition: none;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none !important;
}

.screen>* {
    pointer-events: auto;
}

#preloader-screen {
    background: linear-gradient(to bottom, #1d82f7 0%, #6bc1ff 60%, #a2d8ff 100%);
    padding: 10% 20px 8% 20px;
    z-index: 100;
}

.logo-container {
    position: relative;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: scale(1.1);
    margin-top: 20px;
}

.speed-text {
    font-size: 5rem;
    color: #ffffff;
    line-height: 0.8;
    -webkit-text-stroke: 2px #0a2d75;
    text-shadow: 0px 6px 0px #0a2d75, 0px 8px 15px rgba(0, 0, 0, 0.4);
    z-index: 3;
    transform: rotate(-3deg);
    margin-bottom: -10px;
    margin-left: -15px;
}

.roll-text {
    font-size: 6.5rem;
    color: #ffcc00;
    background: -webkit-linear-gradient(#ffea00, #ff9500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    -webkit-text-stroke: 3px #0a2d75;
    filter: drop-shadow(0px 6px 0px #0a2d75) drop-shadow(0px 8px 10px rgba(0, 0, 0, 0.4));
    z-index: 2;
    position: relative;
}

.roll-text::after {
    content: "⚡";
    position: absolute;
    font-size: 3rem;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    -webkit-text-fill-color: #0a2d75;
    -webkit-text-stroke: 0px;
}

.ball-rush-banner {
    background: linear-gradient(to bottom, #ff1717, #cc0000);
    border: 4px solid #0a2d75;
    border-radius: 12px;
    padding: 5px 25px;
    font-family: 'Montserrat', sans-serif;
    font-style: italic;
    font-size: 1.8rem;
    color: #ffffff;
    text-transform: uppercase;
    box-shadow: 0px 5px 0px #0a2d75, 0px 10px 15px rgba(0, 0, 0, 0.5);
    z-index: 4;
    transform: translateY(-15px) rotate(-2deg);
}

.speed-lines {
    position: absolute;
    right: -20px;
    top: 40px;
    width: 40px;
    height: 60px;
}

.speed-line {
    width: 100%;
    height: 12px;
    background: #ffcc00;
    border: 2px solid #0a2d75;
    margin-bottom: 8px;
    transform: skewX(-30deg);
}

.speed-lines-left {
    left: -30px;
    top: 90px;
    right: auto;
}

.loading-section {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.loading-bar-container {
    width: 85%;
    height: 30px;
    background: #082c6c;
    border: 4px solid #367dff;
    border-radius: 15px;
    padding: 2px;
    box-shadow: 0 0 15px rgba(0, 100, 255, 0.5), inset 0px 3px 5px rgba(0, 0, 0, 0.5);
}

.loading-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(to bottom, #5dff5d, #00d200);
    border-radius: 8px;
    transition: width 0.1s linear;
    box-shadow: inset 0px 2px 3px rgba(255, 255, 255, 0.6);
}

.loading-text {
    font-family: 'Montserrat', sans-serif;
    font-style: italic;
    font-weight: 800;
    color: #ffffff;
    font-size: 1.5rem;
    margin-top: 15px;
    letter-spacing: 1px;
    text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.4);
}

.btn {
    background: linear-gradient(to bottom, #ffea00, #ff9500);
    border: 4px solid #0a2d75;
    color: #ffffff;
    font-family: 'Lilita One', cursive;
    font-size: 2rem;
    padding: 12px 40px;
    border-radius: 30px;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 6px 0 #0a2d75, 0 10px 15px rgba(0, 0, 0, 0.4);
    transition: transform 0.1s, box-shadow 0.1s;
    -webkit-text-stroke: 1px #0a2d75;
}

.btn:active {
    transform: translateY(6px);
    box-shadow: 0 0px 0 #0a2d75, 0 4px 5px rgba(0, 0, 0, 0.4);
}

#hud-screen {
    padding: 20px;
    justify-content: flex-start;
}

.hud-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.score-board {
    background: rgba(10, 45, 117, 0.8);
    border: 3px solid #367dff;
    color: #fff;
    font-size: 2rem;
    padding: 10px 20px;
    border-radius: 15px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
}

.lives-container {
    display: flex;
    gap: 8px;
    background: rgba(10, 45, 117, 0.8);
    border: 3px solid #367dff;
    padding: 10px 15px;
    border-radius: 15px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
}






.life-icon {
    width: 28px;
    height: 28px;
    color: #32cd32;
    font-size: 28px;
    line-height: 28px;
    text-align: center;

    text-shadow:
        1px 2px 0 #32cd32,
        0 0 6px #32cd32,
        0 0 12px rgba(93, 255, 23, 0.7);

    filter: drop-shadow(0 3px 2px rgba(0,0,0,0.35));

    transition: opacity 0.3s, transform 0.2s;
}



.life-icon.lost {
    opacity: 0.5;
    color: #ff1717;
    box-shadow: none;
    text-shadow:
        1px 2px 0 #ff1717,
        0 0 6px #ff1717,
        0 0 12px rgba(255, 23, 23, 0.7);

}

#menu-screen,
#gameover-screen {
    background: rgba(29, 130, 247, 0.85);
    justify-content: center;
    gap: 30px;
    backdrop-filter: blur(5px);
}


/* ==============================
HOW TO PLAY MODAL
============================== */

#how-to-play-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(5, 25, 75, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

#how-to-play-modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.how-to-play-box {
    width: min(92vw, 480px);
    background: linear-gradient(to bottom,
            #ffffff 0%,
            #eaf6ff 100%);
    border: 5px solid #0a2d75;
    border-radius: 28px;
    padding: 25px 25px 28px;
    box-shadow:
        0 10px 0 #0a2d75,
        0 20px 40px rgba(0, 0, 0, 0.45);
    text-align: center;
    transform: scale(1);
    animation: howToPlayPop 0.3s ease-out;
}

@keyframes howToPlayPop {
    0% {
        transform: scale(0.75);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.how-to-play-title {
    font-family: 'Lilita One', cursive;
    font-size: 3rem;
    line-height: 1;
    color: #ffcc00;
    -webkit-text-stroke: 2px #0a2d75;
    text-shadow:
        0 4px 0 #0a2d75,
        0 6px 10px rgba(0, 0, 0, 0.25);
    margin-bottom: 22px;
}

.how-to-play-items {
    display: flex;
    flex-direction: column;
    gap: 13px;
    margin-bottom: 25px;
}

.how-to-play-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #dff2ff;
    border: 3px solid #367dff;
    border-radius: 16px;
    padding: 13px 15px;
    text-align: left;
    box-shadow: 0 4px 0 rgba(10, 45, 117, 0.25);
}

.how-icon {
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(to bottom, #ffea00, #ff9500);
    border: 3px solid #0a2d75;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 3px 0 #0a2d75;
}

.how-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    line-height: 1.25;
    color: #0a2d75;
    font-weight: 800;
}

.how-text strong {
    display: block;
    font-family: 'Lilita One', cursive;
    font-size: 1.25rem;
    color: #0a2d75;
    margin-bottom: 2px;
}

#how-to-play-start {
    width: 100%;
    font-size: 1.8rem;
    padding: 12px 25px;
}

@media (max-width: 480px) {
    .how-to-play-box {
        padding: 20px 16px 23px;
        border-width: 4px;
        border-radius: 22px;
    }

    .how-to-play-title {
        font-size: 2.4rem;
    }

    .how-to-play-item {
        padding: 10px;
        gap: 11px;
    }

    .how-icon {
        flex-basis: 45px;
        width: 45px;
        height: 45px;
        font-size: 23px;
    }

    .how-text {
        font-size: 0.82rem;
    }

    .how-text strong {
        font-size: 1.1rem;
    }
}