.map-header {

    display: flex;

    justify-content: center;

    align-items: center;

    padding: 1rem;

    background: rgba(15, 23, 42, 0.4);

    backdrop-filter: blur(20px);

    border-bottom: 1px solid rgba(255, 255, 255, 0.05);

    z-index: 50;

    position: relative;

}



.map-viewport {

    position: absolute;

    inset: 0;

    overflow: hidden;

    display: flex;

    justify-content: center;

    align-items: flex-start;

    background: radial-gradient(circle at center, #0f172a 0%, #020617 100%);

}



.map-nodes-container {

    height: 100%;

    width: auto;

    position: relative;

    flex-shrink: 0;

    user-select: none;

}



.map-nodes-container img,

.map-base-img {

    height: 100%;

    width: auto;

    max-width: none;

    display: block;

    pointer-events: none;

}

/* 修行宮殿入口：地圖共鳴輪頁右下角浮動按鈕 */
.codex-book--resonance .codex-training-entry {
    position: absolute;
    right: 18px;
    bottom: 18px;
    z-index: 6;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 999px;
    background: linear-gradient(145deg, rgba(56, 189, 248, 0.22), rgba(14, 116, 144, 0.34));
    border: 1px solid rgba(125, 211, 252, 0.45);
    color: #e0f2fe;
    font-weight: 800;
    font-size: 1.02rem;
    letter-spacing: 0.04em;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.42), 0 0 16px rgba(56, 189, 248, 0.25);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.codex-book--resonance .codex-training-entry:hover {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5), 0 0 22px rgba(56, 189, 248, 0.4);
}

.codex-book--resonance .codex-training-entry:active {
    transform: scale(0.97);
}

.codex-training-entry__icon {
    font-size: 1.35rem;
    line-height: 1;
}

@media (max-width: 480px) {
    .codex-book--resonance .codex-training-entry {
        right: 12px;
        bottom: 12px;
        padding: 10px 18px;
        font-size: 0.95rem;
    }

    .codex-training-entry__icon {
        font-size: 1.25rem;
    }
}

/* 手機易讀性放大（電腦版不變）：關卡資訊圖卡整體 +10%，NPC 臺詞放大 */
@media (max-width: 768px) {
    .stage-info-card {
        zoom: 1.1;
    }

    .mentor-dialogue-text {
        font-size: 1.3rem !important;
        line-height: 1.75 !important;
    }
}



/* Stage Anchor v1 */

.stage-node-wrap {

    position: absolute;

    z-index: 10;

    display: flex;

    flex-direction: column;

    align-items: center;

}

.node-landmark-label {

    font-size: 0.75rem;

    font-weight: 800;

    color: #f1f5f9;

    text-shadow:

        0 2px 6px rgba(0, 0, 0, 0.8),

        0 1px 2px rgba(0, 0, 0, 0.9),

        0 0 1px rgba(0, 0, 0, 1);

    letter-spacing: 0.05em;

    opacity: 0.95;

}

/* S/A/B Grade Badge - Primary Visual Focus */

.grade-badge {

    display: inline-flex;

    align-items: center;

    justify-content: center;

    width: 32px;

    height: 32px;

    border-radius: 50%;

    font-size: 26px;

    font-weight: 900;

    text-align: center;

    position: relative;

    z-index: 10;

}



/* S Grade - Brilliant Gold Medal (Most Prominent) */

.text-yellow-400.grade-badge,

.text-yellow-300.grade-badge {

    background: linear-gradient(145deg, #fde047, #fbbf24, #f59e0b);

    color: #2d1408;

    border: 3px solid #fef9c3;

    box-shadow:

        0 0 28px rgba(251, 191, 36, 1),

        0 0 16px rgba(251, 191, 36, 0.8),

        0 0 8px rgba(251, 191, 36, 0.6),

        0 4px 12px rgba(0, 0, 0, 0.6),

        inset 0 2px 4px rgba(255, 255, 255, 0.6),

        inset 0 -2px 6px rgba(217, 119, 6, 0.7);

    -webkit-text-stroke: 1px rgba(0, 0, 0, 0.3);

    text-shadow:

        0 1px 2px rgba(255, 255, 255, 0.9),

        0 0 12px rgba(251, 191, 36, 1),

        0 0 6px rgba(251, 191, 36, 0.8);

    animation: pulse-glow-s 1.8s ease-in-out infinite;

    filter: brightness(1.3);

}

@keyframes pulse-glow-s {
    0%, 100% {
        box-shadow:
            0 0 28px rgba(251,191,36,1),
            0 0 16px rgba(251,191,36,0.8),
            0 0 8px rgba(251,191,36,0.6),
            0 4px 12px rgba(0,0,0,0.6),
            inset 0 2px 4px rgba(255,255,255,0.6),
            inset 0 -2px 6px rgba(217,119,6,0.7);
        filter: brightness(1.3);
    }
    50% {
        box-shadow:
            0 0 44px rgba(251,191,36,1),
            0 0 26px rgba(251,191,36,0.9),
            0 0 14px rgba(251,191,36,0.7),
            0 4px 12px rgba(0,0,0,0.6),
            inset 0 2px 4px rgba(255,255,255,0.8),
            inset 0 -2px 6px rgba(217,119,6,0.9);
        filter: brightness(1.55);
    }
}

/* A Grade - Silver Medal */

.text-blue-400.grade-badge,

.text-cyan-400.grade-badge {

    background: linear-gradient(145deg, #93c5fd, #60a5fa, #3b82f6);

    color: #0b2559;

    border: 2.5px solid #dbeafe;

    box-shadow:

        0 0 16px rgba(96, 165, 250, 0.7),

        0 0 8px rgba(96, 165, 250, 0.5),

        0 4px 12px rgba(0, 0, 0, 0.5),

        inset 0 2px 3px rgba(255, 255, 255, 0.5),

        inset 0 -2px 4px rgba(37, 99, 235, 0.6);

    -webkit-text-stroke: 0.8px rgba(0, 0, 0, 0.25);

    text-shadow:

        0 1px 2px rgba(255, 255, 255, 0.8),

        0 0 8px rgba(147, 197, 253, 0.8);

    filter: brightness(1.2);

}



/* B Grade - Magical Silver-Blue Medal (Refined) */

.text-orange-400.grade-badge,

.text-amber-600.grade-badge {

    background: linear-gradient(145deg, #f8fafc, #cbd5e1, #64748b);

    color: #1e293b;

    border: 2.5px solid #f1f5f9;

    box-shadow:

        0 0 16px rgba(148, 163, 184, 0.5),

        0 0 8px rgba(148, 163, 184, 0.3),

        0 4px 12px rgba(0, 0, 0, 0.5),

        inset 0 2px 3px rgba(255, 255, 255, 0.6),

        inset 0 -2px 4px rgba(71, 85, 105, 0.4);

    -webkit-text-stroke: 0.8px rgba(0, 0, 0, 0.2);

    text-shadow:

        0 1px 2px rgba(255, 255, 255, 0.8),

        0 0 6px rgba(148, 163, 184, 0.5);

    filter: brightness(1.2);

}



/* Mentor Dialogue - Readability v2.0.2 */

.mentor-dialogue-box {

    overflow: hidden !important;

    isolation: isolate;

    transform: none !important;

    transition: none !important;

}

.mentor-dialogue-text {

    background: transparent;

    border: none;

    border-radius: 0;

    padding: 0;

    color: rgba(248, 250, 252, 0.98) !important;

    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.78), 0 0 2px rgba(0, 0, 0, 0.7);

}

.mentor-dialogue-box .animate-pulse,

.mentor-dialogue-box .animate-bounce {

    animation: none !important;

}



/* Grade Letter Readability v1 */

.grade-badge {

    -webkit-text-stroke: 0.6px rgba(0, 0, 0, 0.7);

    text-shadow:

        0 1px 0 rgba(255, 255, 255, 0.35),

        0 0 1px rgba(0, 0, 0, 0.9),

        0 1.5px 2px rgba(0, 0, 0, 0.85);

    paint-order: stroke fill;

    letter-spacing: 0.02em;

}



.text-yellow-400.grade-badge,

.text-yellow-300.grade-badge {

    color: #5b3708;

}



.text-blue-400.grade-badge,

.text-cyan-400.grade-badge {

    color: #0b3a82;

}



.text-orange-400.grade-badge,

.text-amber-600.grade-badge {

    color: #334155;

}



.text-slate-200.grade-badge,

.text-gray-200.grade-badge {
    color: #0f172a;
}

/* --- [NEW] Skill Action Banner --- */
.skill-banner-v2 {
    position: relative;
    background: linear-gradient(90deg, transparent, rgba(20, 30, 60, 0.85) 15%, rgba(30, 58, 138, 0.95) 50%, rgba(20, 30, 60, 0.85) 85%, transparent);
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.skill-banner-v2-glow {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.2) 50%, transparent);
    animation: banner-glow 2s infinite linear;
}

@keyframes banner-glow {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.skill-banner-v2-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

.skill-banner-v2-label {
    font-size: 10px;
    font-weight: 900;
    color: #60a5fa;
    letter-spacing: 0.4em;
    margin-bottom: 2px;
    text-shadow: 0 0 8px rgba(96, 165, 250, 0.8);
}

.skill-banner-v2-name {
    font-size: 28px;
    font-weight: 900;
    color: #fff;
    letter-spacing: 0.15em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8), 0 0 15px rgba(255, 255, 255, 0.3);
}

.skill-type-badge {
    flex: 0 0 auto;
    padding: 1px 6px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.75);
    color: #cbd5e1;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.08em;
    line-height: 1.35;
}

.skill-card--debuff .skill-icon-frame,
.skill-card--debuff .skill-type-badge {
    border-color: rgba(248, 113, 113, 0.75);
    color: #fecaca;
    box-shadow: 0 0 18px rgba(239, 68, 68, 0.18);
}

.skill-card--buff .skill-icon-frame,
.skill-card--buff .skill-type-badge {
    border-color: rgba(45, 212, 191, 0.75);
    color: #99f6e4;
    box-shadow: 0 0 18px rgba(20, 184, 166, 0.16);
}

.skill-card--heal .skill-icon-frame,
.skill-card--heal .skill-type-badge {
    border-color: rgba(74, 222, 128, 0.75);
    color: #bbf7d0;
    box-shadow: 0 0 18px rgba(34, 197, 94, 0.18);
}

.skill-card--attackBuff .skill-icon-frame,
.skill-card--attackBuff .skill-type-badge {
    border-color: rgba(251, 191, 36, 0.85);
    color: #fde68a;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.22);
}

.combo-popup-anchor {
    position: absolute;
    left: var(--combo-left, 72%);
    top: var(--combo-top, 52%);
    transform: translate(-50%, -50%);
    pointer-events: none;
    --combo-popup-dur: 1.35s;
}

.combo-center-popup {
    display: flex;
    align-items: baseline;
    gap: 0.42rem;
    color: #fff7d6;
    white-space: nowrap;
    transform-origin: 50% 60%;
    animation: combo-center-burst var(--combo-popup-dur, 1.35s) cubic-bezier(0.22, 1, 0.36, 1) both;
}

.combo-center-popup__value {
    font-size: clamp(2.4rem, 8vw, 4.8rem);
    line-height: 0.9;
    font-weight: 950;
    letter-spacing: 0.02em;
    color: #fff4c2;
    -webkit-text-stroke: 1.5px rgba(72, 36, 12, 0.9);
    paint-order: stroke fill;
    text-shadow:
        0 2px 0 rgba(70, 35, 10, 0.95),
        0 4px 8px rgba(0, 0, 0, 0.65),
        0 0 6px rgba(255, 190, 70, 0.75);
}

.combo-center-popup__label {
    margin-left: 0.08em;
    font-size: clamp(1.08rem, 3.24vw, 1.62rem);
    line-height: 1;
    font-weight: 800;
    letter-spacing: 0.14em;
    color: #fffcf5;
    -webkit-text-stroke: 1.1px rgba(48, 28, 12, 0.92);
    paint-order: stroke fill;
    text-shadow:
        0 2px 0 rgba(52, 30, 14, 0.95),
        0 4px 8px rgba(0, 0, 0, 0.65),
        0 0 5px rgba(255, 200, 95, 0.55);
}

.combo-center-popup--great .combo-center-popup__value {
    font-size: clamp(2.9rem, 9vw, 5.6rem);
    color: #fff7d6;
    text-shadow:
        0 2px 0 rgba(70, 35, 10, 0.95),
        0 4px 8px rgba(0, 0, 0, 0.65),
        0 0 6px rgba(255, 190, 70, 0.75),
        0 0 9px rgba(255, 205, 100, 0.45);
}

.combo-center-popup--amazing,
.combo-center-popup--max {
    color: #fffbe6;
    animation-name: combo-center-burst-strong;
}

.combo-center-popup--amazing .combo-center-popup__value,
.combo-center-popup--max .combo-center-popup__value {
    font-size: clamp(3.4rem, 10vw, 6.4rem);
    color: #fff7dc;
    text-shadow:
        0 2px 0 rgba(70, 35, 10, 0.95),
        0 4px 8px rgba(0, 0, 0, 0.65),
        0 0 6px rgba(255, 190, 70, 0.75),
        0 0 9px rgba(255, 215, 130, 0.55),
        0 0 8px rgba(255, 148, 90, 0.22);
}

.combo-center-popup--amazing .combo-center-popup__label,
.combo-center-popup--max .combo-center-popup__label {
    color: #fffdf8;
    text-shadow:
        0 2px 0 rgba(52, 30, 14, 0.95),
        0 4px 8px rgba(0, 0, 0, 0.65),
        0 0 5px rgba(255, 205, 120, 0.45);
}

.combo-pop-leave-active {
    transition: opacity 120ms ease;
}

.combo-pop-leave-to {
    opacity: 0;
}

.combo-milestone {
    filter: drop-shadow(0 0 10px rgba(255,220,60,0.85)) drop-shadow(0 0 4px rgba(255,180,0,0.6));
}
.combo-milestone .combo-center-popup__value {
    color: #fffde8 !important;
    text-shadow:
        0 2px 0 rgba(70,35,10,0.95),
        0 4px 8px rgba(0,0,0,0.65),
        0 0 20px rgba(255,230,80,1),
        0 0 12px rgba(255,200,50,0.9),
        0 0 6px rgba(255,140,0,0.5);
}

@keyframes combo-center-burst {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.72);
    }
    14% {
        opacity: 1;
        transform: translateY(-2px) scale(1.1);
    }
    28% {
        transform: translateY(-8px) scale(1);
    }
    55% {
        opacity: 1;
        transform: translateY(-12px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-20px) scale(0.92);
    }
}

@keyframes combo-center-burst-strong {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.72) rotate(-1deg);
    }
    12% {
        opacity: 1;
        transform: translateY(-4px) scale(1.16) rotate(1deg);
    }
    26% {
        transform: translateY(-10px) scale(1.02) rotate(-0.8deg);
    }
    40% {
        transform: translateY(-14px) scale(1.04) rotate(0.6deg);
    }
    58% {
        opacity: 1;
        transform: translateY(-16px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-26px) scale(0.94) rotate(0deg);
    }
}

@media (max-width: 640px) and (orientation: portrait) {
    .combo-center-popup__value {
        font-size: clamp(2.1rem, 11vw, 3.8rem);
    }

    .combo-center-popup__label {
        font-size: clamp(1.03rem, 3.42vw, 1.54rem);
    }

    .combo-center-popup--great .combo-center-popup__value,
    .combo-center-popup--amazing .combo-center-popup__value,
    .combo-center-popup--max .combo-center-popup__value {
        font-size: clamp(2.4rem, 12vw, 4.4rem);
    }
}

.banner-slide-enter-active {
    animation: banner-in 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.banner-slide-leave-active {
    animation: banner-out 0.4s cubic-bezier(0.7, 0, 0.84, 0) forwards;
}

@keyframes banner-in {
    0% {
        transform: scaleX(0);
        opacity: 0;
    }

    40% {
        transform: scaleX(1.1);
        opacity: 1;
    }

    100% {
        transform: scaleX(1);
        opacity: 1;
    }
}

@keyframes banner-out {
    0% {
        transform: scaleX(1);
        opacity: 1;
    }

    100% {
        transform: scaleX(0);
        opacity: 0;
    }
}

/* --- [NEW] Mobile question readability overrides --- */
.battle-question-text {
    font-family: 'Noto Sans JP', sans-serif;
    line-height: 1.6;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9), 0 0 3px rgba(0, 0, 0, 1);
    letter-spacing: 0.02em;
    flex: 0 1 auto;
    min-width: 0;
}

/* 中文輔助行：偏暖白、對比加強，不搶日文主行 */
.battle-question-cn {
    color: #fff8f0;
    font-weight: 900;
    text-shadow: 0 0 1px rgba(0, 0, 0, 1),
        0 0 4px rgba(0, 0, 0, 0.98),
        0 1px 4px rgba(0, 0, 0, 1),
        0 2px 8px rgba(0, 0, 0, 0.98),
        0 2px 16px rgba(0, 0, 0, 0.92),
        0 0 12px rgba(0, 0, 0, 0.5);
    -webkit-text-stroke: 0.7px rgba(0, 0, 0, 0.52);
    paint-order: stroke fill;
}

rt {
    font-size: 0.55em !important;
    margin-bottom: -0.15em;
    /* Narrow the gap with base text */
    text-shadow: 0 1px 4px rgba(0, 0, 0, 1), 0 0 2px rgba(0, 0, 0, 1) !important;
}

/* --- Long-question compact mode (JS detects overflow, toggles class) --- */
#question-area.question-compact>div:first-child {
    gap: 0.25rem;
}

#question-area.question-compact>div:first-child>span>span,
#question-area.question-compact>div:first-child>span>.blank-slot,
#question-area.question-compact>div:first-child>span>.particle-input {
    font-size: 1.375rem !important;
}

#question-area.question-compact>div:first-child>span>.blank-slot {
    border-bottom-width: 3px !important;
    min-width: 2.75rem !important;
}

@media (min-width: 768px) {

    #question-area.question-compact>div:first-child>span>span,
    #question-area.question-compact>div:first-child>span>.blank-slot,
    #question-area.question-compact>div:first-child>span>.particle-input {
        font-size: 1.75rem !important;
    }
}


/* --- Ultra-compact fallback (second pass, only if compact still overflows) --- */
#question-area.question-ultra-compact>div:first-child {
    gap: 0rem;
}

#question-area.question-ultra-compact>div:first-child>span>span,
#question-area.question-ultra-compact>div:first-child>span>.blank-slot,
#question-area.question-ultra-compact>div:first-child>span>.particle-input {
    font-size: 1.15rem !important;
}

#question-area.question-ultra-compact>div:first-child>span>.blank-slot {
    border-bottom-width: 2px !important;
    min-width: 1.5rem !important;
}

@media (min-width: 768px) {

    #question-area.question-ultra-compact>div:first-child>span>span,
    #question-area.question-ultra-compact>div:first-child>span>.blank-slot,
    #question-area.question-ultra-compact>div:first-child>span>.particle-input {
        font-size: 1.1rem !important;
    }
}

#question-area.question-ultra-compact rt {
    font-size: 0.45em !important;
}

/* 手機戰鬥易讀性（電腦版不變）：STAGE 標籤、攻擊鈕、TAP/Flick、假名間距 */
@media (max-width: 768px) {
    #stage-confirm-heading {
        font-size: 13px !important;
    }

    .battle-tap-attack-row button {
        font-size: 16px !important;
    }

    .battle-mode-toggle {
        transform: none !important;
    }

    .battle-mode-toggle button {
        font-size: 13px !important;
        min-width: 46px !important;
        min-height: 44px !important;
        height: 44px !important;
    }

    /* 假名下降、縮小與漢字之間的間距 */
    #question-area rt {
        margin-bottom: -0.3em !important;
    }
}



.text-yellow-400.grade-badge,

.text-yellow-300.grade-badge {

    color: #5b3708;

    position: absolute;

    inset: 0;

    pointer-events: none;

    z-index: 4;

}



.map-progress-line {

    position: absolute;

    height: 3px;

    border-radius: 999px;

    transform-origin: center center;

    background: linear-gradient(90deg, transparent, rgba(226, 232, 240, 0.34) 18%, rgba(251, 191, 36, 0.26) 50%, rgba(226, 232, 240, 0.34) 82%, transparent);

    filter: drop-shadow(0 0 8px rgba(148, 163, 184, 0.16));

    opacity: 0.72;

}



.map-progress-line::after {

    content: '';

    position: absolute;

    inset: -1px 0;

    border-radius: inherit;

    background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 10px, rgba(255, 255, 255, 0) 10px 18px);

    opacity: 0.8;

}



.map-progress-line.route-1 {

    left: 40%;

    top: 25%;

    width: 30%;

    transform: translate(-50%, -50%) rotate(135deg);

}



.map-progress-line.route-2 {

    left: 52.5%;

    top: 45%;

    width: 50%;

    transform: translate(-50%, -50%) rotate(24deg);

}



.map-progress-line.route-3 {

    left: 57.5%;

    top: 65%;

    width: 42%;

    transform: translate(-50%, -50%) rotate(150deg);

}



.map-progress-line.route-4 {

    left: 52.5%;

    top: 82.5%;

    width: 31%;

    transform: translate(-50%, -50%) rotate(31deg);

}



.map-stage-node {

    position: relative;

    display: flex;

    flex-direction: column;

    align-items: center;

    gap: 2px;

    width: 114px;

    padding: 0 !important;

    background: transparent !important;

    border: none;

    box-shadow: none;

    overflow: visible;

}



.map-stage-node-visual {

    position: relative;

    width: 78px;

    height: 78px;

    display: flex;

    align-items: center;

    justify-content: center;

}



.map-stage-node-frame {

    position: relative;

    width: 72px;

    height: 72px;

    padding: 0;

    border-radius: 24px;

    background: transparent;

    border: none;

    box-shadow: none;

    transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease, opacity 0.28s ease;

}



.map-stage-node-image-layer {

    position: relative;

    width: 100%;

    height: 100%;

    border-radius: 18px;

    background-color: transparent;

    background-size: contain;

    background-position: center;

    background-repeat: no-repeat;

    overflow: visible;

}



.map-stage-node-image-placeholder {

    position: absolute;

    inset: 0;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    gap: 5px;

    border-radius: 18px;

    border: none;

    background: transparent;

    backdrop-filter: none;

    -webkit-backdrop-filter: none;

}



.map-stage-node-image-glyph {

    font-size: 1.1rem;

    line-height: 1;

    font-weight: 900;

    color: rgba(248, 250, 252, 0.82);

    text-shadow: 0 2px 6px rgba(15, 23, 42, 0.28);

}



.map-stage-node-image-label {

    font-size: 0.5rem;

    line-height: 1;

    font-weight: 900;

    letter-spacing: 0.16em;

    color: rgba(226, 232, 240, 0.76);

}



.map-stage-node.state-unopened .map-stage-node-frame {

    border-color: rgba(148, 163, 184, 0.16);

}



.map-stage-node.state-unopened .map-stage-node-image-layer {

    background: transparent;

}



.map-stage-node.state-unopened .map-stage-node-image-placeholder {

    border-color: rgba(148, 163, 184, 0.24);

}



.map-stage-node.state-unopened .map-stage-node-frame {
    opacity: 0.65;
    filter: grayscale(1) brightness(0.7);
    box-shadow: none;
    border-color: rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.1);
}

.map-stage-node.state-unopened .map-stage-node-image-label {
    color: rgba(203, 213, 225, 0.5);
}



.map-stage-node.state-opened .map-stage-node-frame {
    border-color: rgba(167, 139, 250, 0.35);
    transform: translateY(-1px);
    box-shadow:
        0 6px 16px rgba(15, 23, 42, 0.15),
        0 0 10px rgba(167, 139, 250, 0.15),
        /* Stable achievement glow */
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    background: rgba(167, 139, 250, 0.03);
    transition: all 0.3s ease;
}

.map-stage-node.state-opened .map-stage-node-book-img {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
    opacity: 0.9;
}

.map-stage-node.state-opened .map-stage-node-image-layer {
    background: transparent;
}

.map-stage-node.state-opened .map-stage-node-image-placeholder {
    border-color: transparent;
    background: transparent;
}



.map-page-container {
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.map-stage-node.state-current .map-stage-node-frame {
    border-color: rgba(185, 226, 255, 0.6);
    transform: translateY(-2px) scale(1.02);
    box-shadow:
        0 14px 24px rgba(15, 23, 42, 0.35),
        0 0 25px rgba(0, 150, 255, 0.5),
        /* Deep Blue Glow Base */
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    animation: map-stage-node-pulse 2s ease-in-out infinite;
    position: relative;
}

/* Rotating Magic Circle (Rune Ring) */
.map-stage-node.state-current .map-stage-node-frame::before {
    content: '';
    position: absolute;
    inset: -22px;
    border: 2px dashed rgba(185, 226, 255, 0.5);
    border-radius: 50%;
    animation: map-node-rotate 10s linear infinite;
    pointer-events: none;
    box-shadow: inset 0 0 15px rgba(0, 150, 255, 0.2), 0 0 15px rgba(0, 150, 255, 0.2);
    z-index: -1;
}

.map-stage-node.state-current .map-stage-node-image-layer {
    background: transparent;
}

.map-stage-node.state-current .map-stage-node-image-placeholder {
    border-color: transparent;
    background: transparent;
}

/* Magical Sparkles for Current Node */
.map-stage-node.state-current .map-stage-node-frame::after {
    content: '';
    position: absolute;
    inset: -15px;
    background-image:
        radial-gradient(circle at 20% 30%, #fff 1px, transparent 1px),
        radial-gradient(circle at 80% 40%, #fff 1px, transparent 1px),
        radial-gradient(circle at 40% 80%, #fff 1px, transparent 1px),
        radial-gradient(circle at 70% 70%, #fff 1px, transparent 1px);
    background-size: 100% 100%;
    animation: map-node-sparkle 4s linear infinite;
    pointer-events: none;
    opacity: 0.6;
    z-index: -1;
}

.map-stage-node.state-current .map-stage-node-book-img {
    filter: drop-shadow(0 0 15px rgba(100, 200, 255, 0.9)) drop-shadow(0 0 30px rgba(255, 255, 255, 0.4));
    animation: map-book-magical-glow 1.5s ease-in-out infinite alternate;
    transition: transform 0.2s;
}

@keyframes map-book-magical-glow {
    0% {
        filter: drop-shadow(0 0 10px rgba(100, 200, 255, 0.8)) drop-shadow(0 0 20px rgba(255, 255, 255, 0.3)) brightness(1);
    }

    100% {
        filter: drop-shadow(0 0 20px rgba(185, 226, 255, 1)) drop-shadow(0 0 40px rgba(255, 255, 255, 0.6)) brightness(1.5);
    }
}

@keyframes map-stage-node-pulse {

    0%,
    100% {
        transform: translateY(-2px) scale(1.02);
        box-shadow: 0 14px 24px rgba(15, 23, 42, 0.35), 0 0 20px rgba(0, 150, 255, 0.4);
    }

    50% {
        transform: translateY(-8px) scale(1.08);
        /* Higher float for better visibility */
        box-shadow: 0 25px 40px rgba(15, 23, 42, 0.4), 0 0 40px rgba(100, 200, 255, 0.8);
    }
}

@keyframes map-node-rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes map-node-sparkle {
    0% {
        transform: rotate(0deg) scale(1);
        opacity: 0.2;
    }

    50% {
        transform: rotate(180deg) scale(1.3);
        opacity: 0.7;
        color: #fff;
    }

    100% {
        transform: rotate(360deg) scale(1);
        opacity: 0.2;
    }
}



/* ── Map Ambient: Chapter 1 sway ──────────────────────────────── */
@keyframes map-ambient-sway {
    0% {
        transform: translateX(0px) scale(1.005);
    }

    25% {
        transform: translateX(2px) scale(1.006);
    }

    50% {
        transform: translateX(-1px) scale(1.005);
    }

    75% {
        transform: translateX(1.5px) scale(1.006);
    }

    100% {
        transform: translateX(0px) scale(1.005);
    }
}

/* Applied to map-nodes-container when chapter1 ambient is active */
.map-ambient-ch1 .map-base-img {
    animation: map-ambient-sway 12s ease-in-out infinite;
    transform-origin: center center;
}

/* Applied to map-nodes-container when highland_wind ambient is active */

.map-ambient-highland .map-base-img {

    animation: map-ambient-sway 15s ease-in-out infinite;

    transform-origin: center center;

}



/* Applied to map-nodes-container when icefield_wind ambient is active */
.map-ambient-ice .map-base-img {
    animation: map-ambient-sway 22s ease-in-out infinite;
    transform-origin: center center;
}

/* --- Hero Buff Overlay Layer --- */
.battle-buff-overlay {
    position: fixed;
    bottom: 0;
    left: 4px;
    width: clamp(110px, 7vw, 160px);
    height: clamp(110px, 7vw, 160px);
    z-index: 60;
    /* Above HUD (50), Below Modals (1000+) */
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 768px) {
    .battle-buff-overlay {
        /* Position handled by hero-status.js getBoundingClientRect() */
        position: fixed;
    }
}

/* --- Hero Buff Aura (GIRAGIRA) --- */
@keyframes giragira-aurora {
    0% {
        box-shadow: 0 0 20px 2px rgba(245, 158, 11, 0.4), inset 0 0 10px rgba(251, 191, 36, 0.2);
        transform: scale(1.0);
    }

    50% {
        box-shadow: 0 0 45px 8px rgba(251, 191, 36, 0.7), inset 0 0 20px rgba(245, 158, 11, 0.4);
        transform: scale(1.05);
    }

    100% {
        box-shadow: 0 0 20px 2px rgba(245, 158, 11, 0.4), inset 0 0 10px rgba(251, 191, 36, 0.2);
        transform: scale(1.0);
    }
}

.aura-giragira-ring {
    position: absolute;
    width: 90%;
    height: 90%;
    border-radius: 50%;
    border: 2px solid rgba(251, 191, 36, 0.5);
    animation: giragira-aurora 1.5s ease-in-out infinite;
    z-index: -1;
}

/* Sharp energy "spikes" on overlay */
.aura-giragira-spikes::before,
.aura-giragira-spikes::after {
    content: '✦';
    position: absolute;
    color: #fbbf24;
    font-size: 44px;
    opacity: 0;
    animation: giragira-spikes-refined 2s linear infinite;
    text-shadow: 0 0 12px #f59e0b;
}

.aura-giragira-spikes::before {
    top: -20%;
    left: 0%;
    animation-delay: 0s;
}

.aura-giragira-spikes::after {
    bottom: -10%;
    right: -5%;
    animation-delay: 1s;
}

@keyframes giragira-spikes-refined {
    0% {
        transform: scale(0.5) rotate(0deg);
        opacity: 0;
    }

    40% {
        opacity: 1;
    }

    100% {
        transform: scale(1.8) rotate(180deg);
        opacity: 0;
    }
}

/* --- Buff Badge System --- */
.hero-buff-list {
    position: absolute;
    top: -15px;
    right: -25px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 70;
    pointer-events: none;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.8));
}

.buff-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
    animation: badge-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes badge-pop {
    0% {
        transform: scale(0.5) translateX(20px);
        opacity: 0;
    }

    100% {
        transform: scale(1) translateX(0);
        opacity: 1;
    }
}

.buff-badge-icon {
    font-size: 11px;
    font-weight: 900;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: #fff;
    flex-shrink: 0;
}

.buff-badge-label {
    font-size: 12px;
    font-weight: 900;
    color: #fff;
    white-space: nowrap;
    letter-spacing: 0.05em;
}

.buff-badge-count {
    font-size: 13px;
    font-weight: 900;
    color: #fbbf24;
    margin-left: 4px;
    font-family: monospace;
}

/* Specific Badge: GIRAGIRA */
.buff-badge-giragira .buff-badge-icon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}
