/* Balloon Pop Game Styles - Based on Template */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Dark Theme Base */
body.dark-theme {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: #e0e0e0; /* Light gray text */
    background-color: #121212; /* Very dark grey background */
    display: flex; /* Used for sticky footer */
    flex-direction: column; /* Used for sticky footer */
    min-height: 100vh; /* Used for sticky footer */
}

/* Container */
.container {
    max-width: 1100px; /* Slightly wider for game focus */
    margin: 0 auto;
    padding: 0 20px;
}

/* Game Page Header */
.game-page-header {
    background-color: #1f1f1f; /* Dark header */
    padding: 0.8rem 0;
    border-bottom: 1px solid #333;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    flex-shrink: 0; /* Prevent header from shrinking */
}

.back-link {
    color: #bb86fc; /* Accent color */
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: #e0e0e0; /* Lighter on hover */
}

/* Main Game Content Area */
.game-content {
    padding: 2rem 0;
    flex-grow: 1; /* Allows main content to fill space for sticky footer */
    display: flex;
    flex-direction: column;
    align-items: center; /* Center content vertically within flex */
}

.game-title {
    font-size: 2.2rem;
    font-weight: 600;
    color: #bb86fc; /* Accent color */
    text-align: center;
    margin-bottom: 1.5rem;
}

/* Game Info Section */
.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 1.1rem;
    max-width: 800px;
    width: 100%;
}

/* The Game Container - CRITICAL STYLING */
#game-container {
    width: 100%; /* Take full width of container */
    max-width: 800px; /* Max width for the game itself */
    min-height: 500px; /* Example minimum height */
    background-color: #2a2a2a; /* Slightly different dark shade */
    border: 2px solid #444;
    border-radius: 8px;
    margin: 0 auto 2rem auto; /* Center horizontally, add bottom margin */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
    overflow: hidden; /* Hide anything sticking out */
    position: relative; /* Useful if game elements use absolute positioning */
    display: flex; /* Allows contents to fill container */
    justify-content: center;
    align-items: center;
}

/* Balloon Game Area */
#game-area {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 400px;
    overflow: hidden;
}

/* Controls for Balloon Pop */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    margin-bottom: 30px;
    flex-wrap: nowrap;
    position: relative;
    max-width: 800px;
    width: 100%;
}

/* Game Over Text */
.game-over-text {
    color: #ff6b6b;
    font-weight: bold;
    font-size: 2rem;
    text-shadow: 0 0 10px rgba(255, 107, 107, 0.8);
    display: none;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 10px 20px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    z-index: 100;
    white-space: nowrap;
    pointer-events: none; /* Allows clicking through the text */
}

.game-over-text.visible {
    display: block;
}

/* Buttons */
button {
    background: linear-gradient(45deg, #bb86fc, #c399fc); /* Match template accent color */
    border: none;
    border-radius: 50px;
    color: white;
    padding: 10px 20px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(187, 134, 252, 0.3);
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(187, 134, 252, 0.5);
}

button:active {
    transform: translateY(0);
}

/* Difficulty Buttons */
.difficulty {
    display: flex;
    gap: 8px;
}

.diff-btn {
    font-size: 0.8rem;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

.diff-btn.active {
    background: linear-gradient(45deg, #bb86fc, #c399fc);
    box-shadow: 0 5px 15px rgba(187, 134, 252, 0.3);
}

/* Balloon specific styling */
.balloon {
    position: absolute;
    cursor: pointer;
    transform-origin: bottom center;
    animation: float linear forwards;
    transition: transform 0.05s;
}

.balloon:hover {
    transform: scale(1.05);
}

.balloon::before { /* Balloon string */
    content: '';
    position: absolute;
    width: 1px;
    height: 25px;
    background: rgba(255, 255, 255, 0.7);
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
}

.balloon-red {
    background: radial-gradient(circle at 30% 30%, #ff5252, #d50000);
}

.balloon-blue {
    background: radial-gradient(circle at 30% 30%, #448aff, #2962ff);
}

.balloon-green {
    background: radial-gradient(circle at 30% 30%, #69f0ae, #00c853);
}

.balloon-yellow {
    background: radial-gradient(circle at 30% 30%, #ffff00, #ffd600);
}

.balloon-purple {
    background: radial-gradient(circle at 30% 30%, #e040fb, #aa00ff);
}

/* Gold balloon with glow effect */
.balloon-gold {
    background: radial-gradient(circle at 30% 30%, #ffeb3b, #ffc107);
    box-shadow: 0 0 20px 8px rgba(255, 215, 0, 0.8);
    animation: float linear forwards, glowing 1.5s infinite alternate;
    z-index: 10; /* Make gold balloons appear on top */
}

/* Lead balloon */
.balloon-lead {
    background: radial-gradient(circle at 30% 30%, #9e9e9e, #424242);
    border: 1px solid #212121;
}

/* Bomb balloon */
.balloon-bomb {
    background: radial-gradient(circle at 30% 30%, #444, #000);
    border: 2px solid #ff3333;
    box-shadow: 0 0 10px 2px rgba(255, 0, 0, 0.5);
}

/* Slow-Mo balloon */
.balloon-slowmo {
    background: radial-gradient(circle at 30% 30%, #00e5ff, #0091ea);
    border: 2px solid #80d8ff;
    box-shadow: 0 0 10px 2px rgba(0, 229, 255, 0.6);
}

/* Slow-Mo effect overlay */
.slowmo-overlay {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 229, 255, 0.2);
    border: 2px solid #00e5ff;
    border-radius: 20px;
    padding: 5px 15px;
    color: #00e5ff;
    font-weight: bold;
    z-index: 50;
    pointer-events: none;
    box-shadow: 0 0 15px 5px rgba(0, 229, 255, 0.3);
}

/* Bomb explosion effect */
.explosion {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, #ff5722, #ff9800, transparent);
    opacity: 0;
    z-index: 30;
    animation: explosion 0.8s ease-out forwards;
}

@keyframes explosion {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    70% {
        opacity: 0.7;
    }
    100% {
        transform: scale(20);
        opacity: 0;
    }
}

/* Fireworks effect for gold balloon */
.firework {
    position: absolute;
    border-radius: 50%;
    animation: firework 0.8s forwards;
    z-index: 15;
    filter: brightness(1.3);
}

.pop-effect {
    position: absolute;
    border-radius: 50%;
    animation: pop 0.5s forwards;
    z-index: 5;
}

.game-over {
    display: none;
}

/* Game Instructions Area */
.game-instructions {
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 1rem 1.5rem;
    max-width: 700px;
    width: 90%;
    margin: 0 auto; /* Center instructions */
    text-align: center;
}

.game-instructions h2 {
    font-size: 1.3rem;
    color: #e0e0e0;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.game-instructions p {
    font-size: 0.95rem;
    color: #a0a0a0;
    line-height: 1.7;
}

/* Footer Styles (Copied from template for consistency) */
.site-footer {
    background-color: #1f1f1f;
    color: #a0a0a0;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: auto; /* Pushes footer to bottom (with flexbox) */
    font-size: 0.9rem;
    border-top: 1px solid #333;
    flex-shrink: 0; /* Prevent footer from shrinking */
}

.site-footer p {
    margin: 0;
}

/* Animations */
@keyframes float {
    from { bottom: 20px; }
    to { bottom: 100%; }
}

@keyframes pop {
    0% {
        transform: translate(-50%, -50%) scale(0.3) rotate(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) translate(calc(cos(var(--angle)) * 30px), calc(sin(var(--angle)) * 30px)) scale(0) rotate(360deg);
        opacity: 0;
    }
}

/* Glowing animation for gold balloon */
@keyframes glowing {
    from { box-shadow: 0 0 20px 8px rgba(255, 215, 0, 0.8); }
    to { box-shadow: 0 0 30px 15px rgba(255, 215, 0, 0.9); }
}

/* Firework animation */
@keyframes firework {
    0% {
        transform: translate(-50%, -50%) scale(0.1);
        opacity: 1;
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) translate(calc(cos(var(--angle)) * 40px), calc(sin(var(--angle)) * 40px)) scale(0.6);
    }
    100% {
        transform: translate(-50%, -50%) translate(calc(cos(var(--angle)) * 100px), calc(sin(var(--angle)) * 100px)) scale(0.1);
        opacity: 0;
    }
}

/* Point indicator for lead balloon */
.point-indicator {
    position: absolute;
    color: #ff3333;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
    animation: scoreIndicator 1.2s forwards;
    z-index: 20;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .game-title {
        font-size: 1.8rem;
    }
    #game-container {
        min-height: 400px;
    }
    .game-info {
        font-size: 0.9rem;
    }
    #game-area {
        min-height: 350px;
    }
    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .difficulty {
        display: flex;
        justify-content: space-between;
    }
    button {
        width: 100%;
    }
    .diff-btn {
        width: 32%;
        font-size: 0.7rem;
        padding: 6px 0;
    }
    .game-over-text {
        position: static;
        transform: none;
        margin: 5px 0;
        text-align: center;
        width: 100%;
    }
    .game-instructions {
        width: 95%;
        padding: 0.8rem 1rem;
    }
    .game-instructions h2 {
        font-size: 1.2rem;
    }
    .game-instructions p {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 1.5rem;
    }
    #game-container {
        min-height: 350px;
        max-width: 100%;
    }
    #game-area {
        min-height: 350px;
    }
    .back-link {
        font-size: 0.9rem;
    }
    .diff-btn {
        font-size: 0.7rem;
        padding: 6px 0;
    }
}