/* 1. Import Digital Font */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

/* === Base Layout === */
body {
    /* Keep centering and layout properties */
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    height: 100vh;
    font-family: 'Fredoka One', cursive;
    overflow: hidden;
    /* Remove background image and z-index from body */
    background: none; /* Make sure the body has no default background */
    overscroll-behavior: none;
    transition: all 0.3s ease;
    position: relative; /* Crucial: Needed for absolute positioning of ::before */
    z-index: 1; /* Crucial: Ensures content is above the background */
    padding-bottom: 70px;
}

    /* ⚠️ ADD THIS NEW SECTION */
    body::before {
        content: ''; 
        position: absolute;
        inset: 0; 
        background: url("../images/bg.webp") center/cover no-repeat;
        z-index: -1;
    }

/* === Floating Background (Sparkles / Candies) === */
.falling-object {
    position: absolute;
    width: 15px;
    height: 15px;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
    opacity: 0;
    z-index: -1;
}

/* === Clouds & Background Elements === */
.background-element {
    position: absolute;
    z-index: -1;
    filter: blur(2px);
}

.cloud {
    background-color: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* Default cloud layout (desktop) */
.cloud-1 {
    width: 120px;
    height: 80px;
    top: 10%;
    left: 5%;
}

.cloud-2 {
    width: 180px;
    height: 100px;
    top: 20%;
    right: 10%;
}

.cloud-3 {
    width: 150px;
    height: 90px;
    bottom: 15%;
    left: 8%;
}

.cloud-4 {
    width: 100px;
    height: 60px;
    bottom: 5%;
    right: 20%;
}

/* === Game Container === */
#gameContainer {
    text-align: center;
    width: 95%;
    max-width: 450px;
    position: relative;
    z-index: 10;
    padding-top: 20px;
    transform: scale(1.2);
}

/* === Score Bar (Themed) === */
#score-wrapper {
    position: relative;
    width: 90%;
    margin: -10px auto 0px;
    background: rgb(28 67 65 / 65%);
    border-radius: 20px;
    border: 2px solid #2fe988;
    padding: 10px 16px;
    transform: translateY(-8px);
    z-index: 9;
    box-shadow: 0 0 12px #01060e66, inset 0 0 8px #386d5733;
}

#score-wrapper {
    display: flex;
    justify-content: space-between; /* Pushes Score/Timer to edges */
    align-items: center;
    max-width: 1000px;
    border: 2px solid #2fe988;
    border-radius: 12px;
    padding: 10px 20px;
    box-shadow: 0 0 25px rgba(0, 255, 0, 0.4); /* Stronger neon glow */
}

/* === Header (Score + Timer) === */
#score-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5px;
    flex-wrap: wrap;
    margin-top: -23px;
}

#score-text {
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 6px #15bd68, 0 0 45px #1eff84;
    margin: 0;
    white-space: nowrap;
}

#timer-text {
    font-size: 16px;
    font-weight: bold;
    color: #00ffff;
    text-shadow: 0 0 6px #09040a, 0 0 12px #00ffffaa;
}

/* === Level Label === */
#level-label {
    margin-left: 10px;
    font-size: 15px;
    color: #ffffff;
    background: linear-gradient(90deg, #2fe988, #3f6e46);
    padding: 5px 12px;
    border-radius: 15px;
    display: inline-block;
    box-shadow: 0 0 40px #4affff88;
    font-weight: 600;
}

/* === Progress Bar === */
#progress-container {
    width: 95%;
    height: 18px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 9px;
    margin: 8px auto 0;
    box-shadow: inset 0 0 6px rgba(255, 255, 255, 0.3);
    overflow: hidden;
    border: 2px solid #ff00ff88;
    margin-top: -5px;
}

#progress-bar {
    height: 100%;
    width: var(--level-progress);
    background: linear-gradient(to right, #ff00ff, #ff66ff, #ff00cc);
    border-radius: 6px 0 0 6px;
    transition: width 0.5s ease-out;
    box-shadow: 0 0 10px #ff33ffcc;
}

/* Decorative glow accents */
#score-wrapper::before, #score-wrapper::after {
    content: '✨';
    position: absolute;
    font-size: 25px;
    top: -20px;
    color: #256b4b;
    text-shadow: 0 0 8px #2bcb7b;
}

#score-wrapper::before {
    left: -4px;
}

#score-wrapper::after {
    right: -2px;
}


/* === Game Board === */
#boardFrame {
    margin-top: 1px;
    /*background-image: url(../images/splash.jpg);*/
    background-color: transparent; /*#ff00ff;*/
    background: rgb(60 103 87 / 40%);
    /*border: 2px solid #2fe988 !important;*/ 
    box-shadow: 0 0 24px #1eff7b, inset 0 0 35px #00ffd033;
    border-radius: 20px;
    padding: 10px;
    position: relative;
    padding-top: 55px;
    padding-bottom: 0px;
}

    #boardFrame::before {
        content: '';
        display: flex;
        justify-content: center;
        align-items: center;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 40px;
        /* keep your background */
        background: linear-gradient(to top, #2fe988, #194d46);
        border-radius: 20px 20px 0 0;
        border-bottom: 5px solid #0c5346;
        /* position container for logo */
    }

    #boardFrame::after {
        content: '';
        position: absolute;
        top: 3px; /* adjust for vertical alignment */
        left: 50%;
        transform: translateX(-50%);
        width: 35px; /* adjust logo width */
        height: 35px; /* adjust logo height */
        background: url('../images/dome-logo.png') no-repeat center;
        background-size: contain;
        pointer-events: none; /* ensures clicks pass through */
    }


canvas {
    display: block;
    margin: 0 auto;
    width: 100%;
    max-width: 400px;
    height: auto;
    aspect-ratio: 400 / 478;
    border-radius: 15px;
    touch-action: none;
    /*background: #aadff4;*/
    background: transparent;
}

/* == buttons at the bottom == */
/* === Control Panel Layout === */
#control-panel {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 16px;
}

/* === Galaxy Candy Buttons === */
/* === Control Panel Layout === */
#control-panel {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 16px;
}

/* === Dark Galaxy Candy Buttons === */
/* === Control Panel Layout === */
#control-panel {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 16px;
}

/* === Dark Galaxy Candy Buttons === */
.game-button {
    width: 160px;
    height: 40px;
    font-size: 13px;
    font-weight: bold;
    border-radius: 14px;
    cursor: pointer;
    color: #fff;
    letter-spacing: 2px;
    font-family: 'Orbitron', monospace;
    background: linear-gradient(135deg, #30de82, #3d7b4d, #003d16);
    background-size: 300% 300%;
    border: 2px solid rgb(47 233 136);
    box-shadow: 0 0 12px rgb(66 255 142 / 60%), 0 0 24px rgb(0 255 173 / 25%), inset 0 0 8px rgba(255, 255, 255, 0.1);
    transition: all 0.4s ease;
    animation: pinkGlow 5s ease infinite;
}

    /* Hover — stronger neon pulse */
    .game-button:hover {
        background-position: right center;
        transform: scale(1.08);
        border-color: #2fe988;
        box-shadow: 0 0 20px rgb(9 241 70 / 80%), 0 0 40px #348f6d, 0 0 60px #26553d;
    }

    /* Pressed look */
    .game-button:active {
        transform: scale(0.95);
        filter: brightness(1.3);
    }

#leaderBoard {
    margin-top: -2px;
    padding-top: 11px;
    height: 25px !important;
    text-decoration: none;
    font-size: 13px;
}

.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 102vw;
    height: 102vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    z-index: 9999;
}

.loader {
    border: 6px solid #ccc;
    border-top: 6px solid #ff66ff;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.hidden {
    display: none;
}

/* Subtle animated shimmer */
@keyframes pinkGlow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}


/* === Game Over Popup (centered full screen) === */
.popup {
    position: fixed;
    top: 0;
    left: 4px;
    width: 100vw;
    height: 103vh;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

    .popup.hidden {
        display: none;
    }

.popup-content {
    background: radial-gradient(circle at top, #1a0026, #0a0013);
    border: 2px solid rgb(47 233 136);
    border-radius: 25px;
    padding: 30px 50px;
    text-align: center;
    box-shadow: 0 0 20px #2fe988, 0 0 40px #1e2329;
    animation: popupScale 0.4s ease-out;
    color: #fff;
}

    .popup-content h2 {
        color: #2fe988;
        text-shadow: #fff 0px 0px 1px, #1e2329 0px 0px 8px;
        margin-bottom: 25px;
        font-size: 1.8em;
    }

    .popup-content p {
        color: #00ffff;
        font-size: 1.2em;
        text-shadow: 0 0 8px #00ffff88;
        margin-bottom: 20px;
    }

    .popup-content .button-group {
        display: flex;
        justify-content: center;
        gap: 15px;
        margin-top: 20px;
        flex-wrap: wrap; /* ✅ makes them stack on small screens */
    }

    .popup-content .game-button {
        background: linear-gradient(45deg, #2fe988, #324d3a);
        color: white;
        border: none;
        padding: 5px 5px;
        border-radius: 15px;
        font-weight: bold;
        font-size: 15px;
        cursor: pointer;
        box-shadow: 0 0 12px #2fe988;
        transition: all 0.3s ease;
    }

        .popup-content .game-button:hover {
            background: linear-gradient(45deg, #2fe988, #1b5735);
            box-shadow: 0 0 20px #2fe988;
        }

#scoreText {
    margin-bottom: -15px;
    font-size: 15px;
    color: white;
}

#multiplierText {
    margin-bottom: -8px;
    font-size: 15px;
    color: rgb(47 233 136);
}

#finalScoreText {
    margin-bottom: 25px;
}


@keyframes popupScale {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}


/* Floating "+1.0s" tooltip-style animation above timer */
.bonus-float {
    position: absolute;
    left: 89%;
    bottom: 70%; /* appear right above the timer */
    transform: translateX(-50%) translateY(0);
    color: #2fe988; /* neon aqua text */
    background: rgba(50, 0, 80, 0.85); /* dark purple translucent bg */
    border: 1px solid #2fe988; /* neon pink border */
    border-radius: 8px;
    padding: 3px 8px;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 0 10px #ff00ff66, inset 0 0 6px #ff00ff33;
    text-shadow: 0 0 6px #09040a, 0 0 12px #00ffffaa;
    animation: floatTooltip 1s ease-out forwards;
    pointer-events: none;
    z-index: 99;
}


/* Start Game Overlay */
/* === Start Screen Overlay (inside board) === */
#startScreen {
    position: absolute;
    top: 0px;
    left: 0;
    width: 100%;
    height: 100%;
    background: url(../images/splash.gif) center center / contain no-repeat;
    background-color: #000; /* optional fallback */
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 20;
    transition: opacity 0.4s ease, transform 0.4s ease;
}


    #startScreen.hidden {
        opacity: 0;
        transform: scale(1.1);
        pointer-events: none;
    }

    #startScreen .start-content {
        text-align: center;
        color: white;
        text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    }

    #startScreen h1 {
        font-size: 36px;
        margin-bottom: 10px;
    }

    #startScreen p {
        font-size: 20px;
        opacity: 0.9;
    }

@keyframes pulseText {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}


@keyframes floatTooltip {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-25px);
    }
}

@media (max-width: 600px) {
    #gameContainer {
        transform: scale(0.95);
        padding-top: 40px;
    }
}


@media (min-width: 600px) and (max-height: 900px) {
    #gameContainer {
        transform: scale(0.9);
        padding-top: 0px !important;
    }
}

@media (min-width: 900px) {
    #gameContainer {
        transform: scale(1) !important;
        padding-top: 0px !important;
    }
}

@media (min-width: 900px) and (min-height: 900px) {
    #gameContainer {
        transform: scale(1.3) !important;
        padding-top: 60px;
    }
}

/* === Responsive Design === */
@media (max-width: 900px) {
    #score-text {
        font-size: 18px;
    }

    #level-text {
        font-size: 18px;
    }

    #boardFrame {
        border-width: 8px;
        padding-top: 50px;
    }
}

/* === Placeholder & Visibility === */
.btn-placeholder {
    display: inline-block;
    width: 59.41px;
    height: 30px;
}

@media (min-width: 600px) {
    body {
        padding: 10px 15px;
    }

    #gameContainer {
        width: 100%;
        /*padding-top: 42px;*/
        transform: scale(1.0);
    }

    #score-wrapper {
        width: 90%;
        padding: 8px 15px;
        margin-bottom: 0px;
    }

    #score-text {
        font-size: 18px;
    }

    #level-text {
        font-size: 16px;
    }

    canvas {
        max-width: 350px;
        border-radius: 10px;
        padding-top: 0px;
    }
}

@media (min-width: 600px) and (max-height: 700px) {
    #gameContainer {
        transform: scale(1) !important;
        padding-top: 40px;
    }
}


@media (max-width: 400px) {
    #score-text {
        font-size: 18px;
    }

    #level-text {
        font-size: 14px;
    }
}


@media (max-width: 540px) and (min-height: 1000px) {
    /* Styles for tall, narrow screens */
    #gameContainer {
        transform: scale(1);
        transition: transform 0.3s ease;
        padding-top: 120px;
    }
}

@media (min-width: 541px) and (min-height: 1000px) {
    /* Styles for tall, narrow screens */
    #gameContainer {
        transform: scale(1.3);
        transition: transform 0.3s ease;
        padding-top: 180px;
    }
}


/* === Tall Screens (1000px+) === */
@media (min-height: 1000px) {
    body {
        align-items: flex-start;
        height: auto;
        min-height: 1000px;
        padding-top: 40px;
        overflow-x: hidden;
    }
}

@media (max-height: 650px) {
    body {
        align-items: flex-start;
        overflow-y: auto;
        height: auto;
        padding-top: 20px;
        padding-bottom: 20px;
        padding-left: 4px;
    }
}


/* 2. Global Digital Look */
.digital-mono {
    font-family: 'Orbitron', monospace;
    color: #ccff66; /* Neon Green-Yellow Base */
    text-shadow: 0 0 5px rgba(204, 255, 102, 0.6);
    transition: all 0.3s ease-in-out;
}



/* 4. Center Element: LEVEL */
#level-label {
    position: absolute;
    margin-left: 39%;
    /* Flex properties */
    flex-grow: 1; /* Allows it to take up available space, helping centering */
    text-align: center;
    /* Aesthetics */
    color: #fff;
    font-size: 15px; /* Large and prominent */
    font-weight: 900;
    background: linear-gradient(135deg, #30de82, #3d7b4d, #003d16); /* Semi-transparent green background */
    border-radius: 6px;
    letter-spacing: 2px;
}

/* 5. Left/Right Elements: SCORE and TIMER */
#score-text, #timer-text {
    /* flex-grow: 1 ensures equal space distribution */
    flex-grow: 1;
    flex-shrink: 0;
    font-size: 1.4rem;
    font-weight: 700;
    text-transform: uppercase;
    min-width: 40px; /* ~160px minimum width */
}

/* Ensure Score is aligned to the left edge of its container */
#score-text {
    text-align: left;
}

/* Ensure Timer is aligned to the right edge of its container */
#timer-text {
    text-align: right;
    color: #ffffff;
    text-shadow: 0 0 5px rgb(47 233 136);
}

/* 6. Responsiveness for Mobile */
@media (max-width: 768px) {
    #score-wrapper {
        padding: 8px 10px;
        border-radius: 8px;
        width: 93% !important;
    }

    #score-text, #timer-text {
        font-size: 1rem;
    }

    #level-label {
        font-size: 1.2rem;
        padding: 1px 10px;
    }
}

/* ===== Fixed Footer Menu Bar ===== */
#footerMenu {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: rgba(15, 15, 15, 0.9);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 2px solid #2fe988;
    z-index: 9999;
}

    #footerMenu .footer-item {
        color: #fff;
        text-align: center;
        text-decoration: none;
        font-size: 14px;
        font-family: 'Fredoka One', sans-serif;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        opacity: 0.8;
        transition: 0.2s;
    }

        #footerMenu .footer-item:hover {
            opacity: 1;
            transform: translateY(-2px);
        }

        #footerMenu .footer-item span {
            font-size: 11px;
            letter-spacing: 0.5px;
        }

/* Mobile adjustments */
@media (max-width: 600px) {
    #footerMenu {
        height: 55px;
    }

        #footerMenu .footer-item {
            font-size: 12px;
        }

            #footerMenu .footer-item span {
                font-size: 10px;
            }
}

/* Splash Fullscreen */
#splashScreen {
    position: fixed;
    inset: 0;
    background: #000; /* or an image */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeOut 0.5s ease forwards;
    animation-delay: 3s; /* stays for 3 seconds */
}

/* Logo */
.splash-logo {
    width: 100px;
    height: auto;
    filter: drop-shadow(0 0 20px #2fe988);
    animation: pulse 1.5s infinite ease-in-out;
}

/* Logo breathing effect */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.9;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 0.9;
    }
}

/* Fade out after delay */
@keyframes fadeOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}
