/* Map artwork is the complete screen. Keep navigation as invisible, accessible hit areas. */
#win-map.window-map {
    width: min(94vw, 620px);
    max-width: none;
    max-height: min(86vh, calc(100dvh - var(--panel-top-h) - var(--panel-bottom-h) - 24px));
    padding: 0 !important;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

#win-map.window-map::before,
#win-map.window-map::after {
    display: none;
    content: none;
}

#win-map.window-map > #star-map-root {
    position: relative;
    z-index: auto;
    width: 100%;
    height: auto;
    aspect-ratio: 604 / 651;
    max-height: none;
    margin: 0;
    overflow: hidden;
    isolation: isolate;
    border: 0;
    border-radius: 0;
    background: #02040d;
    box-shadow: 0 14px 42px rgba(0, 0, 0, .58);
    -webkit-tap-highlight-color: transparent;
}

#star-map-root::before {
    display: none;
    content: none;
}

#star-map-root::after {
    position: absolute;
    z-index: 3;
    top: -4%;
    right: 0;
    left: 0;
    height: 4%;
    content: '';
    border-bottom: 1px solid rgba(114, 239, 255, .72);
    background: linear-gradient(180deg, transparent 8%, rgba(0, 232, 255, .12) 72%, rgba(114, 239, 255, .3));
    box-shadow: 0 0 14px rgba(0, 205, 255, .38);
    animation: star-map-scan 7.5s linear infinite;
    pointer-events: none;
}

@keyframes star-map-scan {
    to { transform: translateY(2750%); }
}

#star-map-root .star-map-art {
    position: absolute;
    z-index: 0;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: fill;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

#star-map-root .star-map-core,
#star-map-root .map-system-node,
#star-map-root .star-map-close {
    position: absolute;
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
    color: transparent;
    font-size: 0;
    line-height: 0;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

#star-map-root .star-map-core {
    z-index: 4;
    left: 50%;
    top: 53.45%;
    width: 25%;
    height: 22%;
    transform: translate(-50%, -50%);
}

#star-map-root .star-map-core:active {
    transform: translate(-50%, -50%);
}

#star-map-root .map-system-node {
    z-index: 5;
    transform: translate(-50%, -50%);
}

#star-map-root .map-system-node:active,
#star-map-root .map-system-node.map-node-large,
#star-map-root .map-system-node.map-node-large:active {
    transform: translate(-50%, -50%);
}

#star-map-root .star-map-close {
    z-index: 8;
    left: 92.5%;
    top: 8%;
    width: max(44px, 11.5%);
    height: max(44px, 9%);
    transform: translate(-50%, -50%);
}

#star-map-root .star-map-core:focus-visible,
#star-map-root .map-system-node:focus-visible,
#star-map-root .star-map-close:focus-visible {
    outline: 2px solid rgba(255, 232, 255, .95);
    outline-offset: 2px;
    border-radius: 18%;
    background: rgba(160, 92, 255, .12);
}

#star-map-root .map-node-status {
    position: absolute;
    top: calc(100% + 2px);
    left: 50%;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transform: translateX(-50%);
    color: #fff;
    font-family: var(--ui-font, 'Rajdhani', sans-serif);
    font-size: clamp(8px, 2.4vw, 11px);
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
    pointer-events: none;
    text-shadow: 0 1px 3px #050519, 0 0 7px #251057;
}

/* Dynamic labels start 1 CSS px below each matching label baked into map.png. */
#star-map-root .map-sys-invasion .map-node-status {
    top: calc(79.6% + 1px);
}

#star-map-root .map-sys-collision .map-node-status {
    top: calc(74.4% + 1px);
}

#star-map-root .map-sys-boss .map-node-status {
    top: calc(73.8% + 1px);
}

#star-map-root .map-node-status .map-system-badge {
    position: static;
    display: inline-block;
    max-width: 100%;
    padding: 2px 5px;
    border: 1px solid rgba(134, 221, 255, .78);
    border-radius: 4px;
    background: rgba(5, 12, 40, .9);
    color: #e8f7ff;
    font-size: inherit;
    line-height: 1.2;
    text-shadow: none;
    box-shadow: 0 1px 6px rgba(0, 0, 0, .65);
}

#star-map-root .map-node-status .progress-bar {
    width: 52px;
    height: 4px;
    margin: 0;
    border: 1px solid rgba(145, 218, 255, .72);
    background: rgba(4, 9, 30, .92);
    box-shadow: 0 1px 6px rgba(0, 0, 0, .65);
}

#star-map-root .map-node-status .progress-fill {
    background: linear-gradient(90deg, #ff8a37, #ffe45c);
}

#star-map-root .map-node-status .progress-label {
    padding: 2px 5px;
    border: 1px solid rgba(255, 211, 77, .86);
    background: rgba(28, 14, 10, .92);
    color: #ffe08b;
}

#star-map-root .map-node-status .collision-attempts {
    border-color: rgba(130, 229, 255, .85);
    background: rgba(4, 17, 42, .92);
    color: #d7f5ff;
}

#star-map-root .map-sys-boss .map-node-status .collision-attempts {
    border-color: rgba(255, 128, 190, .86);
    background: rgba(35, 6, 35, .92);
    color: #ffd8ed;
}

#star-map-root .map-sys-event .map-node-status {
    top: calc(69% + 1px);
}

#star-map-root .map-sys-event .event-boss-map-status {
    border-color: rgba(255, 197, 62, .92);
    background: rgba(24, 13, 4, .94);
    color: #ffe19a;
    font-size: clamp(7px, 2vw, 10px);
    font-weight: 800;
    letter-spacing: .01em;
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

#star-map-root .map-sys-event .event-boss-map-status.is-active {
    border-color: rgba(66, 220, 255, .92);
    background: rgba(3, 20, 37, .96);
    color: #b9f4ff;
}

#star-map-root .map-sys-event .event-boss-map-status.is-ended,
#star-map-root .map-sys-event .event-boss-map-status.is-error {
    border-color: rgba(171, 179, 197, .7);
    background: rgba(13, 17, 30, .94);
    color: #d0d4df;
}

#star-map-root .map-sys-event[disabled] {
    cursor: not-allowed;
}

#star-map-root .map-node-status .collision-attempts.is-empty,
#star-map-root .map-sys-boss .map-node-status .collision-attempts.is-empty {
    border-color: rgba(186, 190, 208, .64);
    background: rgba(14, 18, 33, .92);
    color: #d0d4df;
}

#star-map-root .map-node-status .badge-count {
    position: static;
    display: inline-block;
    min-width: 18px;
    height: auto;
    padding: 2px 6px;
    border: 1px solid rgba(255, 231, 239, .86);
    border-radius: 999px;
    background: #e83161;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    box-shadow: 0 1px 7px rgba(0, 0, 0, .7);
}

@media (max-height: 700px) {
    #win-map.window-map {
        width: min(94vw, 620px, calc(100dvh - var(--panel-top-h) - var(--panel-bottom-h) - 70px));
    }
}

@media (prefers-reduced-motion: reduce) {
    #win-map.window-map {
        animation: none;
    }

    #star-map-root::after {
        display: none;
        animation: none;
    }

    #star-map-root .star-map-planet-glow {
        animation: none;
        opacity: .72;
    }

    #star-map-root .star-map-planet-canvas {
        will-change: auto;
    }
}
