/* --- ベースレイアウト --- */
body { 
    background-color: #1a1a1a; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    height: 100vh; 
    margin: 0; 
    font-family: "Helvetica Neue", Arial, sans-serif;
    overflow: hidden; 
}

.game-container { 
    width: 600px; 
    height: 400px; 
    background-color: #f8f8f8; 
    border: 4px solid #fff; 
    border-radius: 12px; 
    display: flex; 
    flex-direction: column; 
    overflow: hidden; 
    position: relative; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
}

/* --- 特殊エフェクト：閃光と振動 --- */
#flash-overlay { 
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
    background: white; opacity: 0; pointer-events: none; z-index: 100; 
}
.flash-active { animation: flash-anim 0.15s ease-out; }
@keyframes flash-anim { 0% { opacity: 0.9; } 100% { opacity: 0; } }

.shake-active { animation: shake-anim 0.3s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake-anim {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(4px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
    40%, 60% { transform: translate3d(6px, 0, 0); }
}

/* --- バトルフィールド --- */
.battle-scene { 
    flex: 3; position: relative; padding: 20px; 
    background-image: linear-gradient(180deg, #3c2a5a 0%, #120a1d 100%); 
}

.hud { 
    background: rgba(255, 255, 255, 0.95); border: 2px solid #333; 
    border-radius: 8px; padding: 10px; position: absolute; width: 170px; z-index: 10; font-size: 13px; 
}
.enemy-hud { top: 20px; left: 20px; }
.player-hud { bottom: 20px; right: 20px; }

.hp-bar-container { 
    width: 100%; height: 12px; background-color: #444; 
    border: 1px solid #000; border-radius: 6px; overflow: hidden; margin-top: 6px;
}
.hp-fill { height: 100%; background-color: #4caf50; width: 100%; transition: width 0.4s ease; }
.hp-text { text-align: right; margin-top: 3px; font-weight: bold; color: #333; }

.sprite { width: 110px; height: 110px; position: absolute; border-radius: 15px; transition: background-color 0.5s; }
#enemy-sprite-box { background-color: #ff6b6b; top: 65px; right: 60px; }
#player-sprite-box { background-color: #4dabf7; bottom: 45px; left: 60px; }

.dark-blizzard-style { background-color: #89c4f4 !important; border: 2px solid #fff; }
.king-blizzard-style { 
    background-color: #2e0854 !important; border: 3px solid #ff00ff !important; 
    box-shadow: 0 0 25px #ff00ff !important; 
}

/* --- 操作パネル --- */
.ui-container { flex: 1.6; background-color: #333; color: white; display: flex; border-top: 4px solid #000; }
.message-box { flex: 1.3; padding: 18px; font-size: 15px; border-right: 2px solid #555; line-height: 1.6; background-color: #2a2a2a; }
.command-box { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; }

button { cursor: pointer; background: #fff; border: 2px solid #000; font-weight: bold; border-radius: 6px; font-size: 12px; transition: all 0.1s; }
button:active:not(:disabled) { transform: translateY(2px); background-color: #ddd; }
button:disabled { background-color: #666; color: #999; cursor: not-allowed; }
.span-wide { grid-column: 1 / 3; }

.final-bolt-style { 
    background-color: #ff4444 !important; color: white !important; 
    border-color: #fff !important; animation: pulse-red 1s infinite; 
}
@keyframes pulse-red { 0% { opacity: 1; } 50% { opacity: 0.7; } 100% { opacity: 1; } }

/* --- リザルト画面 --- */
.result-screen { justify-content: center; align-items: center; text-align: center; background-color: #111; color: #fff; }

/* ★ 黄金のクリア画面演出（完全復元・強化） ★ */
.final-result-screen { 
    background: linear-gradient(45deg, #ffd700, #fff8e1, #ffecb3, #ffd700);
    background-size: 400% 400%;
    animation: gold-glow 10s ease infinite;
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
    z-index: 200;
}

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

.epilogue-message-box { 
    background: rgba(255, 255, 255, 0.9); 
    border: 4px double #d4af37; /* 黄金色のボーダー */
    border-radius: 15px; 
    padding: 25px 40px; 
    color: #443300; 
    font-family: "MS PMincho", "Sawarabi Mincho", serif; 
    font-size: 18px; 
    font-weight: bold; 
    text-align: center; 
    line-height: 1.8; 
    width: 85%;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}