/* Solo Boss styles */
.solo-boss-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 200;
    display: flex;
    flex-direction: column;
    user-select: none;
    touch-action: none;
    overflow: hidden;
}
.solo-boss-screen.hidden {
    display: none !important;
}

.solo-boss-hud-top {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}
.solo-boss-hud-top * {
    pointer-events: auto;
}

.solo-boss-timer {
    font-size: 18px;
    font-weight: bold;
    color: #ff3366;
    text-shadow: 0 0 10px rgba(255, 51, 102, 0.8);
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 51, 102, 0.4);
}

.solo-boss-weapon-debuff {
    padding: 5px 10px;
    border: 1px solid rgba(255, 82, 110, 0.78);
    background: rgba(16, 8, 20, 0.94);
    box-shadow: inset 2px 0 rgba(255, 61, 104, 0.55), 0 0 10px rgba(255, 30, 77, 0.3);
    color: #ffe7ed;
    font-family: 'Rajdhani', 'Segoe UI', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-shadow: 0 0 7px rgba(255, 49, 90, 0.75);
    white-space: nowrap;
}

.solo-boss-btn-exit {
    background: rgba(255, 0, 85, 0.2);
    border: 1px solid #ff0055;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 8px rgba(255, 0, 85, 0.5);
}

.solo-boss-arena {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #020108 url('../mines/soloboss.png') center center / cover no-repeat;
}

.solo-boss-stars {
    display: none;
}

.solo-boss-entity {
    position: absolute;
    transform: translate(-50%, -50%);
    will-change: transform, left, top;
}

.solo-boss-boss-sprite {
    width: 306px;
    height: 306px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    z-index: 4;
    filter: drop-shadow(0 0 15px rgba(255, 0, 85, 0.6));
}

.solo-boss-screen.solo-boss-rebalanced .solo-boss-boss-sprite {
    width: 280px;
    height: 280px;
}

.solo-boss-boss-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.solo-boss-lobby-preview {
    width: 148px;
    height: 148px;
    margin: 0 auto;
    filter: drop-shadow(0 0 16px rgba(255, 0, 85, 0.85));
}

.solo-boss-lobby-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Dynamic boss attack: a locked target, then two delayed energy shots. */
.solo-boss-beams-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.solo-boss-attack-target {
    position: absolute;
    width: 54px;
    height: 54px;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(255, 0, 85, 0.85);
    border-radius: 50%;
    opacity: calc(0.45 + var(--charge, 0) * 0.55);
    box-shadow: 0 0 12px rgba(255, 0, 85, 0.75), inset 0 0 12px rgba(255, 0, 85, 0.25);
    animation: soloBossTargetPulse 0.42s ease-in-out infinite alternate;
}

.solo-boss-attack-target::before,
.solo-boss-attack-target::after {
    content: '';
    position: absolute;
    background: #ff4d8a;
    box-shadow: 0 0 8px #ff0055;
}

.solo-boss-attack-target::before {
    top: 50%;
    left: -8px;
    right: -8px;
    height: 1px;
}

.solo-boss-attack-target::after {
    top: -8px;
    bottom: -8px;
    left: 50%;
    width: 1px;
}

.solo-boss-attack-target span,
.solo-boss-attack-target i {
    position: absolute;
    display: block;
    border: 1px solid rgba(255, 112, 170, 0.9);
    border-radius: 50%;
}

.solo-boss-attack-target span {
    inset: 9px;
}

.solo-boss-attack-target i {
    inset: 20px;
    background: #ff0055;
    box-shadow: 0 0 10px #ff0055;
}

.solo-boss-attack-shot {
    position: absolute;
    width: 22px;
    height: 22px;
    transform: translate(-50%, -50%) scale(calc(0.6 + var(--charge, 0) * 0.4));
    border-radius: 50%;
    opacity: 0.35;
    will-change: left, top, transform;
}

.solo-boss-attack-shot.is-launched {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.solo-boss-attack-shot b {
    position: absolute;
    inset: 4px;
    display: block;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 6px #fff, 0 0 14px #ff4d8a, 0 0 28px #ff0055;
    animation: soloBossShotSpin 0.18s linear infinite;
}

.solo-boss-screen.solo-boss-rebalanced .solo-boss-attack-shot b {
    box-shadow: 0 0 9px #fff, 0 0 18px #fff, 0 0 28px #ff4d8a, 0 0 42px #ff0055;
}

.solo-boss-attack-trail {
    position: absolute;
    width: 13px;
    height: 13px;
    left: 0;
    top: 0;
    transform: translate(-50%, -50%) scale(calc(1 - var(--trail-index) * 0.12));
    display: block;
    border-radius: 50%;
    background: #ff2d72;
    box-shadow: 0 0 8px #ff0055;
    pointer-events: none;
}

.solo-boss-screen.solo-boss-rebalanced .solo-boss-attack-trail {
    box-shadow: 0 0 10px #ff3b80, 0 0 18px rgba(255, 0, 85, 0.9);
}

.solo-boss-attack-impact {
    position: absolute;
    width: 30px;
    height: 30px;
    transform: translate(-50%, -50%);
    border: 3px solid #ff5a98;
    border-radius: 50%;
    box-shadow: 0 0 12px #ff0055, 0 0 28px rgba(255, 0, 85, 0.8);
    animation: soloBossImpact 0.5s ease-out forwards;
}

@keyframes soloBossTargetPulse {
    from { transform: translate(-50%, -50%) scale(0.88) rotate(0deg); }
    to { transform: translate(-50%, -50%) scale(1.12) rotate(45deg); }
}

@keyframes soloBossShotSpin {
    to { transform: rotate(360deg) scale(1.25); }
}

@keyframes soloBossImpact {
    from { opacity: 1; transform: translate(-50%, -50%) scale(0.35); }
    to { opacity: 0; transform: translate(-50%, -50%) scale(2.1); }
}

.solo-boss-player-ship {
    position: absolute;
    width: 96px;
    height: 96px;
    transform: translate(-50%, -50%);
    will-change: transform, left, top;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.solo-boss-player-ship > span,
.solo-boss-player-ship .ship-sprite-img,
.solo-boss-player-ship canvas {
    width: 86px !important;
    height: 86px !important;
    max-width: 86px !important;
    max-height: 86px !important;
    object-fit: contain;
}

.solo-boss-projectile {
    position: absolute;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 4;
}

.solo-boss-projectile.player-laser {
    width: 8px;
    height: 26px;
    background: linear-gradient(180deg, #ffffff 0%, #00f0ff 40%, #0077ff 85%, rgba(0, 119, 255, 0) 100%);
    box-shadow: 0 0 12px #00f0ff, 0 0 24px rgba(0, 240, 255, 0.85), 0 0 36px rgba(0, 100, 255, 0.6);
    border-radius: 4px;
    filter: drop-shadow(0 0 6px #00f0ff);
}

.solo-boss-dmg-pop {
    position: absolute;
    color: #ffea00;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 0 0 4px #000, 0 0 8px #ff0055;
    pointer-events: none;
    transform: translate(-50%, -50%);
    animation: soloBossDmgFloat 0.6s ease-out forwards;
    z-index: 20;
}

.solo-boss-player-dmg-pop {
    position: absolute;
    color: #ff718c;
    font-family: 'Rajdhani', 'Segoe UI', sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-shadow: 0 0 5px #16040a, 0 0 12px rgba(255, 28, 76, 0.9);
    pointer-events: none;
    transform: translate(-50%, -50%);
    animation: soloBossDmgFloat 0.7s ease-out forwards;
    z-index: 20;
}

@keyframes soloBossDmgFloat {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -90px) scale(1.3); }
}

.solo-boss-steer-pad {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: 50%;
    z-index: 15;
    touch-action: none;
}

/* Results modal inside battle screen */
.solo-boss-results-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
}
.solo-boss-results-card {
    background: #101428;
    border: 2px solid var(--gold, #ffd700);
    border-radius: 12px;
    padding: 20px;
    width: 85%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}
.solo-boss-results-title {
    font-size: 18px;
    color: var(--gold, #ffd700);
    margin-bottom: 15px;
    font-weight: bold;
}
.solo-boss-results-body {
    font-size: 14px;
    color: #e0e0e0;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* Leaderboard dropdown in lobby */
.solo-boss-lb-dropdown {
    position: absolute;
    top: 42px;
    left: 6px;
    z-index: 40;
    width: min(94%, 280px);
    max-height: min(60vh, 320px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px;
    background: rgba(4, 12, 28, 0.98);
    border: 1px solid rgba(255, 215, 0, 0.45);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.8);
}
.solo-boss-lb-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px 8px;
    color: var(--gold, #ffd700);
    font-size: 12px;
    font-weight: bold;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
}
.solo-boss-lb-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}
.solo-boss-lb-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 4px;
    font-size: 11px;
}
.solo-boss-lb-row.my-rank {
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid rgba(255, 215, 0, 0.4);
}
.solo-boss-lb-rank {
    font-weight: bold;
    width: 28px;
    color: var(--gold, #ffd700);
}
.solo-boss-lb-name {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 6px;
}
.solo-boss-lb-dmg {
    font-weight: bold;
    color: #00ffff;
}

.solo-boss-lobby-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 11px;
    padding: 4px 0 8px;
}

#win-map-boss .solo-boss-lb-dropdown {
    border: 1px solid rgba(101, 192, 206, .66);
    border-radius: 2px;
    background: rgba(7, 16, 27, .98);
    box-shadow: 0 5px 18px rgba(0, 0, 0, .72), inset 0 0 0 2px rgba(101, 192, 206, .08);
}
#win-map-boss .solo-boss-lb-heading {
    color: #e4c878;
    border-bottom-color: rgba(101, 192, 206, .27);
}
#win-map-boss .solo-boss-lb-row {
    border-radius: 0;
    color: #ced9d8;
    background: rgba(85, 137, 151, .1);
}
#win-map-boss .solo-boss-lb-row.my-rank {
    border-color: rgba(224, 190, 103, .48);
    background: rgba(147, 110, 44, .17);
}
#win-map-boss .solo-boss-lb-dmg {
    color: #88dbe2;
}

/* Solo Boss view: use the supplied complete screen as the actual tab template. */
#win-map-boss.window-map-sub {
    width: min(96vw, 800px, calc((100dvh - var(--panel-top-h) - var(--panel-bottom-h) - 32px) * 1.0185));
    max-width: 800px;
    max-height: none;
    height: auto;
    aspect-ratio: 1266 / 1243;
    flex: 0 0 auto;
    display: block;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    isolation: isolate;
}
#win-map-boss.window-map-sub::before,
#win-map-boss.window-map-sub::after {
    content: none;
    display: none;
}
#win-map-boss .solo-boss-template {
    position: relative;
    width: 100%;
    height: 100%;
    aspect-ratio: 1266 / 1243;
    overflow: hidden;
    container-type: inline-size;
    isolation: isolate;
}
#win-map-boss .solo-boss-template-art {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: fill;
    pointer-events: none;
    user-select: none;
}
#win-map-boss .solo-boss-template-accessible-copy {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
#win-map-boss .solo-boss-template-hotspot {
    position: absolute;
    z-index: 3;
    display: block;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: 0;
    color: transparent;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
#win-map-boss .solo-boss-template-hotspot:hover {
    background: rgba(112, 231, 255, .08);
}
#win-map-boss .solo-boss-template-hotspot:focus-visible,
#win-map-boss .solo-boss-start-btn:focus-visible {
    outline: 2px solid #ffe04d;
    outline-offset: 1px;
}
#win-map-boss .solo-boss-back {
    left: 1.4%;
    top: 0.4%;
    width: 10%;
    height: 7.5%;
}
#win-map-boss .solo-boss-close {
    right: 1.1%;
    top: 0.4%;
    width: 8%;
    height: 7.5%;
}
#win-map-boss .solo-boss-leaderboard {
    left: 1.2%;
    top: 8.5%;
    width: 10%;
    height: 10%;
}
#win-map-boss .solo-boss-help {
    right: 1.2%;
    top: 8.5%;
    width: 10%;
    height: 10%;
}
@media (max-width: 480px) {
    #win-map-boss .solo-boss-template-hotspot {
        min-width: 0;
        min-height: 0;
    }
    #win-map-boss .solo-boss-back,
    #win-map-boss .solo-boss-close {
        top: 0.3%;
        height: 8%;
    }
    #win-map-boss .solo-boss-leaderboard,
    #win-map-boss .solo-boss-help {
        top: 9%;
        height: 10%;
    }
}
#win-map-boss .solo-boss-template-stat {
    position: absolute;
    z-index: 2;
    top: 63.2%;
    height: 13.3%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .15cqw;
    overflow: hidden;
    color: #76e8ff;
    text-align: center;
    text-shadow: 0 1px 2px #00101e, 0 0 5px rgba(15, 199, 255, .55);
    pointer-events: none;
}
#win-map-boss .solo-boss-template-attempts {
    left: 3.4%;
    width: 30.7%;
}
#win-map-boss .solo-boss-template-damage {
    left: 35%;
    width: 30%;
}
#win-map-boss .solo-boss-template-duration {
    left: 66%;
    width: 30.4%;
}
#win-map-boss .solo-boss-template-stat > span,
#win-map-boss .solo-boss-template-stat > em {
    display: block;
    max-width: 100%;
    color: #65e8ff;
    font-family: 'Rajdhani', 'Segoe UI', sans-serif;
    font-size: clamp(5px, 1.25cqw, 12px);
    font-style: normal;
    font-weight: 800;
    letter-spacing: .04em;
    line-height: 1.1;
    white-space: nowrap;
}
#win-map-boss .solo-boss-template-stat > strong {
    display: block;
    max-width: 100%;
    color: #ffe15b;
    font-family: 'Press Start 2P', 'Rajdhani', sans-serif;
    font-size: clamp(9px, 2.85cqw, 26px);
    font-weight: 400;
    line-height: 1.3;
    white-space: nowrap;
    text-shadow: 0 2px 0 #341900, 0 0 8px rgba(255, 181, 34, .65);
}
#win-map-boss .solo-boss-template-stat > strong small {
    color: #ffed9a;
    font-family: 'Rajdhani', 'Segoe UI', sans-serif;
    font-size: .62em;
    font-weight: 700;
}
#win-map-boss .solo-boss-template-stat > strong.is-ready {
    color: #fff080;
}
#win-map-boss .solo-boss-template-stat > strong.is-empty {
    color: #ff6258;
}
#win-map-boss .solo-boss-start-btn {
    position: absolute;
    z-index: 4;
    left: 3%;
    top: 84.5%;
    width: 94%;
    height: 14%;
    min-height: 0 !important;
    margin: 0;
    padding: 0 5%;
    border: 0 !important;
    border-radius: 0 !important;
    color: #fff5d6 !important;
    background: transparent !important;
    box-shadow: none !important;
    font-family: 'Press Start 2P', 'Rajdhani', sans-serif;
    font-size: clamp(8px, 2.5cqw, 22px);
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: .04em;
    text-align: center;
    text-shadow: 0 2px 0 #691600, 0 0 8px #ff4b00, 0 0 16px #ff2900;
    cursor: pointer;
}
#win-map-boss .solo-boss-start-btn:disabled {
    color: #ffd2bd !important;
    background: transparent !important;
    box-shadow: none !important;
    text-shadow: 0 2px 0 #4b1714, 0 0 7px rgba(255, 93, 60, .7);
    cursor: not-allowed;
}
#win-map-boss .solo-boss-lb-dropdown {
    position: absolute;
    z-index: 6;
    top: 18%;
    left: 2.5%;
    width: min(60%, 360px);
    max-height: 55%;
    overflow-y: auto;
    border: 2px solid rgba(56, 177, 207, .9);
    border-radius: 0;
    background: rgba(3, 13, 26, .98);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .75), inset 0 0 0 2px rgba(43, 135, 157, .17);
}
#win-map-boss .solo-boss-lb-heading {
    color: #f0c85b;
    border-bottom-color: rgba(69, 177, 201, .35);
}
#win-map-boss .solo-boss-lb-row {
    border-radius: 0;
    color: #d1e1e4;
    background: rgba(42, 111, 135, .14);
}
#win-map-boss .solo-boss-lb-row.my-rank {
    border-color: rgba(228, 184, 76, .58);
    background: rgba(147, 103, 28, .19);
}
#win-map-boss .solo-boss-lb-dmg {
    color: #66e0e8;
}
@media (prefers-reduced-motion: reduce) {
    #win-map-boss .solo-boss-template-hotspot,
    #win-map-boss .solo-boss-start-btn {
        transition: none;
    }
}
