html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #1b1235 0%, #05030b 60%, #020107 100%);
    color: #fdf7ff;
}

#game-root {
    width: 100%;
    max-width: 900px;
    height: 100vh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    padding: 10px;
}

#hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 12px;
    background: rgba(10, 5, 30, 0.85);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    font-size: 0.9rem;
}

.hud-item span {
    font-weight: 700;
    color: #ffe66d;
}

#playfield {
    position: relative;
    flex: 1;
    border-radius: 18px;
    overflow: hidden;
    background: url("assets/background_forest.png") center/cover no-repeat,
                radial-gradient(circle at top, #1b1235 0%, #05030b 60%, #020107 100%);
    box-shadow: 0 6px 20px rgba(0,0,0,0.6);
}

/* Firefly group */

.firefly-group {
    position: absolute;
    min-width: 60px;
    min-height: 40px;
    padding: 6px 10px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(255,255,200,0.9) 0%, rgba(255,255,200,0.1) 60%, transparent 100%);
    box-shadow: 0 0 18px rgba(255,255,200,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transform: translateY(0);
    transition: transform 0.1s ease-out;
}

.firefly-count {
    font-size: 1rem;
    font-weight: 700;
    color: #2b1740;
}

/* Spark burst */

.spark {
    position: absolute;
    width: 40px;
    height: 40px;
    background: url("assets/spark.png") center/contain no-repeat;
    pointer-events: none;
    animation: spark-pop 0.4s ease-out forwards;
}

@keyframes spark-pop {
    0% { transform: scale(0.4); opacity: 1; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* Overlay */

#messageOverlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(10,5,30,0.9), rgba(0,0,0,0.95));
    display: flex;
    align-items: center;
    justify-content: center;
}

.hidden {
    display: none !important;
}

.message-box {
    background: #1b1235;
    border-radius: 18px;
    padding: 20px 24px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(0,0,0,0.7);
}

.message-box h2 {
    margin-top: 0;
    margin-bottom: 8px;
    color: #ffe66d;
}

#playAgainBtn {
    margin-top: 12px;
    padding: 8px 16px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, #ff9f6b, #ff6bb5);
    color: #1b1235;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

#playAgainBtn:hover {
    transform: translateY(-1px);
}
