body {
    margin: 0;
    height: 100vh;
    background: radial-gradient(circle at center, #180400 0%, #030100 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    cursor: pointer;
    transition: background 0.3s;
}

body.mega-flare {
    background: radial-gradient(circle at center, #3d0a00 0%, #030100 100%);
}

.instruction {
    position: absolute;
    top: 8%;
    color: rgba(255, 120, 50, 0.4);
    font-family: sans-serif;
    font-size: 14px;
    letter-spacing: 2px;
    pointer-events: none;
    text-align: center;
    line-height: 1.6;
}

.bonfire {
    position: relative;
    width: 300px;
    height: 400px;
    transition: transform 0.1s ease-out; 
}

/* 炎が立ちのぼる親グループ（コンテナ） */
.fire-stream {
    position: absolute;
    bottom: 90px;
    left: 50%;
    width: 1px;
    height: 1px;
    transform-origin: bottom center;
    mix-blend-mode: screen;
}

/* 初代の美しいロウソクの炎の流線型グラデーション */
.flame {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 50% 50% 20% 20% / 60% 60% 40% 40%;
    transform-origin: bottom center;
}

.flame.outer { background: linear-gradient(to top, #ff1a00, #ff5500 50%, transparent); filter: blur(5px); }
.flame.mid   { background: linear-gradient(to top, #ff4500, #ffaa00 60%, transparent); filter: blur(2px); }
.flame.core  { background: linear-gradient(to top, #ffaa00, #ffffff 75%, transparent); filter: blur(1px); }


/* --- 5つの炎をバラバラの位置で独立して揺らす（上書きバグ修正済） --- */

/* 炎1：中央奥 */
.flame-1 { animation: flicker-1 1.6s infinite ease-in-out alternate; }
.flame-1 .outer { width: 130px; height: 180px; opacity: 0.5; }
.flame-1 .mid   { width: 90px; height: 130px; }

/* 炎2：左寄り */
.flame-2 { animation: flicker-2 1.1s infinite ease-in-out alternate; animation-delay: -0.3s; }
.flame-2 .mid  { width: 80px; height: 180px; opacity: 0.7; }
.flame-2 .core { width: 45px; height: 110px; }

/* 炎3：右寄り */
.flame-3 { animation: flicker-3 0.8s infinite ease-in-out alternate; animation-delay: -0.6s; }
.flame-3 .outer { width: 100px; height: 220px; opacity: 0.4; }
.flame-3 .mid   { width: 70px; height: 160px; }

/* 炎4：中央手前（メインの芯） */
.flame-4 { animation: flicker-4 1.3s infinite ease-in-out alternate; animation-delay: -0.1s; }
.flame-4 .mid  { width: 80px; height: 190px; }
.flame-4 .core { width: 50px; height: 130px; }

/* 炎5：中央（高速な小さな火種） */
.flame-5 { animation: flicker-5 0.5s infinite ease-in-out alternate; animation-delay: -0.2s; }
.flame-5 .core { width: 45px; height: 90px; opacity: 0.9; }


/* --- 各アニメーション内で位置（translateX）を完全に維持 --- */
@keyframes flicker-1 {
    0% { transform: translateX(-5px) scaleX(0.95) scaleY(0.95) rotate(-1deg); }
    100% { transform: translateX(-2px) scaleX(1.05) scaleY(1.05) rotate(1deg); }
}
@keyframes flicker-2 {
    0% { transform: translateX(-38px) scaleX(1.05) scaleY(0.9) rotate(2deg); }
    100% { transform: translateX(-32px) scaleX(0.9) scaleY(1.1) rotate(-2deg); }
}
@keyframes flicker-3 {
    0% { transform: translateX(22px) scaleX(0.85) scaleY(1.2) rotate(-3deg); }
    100% { transform: translateX(28px) scaleX(1.15) scaleY(0.85) rotate(4deg); }
}
@keyframes flicker-4 {
    0% { transform: translateX(2px) scaleX(1.05) scaleY(0.95) rotate(1deg); }
    100% { transform: translateX(8px) scaleX(0.95) scaleY(1.05) rotate(-1deg); }
}
@keyframes flicker-5 {
    0% { transform: translateX(-18px) scaleX(0.8) scaleY(1.1) rotate(-4deg); }
    100% { transform: translateX(-12px) scaleX(1.2) scaleY(0.8) rotate(5deg); }
}


/* --- 乱雑に組まれた薪 --- */
.wood-pile {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 80px;
    z-index: 20;
}
.wood {
    position: absolute;
    background: #230d04;
    border-radius: 4px;
    box-shadow: inset 0 0 12px #000, 0 0 15px rgba(255, 50, 0, 0.5);
}
.wood.log1 { width: 150px; height: 24px; bottom: 15px; left: 10px; transform: rotate(-18deg); }
.wood.log2 { width: 140px; height: 22px; bottom: 25px; right: 10px; transform: rotate(25deg); background: #140702; }
.wood.log3 { width: 160px; height: 26px; bottom: 5px; left: 20px; transform: rotate(3deg); background: #2d1105; }
.wood.log4 { width: 110px; height: 20px; bottom: 30px; left: 45px; transform: rotate(-45deg); opacity: 0.8; }

.glow {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 260px;
    height: 60px;
    background: radial-gradient(ellipse, #ff3700 0%, transparent 70%);
    filter: blur(8px);
}

/* 火の粉（パーティクル） */
.spark {
    position: absolute;
    background: radial-gradient(circle, #ffffff 0%, #ffdd00 40%, #ff1a00 100%);
    border-radius: 50%;
    pointer-events: none;
    mix-blend-mode: screen;
    animation: flyUp var(--duration) cubic-bezier(0.25, 1, 0.5, 1) forwards; /* 減速が効く放物線用のイージング */
}

/* ★修正：噴水の軌道（頂点でふわっと一瞬とどまり消える）を再現 */
@keyframes flyUp {
    0% { 
        transform: translate(0, 0) scale(1); 
        opacity: 1; 
    }
    80% {
        opacity: 0.8;
    }
    100% { 
        transform: translate(var(--tx), var(--ty)) scale(0.2); 
        opacity: 0; 
    }
}