/* =========================================
   3. 地图层与星球样式 (Map Layer)
   ========================================= */

#map-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    transition: opacity 2s ease;
}

/* 地图容器 */
#level-map-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

/* 进入地图按钮 - 位于右下角 */
/* 进入地图按钮 - 位于右下角 */
.enter-map-button {
    position: fixed;
    bottom: 40px;
    right: 40px;
}

.message-board-button {
    position: fixed;
    bottom: 40px;
    right: 320px;
    /* To the left of the Enter Map button */
    text-decoration: none;
    /* Ensure <a> looks like button */
    display: inline-block;
    z-index: 100;
}

.replay-button {
    position: fixed;
    bottom: 40px;
    right: 40px;
    z-index: 200;
    /* Higher than map layer */
}

/* 漂浮装饰 */
#floating-glyphs {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}

.glyph {
    position: absolute;
    color: rgba(255, 255, 255, 0.1);
    font-size: 2rem;
    animation: floatUp 20s linear infinite;
}

@keyframes floatUp {
    0% {
        transform: translateY(110vh) rotate(0deg);
        opacity: 0;
    }

    20% {
        opacity: 0.2;
    }

    80% {
        opacity: 0.2;
    }

    100% {
        transform: translateY(-10vh) rotate(360deg);
        opacity: 0;
    }
}

/* 路径线 */
#path-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    filter: drop-shadow(0 0 5px rgba(200, 220, 255, 0.2));
}

.path-line {
    stroke: var(--ribbon-white);
    stroke-width: 2px;
    stroke-linecap: round;
    fill: none;
    stroke-dasharray: 10, 15;
    animation: dashMove 30s linear infinite;
}

@keyframes dashMove {
    from {
        stroke-dashoffset: 0;
    }

    to {
        stroke-dashoffset: 1000;
    }
}

/* 玩家标记 - 宇宙飞船 */
#player-marker {
    position: absolute;
    transform: translate(-50%, -120%);
    z-index: 30;
    pointer-events: none;
    transition: all 1s ease;
}

.marker-icon {
    font-size: 3rem;
    filter: drop-shadow(0 0 15px cyan);
    animation: floatShip 4s ease-in-out infinite;
    transform: rotate(-15deg);
}

@keyframes floatShip {

    0%,
    100% {
        transform: translateY(0) rotate(-15deg);
    }

    50% {
        transform: translateY(-15px) rotate(-10deg);
    }
}

/* 关卡节点基础样式 */
.level-node {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    z-index: 20;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.level-node:hover {
    transform: translate(-50%, -50%) scale(1.2);
    z-index: 25;
}

/* 新增：图片图标样式 */
.node-icon {
    /* width: 120px;  Removed global size */
    /* height: 120px; Removed global size */
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
    transition: all 0.3s ease;
}

/*Individual Icon Sizes*/
#node-2 .node-icon {
    width: 120px;
    height: 120px;
}

#node-3 .node-icon {
    width: 120px;
    height: 120px;
}

#node-4 .node-icon {
    width: 300px;
    height: 200px;
}

#node-5 .node-icon {
    width: 250px;
    height: 200px;
}

#node-6 .node-icon {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
}

/* 1. 地球 (Emoji Style) - Use ID for easier customization */
#node-1 .node-circle,
#node-7 .node-circle {
    font-size: 60px;
}

.level-node:hover .node-icon {
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.6));
    transform: scale(1.1);
}

/* 标签样式 */
.node-label {
    margin-top: 5px;
    /* padding: 6px 14px; */
    /* background: rgba(0, 15, 30, 0.7); */
    /* border: 1px solid rgba(212, 175, 55, 0.3); */
    /* border-radius: 4px; */
    text-align: center;
    font-size: 1rem;
    color: rgba(230, 230, 255, 0.9);
    letter-spacing: 1px;
    text-shadow: 0 2px 4px black, 0 0 10px rgba(0, 0, 0, 0.8);
    /* backdrop-filter: blur(4px); */
    transition: all 0.3s;
    opacity: 0.9;
    z-index: 30;
    white-space: nowrap;
    font-weight: bold;
}

.level-node:hover .node-label {
    transform: scale(1.1);
    /* background: rgba(0, 20, 40, 0.95); */
    /* border-color: var(--sand-gold); */
    color: var(--sand-gold);
    text-shadow: 0 0 10px var(--sand-gold), 0 2px 4px black;
}

/* =========================================
   Mobile Responsiveness (Map)
   ========================================= */
@media (max-width: 768px) {

    /* --- Hide SVG path (desktop coords don't match mobile) --- */
    #path-svg {
        display: none;
    }

    /* --- Scale down ALL node icons on mobile --- */
    #node-1 .node-circle,
    #node-6 .node-circle,
    #node-7 .node-circle {
        font-size: 40px;
    }

    #node-2 .node-icon,
    #node-3 .node-icon,
    #node-6 .node-icon {
        width: 55px;
        height: 55px;
    }

    #node-4 .node-icon {
        width: 70px;
        height: auto;
    }

    #node-5 .node-icon {
        width: 65px;
        height: auto;
    }

    /* --- Node container scaling --- */
    .level-node {
        transform: translate(-50%, -50%) scale(0.85);
    }

    .level-node:hover {
        transform: translate(-50%, -50%) scale(1.0);
    }

    /* --- Label Styles --- */
    .node-label {
        font-size: 0.75rem;
        margin-top: 8px;
        white-space: nowrap;
        width: auto;
        padding: 4px 10px;
        background: rgba(0, 0, 0, 0.6);
        border-radius: 4px;
        border: none;
        text-shadow: 0 1px 3px black;
    }

    /* --- Node Positions (zigzag, top 10%–66%) --- */
    #node-7 {
        left: 50%;
        top: 10%;
    }

    #node-6 {
        left: 20%;
        top: 18%;
    }

    #node-5 {
        left: 75%;
        top: 26%;
    }

    #node-4 {
        left: 25%;
        top: 36%;
    }

    #node-3 {
        left: 72%;
        top: 46%;
    }

    #node-2 {
        left: 22%;
        top: 56%;
    }

    #node-1 {
        left: 70%;
        top: 66%;
    }

    /* --- Vertical Button Stack (bottom) --- */
    .enter-map-button,
    .message-board-button,
    .replay-button {
        position: fixed;
        left: 50%;
        transform: translateX(-50%);
        width: 80%;
        text-align: center;
        padding: 12px 0;
        font-size: 0.9rem;
        border: 1px solid var(--sand-gold);
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        color: var(--sand-gold);
        box-shadow: none;
        text-transform: uppercase;
        z-index: 100;
        right: auto;
        top: auto;
    }

    /* Replay OR Enter Map — bottom slot */
    #replay-intro-btn,
    #enter-map-btn {
        bottom: 15px !important;
    }

    /* Message Board — above bottom slot */
    .message-board-button {
        bottom: 70px !important;
    }

}

/* =========================================
   Desktop Node Positions (Moved from HTML)
   ========================================= */
@media (min-width: 769px) {
    #node-1 {
        left: 10%;
        top: 85%;
    }

    #node-2 {
        left: 23%;
        top: 60%;
    }

    #node-3 {
        left: 36%;
        top: 75%;
    }

    #node-4 {
        left: 50%;
        top: 50%;
    }

    #node-5 {
        left: 63%;
        top: 70%;
    }

    #node-6 {
        left: 76%;
        top: 45%;
    }

    #node-7 {
        left: 90%;
        top: 20%;
    }
}

/* =========================================
   Modal Styles (Link Selection)
   ========================================= */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: rgba(10, 20, 30, 0.85);
    border: 1px solid var(--sand-gold);
    border-radius: 12px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.modal.active .modal-content {
    transform: scale(1);
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--sand-gold);
}

#modal-title {
    color: var(--sand-gold);
    margin-bottom: 25px;
    font-size: 1.5rem;
    font-family: inherit;
    text-shadow: 0 2px 4px black;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
    padding-bottom: 10px;
}

.link-btn {
    display: block;
    width: 100%;
    padding: 12px 20px;
    margin: 10px 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #eee;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 1rem;
    cursor: pointer;
}

.link-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: var(--sand-gold);
    color: var(--sand-gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}