/* ==========================================
   WORLD BOSS ARENA
   ========================================== */

#boss-screen {
    padding-top: calc(4rem + 30px);
    background:
        url('../assets/boss_bg.svg') center / cover fixed,
        #0b1220;
    color: #e5e7eb;
}

#world-boss-area {
    position: relative;
}

.world-boss-wrapper {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 12px 16px 32px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.world-boss-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.world-boss-title {
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 1px;
    color: #a78bfa;
    opacity: 0.9;
}

.world-boss-name {
    font-size: 24px;
    font-weight: 800;
    color: #f8fafc;
    text-shadow: 0 6px 24px rgba(167, 139, 250, 0.2);
}

.world-boss-status {
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #bfdbfe;
    min-width: 100px;
    text-align: center;
}

.world-boss-status.cooldown {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fecaca;
}

.world-boss-status.expired {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.5);
    color: #fed7aa;
}

/* Таймер на убийство босса */
.world-boss-expires-timer {
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
    text-align: center;
    white-space: nowrap;
}

.world-boss-expires-timer.warning {
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.5);
    color: #fcd34d;
    animation: expires-pulse 1s ease-in-out infinite;
}

.world-boss-expires-timer.expired {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
}

.world-boss-expires-timer.hidden {
    display: none;
}

@keyframes expires-pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.85;
        transform: scale(1.02);
    }
}

.world-boss-hp-bar {
    position: relative;
    height: 22px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.world-boss-hp-fill {
    position: absolute;
    inset: 0;
    width: 0%;
    background: linear-gradient(90deg, #8b5cf6 0%, #a855f7 50%, #c084fc 100%);
    box-shadow: 0 0 18px rgba(168, 85, 247, 0.4);
    transition: width 0.25s ease-out;
    will-change: width;
}

.world-boss-hp-fill.stage-5 {
    background: linear-gradient(90deg, #22c55e 0%, #16a34a 50%, #0f9f4f 100%);
    box-shadow: 0 0 18px rgba(34, 197, 94, 0.4);
}

.world-boss-hp-fill.stage-4 {
    background: linear-gradient(90deg, #84cc16 0%, #65a30d 50%, #4d7c0f 100%);
    box-shadow: 0 0 18px rgba(132, 204, 22, 0.35);
}

.world-boss-hp-fill.stage-3 {
    background: linear-gradient(90deg, #f59e0b 0%, #d97706 50%, #b45309 100%);
    box-shadow: 0 0 18px rgba(245, 158, 11, 0.35);
}

.world-boss-hp-fill.stage-2 {
    background: linear-gradient(90deg, #f97316 0%, #ea580c 50%, #c2410c 100%);
    box-shadow: 0 0 18px rgba(249, 115, 22, 0.35);
}

.world-boss-hp-fill.stage-1 {
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 50%, #b91c1c 100%);
    box-shadow: 0 0 18px rgba(239, 68, 68, 0.4);
}

.boss-gear-toast {
    position: fixed;
    transform: translateX(-50%);
    padding: 8px 14px;
    background: rgba(239, 68, 68, 0.92);
    color: #fff;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.2px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35), 0 0 12px rgba(239, 68, 68, 0.4);
    z-index: 9999;
    opacity: 0;
    animation: boss-gear-toast 2.2s ease forwards;
    pointer-events: none;
}

@keyframes boss-gear-toast {
    0% {
        opacity: 0;
        transform: translate(-50%, -10px);
    }

    15% {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    85% {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -14px);
    }
}

.world-boss-hp-text {
    position: relative;
    z-index: 1;
    width: 100%;
    text-align: center;
    font-weight: 800;
    font-size: 12px;
    letter-spacing: 0.3px;
    mix-blend-mode: screen;
}

.world-boss-image-area {
    position: relative;
    min-height: 240px;
    border-radius: 20px;
    border: none;
    background: transparent;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: none;
    cursor: pointer;
    transition: transform 0.12s ease;
}

.world-boss-image-area:active {
    transform: scale(0.99);
}

.world-boss-image-area.world-boss-hit {
    animation: world-boss-hit-shake 0.25s ease-out;
}

#world-boss-sprite.world-boss-hit {
    animation: world-boss-hit-flash 0.25s ease-out;
    filter: contrast(1.1) saturate(0.95) brightness(0.95) drop-shadow(0 0 18px rgba(239, 68, 68, 0.55)) drop-shadow(0 0 26px rgba(239, 68, 68, 0.35));
}

.arena-death-full-btn {
    padding: 14px 24px;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.arena-death-full-btn:hover:not(.disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
}

.arena-death-full-btn.disabled {
    background: linear-gradient(135deg, #666, #444);
    cursor: not-allowed;
    opacity: 0.6;
}

.world-boss-sprite-frame {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    /* Pixi эффекты рендерятся поверх (z-index: 10+) */
}


.world-boss-sprite-frame img {
    max-width: 82%;
    max-height: 320px;
    object-fit: contain;
    filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.45));
    transform-origin: 50% 55%;
    will-change: transform, filter;
    transform: translateZ(0) translateY(5px);
    animation: boss-float 6.5s cubic-bezier(0.37, 0, 0.63, 1) infinite, boss-glow 8.5s cubic-bezier(0.37, 0, 0.63, 1) infinite;
    transition: transform 0.2s ease, filter 0.25s ease;
}

/* Используем анимацию удара босса из arena.css (keyframes boss-attack-anim) */
#world-boss-sprite.boss-attack {
    animation: boss-attack-anim 0.4s ease;
}

.world-boss-timer {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 700;
    font-size: 13px;
    color: #e5e7eb;
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    z-index: 50;
    /* Выше спрайта босса */
}

.world-boss-timer.hidden {
    display: none;
}

.world-boss-player-hp {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.world-boss-player-label {
    font-size: 12px;
    color: #cbd5e1;
    letter-spacing: 0.2px;
}

.world-boss-player-bar {
    width: 100%;
    height: 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.world-player-hp-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.35);
    transition: width 0.25s ease-out;
    will-change: width;
}

.world-boss-player-text {
    font-size: 12px;
    color: #e5e7eb;
    letter-spacing: 0.3px;
}

.world-boss-damage-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.world-player-damage {
    font-weight: 700;
    color: #f8fafc;
    font-size: 14px;
}

.world-boss-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.boss-attack-btn {
    flex: 1 1 120px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(168, 85, 247, 0.45);
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.35), rgba(59, 130, 246, 0.28));
    color: #f8fafc;
    font-weight: 800;
    font-size: 15px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.25);
}

.boss-attack-btn:active {
    transform: translateY(1px);
}

.boss-attack-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.boss-aux-btn {
    flex: 1 1 90px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
    font-weight: 700;
    font-size: 14px;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.boss-aux-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.world-boss-hint {
    font-size: 12px;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 10px 12px;
    border: 1px dashed rgba(255, 255, 255, 0.08);
}

.world-boss-leaderboard {
    background: rgba(17, 24, 39, 0.75);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}

.leaderboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: 700;
    color: #e5e7eb;
}

.leaderboard-title {
    font-size: 15px;
}

.leaderboard-sub {
    font-size: 12px;
    color: #94a3b8;
}

.leaderboard-table {
    display: grid;
    gap: 8px;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    align-items: center;
    padding: 8px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.leaderboard-row.me {
    border-color: rgba(59, 130, 246, 0.55);
    box-shadow: 0 6px 14px rgba(59, 130, 246, 0.18);
}

.leaderboard-rank {
    font-weight: 800;
    color: #c084fc;
    font-size: 15px;
}

.leaderboard-merged-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: normal;
}

.leaderboard-name {
    font-weight: 700;
    color: #f8fafc;
    font-size: 14px;
}

.leaderboard-damage-sub {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
}

.leaderboard-rewards-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    text-align: right;
}

.reward-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hide legacy columns if present */
.leaderboard-damage,
.leaderboard-percent {
    display: none;
}

.leaderboard-player-rank {
    margin-top: 8px;
    font-size: 12px;
    color: #cbd5e1;
}

.world-boss-leaderboard.hidden {
    display: none;
}

@keyframes boss-float {

    0%,
    100% {
        transform: translate3d(0, 0, 0) scale(1);
    }

    50% {
        transform: translate3d(0, -10px, 0) scale(1.03);
    }
}

@keyframes boss-glow {

    0%,
    100% {
        filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.65)) drop-shadow(0 0 32px rgba(139, 92, 246, 0.18));
    }

    50% {
        filter: drop-shadow(0 16px 34px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 52px rgba(139, 92, 246, 0.3));
    }
}

/* ==========================================
   ВИЗУАЛ УДАРА ПО БОССУ (как на арене)
   ========================================== */
.arena-attack-effect,
.world-attack-effect {
    position: absolute;
    top: 35%;
    left: 75%;
    pointer-events: none;
    z-index: 22;
}

.slash-effect {
    width: 160px;
    height: 8px;
    position: relative;
    border-radius: 4px;
    animation: slash-swing 0.2s ease-out forwards;
    transform: translate(-50%, -50%) rotate(var(--angle, -30deg)) scaleX(0);
}

.slash-effect.normal {
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(200, 200, 220, 0.4) 15%,
            rgba(255, 255, 255, 0.95) 50%,
            rgba(200, 200, 220, 0.4) 85%,
            transparent 100%);
    box-shadow:
        0 0 8px rgba(255, 255, 255, 0.6),
        0 0 15px rgba(200, 200, 255, 0.3);
}

.slash-effect.crit {
    height: 10px;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 80, 50, 0.5) 15%,
            rgba(255, 120, 80, 1) 50%,
            rgba(255, 80, 50, 0.5) 85%,
            transparent 100%);
    box-shadow:
        0 0 12px rgba(255, 100, 50, 0.8),
        0 0 25px rgba(255, 50, 50, 0.5),
        0 0 40px rgba(255, 50, 50, 0.2);
}

.slash-effect.strong {
    height: 9px;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 180, 50, 0.5) 15%,
            rgba(255, 215, 100, 1) 50%,
            rgba(255, 180, 50, 0.5) 85%,
            transparent 100%);
    box-shadow:
        0 0 10px rgba(255, 200, 50, 0.7),
        0 0 20px rgba(255, 180, 50, 0.4);
}

@keyframes slash-swing {
    0% {
        transform: translate(-50%, -50%) rotate(var(--angle, -30deg)) scaleX(0);
        opacity: 1;
    }

    40% {
        transform: translate(-50%, -50%) rotate(var(--angle, -30deg)) scaleX(1);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) rotate(var(--angle, -30deg)) scaleX(1.1);
        opacity: 0;
    }
}

.slash-effect .spark {
    position: absolute;
    width: 5px;
    height: 5px;
    background: #fff;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    animation: spark-fly 0.35s ease-out forwards;
}

.slash-effect.normal .spark {
    box-shadow:
        0 0 6px 2px rgba(255, 255, 255, 0.8),
        0 0 12px 4px rgba(200, 200, 255, 0.4);
}

.slash-effect.crit .spark {
    width: 6px;
    height: 6px;
    background: #ff6644;
    box-shadow:
        0 0 8px 3px rgba(255, 100, 50, 0.9),
        0 0 16px 6px rgba(255, 50, 50, 0.5);
}

.slash-effect.strong .spark {
    background: #ffd700;
    box-shadow:
        0 0 7px 2px rgba(255, 215, 0, 0.8),
        0 0 14px 5px rgba(255, 180, 50, 0.4);
}

@keyframes spark-fly {
    0% {
        transform: translate(-50%, -50%) translate(0, 0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) translate(var(--dx, 0), var(--dy, 0)) scale(0);
        opacity: 0;
    }
}

@keyframes world-boss-hit-shake {
    0% {
        transform: translate(0, 0) scale(1);
    }

    15% {
        transform: translate(-16px, -4px) scale(0.94);
    }

    30% {
        transform: translate(12px, 0) scale(0.96);
    }

    50% {
        transform: translate(-8px, -3px) scale(0.98);
    }

    70% {
        transform: translate(5px, 0) scale(0.99);
    }

    100% {
        transform: translate(0, 0) scale(1);
    }
}

@keyframes world-boss-hit-flash {
    0% {
        filter: contrast(1.05) saturate(0.9) brightness(0.95);
    }

    20% {
        filter: contrast(1.5) saturate(1.5) brightness(2) sepia(0.25) hue-rotate(-8deg) drop-shadow(0 0 24px rgba(255, 60, 60, 0.75));
    }

    40% {
        filter: contrast(1.25) saturate(0.6) brightness(1.5) drop-shadow(0 0 16px rgba(255, 110, 110, 0.55));
    }

    100% {
        filter: contrast(1.05) saturate(0.9) brightness(0.95);
    }
}

@media (max-width: 420px) {
    .leaderboard-row {
        grid-template-columns: 28px 1fr auto;
        padding: 8px 10px;
    }

    .boss-attack-btn,
    .boss-aux-btn {
        flex: 1 1 100%;
    }
}