/* boss_battle.css - Boss Battle Button, Modal, Animations */

/* ==================== BOSS BUTTON ==================== */
#bossBattleButton {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 11000;
    overflow: visible;
}

#bossBattleButtonImg {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #ff4444;
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.5);
    position: relative;
    z-index: 2;
    transition: transform 0.2s;
}

#bossBattleButton:hover #bossBattleButtonImg {
    transform: scale(1.1);
}

.boss-button-pulse {
    position: absolute;
    top: -6px;
    left: -6px;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    z-index: 1;
    animation: bossPulse 2s ease-in-out infinite;
}

@keyframes bossPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.6);
    }
    50% {
        box-shadow: 0 0 20px 10px rgba(255, 120, 0, 0.3);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.6);
    }
}

#bossBattleButton.boss-button--active .boss-button-pulse {
    animation: none;
    box-shadow: none;
}

/* ==================== BOSS MODAL / OVERLAY ==================== */
#bossBattleOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 11001;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.boss-overlay-content {
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    position: relative;
    min-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: black;
    border-radius: 10px;    
}

.boss-close-btn {
    position: fixed;
    top: 15px;
    right: 20px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    font-size: 28px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 11002;
    line-height: 1;
    transition: background 0.2s;
}

.boss-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ==================== LOBBY STATE ==================== */
.boss-lobby {
    text-align: center;
    color: #fff;
    padding-top: 60px;
}

.boss-lobby-image {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #ff4444;
    box-shadow: 0 0 30px rgba(255, 68, 68, 0.4);
    margin-bottom: 24px;
}

.boss-lobby h2 {
    font-size: 1.5rem;
    color: #ff8800;
    margin-bottom: 16px;
}

.boss-lobby .boss-waiting {
    color: #aaa;
    font-size: 1.1rem;
}

.boss-lobby .fa-spinner {
    color: #ff8800;
    margin-top: 16px;
}

/* ==================== ACTIVE QUESTION STATE ==================== */
.boss-question {
    color: #fff;
    width: 100%;
}

.boss-round-info {
    text-align: center;
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 8px;
}

/* Timer Bar */
.boss-timer-bar-container {
    width: 100%;
    height: 8px;
    background: #333;
    border-radius: 4px;
    margin-bottom: 16px;
    overflow: hidden;
}

.boss-timer-bar {
    height: 100%;
    background: linear-gradient(90deg, #00cc66, #66ff66);
    border-radius: 4px;
    transition: width 0.1s linear;
}

.boss-timer-bar.timer-warning {
    background: linear-gradient(90deg, #ff4444, #ff8800);
}

.boss-timer-text {
    text-align: center;
    font-size: 0.85rem;
    color: #aaa;
    margin-bottom: 12px;
}

/* Question Content */
.boss-question-text {
    font-size: 1.15rem;
    line-height: 1.5;
    margin-bottom: 16px;
    text-align: center;
}

.boss-question-image {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.boss-tts-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    margin-bottom: 16px;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.boss-tts-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Answer Grid */
.boss-answers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    margin-top: 8px;
}

.boss-answer-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 16px 12px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    text-align: center;
    transition: all 0.2s;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    word-break: break-word;
}

.boss-answer-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.boss-answer-btn.selected {
    background: rgba(59, 130, 246, 0.3);
    border-color: #3b82f6;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

.boss-answer-btn .boss-answer-image {
    max-width: 100%;
    max-height: 80px;
    border-radius: 6px;
    margin-bottom: 6px;
}

/* ==================== EVALUATION STATE ==================== */
.boss-evaluation {
    color: #fff;
    width: 100%;
    text-align: center;
}

.boss-answer-btn.correct {
    background: rgba(34, 197, 94, 0.3);
    border-color: #22c55e;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.3);
}

.boss-answer-btn.incorrect {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    opacity: 0.7;
}

.boss-answer-btn.correct.selected,
.boss-answer-btn.incorrect.selected {
    box-shadow: 0 0 0 3px #fff, 0 0 15px rgba(255, 255, 255, 0.3);
}

.boss-eval-stats {
    margin-top: 20px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.boss-eval-stats .stat-line {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.boss-eval-stats .stat-line .correct-num {
    color: #22c55e;
    font-weight: bold;
}

.boss-eval-stats .stat-line .damage-num {
    color: #ff4444;
    font-weight: bold;
}

.boss-explanation {
    margin-top: 16px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid #3b82f6;
    border-radius: 0 8px 8px 0;
    text-align: left;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #ccc;
}

.boss-eval-countdown {
    margin-top: 16px;
    color: #aaa;
    font-size: 0.85rem;
}

/* ==================== HP BAR (in modal) ==================== */
.boss-hp-bar-container {
    width: 100%;
    height: 12px;
    background: #333;
    border-radius: 6px;
    margin-bottom: 4px;
    overflow: hidden;
}

.boss-hp-bar {
    height: 100%;
    border-radius: 6px;
    transition: width 1s ease-out;
}

.boss-hp-text {
    text-align: center;
    font-size: 0.8rem;
    color: #aaa;
    margin-bottom: 16px;
}

/* HP color gradient */
.boss-hp-bar.hp-high {
    background: linear-gradient(90deg, #22c55e, #4ade80);
}
.boss-hp-bar.hp-mid {
    background: linear-gradient(90deg, #eab308, #facc15);
}
.boss-hp-bar.hp-low {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

/* ==================== FINISHED STATES ==================== */
.boss-finished {
    text-align: center;
    color: #fff;
    padding-top: 40px;
}

.boss-finished-image {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 24px;
}

.boss-finished-image.defeated {
    filter: grayscale(100%);
    opacity: 0.5;
    border: 4px solid #666;
}

.boss-finished-image.triumphant {
    border: 4px solid #ff4444;
    box-shadow: 0 0 30px rgba(255, 68, 68, 0.4);
}

.boss-finished h2 {
    font-size: 1.8rem;
    margin-bottom: 16px;
}

.boss-finished h2.victory {
    color: #22c55e;
}
bossStateContent
.boss-finished h2.defeat {
    color: #ef4444;
}

.boss-finished .boss-message {
    font-size: 1.1rem;
    color: #ccc;
    font-style: italic;
    margin-bottom: 20px;
}

.boss-finished .boss-credits {
    font-size: 1.3rem;
    color: #facc15;
    font-weight: bold;
    margin-bottom: 16px;
}

.boss-finished .boss-auto-close {
    color: #666;
    font-size: 0.85rem;
    margin-top: 16px;
}

/* ==================== PAUSED BANNER ==================== */
.boss-paused-banner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    color: #ff8800;
    font-size: 2rem;
    font-weight: bold;
    padding: 20px 40px;
    border-radius: 12px;
    border: 2px solid #ff8800;
    z-index: 10;
    letter-spacing: 4px;
}

/* ==================== DISCONNECTED BANNER ==================== */
.boss-disconnected {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
    text-align: center;
    padding: 10px;
    font-size: 0.9rem;
    z-index: 11003;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 480px) {
    .boss-overlay-content {
        padding: 12px;
        margin: 10px;
    }

    .boss-answers-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .boss-answer-btn {
        padding: 14px 10px;
        font-size: 0.95rem;
        min-height: 50px;
    }

    .boss-lobby-image {
        width: 150px;
        height: 150px;
    }

    .boss-question-text {
        font-size: 1rem;
    }
}

