:root {
    --bg-color: #FFFCF7;
    --primary: #FFC4D6;
    --secondary: #CCD5FF;
    --accent: #FFE5B4;
    --text-color: #4A4A4A;
    --white: #ffffff;
    --shadow: 0 10px 30px rgba(226, 198, 255, 0.4);
    --gold: #f1c40f;
    --danger: #e74c3c;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Quicksand', sans-serif;
    /* Load bg image, center it, and keep it fixed while scrolling */
    background: url('https://raw.githubusercontent.com/yunadata/yunadata.github.io/refs/heads/main/bubble-pop-bg.webp') no-repeat center center fixed; 
    background-size: cover; 
    color: var(--text-color);
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Animated Background (Blobs) --- */
.bg-decoration {
    position: fixed;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    z-index: -1;
    animation: float-blob 20s ease-in-out infinite;
}
.blob-1 { background: var(--primary); top: -100px; left: -100px; animation-delay: 0s; }
.blob-2 { background: var(--secondary); bottom: -100px; right: -100px; animation-delay: 5s; }
.blob-3 { background: var(--accent); top: 50%; right: 10%; animation-delay: 10s; }

@keyframes float-blob {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(50px, -50px) scale(1.1); }
    66% { transform: translate(-50px, 50px) scale(0.9); }
}

/* --- Navigation --- */
nav {
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    position: sticky; top: 0; z-index: 100;
    border-bottom: 1px solid rgba(255,255,255,0.3);
}
.nav-container {
    max-width: 1200px; margin: 0 auto;
    display: flex; justify-content: space-between; align-items: center;
}
.logo { font-weight: 700; font-size: 1.5rem; cursor: pointer; }
.btn-small {
    font-weight: 600; color: var(--text-color); padding: 8px 20px;
    border-radius: 20px; background: rgba(255, 196, 214, 0.2);
    text-decoration: none; transition: 0.3s;
}
.btn-small:hover { background: var(--primary); color: var(--white); }

/* --- Layout --- */
main {
    display: flex; justify-content: center; padding: 2rem;
    min-height: calc(100vh - 140px);
}
.game-layout {
    display: flex; flex-direction: column; align-items: center;
    gap: 30px; width: 100%; max-width: 1100px;
}

#game-wrapper {
    display: flex; gap: 20px;
    background: rgba(255,255,255,0.5); padding: 20px;
    border-radius: 20px; backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    justify-content: center; align-items: flex-start;
    flex-wrap: wrap;
}

/* --- Canvas --- */
.canvas-container {
    position: relative; border-radius: 12px; overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    background: #fff; border: 2px solid #fff;
}
canvas { display: block; max-width: 100%; height: auto; cursor: crosshair; }
#gameCanvas { 
    /* NEW: Very light pastel blue matching the start screen */
    background: linear-gradient(180deg, #E6F7FF 0%, #CDF0FF 100%);
}

/* --- Sidebar --- */
#ui-sidebar {
    width: 280px; background: var(--white);
    padding: 20px; border-radius: 12px;
    display: flex; flex-direction: column; gap: 15px;
    border: 1px solid rgba(255,255,255,0.6);
}
#ui-sidebar h2 { font-size: 1.2rem; text-align: center; margin-bottom: 10px; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-box {
    background: #f8f9fa; padding: 10px; border-radius: 8px;
    display: flex; flex-direction: column; align-items: center;
    font-weight: bold; font-size: 0.9rem;
}
.stat-box.gold span:last-child { color: var(--secondary); font-size: 1.2rem; }

#next-bubble-container {
    display: flex; justify-content: center; align-items: center;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 15px; padding: 10px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
}

.section-title {
    font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px;
    text-align: center; color: #95a5a6; margin-top: 10px;
}

/* --- Buttons --- */
.btn-game {
    width: 100%; padding: 12px; border: none; border-radius: 50px;
    cursor: pointer; font-weight: bold; font-family: 'Quicksand', sans-serif;
    font-size: 1rem; transition: 0.3s;
}
.btn-game.start {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white; width: 200px;
    box-shadow: 0 4px 15px rgba(255, 196, 214, 0.4);
}
.btn-game.start:hover { transform: scale(1.05); }
.btn-game.upgrade { background: #dfe6e9; color: #636e72; }
.btn-game.action { background: var(--secondary); color: white; margin-top: 10px; }

/* --- Overlay --- */
#overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    z-index: 10; text-align: center; backdrop-filter: blur(8px);
    padding: 20px;
}
#overlay h1 { font-size: 2.5rem; margin-bottom: 10px; color: var(--primary); text-shadow: 2px 2px 0px #fff; }
#overlay p { color: #7f8c8d; max-width: 300px; margin-bottom: 20px; line-height: 1.5; }

.hidden { display: none !important; }

/* --- Leaderboard --- */
#leaderboard-display {
    background: white; padding: 15px; border-radius: 10px;
    margin-bottom: 20px; width: 100%; max-width: 300px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}
#leaderboard-list {
    /* CHANGED: Increased from 120px to 160px to fit 5 items */
    max-height: 160px; 
    overflow-y: auto; font-size: 0.9rem; text-align: left;
}
.score-entry {
    display: flex; justify-content: space-between; padding: 5px 0;
    border-bottom: 1px solid #f1f1f1;
}
#player-name {
    padding: 10px; border-radius: 20px; border: 1px solid #ddd;
    text-align: center; font-family: 'Quicksand', sans-serif; width: 80%;
}
.final-score-text { font-size: 1.5rem; color: var(--secondary); font-weight: bold; margin-bottom: 10px; }

/* --- How to Play --- */
#how-to-play {
    background: rgba(255,255,255,0.6); border-radius: 20px; padding: 30px;
    text-align: center; width: 100%;
}
.instructions-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-top: 20px;
}
.instruction-card {
    background: white; padding: 20px; border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05); text-align: center;
}
.instruction-card .icon { font-size: 2rem; margin-bottom: 10px; color: var(--secondary); }
.instruction-card h3 { font-size: 1rem; margin-bottom: 5px; }
.instruction-card p { font-size: 0.85rem; color: #666; }

footer { text-align: center; padding: 20px; font-size: 0.8rem; opacity: 0.7; }

@media (max-width: 800px) {
    #game-wrapper { flex-direction: column; align-items: center; }
    #ui-sidebar { width: 100%; order: 2; }
    .canvas-container { order: 1; }
}







/* Add spacing below the score submission area */
#submit-score-container {
    margin-bottom: 25px; /* Creates the gap before the 'Play Again' button */
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}





/* --- MOBILE OVERLAY FIX --- */
@media (max-width: 600px) {
    /* 1. Enable Scrolling inside the canvas overlay */
    #overlay {
        overflow-y: auto;          /* Allows scrolling if content is too tall */
        justify-content: flex-start; /* Starts content at the top instead of center */
        padding-top: 20px;         /* Adds breathing room at the top */
        padding-bottom: 20px;      /* Ensures button isn't stuck to edge */
    }

    /* 2. Shrink Text & Margins to fit more content */
    #overlay h1 {
        font-size: 1.8rem;         /* Smaller title */
        margin-bottom: 5px;
    }
    
    #overlay p {
        font-size: 0.8rem;         /* Smaller description */
        margin-bottom: 10px;
    }

    /* 3. Reduce Leaderboard Height */
    #leaderboard-display {
        margin-bottom: 10px;
    }
    #leaderboard-list {
        max-height: 80px;          /* Show fewer scores before scrolling inside list */
    }

    /* 4. Tighten Score Input Area */
    #submit-score-container {
        margin-bottom: 15px;
    }
    .final-score-text {
        font-size: 1.2rem;
        margin-bottom: 5px;
    }

    /* 5. Ensure Play Button is safe */
    #start-btn {
        flex-shrink: 0;            /* Prevents button from being squashed */
        margin-top: 5px;
    }
}




/* --- Cookie Banner Fixes --- */
#btn-reopen-settings {

    /* White background with 80% opacity */
    background-color: rgba(255, 255, 255, 0.3) !important; 
    color: rgba(255, 255, 255, 0.8) !important; 
    
    /* Frosted glass effect */
    backdrop-filter: blur(10px) !important; 
    
    /* Adds a soft shadow so the white button doesn't disappear */
    box-shadow: 0 2px 10px rgba(74, 40, 40, 0.1) !important;
}

