body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #333;
    font-family: 'Courier New', Courier, monospace;
    overflow: hidden;
}

#game-container {
    position: relative;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    
    /* Better Responsive Logic */
    width: 100%;
    height: 100%;
    
    /* Constraint to keep aspect ratio 2:3 */
    max-width: calc(100vh * 0.66); /* Limit width based on height */
    max-height: calc(100vw * 1.5); /* Limit height based on width */
    
    aspect-ratio: 320/480;
    margin: auto; /* Center if constrained */
}

canvas {
    display: block;
    background-color: #70c5ce; 
    border: 2px solid #000;
    
    /* Crisp Pixel Art */
    image-rendering: pixelated; 
    
    width: 100%;
    height: 100%;
}

h1 {
    display: none; 
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; 
    display: flex;
    justify-content: center;
    align-items: center;
}

#start-screen {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #000;
    
    /* KEY FIX: allow clicks to pass through to canvas for starting */
    pointer-events: none; 
}

#game-over-screen {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #000;
    pointer-events: auto; /* Needs to catch clicks for the button */
}

.hidden {
    display: none !important;
}

button {
    background-color: #ffcc00;
    border: 2px solid #000;
    padding: 10px 20px;
    font-family: inherit;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
}


/* --- Buttons & Menus --- */

#settings-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid #000;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 20; /* Above UI layer */
    padding: 0;
}

#music-menu {
    background-color: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid #000;
    pointer-events: auto;
    width: 80%;
    max-width: 300px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.music-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 15px 0;
    max-height: 200px;
    overflow-y: auto;
}

.music-btn {
    background-color: #eee;
    padding: 8px;
    border: 1px solid #777;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.2s;
}

.music-btn:hover {
    background-color: #ddd;
}

.music-btn.selected {
    background-color: #70c5ce;
    border-color: #000;
    font-weight: bold;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
}

#close-menu-btn {
    background-color: #ff5722;
    color: white;
}


#wishes {
    color: #e91e63;
    font-size: 24px;
    margin-bottom: 10px;
}

/* --- Fancy Start Screen --- */

#start-screen h1 {
    display: block !important;
    font-size: 32px;
    margin: 10px 0;
    line-height: 1.2;
}

.sparkle-text {
    background: linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000);
    background-size: 400%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: rainbow 10s linear infinite;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

@keyframes rainbow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.balloons-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    font-size: 40px;
    margin-bottom: 10px;
}

.balloon {
    animation: float 3s ease-in-out infinite;
}
.b1 { animation-delay: 0s; }
.b2 { animation-delay: 1s; font-size: 45px; } /* Unicorn slightly bigger */
.b3 { animation-delay: 2s; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-15px) rotate(5deg); }
}

.pulse-instruct {
    font-size: 18px;
    color: #555;
    font-weight: bold;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.confetti-bg {
    font-size: 20px;
    margin-top: 10px;
    opacity: 0.7;
    animation: wiggle 2s ease-in-out infinite;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}
