/* Importing Fonts */
@import url('https://fonts.googleapis.com/css2?family=Comic+Neue:wght@400;700&family=Poppins:wght@400;600&display=swap');

/* General Styling */
body, html {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    text-align: center;
    background: linear-gradient(135deg, #ffefba, #ffffff);
    color: #333;
    overflow-x: hidden;
}

/* Particle Background */
#particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: -4;
    top: 0;
    left: 0;
}

/* Vignette Overlay */
#vignette-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(0, 0, 0, 0.1) 60%, rgba(0, 0, 0, 0.6) 100%);
    z-index: -3;
}

/* Static Background with Glassy Effect */
#parallax-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://via.placeholder.com/1920x1080.webp?text=Alphabet_Adventures') center/cover no-repeat;
    z-index: -2;
    filter: blur(10px) brightness(0.7);
}

/* Top Bar (Glass Bar) */
#glass-bar {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    font-size: 1.5rem;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#glass-bar #player-stats span {
    margin-right: 15px;
    font-size: 1.8rem;
    color: #ffffff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

#glass-bar #controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Controls Styling */
#controls button {
    font-size: 1.5rem;
    padding: 10px 15px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.6);
    color: #333; /* Ensure emoji color contrasts with background */
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

#controls button:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.9);
}

#controls input[type="range"] {
    width: 150px;
    cursor: pointer;
    -webkit-appearance: none;
    background: #ccc;
    height: 5px;
    border-radius: 5px;
    outline: none;
    transition: background 0.3s;
}

#controls input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ff5722;
    cursor: pointer;
    transition: background 0.3s;
}

#controls input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ff5722;
    cursor: pointer;
    transition: background 0.3s;
}

/* Scoreboard */
#scoreboard {
    background: #003366;
    color: white;
    font-size: 1.8rem;
    padding: 15px;
    margin: 80px auto 20px auto; /* Adjusted margin-top to account for fixed top bar */
    text-align: center;
    max-width: 250px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Game Container */
#game-container {
    width: 95%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* Header */
header {
    padding: 20px;
    text-align: center;
    background: linear-gradient(90deg, #ff6f61, #ffcc00);
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
    font-size: 3rem;
    border-radius: 20px 20px 0 0;
    position: relative;
    z-index: 1;
}

header p {
    margin: 10px 0 0;
    font-size: 1.8rem;
    color: #ffeb3b;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* Puzzle Section */
#puzzle-section {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
    flex-wrap: wrap;
    gap: 20px;
}

#letters, #objects {
    width: 45%;
    padding: 20px;
    background: rgba(247, 247, 247, 0.8);
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-width: 300px;
    max-width: 500px;
}

/* Letters and Objects Styling */
.letter, .object {
    background: #ffdd99;
    color: #333;
    border-radius: 10px;
    margin: 15px;
    padding: 30px;
    font-size: 2rem;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
}

.letter:hover, .object:hover {
    transform: scale(1.1);
    background: #ffe0b2;
}

/* Footer */
footer {
    margin-top: 20px;
}

#restart-button {
    padding: 15px 30px;
    font-size: 1.5rem;
    background: #ff6f61;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.3s, transform 0.3s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

#restart-button:hover {
    background: #ff4436;
    transform: scale(1.05);
}

/* End Screen */
#end-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-radius: 20px;
    z-index: 2000;
    transition: opacity 0.5s ease;
    opacity: 0;
    pointer-events: none;
}

#end-screen.visible {
    opacity: 1;
    pointer-events: all;
}

#end-screen h2 {
    font-size: 3.5rem;
    margin-bottom: 20px;
}

#end-screen p {
    font-size: 2.5rem;
    margin-bottom: 30px;
}

#end-screen button {
    font-size: 2rem;
    padding: 20px 40px;
    background: linear-gradient(135deg, #76ff03, #00e5ff);
    border: none;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    transition: transform 0.3s, background 0.3s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

#end-screen button:hover {
    transform: scale(1.1);
    background: linear-gradient(135deg, #00e5ff, #76ff03);
    box-shadow: 0 6px 10px rgba(0,0,0,0.4);
}

/* Confetti Celebration */
#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 9999;
}

.confetti-piece {
    position: absolute;
    width: 15px;
    height: 15px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    animation: confettiFall 5s linear infinite;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100%) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Help Button Styling */
#help-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 20px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    transition: transform 0.2s, background 0.2s;
    z-index: 1001;
    font-size: 1.5rem;
    color: #333;
}

#help-button:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.9);
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    #glass-bar {
        width: 95%;
        padding: 15px;
    }
    
    #player-stats span {
        font-size: 1.6rem;
    }
    
    #controls button {
        font-size: 1.3rem;
        padding: 8px 12px;
    }
    
    #controls input[type="range"] {
        width: 120px;
    }
    
    #scoreboard {
        font-size: 1.6rem;
        max-width: 220px;
    }
    
    header {
        font-size: 2.5rem;
    }
    
    header p {
        font-size: 1.6rem;
    }
    
    .letter, .object {
        font-size: 1.8rem;
        padding: 25px;
        height: 90px;
    }
    
    #restart-button {
        font-size: 1.3rem;
        padding: 12px 25px;
    }
    
    #end-screen h2 {
        font-size: 3rem;
    }
    
    #end-screen p {
        font-size: 2rem;
    }
    
    #end-screen button {
        font-size: 1.8rem;
        padding: 18px 35px;
    }
}

@media (max-width: 768px) {
    #glass-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    #player-stats span {
        margin-right: 0;
        margin-bottom: 5px;
        font-size: 1.4rem;
    }
    
    #controls {
        width: 100%;
        justify-content: space-around;
    }
    
    #controls button {
        font-size: 1.2rem;
        padding: 8px 10px;
    }
    
    #controls input[type="range"] {
        width: 100px;
    }
    
    #scoreboard {
        font-size: 1.4rem;
        max-width: 200px;
    }
    
    header {
        font-size: 2.2rem;
    }
    
    header p {
        font-size: 1.4rem;
    }
    
    .letter, .object {
        font-size: 1.5rem;
        padding: 20px;
        height: 80px;
    }
    
    #restart-button {
        font-size: 1.2rem;
        padding: 10px 20px;
    }
    
    #end-screen h2 {
        font-size: 2.8rem;
    }
    
    #end-screen p {
        font-size: 1.8rem;
    }
    
    #end-screen button {
        font-size: 1.6rem;
        padding: 15px 30px;
    }
}

@media (max-width: 480px) {
    #glass-bar {
        padding: 10px;
    }
    
    #player-stats span {
        font-size: 1.2rem;
    }
    
    #controls button {
        font-size: 1rem;
        padding: 6px 8px;
    }
    
    #controls input[type="range"] {
        width: 80px;
    }
    
    #scoreboard {
        font-size: 1.2rem;
        max-width: 180px;
    }
    
    header {
        font-size: 1.8rem;
    }
    
    header p {
        font-size: 1.2rem;
    }
    
    .letter, .object {
        font-size: 1.3rem;
        padding: 15px;
        height: 70px;
    }
    
    #restart-button {
        font-size: 1rem;
        padding: 8px 16px;
    }
    
    #end-screen h2 {
        font-size: 2.2rem;
    }
    
    #end-screen p {
        font-size: 1.5rem;
    }
    
    #end-screen button {
        font-size: 1.4rem;
        padding: 12px 25px;
    }
}
