body {
    margin: 0;
    padding: 0;
    background-color: #111;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden; /* Prevent scrolling */
    touch-action: none; /* Crucial for touch dragging */
    user-select: none;
    -webkit-user-select: none;
}

#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 15px 25px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    z-index: 100;
    pointer-events: none;
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.9);
}

#score-display {
    color: #fff;
}

#high-score-display {
    color: #ffd700;
}

#game-field {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    background: #15181a;
    background-image: 
        radial-gradient(#2a2d30 1px, transparent 1px),
        radial-gradient(#2a2d30 1px, transparent 1px);
    background-size: 60px 60px;
    background-position: 0 0, 30px 30px;
}

/* --- Entity Styles --- */

#bomb {
    position: absolute;
    left: 0; 
    top: 0;
    width: 40px; 
    height: 40px;
    margin-left: -20px; 
    margin-top: -20px; /* Offset for center origin */
    z-index: 50;
    cursor: grab;
}

#bomb:active {
    cursor: grabbing;
}

#bomb-body {
    width: 100%; 
    height: 100%;
    background: radial-gradient(circle at 30% 30%, #555, #111);
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5), inset -2px -2px 6px rgba(0,0,0,0.8);
    position: relative;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out, box-shadow 0.3s ease-out, background 0.3s ease-out;
}

/* Highlight reflection on the bomb */
#bomb-body::after {
    content: '';
    position: absolute;
    top: 5px; 
    left: 8px;
    width: 10px; 
    height: 10px;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
}

/* Fuse UI */
#fuse-bar-container {
    position: absolute;
    top: -20px; 
    left: -10px;
    width: 60px; 
    height: 8px;
    background-color: #222;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    transition: opacity 0.3s ease;
}

#fuse-bar {
    width: 100%; 
    height: 100%;
    background: linear-gradient(90deg, #ff0000, #ff8c00);
    box-shadow: 0 0 5px #ff4500;
}

/* Explosion state */
#bomb.exploded #bomb-body {
    background: #ff4500;
    box-shadow: 0 0 50px 20px #ff0000;
    transform: scale(4);
    opacity: 0;
}

#bomb.exploded #fuse-bar-container {
    opacity: 0;
}

/* Campfires (Hazards) */
.campfire {
    position: absolute;
    left: 0; 
    top: 0;
    width: 100px; 
    height: 100px;
    margin-left: -50px; 
    margin-top: -50px;
    border-radius: 50%;
    /* Visually fading out at 100% of radius */
    background: radial-gradient(circle, rgba(255, 120, 0, 0.8) 0%, rgba(255, 40, 0, 0.6) 80%, rgba(255, 0, 0, 0) 100%);
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 0 15px 5px rgba(255, 69, 0, 0.3);
}

.campfire::before {
    /* Wooden Logs */
    content: '';
    position: absolute;
    top: 50%; 
    left: 50%;
    width: 20px; 
    height: 20px;
    background: 
        linear-gradient(45deg, transparent 40%, #4a2e15 40%, #4a2e15 60%, transparent 60%),
        linear-gradient(-45deg, transparent 40%, #4a2e15 40%, #4a2e15 60%, transparent 60%);
    transform: translate(-50%, -50%);
    border-radius: 2px;
}

.campfire::after {
    /* Inner bright flame */
    content: '';
    position: absolute;
    top: 50%; 
    left: 50%;
    width: 40px; 
    height: 40px;
    background: radial-gradient(circle, rgba(255, 255, 100, 0.8) 0%, transparent 60%);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    mix-blend-mode: screen;
}

/* Water Puddles (Safe Zones) */
.water-puddle {
    position: absolute;
    left: 0; 
    top: 0;
    width: 100px; 
    height: 100px;
    margin-left: -50px; 
    margin-top: -50px;
    background: radial-gradient(circle at 30% 30%, #4facfe 0%, #00f2fe 80%, transparent 100%);
    pointer-events: none;
    z-index: 5;
    opacity: 0.8;
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.4);
    animation: puddle-wobble 4s infinite ease-in-out;
}

@keyframes puddle-wobble {
    0%, 100% { border-radius: 40% 60% 50% 50% / 50% 50% 60% 40%; }
    33% { border-radius: 50% 50% 40% 60% / 60% 40% 50% 50%; }
    66% { border-radius: 60% 40% 60% 40% / 40% 60% 40% 60%; }
}

/* --- Game Over UI --- */

#game-over-screen {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
    opacity: 1;
    transition: opacity 0.3s ease;
}

#game-over-screen.hidden {
    display: none;
    opacity: 0;
}

#game-over-screen h1 {
    font-size: 4rem;
    color: #ff4500;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(255, 69, 0, 0.8);
    text-transform: uppercase;
    letter-spacing: 2px;
}

#game-over-screen p {
    font-size: 1.5rem;
    margin: 10px 0;
}

.blink-text {
    margin-top: 30px !important;
    font-size: 1.2rem !important;
    color: #aaa;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Responsive adjustments */
@media (max-width: 600px) {
    #ui-layer {
        font-size: 1.2rem;
        padding: 10px 15px;
    }
    #game-over-screen h1 {
        font-size: 3rem;
    }
}
