﻿[v-cloak] {
    display: none !important;
}

body {
    font-family: 'Noto Sans TC', 'Noto Sans JP', sans-serif;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 50%, #1e1b4b 100%);
    min-height: 100vh;
    min-height: 100dvh;
    /* Dynamic Viewport Height */
    color: #e2e8f0;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
}

rt {
    font-size: 0.45em;
    color: #fbbf24;
    /* Warmer gold for better contrast */
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 2px rgba(0, 0, 0, 0.4);
}

.particle-input {
    background: rgba(255, 255, 255, 0.05);
    /* Very subtle background to define the area */
    border-bottom: 4px solid #fbbf24;
    /* Even brighter gold */
    color: #fbbf24;
    font-size: 20px;
    width: 3.5rem;
    text-align: center;
    border-radius: 4px 4px 0 0;
    margin: 0 0.25rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
    /* Stronger glow for visibility */
}

.particle-input:focus {
    background: rgba(245, 158, 11, 0.2);
    outline: none;
    border-color: #fbbf24;
}

.correct {
    color: #059669;
    border-color: #059669;
    background: rgba(5, 150, 105, 0.2);
    color: #6ee7b7;
}

.wrong {
    color: #dc2626;
    border-color: #dc2626;
    background: rgba(220, 38, 38, 0.2);
    color: #fca5a5;
}

.choice-btn {
    transition: all 0.2s;
}

.card {
    backdrop-filter: blur(10px);
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.grammar-card {
    background: #422006;
    border: 1px solid #b45309;
    border-left: 4px solid #f59e0b;
}

.grammar-toggle {
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}

.grammar-toggle:hover {
    opacity: 0.8;
}

.potion-btn-hud {
    position: absolute;
    left: 0.75rem;
    bottom: 0.75rem;
    z-index: 50;
}

.potion-btn-hud.disabled {
    filter: grayscale(100%);
    opacity: 0.6;
    cursor: not-allowed;
}

@keyframes monster-shake {

    0%,
    100% {
        transform: translateX(0)
    }

    25% {
        transform: translateX(-4px)
    }

    75% {
        transform: translateX(4px)
    }
}

@keyframes player-blink {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: 0.3
    }
}

@keyframes monster-attack-lunge {
    0% {
        transform: translateY(0);
    }

    45% {
        transform: translateY(16px);
        animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    }

    100% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

.monster-attack-lunge {
    animation: monster-attack-lunge 0.26s forwards;
}

.monster-shake {
    animation: monster-shake 0.4s ease-in-out;
}

.player-blink {
    animation: player-blink 0.5s ease-in-out 2;
}

/* DQ戰鬥特效 */
@keyframes shake {

    0%,
    100% {
        transform: translate(0)
    }

    20%,
    80% {
        transform: translate(-4px, 2px)
    }

    40%,
    60% {
        transform: translate(4px, -2px)
    }
}

.shake {
    animation: shake 0.25s ease-in-out;
}

@keyframes hudShake {
    0% {
        transform: translate(0, 0);
    }

    15% {
        transform: translate(-8px, -4px) rotate(-1deg);
    }

    30% {
        transform: translate(8px, 6px) rotate(1deg);
    }

    45% {
        transform: translate(-6px, 8px) rotate(-1deg);
    }

    60% {
        transform: translate(6px, -6px) rotate(1deg);
    }

    75% {
        transform: translate(-4px, 2px) rotate(0deg);
    }

    100% {
        transform: translate(0, 0);
        filter: drop-shadow(0 0 10px rgba(220, 38, 38, 0.5));
    }
}

.hud-shake {
    animation: hudShake 0.3s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes hit {
    0% {
        transform: scale(1) translateY(0);
        filter: brightness(1);
    }

    20% {
        transform: scale(1.08) translateY(-4px) rotate(1deg);
        filter: brightness(2) contrast(1.2);
    }

    100% {
        transform: scale(1) translateY(0) rotate(0);
        filter: brightness(1);
    }
}

@keyframes hit-boss {
    0% {
        transform: scale(1) translateY(0);
        filter: brightness(1);
    }

    20% {
        transform: scale(1.02) translateY(-2px) rotate(0.5deg);
        filter: brightness(1.6) contrast(1.1);
    }

    100% {
        transform: scale(1) translateY(0) rotate(0);
        filter: brightness(1);
    }
}



.hit {
    animation: hit 0.25s ease-in-out;
}

@keyframes gira-monster-impact {
    0% {
        transform: scale(1) translateY(0);
        filter: brightness(1) saturate(1);
    }

    16% {
        transform: scale(1.13) translateY(-7px) rotate(-1.4deg);
        filter: brightness(2.65) saturate(1.38) contrast(1.18) drop-shadow(0 0 16px rgba(254, 249, 195, 0.95)) drop-shadow(0 0 34px rgba(251, 191, 36, 0.65));
    }

    100% {
        transform: scale(1) translateY(0) rotate(0);
        filter: brightness(1) saturate(1) contrast(1);
    }
}

@keyframes gira-monster-impact-boss {
    0% {
        transform: scale(1) translateY(0);
        filter: brightness(1) saturate(1);
    }

    16% {
        transform: scale(1.07) translateY(-4px) rotate(-0.6deg);
        filter: brightness(2.15) saturate(1.28) contrast(1.12) drop-shadow(0 0 14px rgba(254, 249, 195, 0.88)) drop-shadow(0 0 28px rgba(251, 191, 36, 0.52));
    }

    100% {
        transform: scale(1) translateY(0) rotate(0);
        filter: brightness(1) saturate(1) contrast(1);
    }
}

.gira-hit-impact {
    animation: gira-monster-impact 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.gira-hit-impact-boss {
    animation: gira-monster-impact-boss 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* GIRAGIRA 命中擊退：與 monsterPositionStyle 分層，僅內層位移 */
.monster-gira-knockback-shell {
    display: flex;
    flex-direction: column;
    align-items: center;
    will-change: transform;
    --giragira-knock-max-x: 0px;
    --giragira-knock-max-y: 0px;
    --giragira-knock-rot: 0deg;
}

@keyframes monster-gira-knock-return {
    0% {
        transform: translate3d(0, 0, 0) rotate(0deg);
    }

    /* 約 140ms：快速撞到最大位移 */
    8% {
        transform: translate3d(var(--giragira-knock-max-x), var(--giragira-knock-max-y), 0) rotate(var(--giragira-knock-rot));
    }

    /* 約 1180ms～：維持擊退＋ tilt，停住体感 ~1s */
    61% {
        transform: translate3d(var(--giragira-knock-max-x), var(--giragira-knock-max-y), 0) rotate(var(--giragira-knock-rot));
    }

    /* 緩回原位並歸零旋轉 */
    100% {
        transform: translate3d(0, 0, 0) rotate(0deg);
    }
}

.monster-gira-knockback-shell.monster-giragira-knockback {
    animation: monster-gira-knock-return 2.08s cubic-bezier(0.5, 0, 0.14, 1) forwards;
}

.flash-overlay {
    position: fixed;
    inset: 0;
    background: #fff;
    opacity: 0;
    pointer-events: none;
    animation: flash 0.3s ease-out;
    z-index: 50;
}

@keyframes flash {
    0% {
        opacity: 1
    }

    100% {
        opacity: 0
    }
}

/* #stage 16:9 JRPG layout */
#stage {
    position: relative;
    margin: auto;
    height: min(92vh, calc(100vw * 9 / 16));
    width: min(100%, calc(92vh * 16 / 9));
    aspect-ratio: 16/9;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 1.5rem;
    overflow: hidden;
}

#battleScene {
    background-size: cover;
    background-position: center;
}

#hud {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    overflow: hidden;
    gap: 1rem;
}

#question-area {
    --battle-question-jp-size: clamp(1rem, 2.42vmin + 0.82rem, 2.375rem);
    --battle-question-row-gap: 0.5rem;
    --battle-particle-slot-min: 2.15em;
    --battle-particle-slot-pad-x: 0.22em;
    --battle-particle-slot-border: max(2px, 0.08em);
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0.5rem;
}

#question-area>div {
    text-align: center;
    max-width: 100%;
    line-height: 1.6;
    font-size: clamp(1rem, 2vw, 1.5rem);
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

#question-area>div:first-child {
    min-width: 0;
}

/* Battle question JP row: keep segments on one baseline line; sizing via .battle-question-jp clamp */
#question-area .battle-question-main-row {
    flex-wrap: nowrap;
    gap: var(--battle-question-row-gap);
    align-items: baseline !important;
    max-width: 100%;
    min-width: 0;
    overflow: visible;
}

#question-area.question-size-medium {
    --battle-question-jp-size: clamp(0.95rem, 1.9vmin + 0.72rem, 2rem);
    --battle-question-row-gap: 0.35rem;
}

#question-area.question-size-long {
    --battle-question-jp-size: clamp(0.9rem, 1.55vmin + 0.64rem, 1.65rem);
    --battle-question-row-gap: 0.22rem;
}

#question-area.question-size-very-long {
    --battle-question-jp-size: clamp(0.82rem, 1.25vmin + 0.56rem, 1.4rem);
    --battle-question-row-gap: 0.12rem;
}

#question-area.question-ultra-compact .battle-question-main-row {
    flex-wrap: wrap;
    overflow-wrap: normal;
    row-gap: 0.125rem;
}

#question-area .battle-question-jp {
    font-size: var(--battle-question-jp-size) !important;
    white-space: nowrap;
    max-width: 100%;
    min-width: 0;
}

#question-area.question-ultra-compact .battle-question-jp {
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
}

.battle-question-text {
    display: inline-flex;
    max-width: 100%;
    align-items: baseline;
    flex: 0 1 auto;
    min-width: 0;
}

.battle-question-phrase {
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    flex: 0 0 auto;
    max-width: none;
    overflow: visible;
    white-space: nowrap;
}

#question-area .blank-slot,
#question-area .particle-input {
    display: inline-flex !important;
    align-items: flex-end !important;
    justify-content: center !important;
    box-sizing: border-box;
    position: relative;
    top: -1px;
    flex: 0 0 auto;
    width: auto !important;
    min-width: var(--battle-particle-slot-min) !important;
    padding: 0 var(--battle-particle-slot-pad-x) 0.04em var(--battle-particle-slot-pad-x) !important;
    margin-inline: 0.08em !important;
    border-top: 0 !important;
    border-right: 0 !important;
    border-bottom: var(--battle-particle-slot-border) solid currentColor !important;
    border-left: 0 !important;
    border-radius: 0 !important;
    white-space: nowrap !important;
    line-height: 1 !important;
    vertical-align: baseline !important;
    transform: none !important;
}

#question-area .blank-slot:hover {
    transform: none !important;
}

#question-area .ruby-text rt {
    position: relative;
    top: 4px;
}

.level-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(251, 191, 36, 0.4);
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    color: #fbbf24;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.monster-speech-wrap {
    position: absolute;
    left: 50%;
    top: 85%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    z-index: 20;
    pointer-events: none;
}

.monster-bubble {
    pointer-events: auto;
    background: rgba(15, 23, 42, 0.95);
    border: 3px solid #f59e0b;
    border-radius: 1.5rem;
    padding: 1rem 1.5rem;
    color: #fef3c7;
    position: relative;
    margin: auto;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
}

.monster-bubble::after {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 15px 15px;
    border-style: solid;
    border-color: transparent transparent #f59e0b;
    display: none;
}

.monster-bubble.bottom-tail::after {
    top: -15px;
    border-width: 0 15px 15px;
    border-color: transparent transparent #f59e0b;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4000;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.modal-panel {
    position: relative;
    margin: auto;
    background: rgba(18, 18, 48, 0.75);
    backdrop-filter: blur(24px) saturate(170%);
    -webkit-backdrop-filter: blur(24px) saturate(170%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 2rem;
    padding: 1.5rem;
    max-height: 90vh;
    max-width: 600px;
    overflow-y: auto;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.6),
        inset 0 0 20px rgba(255, 255, 255, 0.02);
}

.knowledge-card-overlay,
.knowledge-card-container,
.knowledge-card,
.spirit-unlock-stage,
.spirit-unlock-btn {
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 480px) {
    .menu-modal-panel {
        padding: 1.35rem !important;
    }

    .menu-modal-panel .modal-header-row h2 {
        font-size: 1.55rem !important;
    }

    .menu-modal-panel .modal-caption {
        font-size: 0.82rem !important;
        letter-spacing: 0.18em;
    }

    .menu-modal-panel .modal-section-card,
    .menu-modal-panel button {
        font-size: 1rem !important;
    }

    .menu-modal-panel .volume-control-label,
    .menu-modal-panel .text-xs,
    .menu-modal-panel .text-\[11px\],
    .menu-modal-panel .text-\[10px\],
    .menu-modal-panel .text-\[9px\] {
        font-size: 0.82rem !important;
    }

    .menu-modal-panel button {
        min-height: 3.2rem;
    }
}


.flash-card {
    animation: popPulsing 0.8s ease-out;
    z-index: 10;
}

@keyframes popPulsing {
    0% {
        box-shadow: 0 0 0 rgba(245, 158, 11, 0.8), inset 0 0 0 rgba(245, 158, 11, 0.8);
        border-color: rgba(245, 158, 11, 1);
        background-color: rgba(62, 39, 35, 0.9);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 30px rgba(245, 158, 11, 1), inset 0 0 20px rgba(245, 158, 11, 0.8);
        border-color: rgba(251, 191, 36, 1);
        background-color: rgba(93, 64, 55, 1);
        transform: scale(1.02);
    }

    100% {
        box-shadow: 0 0 0 rgba(245, 158, 11, 0), inset 0 0 0 rgba(245, 158, 11, 0);
        border-color: rgba(180, 83, 9, 0.5);
        background-color: rgba(62, 39, 35, 0.6);
        transform: scale(1);
    }
}

.particle-slot,
.blank-slot {
    display: inline-block;
    min-width: 4rem;
    padding: 0.05em 0.25rem 0.15em 0.25rem;
    /* Lower the border-bottom */
    margin: 0 0.25rem;
    text-align: center;
    border-bottom-width: 4px;
    border-bottom-style: solid;
    font-size: 1.25rem;
    font-weight: 900;
    vertical-align: middle;
    transition: all 0.3s ease;
    position: relative;
    margin: auto;
    cursor: pointer;
}

.particle-slot.is-empty {
    border-bottom-color: #fbbf24 !important;
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
    box-shadow: 0 8px 12px -8px rgba(251, 191, 36, 0.5);
    animation: slotPulse 2s infinite alternate ease-in-out;
}

.particle-slot.is-empty:hover,
.particle-slot.is-empty:focus,
.particle-slot.is-empty:active {
    border-bottom-color: #f59e0b !important;
    text-shadow: 0 0 12px rgba(245, 158, 11, 0.8);
    box-shadow: 0 12px 16px -6px rgba(245, 158, 11, 0.8);
    animation: flowGlow 1.5s linear infinite;
}

@keyframes slotPulse {
    0% {
        border-bottom-color: rgba(251, 191, 36, 0.6);
        filter: drop-shadow(0 2px 4px rgba(251, 191, 36, 0.4));
    }

    100% {
        border-bottom-color: rgba(251, 191, 36, 1);
        filter: drop-shadow(0 4px 10px rgba(251, 191, 36, 0.8));
    }
}

@keyframes flowGlow {
    0% {
        filter: drop-shadow(-4px 4px 8px rgba(245, 158, 11, 0.4)) drop-shadow(4px 4px 8px rgba(245, 158, 11, 0.8));
    }

    50% {
        filter: drop-shadow(4px 4px 8px rgba(245, 158, 11, 0.4)) drop-shadow(-4px 4px 8px rgba(245, 158, 11, 0.8));
    }

    100% {
        filter: drop-shadow(-4px 4px 8px rgba(245, 158, 11, 0.4)) drop-shadow(4px 4px 8px rgba(245, 158, 11, 0.8));
    }
}

.particle-slot.is-correct {
    border-bottom-color: #10b981 !important;
    color: #10b981;
    animation: flashGreen 0.6s ease-out forwards;
}

@keyframes flashGreen {
    0% {
        border-bottom-color: #10b981;
        filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.8));
        text-shadow: 0 0 8px rgba(16, 185, 129, 0);
    }

    50% {
        border-bottom-color: #34d399;
        filter: drop-shadow(0 0 20px rgba(52, 211, 153, 1));
        color: #34d399;
        text-shadow: 0 0 12px rgba(52, 211, 153, 0.8);
    }

    100% {
        border-bottom-color: #10b981;
        filter: drop-shadow(0 2px 6px rgba(16, 185, 129, 0.5));
        color: #10b981;
        text-shadow: 0 0 4px rgba(16, 185, 129, 0.3);
    }
}

.particle-slot.is-wrong {
    border-bottom-color: #f43f5e !important;
    color: #f43f5e;
    animation: shakeRed 0.4s ease-out forwards;
}

@keyframes shakeRed {
    0% {
        filter: drop-shadow(0 0 4px rgba(244, 63, 94, 0.5));
        transform: translateX(0);
        text-shadow: 0 0 4px rgba(244, 63, 94, 0.3);
    }

    20%,
    60% {
        filter: drop-shadow(0 0 12px rgba(244, 63, 94, 0.9));
        transform: translateX(-3px);
        text-shadow: 0 0 12px rgba(244, 63, 94, 0.8);
    }

    40%,
    80% {
        filter: drop-shadow(0 0 12px rgba(244, 63, 94, 0.9));
        transform: translateX(3px);
        text-shadow: 0 0 12px rgba(244, 63, 94, 0.8);
    }

    100% {
        filter: drop-shadow(0 2px 6px rgba(244, 63, 94, 0.5));
        transform: translateX(0);
        text-shadow: 0 0 4px rgba(244, 63, 94, 0.3);
    }
}

.bg-dodge {
    animation: bgDodge 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes bgDodge {
    0% {
        background-position: center center;
    }

    45% {
        background-position: calc(50% + 25px) center;
    }

    100% {
        background-position: center center;
    }
}

/* Monster Quick Dodge Displacement */
.monster-dodge {
    animation: monster-dodge-move 0.72s linear forwards;
}

@keyframes monster-dodge-move {
    0% {
        transform: translateX(0) scale(1);
        opacity: 1;
        animation-timing-function: cubic-bezier(0.05, 0, 0.15, 1);
    }

    12% {
        transform: translateX(90px) scale(0.96);
        opacity: 0.85;
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }

    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes fadeInLog {
    0% {
        opacity: 0;
        transform: translateY(-5px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-avatar {
    width: 128px;
    height: 128px;
    margin: 0 auto;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

/* Data-Driven Hero Positioning */
#heroAvatar {
    left: var(--hero-left-mobile);
}

@media (min-width: 768px) {
    #heroAvatar {
        left: var(--hero-left-desktop);
        margin-left: var(--hero-ml-desktop);
    }
}

.hero-status-pill {
    min-width: 28px;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.92);
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.hero-status-pill.weak {
    background: rgba(255, 160, 90, 0.20);
    border-color: rgba(255, 180, 120, 0.45);
}

.hero-status-pill.speed {
    background: rgba(120, 200, 255, 0.18);
    border-color: rgba(150, 220, 255, 0.45);
}

@keyframes statusPop {
    0% {
        transform: scale(0) rotate(-15deg);
        opacity: 0;
        filter: brightness(3);
    }

    50% {
        transform: scale(1.35) rotate(4deg);
        opacity: 1;
        filter: brightness(2);
    }

    70% {
        transform: scale(0.9) rotate(-2deg);
        filter: brightness(1.4);
    }

    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
        filter: brightness(1);
    }
}

.hero-status-pill {
    animation: statusPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes toastIn {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(10px) scale(0.85);
    }

    60% {
        opacity: 1;
        transform: translateX(-50%) translateY(-4px) scale(1.05);
    }

    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

@keyframes toastOut {
    0% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) scale(0.9);
    }
}

.status-toast {
    position: fixed;
    top: 38%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    pointer-events: none;
    padding: 8px 22px;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 900;
    letter-spacing: 0.12em;
    white-space: nowrap;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.status-toast.out {
    animation: toastOut 0.25s ease-in forwards;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.7);
}

@media (max-width: 900px) {

    html,
    body {
        height: 100%;
        margin: 0;
        padding: 0 !important;
        background: #0f172a;
        overflow: hidden;
    }

    #app {
        height: 100dvh;
        display: flex;
        flex-direction: column;
        padding: 0 !important;
        max-width: 100% !important;
    }

    #stageWrap {
        flex: 1;
        min-height: 0;
        width: 100% !important;
        padding: 0 !important;
        display: flex;
        flex-direction: column;
    }

    #stage {
        flex: 1;
        min-height: 0;
        width: 100% !important;
        border: none !important;
        border-radius: 0 !important;
        background: #0f172a !important;
    }

    #battleScene>div.absolute.top-4.left-4,
    #app>div.absolute.top-2.right-4,
    #app>div.absolute.top-2.right-4.pointer-events-none {
        display: none !important;
    }

    #spFill {
        display: block !important;
        height: 10px !important;
        min-height: 10px !important;
        border-radius: 5px !important;
    }

    .sp-label,
    .sp-text {
        font-size: 12px !important;
        white-space: nowrap !important;
        line-height: 1 !important;
        visibility: visible !important;
        display: inline !important;
    }

    .text-xs.font-mono.font-bold {
        font-size: 12px !important;
    }

    .sp-text,
    .sp-label {
        font-size: 12px !important;
        line-height: 1 !important;
        white-space: nowrap;
    }

    .hero-status-pill {
        height: 16px !important;
        min-width: 20px !important;
        font-size: 12px !important;
        padding: 0 4px !important;
    }

    #monsterStatusBar {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        flex-wrap: wrap !important;
        gap: 4px !important;
        width: 100% !important;
        position: static !important;
    }

    #question-area {
        margin-bottom: 8px !important;
    }

    /* 題目區：上日文主行、下中文輔助 */
    #question-area>div:first-child {
        font-size: 1.5rem !important;
        margin-bottom: 6px !important;
    }

    #question-area>div:last-child {
        font-size: 15px !important;
        margin-bottom: 0 !important;
    }

    #question-area>div.battle-question-cn:last-child {
        font-size: clamp(22px, 4.2vw, 28px) !important;
        line-height: 1.38 !important;
        margin-top: 2px !important;
        letter-spacing: 0.08em !important;
        text-shadow:
            0 1px 2px rgba(0, 0, 0, 0.95),
            0 2px 6px rgba(0, 0, 0, 0.82),
            0 0 12px rgba(12, 10, 8, 0.55) !important;
        -webkit-text-stroke: 0.35px rgba(30, 24, 20, 0.58);
    }

    .flex.flex-wrap.justify-center.gap-3.w-full {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px !important;
        width: 100% !important;
        padding: 0 4px !important;
    }

    .particle-option {
        padding: 6px 2px !important;
        font-size: clamp(0.9rem, 3.5vw, 1.1rem) !important;
        border-radius: 8px !important;
        height: 40px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: rgba(30, 41, 59, 0.7) !important;
        line-height: 1.1 !important;
    }

    .particle-option.border-amber-400 {
        border-color: #fbbf24 !important;
        background: rgba(251, 191, 36, 0.4) !important;
        box-shadow: 0 0 10px rgba(251, 191, 36, 0.5) !important;
    }

    .flex.justify-center.gap-3.mt-3.w-full.max-w-lg {
        margin-top: 12px !important;
        display: flex !important;
        width: 100% !important;
        max-width: none !important;
        gap: 8px !important;
    }

    .flex.justify-center.gap-3.mt-3.w-full.max-w-lg>button.w-48 {
        flex: 1 !important;
        height: 48px !important;
        padding: 0 !important;
        border-radius: 10px !important;
        font-size: 1.2rem !important;
        border-bottom-width: 4px !important;
    }

    .flex.justify-center.gap-3.mt-3.w-full.max-w-lg>button:last-child {
        width: 56px !important;
        height: 48px !important;
        padding: 0 !important;
        border-radius: 10px !important;
        border-bottom-width: 4px !important;
    }

    .flex.flex-row.items-center.justify-center.gap-12.py-4.w-full.px-6.flex-1 {
        position: fixed !important;
        inset: 0 !important;
        z-index: 2000 !important;
        background: rgba(10, 16, 30, 0.97) !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 20px !important;
        padding: 32px 16px 100px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .flex.flex-row.items-center.justify-center.gap-12.py-4.w-full.px-6.flex-1>div:first-child {
        max-width: none !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 8px !important;
    }

    .flex.flex-row.items-center.justify-center.gap-12.py-4.w-full.px-6.flex-1>.flex-shrink-0.w-64,
    .flex.flex-row.items-center.justify-center.gap-12.py-4.w-full.px-6.flex-1>div:last-child {
        width: 100% !important;
        max-width: 400px !important;
        flex-shrink: 1 !important;
    }

    .flex.flex-row.items-center.justify-center.gap-12.py-4.w-full.px-6.flex-1>div:first-child>h2 {
        text-align: center !important;
    }

    .flex.flex-row.items-center.justify-center.gap-12.py-4.w-full.px-6.flex-1>div:first-child>.flex.flex-col.gap-3.w-full {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 12px !important;
        width: 100% !important;
        max-width: 360px !important;
    }

    .flex.flex-row.items-center.justify-center.gap-12.py-4.w-full.px-6.flex-1>div:first-child>.flex.flex-col.gap-3.w-full>button {
        flex: 1 !important;
        height: 52px !important;
        font-size: 1rem !important;
        padding: 0 8px !important;
        border-radius: 14px !important;
    }

    .flick-layer-overlay {
        position: absolute;
        inset: 0;
        z-index: 25;
        pointer-events: none;
        touch-action: none;
    }

    .sentence-shield {
        position: absolute;
        top: 30%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 100%;
        height: 100px;
        pointer-events: none;
    }

    .aim-line {
        position: absolute;
        bottom: 120px;
        left: 50%;
        transform: translateX(-50%);
        width: 2px;
        height: 150px;
        background: linear-gradient(to top, rgba(251, 191, 36, 0.5), transparent);
        opacity: 0;
        pointer-events: none;
    }

    .rune-bar-fixed {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-width: 600px;
        margin: 0 auto;
        height: 90px;
        background: rgba(15, 23, 42, 0.9);
        backdrop-filter: blur(10px);
        border: 2px solid rgba(245, 158, 11, 0.5);
        border-bottom: none;
        border-radius: 20px 20px 0 0;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 1.5rem;
        padding: 0 1rem;
        z-index: 100;
        box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.6);
    }

    .rune-btn-placeholder {
        width: 60px;
        height: 60px;
        background: linear-gradient(to bottom, #334155, #1e293b);
        border: 2px solid #f59e0b;
        border-radius: 12px;
        color: #fbbf24;
        font-weight: 900;
        font-size: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 0 #b45309;
        cursor: grab;
        transition: all 0.1s;
        touch-action: none;
        user-select: none;
    }

    .rune-btn-placeholder.flick-armed {
        transform: scale(1.1) translateY(-5px);
        background: linear-gradient(to bottom, #475569, #334155);
        border-color: #fbbf24;
        box-shadow: 0 0 20px rgba(251, 191, 36, 0.4), 0 4px 0 #b45309;
        cursor: grabbing;
    }

    .rune-btn-placeholder.flick-success {
        animation: runeSuccessFlash 0.4s ease-out;
    }

    @keyframes runeSuccessFlash {
        0% {
            transform: scale(1.1) translateY(-10px);
            filter: brightness(1);
        }

        50% {
            transform: scale(1.2) translateY(-20px);
            filter: brightness(2) drop-shadow(0 0 30px #fbbf24);
        }

        100% {
            transform: scale(1) translateY(0);
            filter: brightness(1);
        }
    }

    .flick-vfx-layer {
        position: absolute;
        inset: 0;
        pointer-events: none;
        z-index: 50;
        overflow: hidden;
    }

    .flick-projectile {
        position: absolute;
        width: 60px;
        height: 60px;
        background: linear-gradient(to bottom, #f59e0b, #d97706);
        border: 2px solid #fff;
        border-radius: 12px;
        color: #fff;
        font-weight: 900;
        font-size: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 0 20px rgba(245, 158, 11, 0.6);
        z-index: 1000;
        animation: flickShootUp 0.6s ease-out forwards;
    }

    @keyframes flickShootUp {
        0% {
            transform: translate(-50%, -50%) scale(1);
            opacity: 1;
        }

        100% {
            transform: translate(-50%, calc(-50% - 400px)) scale(0.8);
            opacity: 0;
        }
    }

    .vfx-projectile-spawn {
        animation: vfxProjSpawn 120ms cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    }

    @keyframes vfxProjSpawn {
        0% {
            transform: scale(0.7);
            filter: brightness(1.5) drop-shadow(0 0 5px rgba(255, 255, 255, 0.8));
        }

        70% {
            transform: scale(1.06);
            filter: brightness(1.2) drop-shadow(0 0 8px rgba(255, 255, 255, 0.5));
        }

        100% {
            transform: scale(1);
            filter: brightness(1) drop-shadow(0 0 0px transparent);
        }
    }

    .vfx-trail-fade {
        animation: vfxTrailFade var(--fade-dur, 250ms) ease-out forwards;
    }

    @keyframes vfxTrailFade {
        0% {
            opacity: var(--start-opt, 0.8);
            transform: scale(1);
        }

        100% {
            opacity: 0;
            transform: scale(0.3);
        }
    }

    .vfx-hit-ring {
        position: absolute;
        width: 80px;
        height: 80px;
        border: 4px solid rgba(255, 200, 100, 0.8);
        border-radius: 50%;
        transform: translate(-50%, -50%) scale(0);
        pointer-events: none;
        z-index: 9999;
        animation: vfxRingExpand 240ms ease-out forwards;
    }

    @keyframes vfxRingExpand {
        0% {
            transform: translate(-50%, -50%) scale(0.2);
            opacity: 1;
            border-width: 8px;
        }

        100% {
            transform: translate(-50%, -50%) scale(1.8);
            opacity: 0;
            border-width: 1px;
        }
    }

    .vfx-hit-spark {
        position: absolute;
        width: 6px;
        height: 16px;
        background: #fff;
        border-radius: 3px;
        box-shadow: 0 0 8px #fbbf24, 0 0 16px #f59e0b;
        transform-origin: center bottom;
        pointer-events: none;
        z-index: 10000;
    }

    .vfx-dmg-text {
        position: absolute;
        font-weight: 900;
        font-size: 28px;
        color: #fff;
        text-shadow: 0px 3px 0px #b45309, 0px 0px 8px rgba(245, 158, 11, 0.8), 2px 2px 2px rgba(0, 0, 0, 0.8);
        pointer-events: none;
        z-index: 10001;
        transform: translate(-50%, -50%);
        animation: vfxDmgPopFade 700ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    }

    @keyframes vfxDmgPopFade {
        0% {
            transform: translate(-50%, -30%) scale(0.5);
            opacity: 0;
        }

        15% {
            transform: translate(-50%, -100%) scale(1.2);
            opacity: 1;
        }

        30% {
            transform: translate(-50%, -120%) scale(1);
            opacity: 1;
        }

        70% {
            transform: translate(-50%, -160%) scale(0.95);
            opacity: 0.9;
        }

        100% {
            transform: translate(-50%, -200%) scale(0.9);
            opacity: 0;
        }
    }

    @keyframes shakeMild {
        0% {
            transform: translate(1px, 1px) rotate(0deg);
        }

        10% {
            transform: translate(-1px, -2px) rotate(-1deg);
        }

        20% {
            transform: translate(-3px, 0px) rotate(1deg);
        }

        30% {
            transform: translate(3px, 2px) rotate(0deg);
        }

        40% {
            transform: translate(1px, -1px) rotate(1deg);
        }

        50% {
            transform: translate(-1px, 2px) rotate(-1deg);
        }

        60% {
            transform: translate(-3px, 1px) rotate(0deg);
        }

        70% {
            transform: translate(3px, 1px) rotate(-1deg);
        }

        80% {
            transform: translate(-1px, -1px) rotate(1deg);
        }

        90% {
            transform: translate(1px, 2px) rotate(0deg);
        }

        100% {
            transform: translate(1px, -2px) rotate(-1deg);
        }
    }

    .shake-mild {
        animation: shakeMild 200ms cubic-bezier(.36, .07, .19, .97) both;
    }

    .rune-btn-placeholder:active {
        transform: translateY(2px);
        box-shadow: 0 2px 0 #b45309;
    }

    #stage {
        height: auto !important;
        min-height: 80dvh !important;
        aspect-ratio: auto !important;
        border-radius: 1.5rem 1.5rem 0 0 !important;
        padding-bottom: 20px;
    }

    .answer-mode-toggle button {
        white-space: nowrap;
    }

    #runeBar {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 18px !important;
        padding: 16px 20px !important;
        background: rgba(2, 6, 23, .45) !important;
        border: 1px solid rgba(245, 158, 11, .45) !important;
        border-radius: 22px !important;
        backdrop-filter: blur(6px);
    }

    #runeBar .rune-btn-placeholder {
        appearance: none !important;
        -webkit-appearance: none !important;
        min-width: 84px !important;
        height: 84px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border: 2px solid rgba(245, 158, 11, .95) !important;
        border-radius: 22px !important;
        background: rgba(15, 23, 42, .92) !important;
        color: #fbbf24 !important;
        font-weight: 900 !important;
        font-size: 42px !important;
        line-height: 1 !important;
        box-shadow: 0 10px 25px rgba(0, 0, 0, .35) !important;
    }
}

body.lock-scroll {
    position: fixed;
    width: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    overscroll-behavior-y: none;
    touch-action: manipulation;
}

@media (max-width: 480px) {

    /* 第一區為日文主行（較大）、第二區為中文輔助（較小） */
    #question-area>div:first-child {
        font-size: clamp(24px, 5.6vw, 28px) !important;
        line-height: 1.5 !important;
        letter-spacing: 0.04em !important;
    }

    #question-area>div:nth-child(2) {
        font-size: clamp(24px, 6vw, 30px) !important;
        line-height: 1.34 !important;
    }

    #question-area>div.battle-question-cn:last-child {
        font-size: clamp(24px, 6vw, 30px) !important;
        line-height: 1.34 !important;
        letter-spacing: 0.04em !important;
        text-shadow:
            0 1px 2px rgba(0, 0, 0, 0.96),
            0 2px 6px rgba(0, 0, 0, 0.84),
            0 0 12px rgba(12, 10, 8, 0.58) !important;
        -webkit-text-stroke: 0.4px rgba(30, 24, 20, 0.62);
    }

    #question-area>div:first-child .ruby-text {
        ruby-position: over;
    }

    #question-area>div:first-child .ruby-text rt {
        line-height: 0.9 !important;
        margin-bottom: -0.25em !important;
        padding-bottom: 0 !important;
        transform: translateY(0.12em);
    }

    #question-area .text-slate-100,
    #question-area .particle-slot {
        font-size: inherit !important;
    }

    .jp-tap-choices {
        margin-top: auto !important;
        padding-bottom: 6px !important;
    }
}

.praise-pop-enter-active {
    animation: praise-pop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.praise-pop-leave-active {
    animation: praise-pop-out 0.2s ease-in both;
}

@keyframes praise-pop-in {
    0% {
        transform: translate(-50%, 20px) scale(0.5);
        opacity: 0;
    }

    100% {
        transform: translate(-50%, 0) scale(1);
        opacity: 1;
        text-shadow: 0 0 10px #fbbf24, 0 0 20px #fbbf24;
    }
}

@keyframes praise-pop-out {
    0% {
        transform: translate(-50%, 0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -20px) scale(0.8);
        opacity: 0;
    }
}

@media (max-width: 520px) {
    .answer-mode-toggle {
        margin-bottom: 18px !important;
    }

    #question-area {
        margin-top: 26px !important;
        padding-top: 6px !important;
    }
}

#flickVfxLayer .flick-projectile {
    background: none !important;
    border: none !important;
    animation: none !important;
    filter: none !important;
    width: 40px !important;
    height: 40px !important;
    overflow: visible !important;
}

#flickVfxLayer .flick-projectile::before {
    display: none !important;
}

@media (max-width: 520px) {
    .modal-panel {
        width: min(92vw, 520px);
        max-width: 520px;
        padding: 1.2rem;
    }
}

.modal-panel .text-slate-300\/80,
.modal-panel .text-slate-300\/70,
.modal-panel .text-slate-300\/60 {
    white-space: pre-line !important;
    line-height: 1.35 !important;
}

@media (min-width: 901px) {
    #runeBar {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 14px !important;
        margin-top: 18px !important;
        flex-wrap: wrap !important;
    }

    #runeBar .rune-btn-placeholder {
        display: inline-flex !important;
        justify-content: center !important;
        align-items: center !important;
        min-width: 82px !important;
        height: 52px !important;
        padding: 10px 18px !important;
        border-radius: 16px !important;
        border: 2px solid rgba(251, 191, 36, 0.45) !important;
        background: linear-gradient(180deg, rgba(51, 65, 85, 0.95) 0%, rgba(30, 41, 59, 0.92) 55%, rgba(15, 23, 42, 0.92) 100%) !important;
        color: rgba(226, 232, 240, 0.98) !important;
        font-weight: 900 !important;
        font-size: 26px !important;
        line-height: 1 !important;
        text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25) !important;
        box-shadow: 0 14px 26px rgba(0, 0, 0, 0.40), inset 0 1px 0 rgba(255, 255, 255, 0.10), inset 0 -10px 18px rgba(0, 0, 0, 0.22) !important;
        transition: transform .10s ease, filter .12s ease, box-shadow .12s ease !important;
        user-select: none !important;
    }

    #runeBar .rune-btn-placeholder:hover {
        transform: translateY(-1px) scale(1.03) !important;
        filter: brightness(1.08) !important;
        box-shadow: 0 18px 34px rgba(0, 0, 0, 0.46), 0 0 18px rgba(251, 191, 36, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -10px 18px rgba(0, 0, 0, 0.18) !important;
    }

    #runeBar .rune-btn-placeholder:active {
        transform: translateY(2px) scale(0.99) !important;
        filter: brightness(1.03) !important;
    }
}

@media (max-width: 900px) {
    #runeBar {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 14px !important;
        margin-top: 14px !important;
    }

    #runeBar .rune-btn-placeholder {
        display: inline-flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 92px !important;
        height: 92px !important;
        border-radius: 20px !important;
        border: 3px solid rgba(251, 191, 36, 0.65) !important;
        background: linear-gradient(180deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.96)) !important;
        color: rgba(251, 191, 36, 0.95) !important;
        font-weight: 900 !important;
        font-size: 44px !important;
        line-height: 1 !important;
        box-shadow: 0 18px 36px rgba(0, 0, 0, 0.50), inset 0 1px 0 rgba(255, 255, 255, 0.10) !important;
    }

    #runeBar .rune-btn-placeholder:active {
        transform: translateY(2px) scale(0.98) !important;
    }
}

/* =========================================
   JRPG v2 視覺強化包 (Battle Log & 怪物呼吸)
========================================= */

/* 1. 戰鬥日誌 (Battle Log) 質感提升 */
#battleLog {
    backdrop-filter: blur(8px) !important;
    background: rgba(15, 23, 42, 0.75) !important;
    /* 深藍色半透明底，讓字更清楚 */
    border: 2px solid rgba(251, 191, 36, 0.6) !important;
    /* 金黃色 RPG 邊框 */
    border-radius: 16px !important;
    padding: 12px 20px !important;
    font-weight: 700 !important;
    letter-spacing: 0.05em !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6) !important;
    /* 浮空陰影 */
}

/* 讓 Battle Log 裡面的文字更有復古 RPG 感 */
#battleLog .log-item {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    margin-bottom: 4px;
}

/* 登場演出 (Monster Entrance) */
@keyframes monsterEntrance {
    0% {
        opacity: 0;
        transform: scale(calc(var(--m-scale, 1) * 0.3)) translateY(40px);
        filter: brightness(3) blur(15px);
    }

    70% {
        transform: scale(calc(var(--m-scale, 1) * 1.08)) translateY(-5px);
        filter: brightness(1.5) blur(2px);
    }

    100% {
        opacity: 1;
        transform: scale(calc(var(--m-scale, 1) * 1)) translateY(0);
        filter: brightness(1) blur(0);
    }
}

.monster-entrance {
    animation: monsterEntrance 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* 2. 怪物呼吸動畫 (Monster Breath) */
.monster-breath {
    /* transform-origin 設為 bottom center 讓它從腳底往上呼吸，看起來更自然有重量感 */
    transform-origin: bottom center;
    animation: monsterBreath 3s ease-in-out infinite;
    will-change: transform;
}

@keyframes monsterBreath {
    0% {
        transform: scale(1) translateY(0);
    }

    50% {
        transform: scale(1.06) translateY(-2px);
    }

    /* 微微膨脹並稍微浮起 */
    100% {
        transform: scale(1) translateY(0);
    }
}

/* =========================================
   JRPG v2 視覺強化包 (防暴走魔法石碑)
========================================= */
/* 🌟 強制清洗舊版殘留的樣式干擾 */
.jp-tap-choices button,
.jp-tap-choices {
    width: auto !important;
    height: auto !important;
}

/* 題目區 Slot 強化 */
.blank-slot {
    border-bottom: 4px solid #fbbf24 !important;
    padding: 0px 12px 14px 12px !important;
    transition: transform 0.2s, border-color 0.2s !important;
    cursor: pointer;
    min-width: 50px;
    text-align: center;
    color: #fbbf24;
}

.blank-slot:hover {
    transform: translateY(-2px);
    border-bottom-color: #f59e0b !important;
}

/* 統一的石碑本體 (手機版絕佳尺寸：64x64) */
.rune-btn {
    width: 64px !important;
    height: 64px !important;
    border-radius: 14px !important;
    background: linear-gradient(135deg, #475569 0%, #334155 50%, #1e293b 100%) !important;
    border: 2px solid #0f172a !important;
    font-size: 26px !important;
    font-weight: 900 !important;
    color: #94a3b8 !important;
    box-shadow:
        inset 2px 2px 4px rgba(255, 255, 255, 0.15),
        inset -2px -2px 6px rgba(0, 0, 0, 0.6),
        0 4px 8px rgba(0, 0, 0, 0.5) !important;
    text-shadow: -1px -1px 1px rgba(0, 0, 0, 0.8), 1px 1px 1px rgba(255, 255, 255, 0.1) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer;
    user-select: none;
}

/* 電腦版尺寸：76x76 */
@media (min-width: 640px) {
    .rune-btn {
        width: 76px !important;
        height: 76px !important;
        font-size: 30px !important;
        border-radius: 16px !important;
    }
}

/* 狀態：閒置 Hover */
.rune-btn.is-idle:hover {
    color: #fbbf24 !important;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.8) !important;
    border-color: #78350f !important;
    box-shadow: inset 2px 2px 4px rgba(255, 255, 255, 0.2), inset -2px -2px 6px rgba(0, 0, 0, 0.6), 0 6px 12px rgba(251, 191, 36, 0.2) !important;
    transform: translateY(-2px) !important;
}

.rune-btn.is-idle:active {
    transform: translateY(2px) !important;
    box-shadow: inset 2px 2px 8px rgba(0, 0, 0, 0.8), 0 0 0 transparent !important;
}

/* 狀態：已選中 */
.rune-btn.is-selected {
    color: #fbbf24 !important;
    text-shadow: 0 0 12px rgba(251, 191, 36, 1) !important;
    background: linear-gradient(135deg, #334155, #1e293b) !important;
    border-color: #92400e !important;
    transform: translateY(2px) !important;
    box-shadow: inset 3px 3px 10px rgba(0, 0, 0, 0.9) !important;
}

/* 狀態：答對 */
.rune-btn.is-correct {
    background: linear-gradient(135deg, #059669, #064e3b) !important;
    border-color: #10b981 !important;
    color: #fff !important;
    text-shadow: 0 0 12px #fff, 0 0 20px #34d399 !important;
    box-shadow: inset 2px 2px 6px rgba(255, 255, 255, 0.4), 0 0 25px rgba(16, 185, 129, 0.8) !important;
    transform: scale(1.05) !important;
    z-index: 10;
}

/* 狀態：答錯 */
.rune-btn.is-wrong {
    background: linear-gradient(135deg, #7f1d1d, #450a0a) !important;
    border-color: #ef4444 !important;
    color: #fca5a5 !important;
    box-shadow: inset 3px 3px 10px rgba(0, 0, 0, 0.9) !important;
}

/* 狀態：無效 */
.rune-btn.is-disabled {
    opacity: 0.6 !important;
    filter: grayscale(1) !important;
    transform: translateY(2px) !important;
}

/* =========================================
   JRPG v2 視覺強化包 (統一彈射模式為石碑)
========================================= */

/* 將彈射模式的按鈕 (.flick-opt) 完全同步為遠古石碑風格 */
.flick-opt {
    width: 60px !important;
    height: 60px !important;
    border-radius: 12px !important;
    background: linear-gradient(135deg, #475569 0%, #334155 50%, #1e293b 100%) !important;
    border: 2px solid #0f172a !important;
    font-size: 24px !important;
    font-weight: 900 !important;
    color: #94a3b8 !important;
    box-shadow:
        inset 2px 2px 4px rgba(255, 255, 255, 0.15),
        inset -2px -2px 6px rgba(0, 0, 0, 0.6),
        0 4px 8px rgba(0, 0, 0, 0.5) !important;
    text-shadow: -1px -1px 1px rgba(0, 0, 0, 0.8), 1px 1px 1px rgba(255, 255, 255, 0.1) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

@media (min-width: 640px) {
    .flick-opt {
        width: 80px !important;
        height: 80px !important;
        font-size: 32px !important;
        border-radius: 16px !important;
    }
}

/* 彈射模式：準備發射時的發光 */
.flick-opt.is-active {
    color: #fbbf24 !important;
    text-shadow: 0 0 12px rgba(251, 191, 36, 1) !important;
    border-color: #92400e !important;
    transform: scale(0.95) !important;
    box-shadow: inset 3px 3px 10px rgba(0, 0, 0, 0.9) !important;
}

/* 彈射模式：被子彈瞄準時的魔力共鳴 */
.flick-opt.is-target {
    color: #fff !important;
    text-shadow: 0 0 12px #fff, 0 0 20px #fbbf24 !important;
    border-color: #fbbf24 !important;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.8), inset 2px 2px 4px rgba(255, 255, 255, 0.4) !important;
    transform: scale(1.1) !important;
}

.audio-debug-overlay {
    position: fixed;
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 1000002;
    width: min(94vw, 520px);
    max-height: min(78dvh, 720px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(125, 211, 252, 0.28);
    border-radius: 16px;
    background: rgba(8, 13, 28, 0.9);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    color: #e5f4ff;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    pointer-events: auto;
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.audio-debug-overlay.is-collapsed {
    width: min(86vw, 290px);
    top: max(10px, env(safe-area-inset-top));
    right: max(10px, env(safe-area-inset-right));
    bottom: auto;
}

.audio-debug-overlay.is-dragging {
    user-select: none;
}

.audio-debug-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.audio-debug-overlay.is-dragging .audio-debug-header {
    cursor: grabbing;
}

.audio-debug-title {
    color: #67e8f9;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.audio-debug-subtitle {
    margin-top: 2px;
    color: rgba(226, 232, 240, 0.55);
    font-size: 10px;
}

.audio-debug-header-actions,
.audio-debug-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.audio-debug-overlay button {
    min-height: 28px;
    padding: 5px 8px;
    border: 1px solid rgba(125, 211, 252, 0.22);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.78);
    color: #dff8ff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.audio-debug-overlay button:active {
    transform: translateY(1px);
}

.audio-debug-body {
    min-height: 0;
    padding: 10px 12px 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.audio-debug-actions {
    margin-bottom: 10px;
}

.audio-debug-sections {
    display: grid;
    gap: 10px;
}

.audio-debug-section {
    padding: 9px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.045);
}

.audio-debug-section h3 {
    margin: 0 0 7px;
    color: #fde68a;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.audio-debug-row {
    display: grid;
    grid-template-columns: minmax(96px, 38%) minmax(0, 1fr);
    gap: 8px;
    padding: 3px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.045);
    font-size: 10px;
    line-height: 1.35;
}

.audio-debug-row:first-of-type {
    border-top: 0;
}

.audio-debug-row span {
    color: rgba(203, 213, 225, 0.72);
    overflow-wrap: anywhere;
}

.audio-debug-row code {
    color: #f8fafc;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.text-orange-400.grade-badge {
    width: 32px !important;
    height: 32px !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    color: #a67c62 !important;
    filter: none !important;
    -webkit-text-stroke: 0.7px rgba(26, 20, 16, 0.72) !important;
    text-shadow:
        0 1px 0 rgba(255, 236, 205, 0.16),
        0 2px 4px rgba(0, 0, 0, 0.72),
        0 0 7px rgba(90, 55, 42, 0.28) !important;
}

@media (max-width: 640px) {
    .audio-debug-overlay {
        left: 8px;
        right: 8px;
        top: calc(env(safe-area-inset-top, 0px) + 12px);
        bottom: auto;
        width: auto;
        max-height: 48dvh;
        border-radius: 14px;
    }

    .audio-debug-overlay.is-collapsed {
        left: auto;
        top: calc(env(safe-area-inset-top, 0px) + 12px);
        right: 12px;
        bottom: auto;
        width: min(88vw, 300px);
        max-width: calc(100vw - 24px);
    }

    .audio-debug-row {
        grid-template-columns: minmax(82px, 34%) minmax(0, 1fr);
    }
}

.map-mentor-portrait-stage {
    bottom: clamp(8rem, 21vh, 12.5rem);
    height: 72vh;
    max-width: min(92vw, 520px);
    overflow: visible;
    align-items: flex-start;
}

.map-mentor-portrait-stage .mentor-scene-portrait {
    width: auto !important;
    height: 124vh !important;
    max-width: none;
    max-height: none;
    object-fit: contain;
    object-position: top center;
    transform: translateY(9vh);
}

@media (hover: none) and (pointer: coarse) and (max-width: 767px) and (orientation: portrait) {
    .map-mentor-portrait-stage {
        --mentor-mobile-offset-x: clamp(45px, 15vw, 75px);
    }

    .map-mentor-portrait-stage .mentor-scene-portrait {
        transform: translateX(var(--mentor-mobile-offset-x)) translateY(9vh);
    }
}

@media (min-width: 768px) and (orientation: portrait) {
    .map-mentor-portrait-stage {
        height: 76vh;
        max-width: min(78vw, 620px);
    }

    .map-mentor-portrait-stage .mentor-scene-portrait {
        height: 128vh !important;
        transform: translateY(9vh);
    }
}

@media (orientation: landscape) {
    .map-mentor-portrait-stage {
        bottom: clamp(7rem, 19vh, 10rem);
        height: 64vh;
        max-width: min(58vw, 520px);
    }

    .map-mentor-portrait-stage .mentor-scene-portrait {
        height: 104vh !important;
        transform: translateY(6vh);
    }
}

@media (max-width: 640px) {
    #hud {
        padding-top: 10px !important;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)) !important;
        flex-direction: column !important;
        min-height: 0 !important;
        height: auto !important;
    }

    #question-area {
        min-height: 0 !important;
        height: auto !important;
        justify-content: center !important;
        padding-bottom: 10px !important;
        margin-top: 10px !important;
    }

    /* 點選模式專用：縮小攻擊鈕與間距，避免擠壓 */
    .tap-mode-controls {
        gap: 0.75rem !important;
    }

    .tap-attack-btn {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
        margin-top: -0.15rem !important;
        font-size: 1rem !important;
    }
}

/* ---------------- Boss VFX Classes ---------------- */
.boss-vfx-shake {
    animation: boss-shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes boss-shake {

    0%,
    100% {
        transform: translate(0, 0);
    }

    15% {
        transform: translate(-15px, -8px) rotate(-2deg);
    }

    30% {
        transform: translate(15px, 12px) rotate(2deg);
    }

    45% {
        transform: translate(-12px, 15px) rotate(-1deg);
    }

    60% {
        transform: translate(12px, -12px) rotate(2deg);
    }

    75% {
        transform: translate(-8px, 6px) rotate(0deg);
    }
}

/* 1.2 版：爪痕群組容器 - 負責整組的同步位移與旋轉 */
.boss-claw-group {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: 20;
    transform: rotate(25deg);
    /* 整組固定傾角 */
    animation: boss-claw-swipe 1.0s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}

@keyframes boss-claw-swipe {
    0% {
        transform: rotate(25deg) translateY(-30vh) scale(0.8);
        opacity: 0;
    }

    15% {
        opacity: 1;
        transform: rotate(25deg) translateY(-5vh) scale(0.95);
    }

    30% {
        opacity: 1;
        transform: rotate(25deg) translateY(0vh) scale(1.0);
    }

    70% {
        opacity: 0.85;
        transform: rotate(25deg) translateY(8vh) scale(1.02);
    }

    100% {
        transform: rotate(25deg) translateY(30vh) scale(1.05);
        opacity: 0;
    }
}

/* 強化：預備動作/前震 (Anticipation/Pre-impact) */
.boss-vfx-anticipation {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    z-index: 5;
    animation: boss-dim 0.4s ease-in forwards;
}

@keyframes boss-dim {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

/* 強化：餘震/震後殘留 (Aftershock/Residual) */
.boss-vfx-residual {
    position: absolute;
    inset: 0;
    background: rgba(220, 38, 38, 0.1);
    mix-blend-mode: color-burn;
    opacity: 0;
    z-index: 5;
    animation: boss-residual 0.8s ease-out forwards;
}

@keyframes boss-residual {
    0% {
        opacity: 0.8;
        transform: scale(1.1);
    }

    100% {
        opacity: 0;
        transform: scale(1);
    }
}

/* Level 5: 藤蔓攻擊 (Vine Attack) - 植物荊棘強化版 */
.boss-vine-group {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 藤蔓改用 SVG 繪製（彎曲莖幹＋葉片＋捲鬚），此 wrapper 僅負責定位與既有甩動動畫；
   SVG 以等比鋪滿高度、置中於 wrapper、可超出邊界顯示葉片。 */
.boss-vfx-vine {
    position: absolute;
    width: 4px;
    height: 150vh;
    overflow: visible;
}

.boss-vfx-vine .boss-vine-svg {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    height: 100%;
    width: auto;
    overflow: visible;
    filter:
        drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55))
        drop-shadow(0 0 6px rgba(20, 60, 8, 0.4));
}

/* 統一甩動：基準角度由行內 --vine-rot 控制（JS 每條隨機指定），保留「斜插→甩落→淡出」節奏。
   垂直藤蔓 rot≈±48°、橫向藤蔓 rot≈±90°，皆隨機。 */
.boss-vine-whip {
    animation: vine-whip 0.85s cubic-bezier(0.3, 0, 0.15, 1) forwards;
    opacity: 0.95;
}

@keyframes vine-whip {
    0% {
        transform: rotate(calc(var(--vine-rot, 0deg) - 20deg)) scaleY(0) translateY(-100%) skewX(-3deg);
        opacity: 0;
    }

    28% {
        transform: rotate(calc(var(--vine-rot, 0deg) - 9deg)) scaleY(1.2) translateY(0) skewX(2deg);
        opacity: 1;
    }

    65% {
        transform: rotate(calc(var(--vine-rot, 0deg) - 3deg)) scaleY(1.4) translateY(55%) skewX(-1deg);
        opacity: 0.9;
    }

    100% {
        transform: rotate(var(--vine-rot, 0deg)) scaleY(1.55) translateY(100%) skewX(3deg);
        opacity: 0;
    }
}

/* Level 15: 重擊 (Smash Attack) - 強化版：更強烈的衝擊感 */
.boss-smash-group {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: 30;
}

.boss-vfx-shockwave {
    position: absolute;
    width: 200px;
    height: 200px;
    border: 8px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    opacity: 0;
    animation: smash-shockwave 0.6s ease-out forwards;
}

@keyframes smash-shockwave {
    0% {
        transform: scale(0.2);
        opacity: 1;
        border-width: 40px;
    }

    100% {
        transform: scale(5);
        opacity: 0;
        border-width: 2px;
    }
}

/* 怪物死亡動畫 - 普通 */
.monster-death-anim {
    animation: monster-die-sequence 2s ease-out forwards !important;
    pointer-events: none;
}


/* 怪物死亡動畫 - Boss */
.boss-death-anim {
    animation: boss-die-container-fade 10s linear forwards !important;
    pointer-events: none;
    transform-origin: center center;
    will-change: filter, opacity;
}

@keyframes monster-die-sequence {
    0% {
        transform: scale(1) translateY(0);
        filter: brightness(1) contrast(1) saturate(1);
        opacity: 1;
    }
    6% {
        /* 受擊壓縮 */
        transform: scale(0.92, 1.06) translateY(4px);
        filter: brightness(2) contrast(1.3) saturate(1.2);
        opacity: 1;
    }
    15% {
        /* 強白閃 - 碎裂瞬間 */
        transform: scale(1.08) translateY(-4px);
        filter: brightness(15) contrast(2) saturate(0.4) drop-shadow(0 0 24px rgba(255, 255, 255, 0.9));
        opacity: 1;
    }
    28% {
        /* 去飽和 - 生命力流失 */
        transform: scale(1.03) translateY(-2px);
        filter: brightness(3) contrast(2.2) saturate(0) drop-shadow(0 0 10px rgba(255, 220, 100, 0.5));
        opacity: 0.9;
    }
    50% {
        transform: scale(1.0) translateY(0);
        filter: brightness(1.5) contrast(3) saturate(0) blur(1px);
        opacity: 0.55;
    }
    75% {
        transform: scale(0.95) translateY(4px);
        filter: brightness(0.5) contrast(2) saturate(0) blur(5px);
        opacity: 0.18;
    }
    100% {
        transform: scale(0.88) translateY(8px);
        filter: brightness(0) blur(12px);
        opacity: 0;
    }
}

/* 普通怪死亡碎片 VFX */
.normal-death-vfx-wrap {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
    z-index: 5;
    pointer-events: none;
    overflow: visible;
}

.normal-death-burst-core {
    position: absolute;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 1) 0%, rgba(255, 230, 80, 0.85) 40%, rgba(255, 140, 0, 0.4) 70%, transparent 100%);
    transform: translate(-50%, -50%) scale(0.15);
    animation: normal-death-burst-fade 0.45s ease-out forwards;
}

@keyframes normal-death-burst-fade {
    0%   { transform: translate(-50%, -50%) scale(0.15); opacity: 1; }
    40%  { opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2.4); opacity: 0; }
}

.normal-death-shard-field {
    position: absolute;
    top: 0;
    left: 0;
}

.normal-death-shard {
    position: absolute;
    width: var(--sw, 11px);
    height: var(--sh, 5px);
    top: calc(var(--sh, 5px) / -2);
    left: calc(var(--sw, 11px) / -2);
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 230, 80, 0.88) 45%, rgba(255, 130, 0, 0.65) 100%);
    box-shadow: 0 0 5px rgba(255, 210, 60, 0.85);
    clip-path: polygon(0% 20%, 80% 0%, 100% 65%, 18% 100%);
    animation: normal-death-shard-fly 0.82s cubic-bezier(0.15, 0.8, 0.3, 1) forwards;
    animation-delay: var(--delay, 0s);
}

.normal-death-shard:nth-child(3n+1) { clip-path: polygon(0% 20%, 80% 0%, 100% 65%, 18% 100%); }
.normal-death-shard:nth-child(3n+2) { clip-path: polygon(50% 0%, 100% 35%, 70% 100%, 0% 65%); }
.normal-death-shard:nth-child(3n)   { clip-path: polygon(15% 0%, 100% 10%, 85% 100%, 0% 80%); }

@keyframes normal-death-shard-fly {
    0%   { transform: rotate(var(--angle)) translateX(3px); opacity: 1; }
    18%  { opacity: 1; }
    100% { transform: rotate(calc(var(--angle) + var(--spin, 80deg))) translateX(var(--dist, 60px)); opacity: 0; }
}

@keyframes boss-die-sequence {
    0% {
        transform: scale(1) translateY(0) rotate(0deg);
        filter: brightness(1) saturate(1) contrast(1);
        opacity: 1;
    }

    6% {
        transform: scale(1.012) translateY(-2px) rotate(-0.6deg);
        filter: brightness(1.9) saturate(1.28) contrast(1.12) drop-shadow(0 0 12px rgba(255, 245, 200, 0.82));
    }

    12% {
        transform: scale(1.006) translateY(1px) rotate(0.45deg);
        filter: brightness(1.22) saturate(1.08) contrast(1.04);
    }

    18% {
        transform: scale(1.024) translateY(-4px) rotate(-0.95deg);
        filter: brightness(2.35) saturate(1.42) contrast(1.18) drop-shadow(0 0 16px rgba(255, 250, 220, 0.86));
    }

    30% {
        transform: scale(1.03) translateY(-8px) rotate(1deg);
        filter: brightness(2.5) saturate(1.46) contrast(1.26) drop-shadow(0 0 18px rgba(196, 181, 253, 0.72));
        opacity: 0.88;
    }

    45% {
        transform: scale(1.038) translateY(-14px) rotate(-1.35deg);
        filter: brightness(1.35) saturate(0.92) contrast(1.16) blur(0.35px);
        opacity: 0.85;
    }

    52% {
        transform: scale(1.05) translate3d(-6px, -18px, 0) rotate(-2.8deg);
        filter: brightness(2.2) saturate(1.1) contrast(1.3) blur(0.8px) drop-shadow(0 0 16px rgba(255, 255, 255, 0.42));
        opacity: 0.8;
    }

    64% {
        transform: scale(0.99) translate3d(7px, -24px, 0) rotate(3.1deg);
        filter: brightness(2.95) saturate(1.2) contrast(1.38) blur(1.4px) drop-shadow(0 0 18px rgba(221, 214, 254, 0.48));
        opacity: 0.72;
    }

    76% {
        transform: scale(1.06, 0.94) translate3d(-8px, -28px, 0) rotate(-3.8deg);
        filter: brightness(3.2) saturate(1.06) contrast(1.42) blur(1.7px);
        opacity: 0.66;
    }

    87% {
        transform: scale(1.18) translate3d(0, -38px, 0) rotate(0deg);
        filter: brightness(5.2) saturate(0.42) contrast(1.54) blur(4px) drop-shadow(0 0 28px rgba(255, 255, 255, 0.95));
        opacity: 0.34;
    }

    90% {
        transform: scale(0.86) translate3d(0, -44px, 0) rotate(-1.4deg);
        filter: brightness(1.1) saturate(0.08) contrast(0.88) grayscale(0.74) blur(8px);
        opacity: 0.16;
    }

    100% {
        transform: scale(0.52) translate3d(0, -58px, 0) rotate(-3.6deg);
        filter: brightness(0.4) saturate(0) contrast(0.82) grayscale(1) blur(16px);
        opacity: 0;
    }
}

@keyframes boss-die-container-fade {
    0% {
        filter: brightness(1) saturate(1) contrast(1);
        opacity: 1;
    }

    6% {
        filter: brightness(1.9) saturate(1.28) contrast(1.12) drop-shadow(0 0 12px rgba(255, 245, 200, 0.82));
    }

    18% {
        filter: brightness(2.35) saturate(1.42) contrast(1.18) drop-shadow(0 0 16px rgba(255, 250, 220, 0.86));
    }

    45% {
        filter: brightness(1.35) saturate(0.92) contrast(1.16) blur(0.35px);
        opacity: 0.85;
    }

    76% {
        filter: brightness(3.2) saturate(1.06) contrast(1.42) blur(1.7px);
        opacity: 0.66;
    }

    87% {
        filter: brightness(5.2) saturate(0.42) contrast(1.54) blur(4px) drop-shadow(0 0 28px rgba(255, 255, 255, 0.95));
        opacity: 0.34;
    }

    90% {
        filter: brightness(1.1) saturate(0.08) contrast(0.88) grayscale(0.74) blur(8px);
        opacity: 0.16;
    }

    100% {
        filter: brightness(0.4) saturate(0) contrast(0.82) grayscale(1) blur(16px);
        opacity: 0;
    }
}

/* L36 隱藏魔王：容器死亡動畫 — 較少全白閃、偏虛無收束 */
.boss-death-anim.boss-death-anim--hidden {
    animation: boss-die-container-fade-hidden 10s linear forwards !important;
}

@keyframes boss-die-container-fade-hidden {
    0% {
        filter: brightness(1) saturate(1) contrast(1);
        opacity: 1;
    }

    8% {
        filter: brightness(1.35) saturate(0.85) contrast(1.08) drop-shadow(0 0 14px rgba(88, 28, 135, 0.55));
    }

    22% {
        filter: brightness(1.15) saturate(0.72) contrast(1.12) drop-shadow(0 0 18px rgba(30, 27, 75, 0.65));
        opacity: 0.94;
    }

    48% {
        filter: brightness(0.95) saturate(0.55) contrast(1.18) blur(0.5px) drop-shadow(0 0 22px rgba(49, 46, 129, 0.5));
        opacity: 0.82;
    }

    72% {
        filter: brightness(0.72) saturate(0.35) contrast(1.22) blur(1.6px) drop-shadow(0 0 12px rgba(12, 10, 40, 0.7));
        opacity: 0.58;
    }

    88% {
        filter: brightness(0.42) saturate(0.12) contrast(1.08) blur(5px) drop-shadow(0 0 28px rgba(76, 29, 149, 0.45));
        opacity: 0.22;
    }

    100% {
        filter: brightness(0.18) saturate(0) contrast(0.95) blur(14px) grayscale(0.92);
        opacity: 0;
    }
}

.boss-death-overlay-wrap {
    position: absolute;
    left: 50%;
    top: 50%;
    width: clamp(13.5rem, 45vmin, 32rem);
    height: clamp(13.5rem, 45vmin, 32rem);
    transform: translate(-50%, -50%);
    z-index: 4;
    pointer-events: none;
    overflow: visible;
    contain: none;
}

.boss-death-overlay {
    position: relative;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transform-origin: center center;
    overflow: visible;
}

.boss-death-vignette,
.boss-death-aura,
.boss-death-core,
.boss-death-ring,
.boss-death-afterglow,
.boss-death-leak-field,
.boss-death-fragment-field {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.boss-death-vignette {
    border-radius: 50%;
    background:
        radial-gradient(circle at center,
            rgba(255, 255, 255, 0.2) 0%,
            rgba(196, 181, 253, 0.15) 24%,
            rgba(91, 33, 182, 0.22) 48%,
            rgba(15, 23, 42, 0.36) 72%,
            transparent 100%);
    filter: blur(12px);
}

.boss-death-aura {
    inset: 23%;
    border-radius: 50%;
    background:
        radial-gradient(circle at center,
            rgba(255, 255, 255, 0.88) 0%,
            rgba(244, 239, 255, 0.5) 18%,
            rgba(196, 181, 253, 0.3) 34%,
            rgba(168, 85, 247, 0.18) 56%,
            transparent 71%);
    filter: blur(8px);
}

.boss-death-core {
    inset: 39%;
    border-radius: 50%;
    background:
        radial-gradient(circle at center,
            rgba(255, 255, 255, 1) 0%,
            rgba(250, 245, 255, 0.98) 18%,
            rgba(221, 214, 254, 0.74) 42%,
            rgba(168, 85, 247, 0.22) 64%,
            rgba(255, 255, 255, 0) 81%);
    mix-blend-mode: screen;
    filter: blur(2px);
}

.boss-death-ring {
    inset: 25%;
    border-radius: 50%;
    border: 2px solid rgba(255, 248, 220, 0.65);
    opacity: 0;
}

.boss-death-ring-b {
    inset: 15%;
    border-color: rgba(196, 181, 253, 0.4);
}

.boss-death-afterglow {
    inset: -4%;
    border-radius: 50%;
    background:
        radial-gradient(circle at center,
            rgba(248, 250, 252, 0.18) 0%,
            rgba(221, 214, 254, 0.18) 24%,
            rgba(168, 85, 247, 0.14) 46%,
            rgba(30, 41, 59, 0.06) 62%,
            transparent 74%);
    filter: blur(11px);
    opacity: 0;
}

.boss-death-body-vfx {
    position: absolute;
    inset: -4%;
    z-index: 5;
    pointer-events: none;
    border-radius: 44%;
    overflow: visible;
    opacity: 0;
    mix-blend-mode: screen;
}

.boss-death-sync-shell {
    transform-origin: center center;
    will-change: transform, filter;
}

.boss-death-sync-shell.boss-death-stage-3 {
    animation: boss-shell-core-sync 0.52s cubic-bezier(0.32, 0.02, 0.14, 1) infinite;
}

.boss-death-sync-shell.boss-death-stage-4 {
    animation: boss-shell-final-sync 2.1s cubic-bezier(0.24, 0.78, 0.16, 1) forwards;
}

.boss-death-body-core,
.boss-death-body-glow,
.boss-death-body-distortion,
.boss-death-body-cracks,
.boss-death-body-erosion,
.boss-death-body-fragments {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.boss-death-body-core {
    border-radius: 48%;
    background:
        radial-gradient(circle at 50% 50%,
            rgba(255, 255, 255, 0.96) 0%,
            rgba(248, 245, 255, 0.9) 16%,
            rgba(221, 214, 254, 0.46) 34%,
            rgba(168, 85, 247, 0.08) 56%,
            rgba(255, 255, 255, 0) 66%);
    filter: blur(4.5px);
    opacity: 0;
}

.boss-death-body-glow {
    border-radius: 46%;
    background:
        radial-gradient(circle at 50% 48%,
            rgba(255, 255, 255, 0.32) 0%,
            rgba(248, 245, 255, 0.28) 12%,
            rgba(221, 214, 254, 0.22) 26%,
            rgba(168, 85, 247, 0.18) 44%,
            rgba(91, 33, 182, 0.14) 60%,
            rgba(15, 23, 42, 0) 73%);
    filter: blur(5px);
}

.boss-death-body-distortion {
    border-radius: 42%;
    background:
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.28) 0%, transparent 18%),
        radial-gradient(circle at 42% 34%, rgba(196, 181, 253, 0.18) 0%, transparent 18%),
        radial-gradient(circle at 64% 64%, rgba(168, 85, 247, 0.16) 0%, transparent 22%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 44%, rgba(167, 139, 250, 0.16) 70%, transparent 100%);
    mix-blend-mode: plus-lighter;
    filter: blur(4px);
}

.boss-death-body-crack {
    position: absolute;
    left: var(--crack-x, 50%);
    top: var(--crack-y, 50%);
    width: 10px;
    height: 64px;
    margin-left: -5px;
    margin-top: -32px;
    border-radius: 999px;
    background:
        linear-gradient(180deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 245, 200, 0.86) 18%,
            rgba(250, 204, 21, 0.78) 48%,
            rgba(168, 85, 247, 0.55) 72%,
            rgba(15, 23, 42, 0) 100%);
    box-shadow:
        0 0 8px rgba(255, 248, 220, 0.48),
        0 0 18px rgba(168, 85, 247, 0.28);
    transform: rotate(var(--crack-rot, 0deg)) scaleY(0.15);
    opacity: 0;
}

.boss-death-body-erosion {
    border-radius: 46%;
    background:
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.24) 0%, transparent 16%),
        radial-gradient(circle at 38% 34%, rgba(255, 255, 255, 0.16) 0%, transparent 14%),
        radial-gradient(circle at 64% 34%, rgba(221, 214, 254, 0.16) 0%, transparent 14%),
        radial-gradient(circle at 50% 68%, rgba(168, 85, 247, 0.16) 0%, transparent 18%);
    opacity: 0;
    filter: blur(3px);
}

.boss-death-body-fragment {
    position: absolute;
    left: var(--body-frag-x, 50%);
    top: var(--body-frag-y, 50%);
    width: 10px;
    height: 10px;
    margin-left: -5px;
    margin-top: -5px;
    border-radius: 3px;
    background:
        linear-gradient(145deg,
            rgba(255, 255, 255, 0.88) 0%,
            rgba(203, 213, 225, 0.78) 42%,
            rgba(100, 116, 139, 0.56) 100%);
    box-shadow:
        0 0 8px rgba(248, 250, 252, 0.28),
        0 0 12px rgba(148, 163, 184, 0.18);
    transform: rotate(var(--body-frag-angle, 0deg)) translateY(0) scale(0.25);
    opacity: 0;
}

.boss-death-leak,
.boss-death-fragment {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 999px;
    pointer-events: none;
    opacity: 0;
}

.boss-death-leak {
    width: 10px;
    height: 152px;
    margin-left: -5px;
    margin-top: -76px;
    background: linear-gradient(180deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.85) 20%,
            rgba(221, 214, 254, 0.9) 52%,
            rgba(168, 85, 247, 0.55) 82%,
            rgba(168, 85, 247, 0) 100%);
    box-shadow:
        0 0 10px rgba(255, 255, 255, 0.5),
        0 0 18px rgba(168, 85, 247, 0.34);
    transform:
        rotate(var(--angle, 0deg)) translateY(calc(var(--radius, 72px) * -1)) scaleY(1);
    filter: brightness(1.05);
    animation: boss-death-leak-reveal 0.52s cubic-bezier(0.22, 0.82, 0.24, 1) both;
    animation-delay: var(--reveal-delay, 0s);
}

.boss-death-fragment {
    width: 14px;
    height: 14px;
    margin-left: -7px;
    margin-top: -7px;
    background:
        radial-gradient(circle at 30% 30%,
            rgba(255, 255, 255, 0.92) 0%,
            rgba(221, 214, 254, 0.84) 34%,
            rgba(91, 33, 182, 0.8) 100%);
    box-shadow:
        0 0 8px rgba(248, 250, 252, 0.5),
        0 0 14px rgba(168, 85, 247, 0.3);
    transform:
        rotate(var(--angle, 0deg)) translateY(calc(var(--distance, 48px) * -0.25)) scale(0.3);
    animation: boss-death-fragment-burst 1.6s ease-out infinite;
    animation-delay: var(--delay, 0s);
}

.boss-death-stage-1 {
    opacity: 1;
}

.boss-death-body-vfx.boss-death-stage-1,
.boss-death-body-vfx.boss-death-stage-2,
.boss-death-body-vfx.boss-death-stage-3,
.boss-death-body-vfx.boss-death-stage-4 {
    opacity: 1;
}

.boss-death-stage-1 .boss-death-aura,
.boss-death-stage-1 .boss-death-core {
    animation: boss-death-stage-1-pulse 1.2s ease-in-out infinite;
}

.boss-death-body-vfx.boss-death-stage-1 .boss-death-body-glow,
.boss-death-body-vfx.boss-death-stage-1 .boss-death-body-distortion,
.boss-death-body-vfx.boss-death-stage-1 .boss-death-body-core {
    animation: boss-body-instability 1.15s ease-in-out infinite;
}

.boss-death-stage-1 .boss-death-ring-a {
    animation: boss-death-ring-ripple 1.45s ease-out infinite;
}

.boss-death-stage-2 {
    opacity: 1;
}

.boss-death-stage-2 .boss-death-aura {
    animation: boss-death-stage-2-flare 1.8s ease-in-out infinite;
}

.boss-death-stage-2 .boss-death-core {
    animation: boss-death-stage-2-core 1.15s steps(2, end) infinite;
}

.boss-death-stage-2 .boss-death-ring-a,
.boss-death-stage-2 .boss-death-ring-b,
.boss-death-stage-3 .boss-death-ring-a,
.boss-death-stage-3 .boss-death-ring-b {
    opacity: 1;
}

.boss-death-stage-2 .boss-death-ring-a {
    animation: boss-death-ring-ripple 1.7s ease-out infinite;
}

.boss-death-stage-2 .boss-death-ring-b {
    animation: boss-death-ring-ripple 1.7s ease-out infinite 0.45s;
}

.boss-death-body-vfx.boss-death-stage-2 .boss-death-body-glow {
    animation: boss-body-stage-2-glow 1.4s ease-in-out infinite;
}

.boss-death-body-vfx.boss-death-stage-2 .boss-death-body-core {
    opacity: 1;
    animation: boss-body-core-overload 1.15s ease-in-out infinite;
}

.boss-death-body-vfx.boss-death-stage-2 .boss-death-body-distortion {
    animation: boss-body-distortion 1s steps(2, end) infinite;
}

.boss-death-body-vfx.boss-death-stage-2 .boss-death-body-erosion {
    opacity: 1;
    animation: boss-body-erosion-pulse 1.5s ease-out infinite;
}

.boss-death-body-vfx.boss-death-stage-2 .boss-death-body-crack {
    animation: boss-body-crack-open 1.6s ease-out infinite;
    animation-delay: var(--crack-delay, 0s);
}

.boss-death-body-vfx.boss-death-stage-2 .boss-death-body-fragment {
    animation: boss-body-fragment-shed 1.45s ease-out infinite;
    animation-delay: var(--body-frag-delay, 0s);
}

.boss-death-stage-3 {
    opacity: 1;
}

.boss-death-stage-3 .boss-death-core {
    animation: boss-death-stage-3-core 0.52s cubic-bezier(0.32, 0.02, 0.14, 1) infinite;
}

.boss-death-stage-3 .boss-death-ring-a {
    animation: boss-death-ring-ripple 0.58s ease-out infinite;
}

.boss-death-stage-3 .boss-death-ring-b {
    animation: boss-death-ring-ripple 0.58s ease-out infinite 0.12s;
}

.boss-death-stage-3 .boss-death-fragment {
    opacity: 1;
}

.boss-death-body-vfx.boss-death-stage-3 .boss-death-body-glow {
    animation: boss-body-stage-3-glow 0.52s cubic-bezier(0.32, 0.02, 0.14, 1) infinite;
}

.boss-death-body-vfx.boss-death-stage-3 {
    animation: none;
    transform-origin: center center;
}

.boss-death-body-vfx.boss-death-stage-3 .boss-death-body-core {
    opacity: 1;
    animation: boss-body-core-collapse 0.52s cubic-bezier(0.32, 0.02, 0.14, 1) infinite;
}

.boss-death-body-vfx.boss-death-stage-3 .boss-death-body-distortion {
    animation: boss-body-light-pulse 0.72s ease-in-out infinite;
}

.boss-death-body-vfx.boss-death-stage-3 .boss-death-body-erosion {
    opacity: 1;
    animation: boss-body-erosion-bloom 0.52s cubic-bezier(0.32, 0.02, 0.14, 1) infinite;
}

.boss-death-body-vfx.boss-death-stage-3 .boss-death-body-crack {
    animation: boss-body-crack-overload 0.52s cubic-bezier(0.32, 0.02, 0.14, 1) infinite;
    animation-delay: var(--crack-delay, 0s);
}

.boss-death-body-vfx.boss-death-stage-3 .boss-death-body-fragment {
    animation: boss-body-fragment-burst 0.52s cubic-bezier(0.32, 0.02, 0.14, 1) infinite;
    animation-delay: var(--body-frag-delay, 0s);
}

.boss-death-stage-4 {
    opacity: 1;
    animation: boss-death-overlay-fadeout 3s ease-out forwards;
}

.boss-death-stage-4 .boss-death-aura,
.boss-death-stage-4 .boss-death-core,
.boss-death-stage-4 .boss-death-vignette {
    animation: boss-death-stage-4-fade 2.1s cubic-bezier(0.24, 0.78, 0.16, 1) forwards;
}

.boss-death-stage-4 .boss-death-afterglow {
    opacity: 1;
    animation: boss-death-afterglow-fade 2.1s ease-out forwards;
}

.boss-death-stage-4 .boss-death-ring-a,
.boss-death-stage-4 .boss-death-ring-b {
    animation: boss-death-ring-fadeout 1.35s ease-out forwards;
}

.boss-death-stage-4 .boss-death-leak {
    opacity: 1;
    animation: boss-death-leak-fadeout 0.95s ease-out forwards;
}

.boss-death-stage-4 .boss-death-fragment {
    opacity: 1;
    animation: boss-death-fragment-fadeout 1s ease-out forwards;
}

.boss-death-body-vfx.boss-death-stage-4 {
    animation: boss-body-light-final-fade 2.1s cubic-bezier(0.24, 0.78, 0.16, 1) forwards;
}

.boss-death-body-vfx.boss-death-stage-4 .boss-death-body-glow,
.boss-death-body-vfx.boss-death-stage-4 .boss-death-body-core,
.boss-death-body-vfx.boss-death-stage-4 .boss-death-body-distortion,
.boss-death-body-vfx.boss-death-stage-4 .boss-death-body-erosion {
    animation: boss-body-light-collapse 2.1s cubic-bezier(0.24, 0.78, 0.16, 1) forwards;
}

.boss-death-body-vfx.boss-death-stage-4 .boss-death-body-crack {
    opacity: 1;
    animation: boss-body-crack-fade 0.9s ease-out forwards;
}

.boss-death-body-vfx.boss-death-stage-4 .boss-death-body-fragment {
    opacity: 1;
    animation: boss-body-fragment-fade 1.25s ease-out forwards;
}

/* ---- L36 隱藏魔王專用：黑紫核心、裂縫、收束爆發（不影響無 .boss-death--hidden 的一般 boss）---- */
.boss-death-overlay.boss-death--hidden {
    overflow: visible;
}

.boss-death-overlay.boss-death--hidden::before {
    content: "";
    position: absolute;
    inset: -18%;
    border-radius: 50%;
    pointer-events: none;
    background:
        conic-gradient(from 0deg at 50% 50%,
            rgba(12, 10, 28, 0.55) 0deg,
            rgba(49, 46, 129, 0.22) 52deg,
            rgba(12, 10, 28, 0.62) 104deg,
            rgba(76, 29, 149, 0.28) 168deg,
            rgba(15, 23, 42, 0.58) 220deg,
            rgba(88, 28, 135, 0.26) 286deg,
            rgba(12, 10, 28, 0.55) 360deg);
    opacity: 0.42;
    mix-blend-mode: multiply;
    filter: blur(1px);
    animation: boss-hidden-void-spin 14s linear infinite;
    z-index: 0;
}

.boss-death-overlay.boss-death--hidden::after {
    content: "";
    position: absolute;
    inset: 8%;
    border-radius: 50%;
    pointer-events: none;
    background:
        radial-gradient(ellipse 120% 42% at 50% 50%,
            rgba(0, 0, 0, 0) 38%,
            rgba(30, 27, 75, 0.35) 62%,
            rgba(12, 10, 24, 0.55) 78%,
            rgba(0, 0, 0, 0) 100%);
    opacity: 0.55;
    mix-blend-mode: multiply;
    z-index: 1;
}

.boss-death-overlay.boss-death--hidden .boss-death-vignette {
    background:
        radial-gradient(circle at center,
            rgba(30, 27, 75, 0.12) 0%,
            rgba(49, 46, 129, 0.22) 28%,
            rgba(12, 10, 28, 0.48) 58%,
            rgba(0, 0, 0, 0.42) 82%,
            transparent 100%);
    filter: blur(14px);
}

.boss-death-overlay.boss-death--hidden .boss-death-aura {
    background:
        radial-gradient(circle at center,
            rgba(76, 29, 149, 0.35) 0%,
            rgba(49, 46, 129, 0.28) 22%,
            rgba(30, 27, 75, 0.22) 44%,
            rgba(12, 10, 24, 0.12) 68%,
            transparent 82%);
    filter: blur(10px);
}

.boss-death-overlay.boss-death--hidden .boss-death-core {
    inset: 36%;
    background:
        radial-gradient(circle at center,
            rgba(167, 139, 250, 0.55) 0%,
            rgba(76, 29, 149, 0.72) 28%,
            rgba(12, 10, 28, 0.88) 52%,
            rgba(0, 0, 0, 0.75) 72%,
            rgba(255, 255, 255, 0) 88%);
    mix-blend-mode: normal;
    filter: blur(2.5px);
    box-shadow:
        0 0 28px rgba(76, 29, 149, 0.35),
        0 0 48px rgba(12, 10, 28, 0.4);
}

.boss-death-overlay.boss-death--hidden .boss-death-ring-a {
    border-color: rgba(49, 46, 129, 0.55);
    box-shadow: 0 0 14px rgba(76, 29, 149, 0.28);
}

.boss-death-overlay.boss-death--hidden .boss-death-ring-b {
    border-color: rgba(12, 10, 28, 0.45);
}

.boss-death-overlay.boss-death--hidden .boss-death-afterglow {
    background:
        radial-gradient(circle at center,
            rgba(76, 29, 149, 0.12) 0%,
            rgba(30, 27, 75, 0.2) 36%,
            rgba(0, 0, 0, 0.18) 58%,
            transparent 76%);
    filter: blur(14px);
}

.boss-death-overlay.boss-death--hidden.boss-death-stage-1 .boss-death-core,
.boss-death-overlay.boss-death--hidden.boss-death-stage-1 .boss-death-aura {
    animation: boss-hidden-stage-1-pulse 1.2s ease-in-out infinite;
}

.boss-death-overlay.boss-death--hidden.boss-death-stage-2 .boss-death-aura {
    animation: boss-hidden-stage-2-aura 1.8s ease-in-out infinite;
}

.boss-death-overlay.boss-death--hidden.boss-death-stage-2 .boss-death-core {
    animation: boss-hidden-stage-2-core 1.15s steps(2, end) infinite;
}

.boss-death-overlay.boss-death--hidden.boss-death-stage-3 .boss-death-core {
    animation: boss-hidden-stage-3-core 0.52s cubic-bezier(0.32, 0.02, 0.14, 1) infinite;
}

.boss-death-overlay.boss-death--hidden .boss-death-leak {
    background: linear-gradient(180deg,
            rgba(12, 10, 28, 0) 0%,
            rgba(76, 29, 149, 0.75) 22%,
            rgba(49, 46, 129, 0.88) 52%,
            rgba(12, 10, 28, 0.72) 82%,
            rgba(12, 10, 28, 0) 100%);
    box-shadow:
        0 0 12px rgba(76, 29, 149, 0.35),
        0 0 22px rgba(12, 10, 28, 0.45);
    filter: brightness(0.92);
}

.boss-death-overlay.boss-death--hidden .boss-death-fragment {
    background:
        radial-gradient(circle at 32% 32%,
            rgba(167, 139, 250, 0.55) 0%,
            rgba(49, 46, 129, 0.72) 42%,
            rgba(12, 10, 28, 0.9) 100%);
    box-shadow:
        0 0 10px rgba(76, 29, 149, 0.32),
        0 0 18px rgba(12, 10, 28, 0.4);
}

.boss-death-overlay.boss-death--hidden.boss-death-stage-4 {
    animation: boss-death-overlay-fadeout-hidden 3s cubic-bezier(0.18, 0.82, 0.12, 1) forwards;
}

.boss-death-overlay.boss-death--hidden.boss-death-stage-4 .boss-death-core {
    animation: boss-hidden-core-collapse-burst 2.35s cubic-bezier(0.12, 0.9, 0.2, 1) forwards;
}

.boss-death-overlay.boss-death--hidden.boss-death-stage-4 .boss-death-aura,
.boss-death-overlay.boss-death--hidden.boss-death-stage-4 .boss-death-vignette {
    animation: boss-hidden-stage-4-fade 2.35s cubic-bezier(0.2, 0.78, 0.14, 1) forwards;
}

.boss-death-body-vfx.boss-death--hidden {
    mix-blend-mode: normal;
}

.boss-death-body-vfx.boss-death--hidden .boss-death-body-core {
    background:
        radial-gradient(circle at 50% 50%,
            rgba(76, 29, 149, 0.42) 0%,
            rgba(30, 27, 75, 0.55) 22%,
            rgba(12, 10, 28, 0.72) 48%,
            rgba(0, 0, 0, 0.5) 68%,
            rgba(255, 255, 255, 0) 82%);
    filter: blur(5px);
}

.boss-death-body-vfx.boss-death--hidden .boss-death-body-glow {
    background:
        radial-gradient(circle at 50% 48%,
            rgba(76, 29, 149, 0.22) 0%,
            rgba(49, 46, 129, 0.28) 28%,
            rgba(12, 10, 28, 0.38) 56%,
            rgba(15, 23, 42, 0) 76%);
    filter: blur(6px);
}

.boss-death-body-vfx.boss-death--hidden .boss-death-body-distortion {
    background:
        radial-gradient(circle at 50% 50%, rgba(12, 10, 28, 0.22) 0%, transparent 20%),
        radial-gradient(circle at 40% 36%, rgba(76, 29, 149, 0.2) 0%, transparent 22%),
        radial-gradient(circle at 66% 62%, rgba(49, 46, 129, 0.22) 0%, transparent 24%),
        linear-gradient(128deg, rgba(12, 10, 28, 0.14), transparent 46%, rgba(76, 29, 149, 0.12) 72%, transparent 100%);
    mix-blend-mode: multiply;
    filter: blur(4.5px);
}

.boss-death-body-vfx.boss-death--hidden .boss-death-body-crack {
    background:
        linear-gradient(180deg,
            rgba(12, 10, 28, 0) 0%,
            rgba(49, 46, 129, 0.55) 16%,
            rgba(76, 29, 149, 0.72) 42%,
            rgba(12, 10, 28, 0.82) 74%,
            rgba(12, 10, 28, 0) 100%);
    box-shadow:
        0 0 10px rgba(76, 29, 149, 0.32),
        0 0 22px rgba(12, 10, 28, 0.45);
}

.boss-death-body-vfx.boss-death--hidden .boss-death-body-erosion {
    background:
        radial-gradient(circle at 50% 50%, rgba(12, 10, 28, 0.22) 0%, transparent 18%),
        radial-gradient(circle at 36% 32%, rgba(76, 29, 149, 0.18) 0%, transparent 16%),
        radial-gradient(circle at 64% 36%, rgba(49, 46, 129, 0.18) 0%, transparent 16%),
        radial-gradient(circle at 50% 70%, rgba(12, 10, 28, 0.22) 0%, transparent 20%);
}

.boss-death-body-vfx.boss-death--hidden .boss-death-body-fragment {
    background:
        linear-gradient(145deg,
            rgba(76, 29, 149, 0.55) 0%,
            rgba(30, 27, 75, 0.62) 42%,
            rgba(12, 10, 28, 0.78) 100%);
    box-shadow:
        0 0 10px rgba(76, 29, 149, 0.28),
        0 0 16px rgba(12, 10, 28, 0.38);
}

.boss-death-sync-shell.boss-death--hidden.boss-death-stage-4 {
    animation: boss-shell-final-sync-hidden 2.35s cubic-bezier(0.12, 0.88, 0.16, 1) forwards;
}

@keyframes boss-hidden-void-spin {
    0% {
        transform: rotate(0deg) scale(1);
    }

    100% {
        transform: rotate(360deg) scale(1.02);
    }
}

@keyframes boss-hidden-stage-1-pulse {

    0%,
    100% {
        transform: scale(0.97);
        filter: brightness(0.88) saturate(0.85);
    }

    50% {
        transform: scale(1.04);
        filter: brightness(1.12) saturate(0.95);
    }
}

@keyframes boss-hidden-stage-2-aura {

    0%,
    100% {
        transform: scale(0.98);
        filter: brightness(0.82) blur(10px);
    }

    50% {
        transform: scale(1.03);
        filter: brightness(1.05) blur(9px);
    }
}

@keyframes boss-hidden-stage-2-core {

    0%,
    100% {
        transform: scale(0.96);
        filter: brightness(0.75) contrast(1.05);
    }

    50% {
        transform: scale(1.06);
        filter: brightness(1.08) contrast(1.1);
    }
}

@keyframes boss-hidden-stage-3-core {

    0%,
    100% {
        transform: scale(0.94);
        filter: brightness(0.72) blur(2.5px);
    }

    50% {
        transform: scale(1.08);
        filter: brightness(1.02) blur(2px);
    }
}

@keyframes boss-death-overlay-fadeout-hidden {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    55% {
        opacity: 1;
        transform: scale(0.94);
    }

    100% {
        opacity: 0;
        transform: scale(0.62);
    }
}

@keyframes boss-hidden-core-collapse-burst {
    0% {
        opacity: 1;
        transform: scale(1);
        filter: brightness(1) blur(2.5px);
    }

    35% {
        opacity: 1;
        transform: scale(1.12);
        filter: brightness(1.15) blur(2px);
        box-shadow:
            0 0 36px rgba(167, 139, 250, 0.42),
            0 0 64px rgba(12, 10, 28, 0.55);
    }

    100% {
        opacity: 0;
        transform: scale(0.18);
        filter: brightness(0.35) blur(8px);
        box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    }
}

@keyframes boss-hidden-stage-4-fade {
    0% {
        opacity: 1;
        filter: brightness(1);
    }

    100% {
        opacity: 0;
        filter: brightness(0.25) blur(12px);
    }
}

@keyframes boss-shell-final-sync-hidden {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
        filter: brightness(1) saturate(0.85);
    }

    28% {
        transform: translate3d(-6px, 4px, 0) scale(1.06, 0.92);
        filter: brightness(1.12) saturate(0.72);
    }

    52% {
        transform: translate3d(8px, -6px, 0) scale(1.1, 0.88);
        filter: brightness(0.95) saturate(0.5) contrast(1.08);
    }

    78% {
        transform: translate3d(0, -10px, 0) scale(0.72);
        filter: brightness(0.55) saturate(0.22) grayscale(0.55);
    }

    100% {
        transform: translate3d(0, -16px, 0) scale(0.38);
        filter: brightness(0.22) saturate(0) grayscale(0.95);
    }
}

@keyframes boss-death-stage-1-pulse {

    0%,
    100% {
        transform: scale(0.967);
        filter: brightness(1.05);
    }

    50% {
        transform: scale(1.045);
        filter: brightness(1.74);
    }
}

@keyframes boss-body-instability {

    0%,
    100% {
        transform: scale(0.98);
        opacity: 0.36;
        filter: blur(3px) brightness(1.05) saturate(0.92);
    }

    50% {
        transform: scale(1.047);
        opacity: 0.88;
        filter: blur(5.5px) brightness(1.66) saturate(1.08);
    }
}

@keyframes boss-body-stage-2-glow {

    0%,
    100% {
        transform: scale(0.96);
        opacity: 0.52;
        filter: blur(5px) brightness(1.14) saturate(1);
    }

    40% {
        transform: scale(1.062);
        opacity: 0.96;
        filter: blur(7.5px) brightness(1.9) saturate(1.15);
    }

    75% {
        transform: scale(1.01);
        opacity: 0.64;
        filter: blur(5.5px) brightness(1.38) saturate(1.05);
    }
}

@keyframes boss-body-core-overload {

    0%,
    100% {
        transform: scale(0.72);
        opacity: 0.44;
        filter: blur(5.5px) brightness(1.2);
    }

    48% {
        transform: scale(1.125);
        opacity: 1;
        filter: blur(9px) brightness(2.08);
    }

    78% {
        transform: scale(0.92);
        opacity: 0.62;
        filter: blur(6px) brightness(1.42);
    }
}

@keyframes boss-body-stage-3-glow {

    0%,
    100% {
        transform: scale(0.94);
        opacity: 0.46;
        filter: blur(5.5px) brightness(1.1);
    }

    24% {
        transform: scale(1.125);
        opacity: 1;
        filter: blur(10px) brightness(2.45);
    }

    52% {
        transform: scale(1.078, 0.943);
        opacity: 0.9;
        filter: blur(7.5px) brightness(2.02);
    }

    76% {
        transform: scale(1.203, 0.827);
        opacity: 1;
        filter: blur(12px) brightness(3.05);
    }
}

@keyframes boss-body-core-collapse {

    0%,
    100% {
        transform: scale(0.82);
        opacity: 0.58;
        filter: blur(6px) brightness(1.3);
    }

    24% {
        transform: scale(1.109);
        opacity: 0.94;
        filter: blur(8.5px) brightness(2.1);
    }

    52% {
        transform: scale(1.327);
        opacity: 1;
        filter: blur(11.5px) brightness(2.75);
    }

    76% {
        transform: scale(1.28);
        opacity: 1;
        filter: blur(13px) brightness(3.25);
    }
}

@keyframes boss-body-stage-3-thrash {

    0%,
    100% {
        transform: translate3d(0, 0, 0) scale(1);
    }

    24% {
        transform: translate3d(-10px, 3px, 0) scale(1.12, 0.92);
    }

    52% {
        transform: translate3d(14px, -6px, 0) scale(0.84, 1.18);
    }

    76% {
        transform: translate3d(-18px, 5px, 0) scale(1.28, 0.76);
    }
}

@keyframes boss-body-distortion {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.3;
    }

    25% {
        transform: translate(-3px, 1px) scale(1.03);
        opacity: 0.7;
    }

    50% {
        transform: translate(2px, -2px) scale(0.98);
        opacity: 0.48;
    }

    75% {
        transform: translate(-1px, 2px) scale(1.04);
        opacity: 0.76;
    }
}

@keyframes boss-body-distortion-thrash {

    0%,
    100% {
        transform: translate3d(0, 0, 0) scale(1);
        opacity: 0.36;
        filter: blur(5px) brightness(1.1);
    }

    24% {
        transform: translate3d(-11px, 3px, 0) scale(1.16, 0.86);
        opacity: 0.9;
        filter: blur(8px) brightness(2.05);
    }

    52% {
        transform: translate3d(15px, -6px, 0) scale(0.78, 1.24);
        opacity: 0.96;
        filter: blur(9px) brightness(2.55);
    }

    76% {
        transform: translate3d(-18px, 5px, 0) scale(1.3, 0.74);
        opacity: 1;
        filter: blur(11px) brightness(3.05);
    }
}

@keyframes boss-body-light-pulse {

    0%,
    100% {
        transform: scale(0.98);
        opacity: 0.42;
        filter: blur(6px) brightness(1.25);
    }

    50% {
        transform: scale(1.16);
        opacity: 0.92;
        filter: blur(11px) brightness(2.55);
    }
}

@keyframes boss-shell-core-sync {

    0%,
    100% {
        transform: translate3d(0, 0, 0) scale(1);
        filter: brightness(1) saturate(1);
    }

    24% {
        transform: translate3d(-10px, 3px, 0) scale(1.06, 0.94);
        filter: brightness(1.18) saturate(1.04);
    }

    52% {
        transform: translate3d(14px, -6px, 0) scale(0.9, 1.14);
        filter: brightness(1.34) saturate(1.08);
    }

    76% {
        transform: translate3d(-18px, 5px, 0) scale(1.16, 0.84);
        filter: brightness(1.52) saturate(1.12);
    }
}

@keyframes boss-shell-final-sync {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
        filter: brightness(1) saturate(1);
    }

    18% {
        transform: translate3d(-10px, 3px, 0) scale(1.08, 0.94);
        filter: brightness(1.3) saturate(1.02);
    }

    34% {
        transform: translate3d(14px, -5px, 0) scale(1.18, 0.86);
        filter: brightness(1.55) saturate(0.96);
    }

    58% {
        transform: translate3d(0, -8px, 0) scale(0.8);
        filter: brightness(0.84) saturate(0.34) grayscale(0.72);
    }

    100% {
        transform: translate3d(0, -14px, 0) scale(0.48);
        filter: brightness(0.3) saturate(0) grayscale(1);
    }
}

@keyframes boss-body-crack-open {

    0%,
    100% {
        opacity: 0;
        transform: rotate(var(--crack-rot, 0deg)) scaleY(0.15);
    }

    35% {
        opacity: 0.88;
        transform: rotate(var(--crack-rot, 0deg)) scaleY(0.95);
    }

    70% {
        opacity: 0.35;
        transform: rotate(calc(var(--crack-rot, 0deg) + 4deg)) scaleY(0.58);
    }
}

@keyframes boss-body-crack-overload {

    0%,
    100% {
        opacity: 0.15;
        transform: rotate(var(--crack-rot, 0deg)) scaleY(0.28);
    }

    24% {
        opacity: 0.82;
        transform: rotate(calc(var(--crack-rot, 0deg) - 3deg)) scaleY(0.9);
    }

    52% {
        opacity: 1;
        transform: rotate(calc(var(--crack-rot, 0deg) - 5deg)) scaleY(1.18);
    }

    76% {
        opacity: 0.86;
        transform: rotate(calc(var(--crack-rot, 0deg) + 7deg)) scaleY(1.02);
    }
}

@keyframes boss-body-erosion-pulse {

    0%,
    100% {
        opacity: 0.18;
        transform: scale(0.98);
    }

    50% {
        opacity: 0.58;
        transform: scale(1.05);
    }
}

@keyframes boss-body-erosion-bloom {

    0%,
    100% {
        opacity: 0.28;
        transform: scale(0.96);
        filter: blur(4px);
    }

    24% {
        opacity: 0.64;
        transform: scale(1.02);
        filter: blur(5px);
    }

    52% {
        opacity: 0.82;
        transform: scale(1.08);
        filter: blur(7px);
    }

    76% {
        opacity: 0.92;
        transform: scale(1.14);
        filter: blur(8px);
    }
}

@keyframes boss-body-fragment-shed {
    0% {
        opacity: 0;
        transform: rotate(var(--body-frag-angle, 0deg)) translateY(0) scale(0.2);
    }

    30% {
        opacity: 0.82;
        transform: rotate(var(--body-frag-angle, 0deg)) translateY(8px) scale(0.95);
    }

    100% {
        opacity: 0;
        transform: rotate(calc(var(--body-frag-angle, 0deg) + 8deg)) translateY(18px) translateX(4px) scale(0.28);
    }
}

@keyframes boss-body-fragment-burst {
    0% {
        opacity: 0;
        transform: rotate(var(--body-frag-angle, 0deg)) translateY(0) scale(0.24);
    }

    24% {
        opacity: 0.72;
        transform: rotate(var(--body-frag-angle, 0deg)) translateY(8px) scale(0.8);
    }

    52% {
        opacity: 0.95;
        transform: rotate(var(--body-frag-angle, 0deg)) translateY(12px) scale(1);
    }

    76% {
        opacity: 0.84;
        transform: rotate(calc(var(--body-frag-angle, 0deg) + 8deg)) translateY(18px) translateX(4px) scale(0.66);
    }

    100% {
        opacity: 0;
        transform: rotate(calc(var(--body-frag-angle, 0deg) + 10deg)) translateY(22px) translateX(5px) scale(0.14);
    }
}

@keyframes boss-body-final-fade {
    0% {
        opacity: 1;
        transform: scale(1);
        filter: blur(0) grayscale(0) brightness(1);
    }

    18% {
        opacity: 1;
        transform: scale(1.08) translate3d(-4px, 1px, 0);
        filter: blur(1px) grayscale(0) brightness(2);
    }

    34% {
        opacity: 1;
        transform: scale(1.3) translate3d(10px, -4px, 0);
        filter: blur(4px) grayscale(0.04) brightness(3.9);
    }

    58% {
        opacity: 0.62;
        transform: scale(0.82) translate3d(0, -8px, 0);
        filter: blur(6px) grayscale(0.72) brightness(0.9);
    }

    100% {
        opacity: 0;
        transform: scale(0.64);
        filter: blur(14px) grayscale(1) brightness(0.32);
    }
}

@keyframes boss-body-light-final-fade {
    0% {
        opacity: 1;
        filter: blur(0) grayscale(0) brightness(1);
    }

    34% {
        opacity: 1;
        filter: blur(4px) grayscale(0.04) brightness(3.4);
    }

    58% {
        opacity: 0.62;
        filter: blur(7px) grayscale(0.72) brightness(0.9);
    }

    100% {
        opacity: 0;
        filter: blur(14px) grayscale(1) brightness(0.32);
    }
}

@keyframes boss-body-collapse {
    0% {
        opacity: 0.9;
        transform: scale(1);
        filter: blur(4px) brightness(1.3);
    }

    18% {
        opacity: 0.96;
        transform: scale(1.1) translate3d(-4px, 1px, 0);
        filter: blur(5px) brightness(2.2) saturate(0.45);
    }

    34% {
        opacity: 1;
        transform: scale(1.36) translate3d(11px, -4px, 0);
        filter: blur(7px) brightness(4.2) saturate(0.14);
    }

    58% {
        opacity: 0.58;
        transform: scale(0.76) translate3d(0, -8px, 0);
        filter: blur(10px) brightness(0.92) grayscale(0.72);
    }

    100% {
        opacity: 0;
        transform: scale(0.52);
        filter: blur(15px) brightness(0.28) grayscale(1);
    }
}

@keyframes boss-body-light-collapse {
    0% {
        opacity: 0.9;
        transform: scale(1);
        filter: blur(4px) brightness(1.3);
    }

    34% {
        opacity: 1;
        transform: scale(1.36);
        filter: blur(7px) brightness(4.2) saturate(0.14);
    }

    58% {
        opacity: 0.58;
        transform: scale(0.76);
        filter: blur(10px) brightness(0.92) grayscale(0.72);
    }

    100% {
        opacity: 0;
        transform: scale(0.52);
        filter: blur(15px) brightness(0.28) grayscale(1);
    }
}

@keyframes boss-body-crack-fade {
    0% {
        opacity: 1;
        transform: rotate(var(--crack-rot, 0deg)) scaleY(0.9);
    }

    100% {
        opacity: 0;
        transform: rotate(calc(var(--crack-rot, 0deg) + 8deg)) scaleY(0.18);
    }
}

@keyframes boss-body-fragment-fade {
    0% {
        opacity: 1;
        transform: rotate(var(--body-frag-angle, 0deg)) translateY(12px) scale(0.8);
        filter: grayscale(0.1);
    }

    40% {
        opacity: 0.9;
        transform: rotate(calc(var(--body-frag-angle, 0deg) + 8deg)) translateY(20px) translateX(6px) scale(0.46);
        filter: grayscale(0.86);
    }

    100% {
        opacity: 0;
        transform: rotate(calc(var(--body-frag-angle, 0deg) + 16deg)) translateY(34px) translateX(10px) scale(0.08);
        filter: grayscale(1) blur(2px);
    }
}

@keyframes boss-death-stage-2-flare {

    0%,
    100% {
        transform: scale(0.953);
        filter: brightness(1.1);
    }

    35% {
        transform: scale(1.062);
        filter: brightness(1.82);
    }

    60% {
        transform: scale(1.016);
        filter: brightness(1.23);
    }
}

@keyframes boss-death-stage-2-core {

    0%,
    100% {
        opacity: 0.8;
        transform: scale(0.889);
    }

    50% {
        opacity: 1;
        transform: scale(1.062);
    }
}

@keyframes boss-death-stage-3-core {

    0%,
    100% {
        opacity: 0.46;
        transform: scale(0.758);
        filter: brightness(1.2);
    }

    24% {
        opacity: 0.82;
        transform: scale(1.016);
        filter: brightness(1.95);
    }

    52% {
        opacity: 1;
        transform: scale(1.187);
        filter: brightness(2.55);
    }

    76% {
        opacity: 1;
        transform: scale(1.285);
        filter: brightness(3.08);
    }
}

@keyframes boss-death-ring-ripple {
    0% {
        opacity: 0.78;
        transform: scale(0.45);
    }

    100% {
        opacity: 0;
        transform: scale(1.157);
    }
}

@keyframes boss-death-leak-reveal {
    0% {
        opacity: 0;
        filter: brightness(1.45);
        transform:
            rotate(var(--angle, 0deg)) translateY(calc(var(--radius, 96px) * -0.88)) scaleY(0.38);
    }

    100% {
        opacity: 0.94;
        filter: brightness(1.05);
        transform:
            rotate(var(--angle, 0deg)) translateY(calc(var(--radius, 96px) * -1)) scaleY(1);
    }
}

@keyframes boss-death-fragment-burst {
    0% {
        opacity: 0;
        transform:
            rotate(var(--angle, 0deg)) translateY(calc(var(--distance, 100px) * -0.15)) scale(0.18);
    }

    22% {
        opacity: 1;
        transform:
            rotate(var(--angle, 0deg)) translateY(calc(var(--distance, 100px) * -0.78)) scale(1);
    }

    100% {
        opacity: 0;
        transform:
            rotate(var(--angle, 0deg)) translateY(calc(var(--distance, 100px) * -1.15)) scale(0.2);
    }
}

@keyframes boss-death-stage-4-fade {
    0% {
        opacity: 1;
        transform: scale(1);
        filter: blur(10px) brightness(1);
    }

    18% {
        opacity: 1;
        transform: scale(1.08);
        filter: blur(12px) brightness(2.1);
    }

    34% {
        opacity: 1;
        transform: scale(1.22);
        filter: blur(16px) brightness(3.3);
    }

    58% {
        opacity: 0.5;
        transform: scale(0.9);
        filter: blur(20px) brightness(0.7) grayscale(0.78);
    }

    100% {
        opacity: 0;
        transform: scale(0.74);
        filter: blur(26px) brightness(0.24) grayscale(1);
    }
}

@keyframes boss-death-overlay-fadeout {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(1.08);
    }
}

@keyframes boss-death-afterglow-fade {
    0% {
        opacity: 0.85;
        transform: scale(0.92);
    }

    100% {
        opacity: 0;
        transform: scale(1.25);
    }
}

.boss-death-burst {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 999998;
    pointer-events: none;
    --burst-circle-scale: 0.72;
    animation: boss-death-burst-shell-fade var(--burst-life, 1000ms) ease-out forwards;
}

.boss-death-burst-ring,
.boss-death-burst-core,
.boss-death-burst-spark {
    position: absolute;
    top: 50%;
    left: 50%;
    pointer-events: none;
}

.boss-death-burst-ring {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.76);
    box-shadow:
        0 0 14px rgba(255, 255, 255, 0.42),
        0 0 22px rgba(168, 85, 247, 0.24);
    transform: translate(-50%, -50%) scale(var(--burst-ring-scale, 1));
    animation: boss-death-burst-ring-pop calc(var(--burst-life, 1000ms) * 0.84) ease-out forwards;
}

.boss-death-burst-core {
    width: 30%;
    height: 30%;
    border-radius: 50%;
    background:
        radial-gradient(circle,
            rgba(255, 255, 255, 1) 0%,
            rgba(241, 245, 249, 0.96) 28%,
            rgba(196, 181, 253, 0.72) 54%,
            rgba(239, 68, 68, 0) 100%);
    transform: translate(-50%, -50%) scale(var(--burst-core-scale, 1));
    box-shadow:
        0 0 18px rgba(255, 255, 255, 0.8),
        0 0 28px rgba(168, 85, 247, 0.32);
    animation: boss-death-burst-core-pop calc(var(--burst-life, 1000ms) * 0.6) ease-out forwards;
}

.boss-death-burst-spark {
    width: 6px;
    height: 32px;
    margin-left: -3px;
    margin-top: -16px;
    border-radius: 999px;
    background: linear-gradient(180deg,
            rgba(255, 255, 255, 1) 0%,
            rgba(221, 214, 254, 0.88) 48%,
            rgba(239, 68, 68, 0) 100%);
    box-shadow:
        0 0 6px rgba(255, 255, 255, 0.54),
        0 0 10px rgba(168, 85, 247, 0.28);
    transform:
        rotate(var(--spark-angle, 0deg)) translateY(0) scale(var(--burst-spark-scale, 1));
    animation: boss-death-burst-spark-fly calc(var(--burst-life, 1000ms) * 0.82) ease-out forwards;
    animation-delay: var(--spark-delay, 0ms);
}

.boss-death-burst--hidden {
    --burst-circle-scale: 0.68;
}

.boss-death-burst--hidden .boss-death-burst-ring {
    border-color: rgba(49, 46, 129, 0.72);
    box-shadow:
        0 0 16px rgba(76, 29, 149, 0.38),
        0 0 28px rgba(12, 10, 28, 0.42);
}

.boss-death-burst--hidden .boss-death-burst-core {
    background:
        radial-gradient(circle,
            rgba(167, 139, 250, 0.88) 0%,
            rgba(76, 29, 149, 0.72) 32%,
            rgba(12, 10, 28, 0.82) 58%,
            rgba(0, 0, 0, 0) 100%);
    box-shadow:
        0 0 20px rgba(76, 29, 149, 0.45),
        0 0 40px rgba(12, 10, 28, 0.38);
}

.boss-death-burst--hidden .boss-death-burst-spark {
    background: linear-gradient(180deg,
            rgba(167, 139, 250, 0.95) 0%,
            rgba(49, 46, 129, 0.72) 46%,
            rgba(239, 68, 68, 0) 100%);
    box-shadow:
        0 0 8px rgba(76, 29, 149, 0.4),
        0 0 14px rgba(12, 10, 28, 0.35);
}

@keyframes boss-death-ring-fadeout {
    0% {
        opacity: 0.9;
        transform: scale(0.92);
    }

    100% {
        opacity: 0;
        transform: scale(1.28);
    }
}

@keyframes boss-death-leak-fadeout {
    0% {
        opacity: 0.95;
        filter: brightness(1.2);
    }

    100% {
        opacity: 0;
        filter: brightness(0.9);
    }
}

@keyframes boss-death-fragment-fadeout {
    0% {
        opacity: 1;
        transform:
            rotate(var(--angle, 0deg)) translateY(calc(var(--distance, 100px) * -0.82)) scale(0.9);
    }

    100% {
        opacity: 0;
        transform:
            rotate(var(--angle, 0deg)) translateY(calc(var(--distance, 100px) * -1.02)) scale(0.18);
    }
}

@keyframes boss-death-burst-shell-fade {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.94);
    }

    55% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.08);
    }
}

@keyframes boss-death-burst-ring-pop {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(calc(0.2 * var(--burst-ring-scale, 1) * var(--burst-circle-scale, 1)));
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(calc(1.45 * var(--burst-ring-scale, 1) * var(--burst-circle-scale, 1)));
    }
}

@keyframes boss-death-burst-core-pop {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(calc(0.2 * var(--burst-core-scale, 1) * var(--burst-circle-scale, 1)));
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(calc(2.6 * var(--burst-core-scale, 1) * var(--burst-circle-scale, 1)));
    }
}

@keyframes boss-death-burst-spark-fly {
    0% {
        opacity: 0;
        transform: rotate(var(--spark-angle, 0deg)) translateY(0) scale(var(--burst-spark-scale, 1), calc(0.45 * var(--burst-spark-scale, 1)));
    }

    20% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform:
            rotate(var(--spark-angle, 0deg)) translateY(calc(var(--spark-distance, 70px) * -2)) scale(var(--burst-spark-scale, 1), calc(0.1 * var(--burst-spark-scale, 1)));
    }
}

.boss-vfx-crack {
    position: absolute;
    width: 100vw;
    height: 100vh;
    background-image: radial-gradient(circle, transparent 30%, rgba(0, 0, 0, 0.4) 100%);
    opacity: 0;
    animation: smash-crack 0.6s ease-in forwards;
}

@keyframes smash-crack {
    0% {
        opacity: 0;
        transform: scale(1.5);
    }

    10% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(0.95);
    }
}

.boss-vfx-flash-heavy {
    position: absolute;
    inset: 0;
    background: white;
    filter: brightness(1.5);
    opacity: 0;
    animation: flash-heavy 0.5s ease-out forwards;
    z-index: 40;
}

@keyframes flash-heavy {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

.boss-vfx-flash {
    position: absolute;
    inset: 0;
    background: rgba(220, 38, 38, 0.4);
    mix-blend-mode: overlay;
    animation: boss-flash 0.8s ease-out forwards;
    pointer-events: none;
    z-index: 10;
}

/* 這一版新增：更強烈的白色/紅色衝擊閃光 */
.boss-vfx-impact-flash {
    position: absolute;
    inset: 0;
    background: white;
    mix-blend-mode: screen;
    opacity: 0;
    animation: boss-impact-flash 0.4s ease-out forwards;
    pointer-events: none;
    z-index: 50;
}

/* --- Monster Sizing Classes --- */
.monster-container-normal {
    width: 8rem !important;
    height: 8rem !important;
}

.monster-container-boss {
    width: 10rem !important;
    height: 10rem !important;
}

/* Boss Aura Effect: High-Intensity 'Subtraction Mindset' Overhaul */
.boss-aura-layer,
.boss-aura-layer-luminous {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150%;
    height: 150%;
    z-index: 10;
    pointer-events: none;
    border-radius: 50%;
    overflow: hidden;
}

.boss-aura-layer-luminous {
    z-index: 11;
    /* Even more in front */
}

/* Layer 1: Ambient Evil Miasma & Ghostly Sparks */
.boss-aura-layer::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 50% 90%, rgba(88, 28, 135, 0.6) 0%, transparent 65%),
        radial-gradient(circle at 10% 60%, rgba(168, 85, 247, 0.25) 0%, transparent 45%),
        radial-gradient(circle at 90% 60%, rgba(168, 85, 247, 0.25) 0%, transparent 45%);
    filter: blur(12px);
    animation: wisp-flicker-flow 3.5s infinite ease-in-out;
}

/* Layer 1 Particles: Ghostly/Faded Soul-fire (Increased Density & Frequency) */
.boss-aura-layer::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background: transparent;
    border-radius: 50%;
    bottom: 5%;
    left: 50%;
    opacity: 0.8;
    /* Faster cycle for higher frequency */
    animation: soul-fire-ascent 2.2s infinite linear;
}

/* Layer 2: SHARP Luminous Core Fragments (High Frequency Stream) */
.boss-aura-layer-luminous::after {
    content: '';
    position: absolute;
    width: 5px;
    height: 5px;
    background: transparent;
    border-radius: 50%;
    bottom: 0%;
    left: 50%;
    animation: luminous-fire-rise 1.8s infinite ease-out;
}

/* Layer 3 [NEW]: Continuous Stream Layer (Offset Timing) */
.boss-aura-layer-luminous::before {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background: transparent;
    border-radius: 50%;
    bottom: -10%;
    left: 45%;
    /* Desynchronized to fill the gaps */
    animation: luminous-fire-rise 2.1s infinite ease-out;
    animation-delay: -1s;
}

@keyframes wisp-flicker-flow {

    0%,
    100% {
        opacity: 0.3;
        transform: scale(1) translateY(0);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.15) translateY(-15px) skewX(4deg);
    }
}

/* Regular/Ghostly Ascent (Denser stream) */
@keyframes soul-fire-ascent {
    0% {
        opacity: 0;
        box-shadow:
            -40px 10px 4px #a855f7, 45px 15px 2px #fff, -25px 30px 4px #7c3aed,
            35px 40px 3px rgba(168, 85, 247, 0.8), -60px 10px 2px #fff,
            -75px 50px 3px #a855f7, 70px 45px 2px #fff, 10px 80px 4px #7c3aed,
            -20px 40px 5px #a855f7, 55px 60px 3px #fff, -50px 20px 4px #7c3aed,
            /* Dense cluster bottom */
            -10px 90px 2px #fff, 15px 100px 3px #a855f7;
        transform: translateY(40px) translateX(0);
    }

    20% {
        opacity: 1;
    }

    80% {
        opacity: 0.7;
    }

    100% {
        opacity: 0;
        box-shadow:
            -50px -90px 10px transparent, 55px -80px 8px transparent, -35px -100px 12px transparent,
            45px -70px 10px transparent, -70px -110px 8px transparent,
            -85px -60px 8px transparent, 80px -55px 6px transparent, 20px -130px 10px transparent,
            -30px -40px 12px transparent, 65px -50px 10px transparent, -60px -30px 12px transparent,
            -15px -100px 5px transparent, 25px -120px 6px transparent;
        transform: translateY(-150px) translateX(-20px);
    }
}

/* HIGH BRIGHTNESS / CORE FRAGMENTS (High Speed Stream) */
@keyframes luminous-fire-rise {
    0% {
        opacity: 0;
        box-shadow:
            -30px 5px 1px #fff, 35px 15px 1px #fff,
            -60px 35px 2px #c084fc, 65px 25px 2px #c084fc,
            -15px 60px 10px 3px #a855f7, 20px 75px 8px 3px #fff,
            -80px 40px 1px 1px #fff, 85px 50px 1px 1px #fff,
            -45px 10px 1px #fff, 50px 20px 1px #c084fc;
        transform: translateY(50px) scale(0.8);
    }

    10% {
        opacity: 1;
        filter: brightness(1.6);
    }

    90% {
        opacity: 0.9;
    }

    100% {
        opacity: 0;
        box-shadow:
            -35px -100px 2px #fff, 40px -115px 2px #fff,
            -70px -90px 4px #c084fc, 75px -105px 4px #c084fc,
            -20px -140px 15px 5px transparent, 25px -150px 12px 5px transparent,
            -90px -80px 2px transparent, 95px -90px 2px transparent,
            -55px -110px 2px transparent, 60px -120px 2px transparent;
        transform: translateY(-180px) scale(1.6);
    }
}

.monster-img-normal {
    width: 6rem !important;
    height: 6rem !important;
}

.monster-img-boss {
    width: 8.5rem !important;
    height: 8.5rem !important;
    max-height: 9.5rem !important;
}

.monster-img-normal,
.monster-img-boss,
.monster-breath,
.resonance-spirit-icon {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
}

@keyframes boss-impact-flash {
    0% {
        opacity: 0.8;
        background: white;
    }

    50% {
        opacity: 0.5;
        background: #ff3333;
    }

    100% {
        opacity: 0;
    }
}

@keyframes boss-flash {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

.boss-vfx-slash-mark {
    position: absolute;
    /* 核心為黑紅色 (#4a0000)，模擬撕裂深度；邊端保留發光 */
    background: linear-gradient(90deg,
            rgba(255, 215, 0, 0) 0%,
            rgba(255, 215, 0, 0.6) 10%,
            rgba(220, 38, 38, 0.7) 20%,
            rgba(74, 0, 0, 0.98) 50%,
            rgba(220, 38, 38, 0.7) 80%,
            rgba(255, 215, 0, 0.6) 90%,
            rgba(255, 215, 0, 0) 100%);
    box-shadow: 0 0 20px rgba(139, 0, 0, 0.4);
    /* 形狀補強：邊端收尖 */
    border-radius: 50% / 10%;
    clip-path: polygon(10% 0%, 90% 0%, 100% 50%, 90% 100%, 10% 100%, 0% 50%);
    pointer-events: none;
}

/* 1.2 版：層次化佈局 */
.boss-vfx-slash-mark.is-middle {
    width: 38px;
    height: 120vh;
    filter: brightness(1.2);
    z-index: 22;
}

.boss-vfx-slash-mark.is-side {
    width: 24px;
    height: 90vh;
    opacity: 0.7;
    z-index: 21;
}

/* v3.0 Glass Panel Base */
.glass-panel {
    background: rgba(18, 18, 48, 0.75);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
}

/* -------- L20 ruin-guardian: 城塞受困 -------- */
.boss-fortress-group {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 25;
    overflow: hidden;
}

.boss-vfx-fortress-vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center,
            transparent 20%,
            rgba(25, 10, 2, 0.75) 100%);
    animation: fortress-vignette 1.3s ease-out forwards;
}

@keyframes fortress-vignette {
    0% {
        opacity: 0;
    }

    15% {
        opacity: 1;
    }

    60% {
        opacity: 0.8;
    }

    100% {
        opacity: 0;
    }
}

/* 鎖鏈共用樣式 */
.boss-fortress-chain {
    position: absolute;
    background:
        repeating-linear-gradient(90deg,
            #0d0400 0px, #0d0400 5px,
            #3b1506 5px, #7c3000 14px,
            #c06010 14px, #e88020 20px,
            #f5a820 20px, #e88020 26px,
            #c06010 26px, #7c3000 35px,
            #3b1506 35px, #0d0400 44px,
            #0d0400 44px, #0d0400 50px),
        linear-gradient(180deg,
            #1a0800 0%, #7c3000 30%, #d47010 50%, #7c3000 70%, #1a0800 100%);
    background-blend-mode: multiply;
    box-shadow:
        0 0 20px 7px rgba(160, 70, 10, 0.85),
        0 0 50px 16px rgba(0, 0, 0, 0.65);
    opacity: 0;
}

/* 左右橫向鎖鏈 */
.boss-fortress-chain-left,
.boss-fortress-chain-right {
    height: 58px;
    width: 58%;
    top: 50%;
    transform: translateY(-50%);
    border-top: 4px solid #fde68a;
    border-bottom: 4px solid #92400e;
}

.boss-fortress-chain-left {
    left: -60%;
    animation: fortress-from-left 0.55s ease-out forwards;
}

.boss-fortress-chain-right {
    right: -60%;
    animation: fortress-from-right 0.55s ease-out forwards;
}

/* 上下縱向鎖鏈 */
.boss-fortress-chain-top,
.boss-fortress-chain-bottom {
    width: 58px;
    height: 58%;
    left: 50%;
    transform: translateX(-50%);
    background:
        repeating-linear-gradient(0deg,
            #0d0400 0px, #0d0400 5px,
            #3b1506 5px, #7c3000 14px,
            #c06010 14px, #e88020 20px,
            #f5a820 20px, #e88020 26px,
            #c06010 26px, #7c3000 35px,
            #3b1506 35px, #0d0400 44px,
            #0d0400 44px, #0d0400 50px),
        linear-gradient(90deg,
            #1a0800 0%, #7c3000 30%, #d47010 50%, #7c3000 70%, #1a0800 100%);
    background-blend-mode: multiply;
    border-left: 4px solid #fde68a;
    border-right: 4px solid #92400e;
}

.boss-fortress-chain-top {
    top: -60%;
    animation: fortress-from-top 0.55s ease-out forwards;
}

.boss-fortress-chain-bottom {
    bottom: -60%;
    animation: fortress-from-bottom 0.55s ease-out forwards;
}

@keyframes fortress-from-left {
    0% {
        left: -60%;
        opacity: 1;
    }

    80% {
        left: 6%;
        opacity: 1;
    }

    100% {
        left: 6%;
        opacity: 0.9;
    }
}

@keyframes fortress-from-right {
    0% {
        right: -60%;
        opacity: 1;
    }

    80% {
        right: 6%;
        opacity: 1;
    }

    100% {
        right: 6%;
        opacity: 0.9;
    }
}

@keyframes fortress-from-top {
    0% {
        top: -60%;
        opacity: 1;
    }

    80% {
        top: 6%;
        opacity: 1;
    }

    100% {
        top: 6%;
        opacity: 0.9;
    }
}

@keyframes fortress-from-bottom {
    0% {
        bottom: -60%;
        opacity: 1;
    }

    80% {
        bottom: 6%;
        opacity: 1;
    }

    100% {
        bottom: 6%;
        opacity: 0.9;
    }
}

/* 鎖定還魂：邊緣加深後淡出，無中心爆炸 */
.boss-vfx-fortress-lock {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center,
            transparent 10%,
            rgba(30, 12, 2, 0.5) 55%,
            rgba(15, 5, 0, 0.82) 100%);
    animation: fortress-lock 0.75s ease-out forwards;
}

@keyframes fortress-lock {
    0% {
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    55% {
        opacity: 0.9;
    }

    100% {
        opacity: 0;
    }
}

/* -------- L25 lord-of-darkness: 虛空十字斬 -------- */
.boss-cross-group {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 25;
}

/* -------- L20 ruin-guardian: 巨大石拳斜上鉤拳 -------- */
.boss-stone-fist-group {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 25;
    overflow: hidden;
}

.boss-vfx-stone-fist {
    position: absolute;
    width: clamp(280px, 25vw, 360px);
    height: clamp(280px, 25vw, 360px);
    background: url('../images/vfx/stone-fist-uppercut.png') no-repeat center center;
    background-size: contain;
    opacity: 0;
    filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.6));
}

.boss-vfx-stone-fist.is-attacking {
    animation: stone-fist-uppercut 0.85s cubic-bezier(0.36, 0, 0.64, 1) forwards;
}

@keyframes stone-fist-uppercut {
    0% {
        transform: translate(120%, 80%) rotate(45deg) scale(0.8);
        opacity: 0;
    }

    15% {
        opacity: 1;
        transform: translate(100%, 60%) rotate(40deg) scale(0.9);
    }

    65% {
        /* Impact point near hero (center-bottom) */
        transform: translate(-50%, -10%) rotate(-10deg) scale(1.3);
        opacity: 1;
    }

    85% {
        transform: translate(-60%, -25%) rotate(-20deg) scale(1.1);
        opacity: 0.8;
    }

    100% {
        transform: translate(-70%, -40%) rotate(-30deg) scale(1.0);
        opacity: 0;
    }
}

/* 之前定義的樣式... */
.boss-vfx-void-vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center,
            rgba(10, 0, 30, 0.1) 20%,
            rgba(46, 16, 101, 0.85) 100%);
    animation: void-vignette 1.4s ease-out forwards;
}

@keyframes void-vignette {
    0% {
        opacity: 0;
    }

    18% {
        opacity: 1;
    }

    55% {
        opacity: 0.85;
    }

    100% {
        opacity: 0;
    }
}

/* 交點火花：小圓形白紫閃光，無方塊感 */
.boss-vfx-xslash-spark {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0.3);
    background: radial-gradient(circle,
            rgba(255, 255, 255, 0.98) 0%,
            rgba(216, 180, 254, 0.85) 28%,
            rgba(139, 92, 246, 0.55) 58%,
            transparent 78%);
    box-shadow:
        0 0 10px 5px rgba(255, 255, 255, 0.7),
        0 0 24px 10px rgba(139, 92, 246, 0.75),
        0 0 50px 18px rgba(109, 40, 217, 0.4);
    animation: xslash-spark 0.55s ease-out forwards;
}

@keyframes xslash-spark {
    0% {
        transform: translate(-50%, -50%) scale(0.3);
        opacity: 0;
    }

    12% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 1;
    }

    40% {
        transform: translate(-50%, -50%) scale(1.0);
        opacity: 0.85;
    }

    100% {
        transform: translate(-50%, -50%) scale(0.7);
        opacity: 0;
    }
}

/* X字斬共用樣式：兩刀均從中心展開 */
.boss-vfx-xslash-a,
.boss-vfx-xslash-b {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 160vmax;
    height: 26px;
    transform-origin: center center;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(109, 40, 217, 0.6) 15%,
            rgba(139, 92, 246, 0.95) 35%,
            rgba(255, 255, 255, 1) 50%,
            rgba(139, 92, 246, 0.95) 65%,
            rgba(109, 40, 217, 0.6) 85%,
            transparent 100%);
    box-shadow:
        0 0 0 2px rgba(196, 181, 253, 0.65),
        0 0 14px 7px rgba(139, 92, 246, 0.9),
        0 0 35px 16px rgba(109, 40, 217, 0.65),
        0 0 70px 28px rgba(76, 29, 149, 0.4);
}

/* 殘影層 */
.boss-vfx-xslash-a::before,
.boss-vfx-xslash-b::before {
    content: '';
    position: absolute;
    inset: -8px 0;
    background: linear-gradient(90deg,
            transparent 5%,
            rgba(139, 92, 246, 0.2) 30%,
            rgba(196, 181, 253, 0.3) 50%,
            rgba(139, 92, 246, 0.2) 70%,
            transparent 95%);
    filter: blur(6px);
}

/* 左上→右下 */
.boss-vfx-xslash-a {
    animation: xslash-a-draw 0.7s ease-out forwards;
}

@keyframes xslash-a-draw {
    0% {
        transform: translate(-50%, -50%) rotate(45deg) scaleX(0);
        opacity: 1;
    }

    38% {
        transform: translate(-50%, -50%) rotate(45deg) scaleX(1);
        opacity: 1;
    }

    65% {
        transform: translate(-50%, -50%) rotate(45deg) scaleX(1);
        opacity: 0.85;
    }

    100% {
        transform: translate(-50%, -50%) rotate(45deg) scaleX(1);
        opacity: 0;
    }
}

/* 右上→左下，略延遲 */
.boss-vfx-xslash-b {
    animation: xslash-b-draw 0.7s ease-out forwards;
}

@keyframes xslash-b-draw {
    0% {
        transform: translate(-50%, -50%) rotate(-45deg) scaleX(0);
        opacity: 0;
    }

    5% {
        opacity: 1;
    }

    38% {
        transform: translate(-50%, -50%) rotate(-45deg) scaleX(1);
        opacity: 1;
    }

    65% {
        transform: translate(-50%, -50%) rotate(-45deg) scaleX(1);
        opacity: 0.85;
    }

    100% {
        transform: translate(-50%, -50%) rotate(-45deg) scaleX(1);
        opacity: 0;
    }
}

/* 交點爆閃：更大、更炸 */
.boss-vfx-cross-flash {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 160px;
    height: 160px;
    transform: translate(-50%, -50%) scale(0.2);
    background: radial-gradient(circle,
            rgba(255, 255, 255, 1) 0%,
            rgba(220, 210, 255, 1) 15%,
            rgba(167, 139, 250, 0.9) 35%,
            rgba(109, 40, 217, 0.6) 60%,
            transparent 80%);
    box-shadow:
        0 0 30px 15px rgba(196, 181, 253, 0.8),
        0 0 80px 35px rgba(109, 40, 217, 0.5);
    animation: cross-flash 0.65s ease-out forwards;
}

@keyframes cross-flash {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.2);
    }

    15% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.8);
    }

    45% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(2.0);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(2.8);
    }
}

/* -------- L30 crimson-throne-lord: 星辰崩壞 -------- */
.boss-starcollapse-group {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 25;
    overflow: hidden;
}

.boss-vfx-arcane-vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center,
            rgba(10, 5, 30, 0.1) 20%,
            rgba(23, 10, 80, 0.8) 100%);
    animation: arcane-vignette 1.5s ease-out forwards;
}

@keyframes arcane-vignette {
    0% {
        opacity: 0;
    }

    15% {
        opacity: 1;
    }

    65% {
        opacity: 0.85;
    }

    100% {
        opacity: 0;
    }
}

.boss-vfx-magic-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    border-style: solid;
}

.boss-magic-ring-outer {
    width: 230px;
    height: 230px;
    border-width: 4px;
    border-color: rgba(96, 165, 250, 0.95) rgba(147, 197, 253, 0.4) rgba(59, 130, 246, 0.85) transparent;
    box-shadow: 0 0 18px 6px rgba(59, 130, 246, 0.55), inset 0 0 18px 5px rgba(59, 130, 246, 0.25);
    animation: magic-ring-outer 1.05s ease-in forwards;
}

@keyframes magic-ring-outer {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(1.5);
        opacity: 0.5;
    }

    18% {
        opacity: 1;
    }

    65% {
        transform: translate(-50%, -50%) rotate(280deg) scale(1.0);
        opacity: 1;
    }

    88% {
        transform: translate(-50%, -50%) rotate(370deg) scale(0.25);
        opacity: 0.7;
    }

    100% {
        transform: translate(-50%, -50%) rotate(410deg) scale(0);
        opacity: 0;
    }
}

.boss-magic-ring-inner {
    width: 145px;
    height: 145px;
    border-width: 3px;
    border-color: rgba(216, 180, 254, 0.9) transparent rgba(139, 92, 246, 0.75) rgba(167, 139, 250, 0.5);
    box-shadow: 0 0 14px 5px rgba(139, 92, 246, 0.55), inset 0 0 14px 4px rgba(139, 92, 246, 0.25);
    animation: magic-ring-inner 0.95s ease-in forwards;
}

@keyframes magic-ring-inner {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(1.2);
        opacity: 0.6;
    }

    18% {
        opacity: 1;
    }

    65% {
        transform: translate(-50%, -50%) rotate(-220deg) scale(0.85);
        opacity: 1;
    }

    88% {
        transform: translate(-50%, -50%) rotate(-320deg) scale(0.2);
        opacity: 0.6;
    }

    100% {
        transform: translate(-50%, -50%) rotate(-360deg) scale(0);
        opacity: 0;
    }
}

.boss-vfx-star-flash {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0.2);
    background: radial-gradient(circle,
            rgba(255, 255, 255, 1) 0%,
            rgba(186, 230, 253, 0.95) 20%,
            rgba(59, 130, 246, 0.75) 50%,
            transparent 78%);
    box-shadow:
        0 0 20px 8px rgba(255, 255, 255, 0.7),
        0 0 50px 20px rgba(96, 165, 250, 0.6),
        0 0 90px 35px rgba(59, 130, 246, 0.35);
    animation: star-flash 0.7s ease-out forwards;
}

@keyframes star-flash {
    0% {
        transform: translate(-50%, -50%) scale(0.2);
        opacity: 0;
    }

    12% {
        transform: translate(-50%, -50%) scale(2.0);
        opacity: 1;
    }

    40% {
        transform: translate(-50%, -50%) scale(1.7);
        opacity: 0.9;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.0);
        opacity: 0;
    }
}

.boss-vfx-star-scatter {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle 3px at 30% 25%, rgba(186, 230, 253, 0.9) 0%, transparent 100%),
        radial-gradient(circle 4px at 68% 20%, rgba(255, 255, 255, 0.85) 0%, transparent 100%),
        radial-gradient(circle 3px at 78% 55%, rgba(147, 197, 253, 0.9) 0%, transparent 100%),
        radial-gradient(circle 4px at 22% 65%, rgba(255, 255, 255, 0.8) 0%, transparent 100%),
        radial-gradient(circle 3px at 55% 80%, rgba(186, 230, 253, 0.85) 0%, transparent 100%),
        radial-gradient(circle 2px at 42% 15%, rgba(255, 255, 255, 0.9) 0%, transparent 100%);
    animation: star-scatter 0.9s ease-out forwards;
}

@keyframes star-scatter {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }

    15% {
        opacity: 1;
        transform: scale(1.0);
    }

    60% {
        opacity: 0.7;
    }

    100% {
        opacity: 0;
        transform: scale(1.4);
    }
}

/* -------- L35 celestial-throne-arbiter: 審判羽刑 -------- */
.boss-featherjudge-group {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 25;
    overflow: hidden;
}

/* 神聖壓迫：上方白光，下方暗影 */
.boss-vfx-featherjudge-vignette {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg,
            rgba(230, 230, 255, 0.6) 0%,
            rgba(180, 170, 230, 0.2) 28%,
            transparent 55%),
        radial-gradient(ellipse at center 85%,
            rgba(5, 0, 20, 0.45) 0%, transparent 70%);
    animation: featherjudge-vignette 1.5s ease-out forwards;
}

@keyframes featherjudge-vignette {
    0% {
        opacity: 0;
    }

    14% {
        opacity: 1;
    }

    65% {
        opacity: 0.85;
    }

    100% {
        opacity: 0;
    }
}

/* 雙翼剪影：上方中央向兩側展開 */
.boss-vfx-judge-wings {
    position: absolute;
    top: -8%;
    left: 50%;
    width: 200px;
    height: 85px;
    transform: translateX(-50%) scaleX(0.15);
    background:
        radial-gradient(ellipse 75% 100% at 28% 85%,
            rgba(15, 8, 45, 0.88) 0%, transparent 72%),
        radial-gradient(ellipse 75% 100% at 72% 85%,
            rgba(15, 8, 45, 0.88) 0%, transparent 72%),
        radial-gradient(ellipse 40% 60% at 50% 95%,
            rgba(200, 190, 255, 0.35) 0%, transparent 80%);
    animation: judge-wings-open 0.85s ease-out forwards;
}

@keyframes judge-wings-open {
    0% {
        transform: translateX(-50%) scaleX(0.15);
        opacity: 0;
        width: 200px;
    }

    22% {
        opacity: 1;
    }

    55% {
        transform: translateX(-50%) scaleX(1.0);
        opacity: 0.92;
        width: 200px;
    }

    80% {
        transform: translateX(-50%) scaleX(1.15);
        opacity: 0.7;
        width: 240px;
    }

    100% {
        transform: translateX(-50%) scaleX(1.2);
        opacity: 0;
        width: 260px;
    }
}

/* 羽刃底部樣式 */
.boss-vfx-feather {
    position: absolute;
    top: -14%;
    width: 11px;
    height: 88px;
    border-radius: 5px 5px 3px 3px;
    transform: rotate(var(--frot, 8deg));
    animation: feather-fall 0.52s ease-in forwards;
}

.feather-white {
    background: linear-gradient(180deg,
            rgba(255, 255, 255, 0.98) 0%,
            rgba(215, 210, 255, 0.9) 50%,
            rgba(170, 160, 240, 0.55) 100%);
    box-shadow:
        0 0 7px 3px rgba(255, 255, 255, 0.7),
        0 0 18px 5px rgba(200, 195, 255, 0.4);
}

.feather-dark {
    background: linear-gradient(180deg,
            rgba(12, 4, 35, 0.97) 0%,
            rgba(55, 18, 100, 0.88) 50%,
            rgba(28, 8, 55, 0.55) 100%);
    box-shadow:
        0 0 7px 3px rgba(109, 40, 217, 0.65),
        0 0 18px 5px rgba(76, 20, 130, 0.35);
}

@keyframes feather-fall {
    0% {
        top: -14%;
        opacity: 1;
    }

    12% {
        opacity: 1;
    }

    68% {
        top: 72%;
        opacity: 0.8;
    }

    85% {
        top: 78%;
        opacity: 0.4;
    }

    100% {
        top: 83%;
        opacity: 0;
    }
}

/* 裁決閃光：神聖白紫圓形，不爆開 */
.boss-vfx-featherjudge-flash {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 78px;
    height: 78px;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0.3);
    background: radial-gradient(circle,
            rgba(255, 255, 255, 1) 0%,
            rgba(220, 215, 255, 0.88) 28%,
            rgba(110, 85, 210, 0.55) 60%,
            transparent 80%);
    box-shadow:
        0 0 10px 5px rgba(255, 255, 255, 0.75),
        0 0 26px 10px rgba(180, 160, 255, 0.5),
        0 0 48px 16px rgba(109, 40, 217, 0.3);
    animation: featherjudge-flash 0.52s ease-out forwards;
}

@keyframes featherjudge-flash {
    0% {
        transform: translate(-50%, -50%) scale(0.3);
        opacity: 0;
    }

    10% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 1;
    }

    38% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 0.85;
    }

    100% {
        transform: translate(-50%, -50%) scale(0.7);
        opacity: 0;
    }
}

/* -------- L36 void-throne-lord: 虛無侵蝕 -------- */
.boss-void-erosion-group {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 25;
    overflow: hidden;
}

.boss-vfx-void-erosion {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center,
            rgba(5, 0, 10, 0.1) 10%,
            rgba(5, 0, 10, 0.65) 45%,
            rgba(2, 0, 5, 0.96) 80%,
            rgba(0, 0, 0, 1) 100%);
    animation: void-erosion-spread 1.55s ease-out forwards;
}

@keyframes void-erosion-spread {
    0% {
        opacity: 0;
    }

    28% {
        opacity: 0.85;
    }

    52% {
        opacity: 1;
    }

    72% {
        opacity: 0.9;
    }

    100% {
        opacity: 0.15;
    }
}

.boss-vfx-void-tendrils {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 120% 28% at 50% 0%,
            rgba(80, 0, 130, 0.55) 0%, transparent 65%),
        radial-gradient(ellipse 120% 28% at 50% 100%,
            rgba(55, 0, 90, 0.55) 0%, transparent 65%),
        radial-gradient(ellipse 28% 120% at 0% 50%,
            rgba(80, 0, 130, 0.55) 0%, transparent 65%),
        radial-gradient(ellipse 28% 120% at 100% 50%,
            rgba(55, 0, 90, 0.55) 0%, transparent 65%);
    animation: void-tendrils-in 1.55s ease-out forwards;
}

@keyframes void-tendrils-in {
    0% {
        opacity: 0;
    }

    22% {
        opacity: 1;
    }

    58% {
        opacity: 0.9;
    }

    100% {
        opacity: 0;
    }
}

.boss-vfx-void-blackout {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    animation: void-blackout-pulse 0.72s ease-out forwards;
}

@keyframes void-blackout-pulse {
    0% {
        opacity: 0;
    }

    14% {
        opacity: 1;
    }

    28% {
        opacity: 0.88;
    }

    100% {
        opacity: 0;
    }
}

.question-card {
    background: rgba(15, 23, 42, 0.25) !important;
}

/* Map stage confirm — avoid transition-all on overlay (slow backdrop-filter transitionend) */
.battle-confirm-overlay {
    transition: opacity 200ms ease;
}

.stage-confirm-modal {
    border-radius: 2rem !important;
    overflow: hidden !important;
    isolation: isolate;
}

.stage-confirm-modal::before,
.stage-confirm-modal::after {
    border-radius: inherit !important;
    inset: 0 !important;
}

.stage-confirm-header {
    position: relative;
    border-radius: inherit;
    padding-top: 3.1rem !important;
    padding-bottom: 1.05rem !important;
}

.stage-confirm-particle-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    height: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    color: #fff7ed;
    background: transparent;
    box-shadow: none;
    font-size: clamp(3.25rem, 17vw, 4.7rem);
    font-weight: 900;
    line-height: 0.92;
    letter-spacing: 0;
    text-shadow:
        0 2px 10px rgba(0, 0, 0, 0.62),
        0 0 18px rgba(251, 191, 36, 0.54),
        0 0 34px rgba(255, 247, 237, 0.26);
    -webkit-text-stroke: 0.6px rgba(253, 230, 138, 0.45);
}

.stage-confirm-stage-label {
    position: absolute;
    top: 1.2rem;
    left: 1.25rem;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    opacity: 0.86;
}

.stage-confirm-stage-label p {
    font-size: 0.95rem !important;
    letter-spacing: 0.16em !important;
}

.stage-confirm-focus-label {
    max-width: 12rem;
    margin: -0.15rem auto 0;
    overflow: hidden;
    color: rgba(253, 230, 138, 0.78);
    font-size: 1.08rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    line-height: 1.25;
    text-overflow: ellipsis;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.48), 0 0 12px rgba(251, 191, 36, 0.18);
    white-space: nowrap;
}

.stage-confirm-record {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    width: fit-content;
    min-width: 9.25rem;
    margin: 1.15rem auto 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.stage-confirm-record.is-empty {
    background: transparent;
}

.stage-confirm-stars {
    color: #fde68a;
    font-size: clamp(2.25rem, 10.5vw, 3rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.08em;
    text-shadow: 0 0 14px rgba(251, 191, 36, 0.58), 0 2px 10px rgba(0, 0, 0, 0.8);
}

.stage-confirm-stars.is-empty-stars {
    color: rgba(226, 232, 240, 0.24);
    text-shadow: none;
}

.stage-confirm-best,
.stage-confirm-empty {
    color: rgba(226, 232, 240, 0.7);
    font-size: 0.96rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.14em;
}

.stage-confirm-best {
    color: #67e8f9;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    text-shadow: 0 0 10px rgba(34, 211, 238, 0.36), 0 2px 8px rgba(0, 0, 0, 0.48);
}

.stage-confirm-mentor-wrap {
    position: relative;
    margin-top: 0.45rem;
    overflow: visible;
}

.stage-confirm-mentor-btn {
    position: relative;
    display: grid;
    grid-template-columns: 6.7rem 1fr;
    align-items: center;
    min-height: 5.9rem;
    padding: 0.55rem 1.35rem 0.55rem 0.2rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 1.35rem;
    color: rgba(255, 255, 255, 0.92);
    background:
        radial-gradient(circle at 12% 10%, rgba(125, 211, 252, 0.16), transparent 54%),
        rgba(255, 255, 255, 0.055);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 24px rgba(0, 0, 0, 0.18);
    overflow: visible;
}

.stage-confirm-mentor-btn:hover {
    background:
        radial-gradient(circle at 12% 10%, rgba(125, 211, 252, 0.22), transparent 54%),
        rgba(255, 255, 255, 0.085);
}

.stage-confirm-mentor-portrait {
    position: relative;
    align-self: end;
    width: 7rem;
    height: 6.75rem;
    margin: -1.45rem 0 -0.9rem -0.55rem;
    pointer-events: none;
    transform: translateY(-0.35rem);
}

.stage-confirm-mentor-portrait img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: bottom center;
    filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.36));
}

.stage-confirm-mentor-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    padding-left: 0.15rem;
}

.stage-confirm-mentor-title {
    color: #fff7ed;
    font-size: 1.08rem;
    font-weight: 900;
    letter-spacing: 0.03em;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.46);
}

/* Remove pointer events from disabled buttons to allow flicker/tap fallthrough */
.rune-btn[disabled] {
    pointer-events: none;
}

/* --- Monster Animation --- */
.monster-breath {
    animation: monster-breath 3s ease-in-out infinite;
    will-change: transform;
}

@keyframes monster-breath {

    0%,
    100% {
        transform: translateY(0) scale(1.0);
    }

    50% {
        transform: translateY(-8px) scale(1.02);
    }
}

@media (max-width: 768px) {

    /* Battle Polish Fixes for Mobile */
    #battleLog {
        font-size: 1rem !important;
        letter-spacing: 0.02em;
    }

    .monster-breath+span,
    .monster-breath+span+span {
        text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9), 0 0 1px rgba(0, 0, 0, 1) !important;
    }

    #heroAvatar {
        margin-bottom: calc(clamp(135px, 18dvh, 160px) + 10px) !important;
    }

    /* Fix for tap->flick mode switch remnant - allowed overflow for mobile stacking */
    .tap-mode-controls {
        background: transparent !important;
        overflow: visible !important;
    }
}

/* HUD Row Stabilization */
.hud-interactive-rows {
    display: flex;
    flex-direction: column;
    /* Remove rigid height lock; use min-height for stability */
    min-height: 50px;
    transition: height 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Question Card Glassmorphism - Align with Hero HUD */
.question-card.glass-panel {
    background: rgba(15, 23, 42, 0.15) !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Match Mode Toggle height/style with other UI elements */
.hud-inner-wrap .h-7.md\:h-8 {
    border-radius: 10px;
    font-size: 10px !important;
}

/* Ensure Row 1 behaves consistently */
#hud .w-full.px-2.py-0 {
    flex-shrink: 0;
}

/* Base HUD internal for shake abstraction */
.hud-inner-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: start;
    padding: 0;
    margin: 0;
}

/* Desktop HUD Layout Polish */
@media (min-width: 901px) {
    #hud {
        padding: 4px 8px !important;
    }

    .hero-status-pill {
        height: 20px !important;
        font-size: 11px !important;
        flex-shrink: 0 !important;
    }

    #heroStatusBar {
        margin-top: 0 !important;
    }

    /* Ensure clear spacing between zones on wide HUD */
    #hud .flex-row.md\:flex-nowrap {
        gap: 1.5rem !important;
    }

    /* Center zone (HP/SP) gets more breath */
    #hud .md\:max-w-md {
        max-width: 480px !important;
    }

    /* Ensure center modals on desktops as requested */
    .modal-overlay {
        align-items: center !important;
        padding-top: 0 !important;
    }

    .modal-panel {
        margin: auto !important;
        align-self: center !important;
    }

}

/* --- Stage Map v1 Styles --- */
/* MAP LAYOUT STRATEGY:
   - .map-page-container: fixed inset:0, height = 100svh (Safari-stable small viewport)
   - .map-viewport: absolute inset:0, overflow hidden, flex center
   - .map-nodes-container: height:100%, width:auto (image-driven)
   - .map-base-img: height:100%, width:auto, object-fit:fill
   - HUD: position:fixed, fully independent of map image scale
*/
.map-page-container {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: radial-gradient(circle at center, #1e1b4b 0%, #0f172a 100%);
    overflow: hidden;
}

/* Visibility Control */
.map-ui-desktop-zone {
    display: none;
}

.map-ui-mobile-zone {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 45;
    pointer-events: none;
}

.map-page-container .map-ui-mobile-zone .map-float-header,
.map-page-container .map-ui-mobile-zone .map-hud-bottom,
.map-page-container .map-ui-mobile-zone .map-hud-actions,
.map-page-container .map-ui-mobile-zone .map-hud-btn {
    pointer-events: auto;
}

/* Desktop Fine-tuning (Anchored inside .map-nodes-container) */
@media (min-width: 1024px) {
    .map-ui-desktop-zone {
        display: block;
    }

    /* Outrank Tailwind `.relative` on the same node (Lv/EXP overlays); keep avatar anchored to map bottom. */
    .map-ui-desktop-zone .map-hud-avatar {
        position: absolute;
    }

    .map-ui-mobile-zone {
        display: none;
    }

    /* Ensure the map anchor container is not clamped to 400px on desktop graphical map */
    .map-page-container .map-nodes-container {
        max-width: none !important;
        width: max-content !important;
    }

    /* Reduce header inset slightly inside the anchor */
    .map-ui-desktop-zone .map-float-header {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    /* Reduce Hero Avatar size on desktop */
    .map-ui-desktop-zone .map-hud-avatar-img {
        height: 110px !important;
    }

    .map-ui-desktop-zone .map-hud-exp-bar {
        max-width: 118px;
    }

    /* Adjust HUD left padding to match smaller avatar and center content */
    .map-ui-desktop-zone .map-hud-bottom {
        padding-left: 145px !important;
        padding-right: 145px !important;
        justify-content: center !important;
    }

    /* 1. Mentor Overlay Constraint (Keep desktop-only) */
    .map-mentor-overlay {
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        width: 100% !important;
        max-width: 177.78vh !important;
        /* Match Map Height-based Width */
    }
}

/* ── Floating Header ── */
.map-float-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 25;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: calc(env(safe-area-inset-top, 12px) + 12px) 14px 0;
    pointer-events: none;
}

.map-float-header>* {
    pointer-events: auto;
}

.map-chapter-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px 5px 8px;
    background: rgba(2, 6, 23, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(245, 158, 11, 0.22);
    border-radius: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.map-chapter-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #f59e0b;
    box-shadow: 0 0 7px rgba(245, 158, 11, 0.9);
    flex-shrink: 0;
}

.map-chapter-name {
    font-size: 14px;
    font-weight: 800;
    color: rgba(253, 230, 138, 0.92);
    letter-spacing: 0.04em;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

/* ── Map name dropdown trigger (fantasy badge style) ── */
.map-name-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px 7px 10px;
    background: linear-gradient(135deg, rgba(4, 8, 32, 0.75) 0%, rgba(20, 15, 50, 0.7) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(245, 158, 11, 0.28);
    border-radius: 22px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.map-name-btn:active {
    transform: scale(0.96);
}

.map-name-btn--open {
    border-color: rgba(245, 158, 11, 0.6);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.4), 0 0 12px rgba(245, 158, 11, 0.12), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    background: linear-gradient(135deg, rgba(4, 8, 32, 0.88) 0%, rgba(25, 18, 60, 0.82) 100%);
}

.map-name-chevron {
    font-size: 8px;
    color: rgba(245, 158, 11, 0.65);
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}

.map-name-btn--open .map-name-chevron {
    color: rgba(245, 158, 11, 0.9);
}

/* ── Dropdown panel ── */
.map-dropdown-panel {
    position: absolute;
    top: calc(100% + 7px);
    left: 0;
    min-width: 148px;
    max-width: 200px;
    background: rgba(3, 6, 24, 0.94);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid rgba(245, 158, 11, 0.16);
    border-top: 2px solid rgba(245, 158, 11, 0.35);
    border-radius: 12px;
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
    overflow: hidden;
    z-index: 26;
    padding: 4px 0 6px;
}

.map-dropdown-group {
    padding: 0;
}

.map-dropdown-chapter-label {
    font-size: 8.5px;
    font-weight: 900;
    color: rgba(245, 158, 11, 0.45);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 6px 12px 2px;
}

.map-dropdown-item {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    padding: 11px 14px;
    font-size: 14px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.68);
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.11s, color 0.11s;
    line-height: 1.2;
    letter-spacing: 0.01em;
}

.map-dropdown-item:hover {
    background: rgba(245, 158, 11, 0.07);
    color: rgba(255, 255, 255, 0.9);
}

.map-dropdown-item:active {
    background: rgba(245, 158, 11, 0.12);
}

.map-dropdown-item--active {
    color: rgba(253, 224, 71, 0.95);
    background: rgba(245, 158, 11, 0.06);
}

.map-dropdown-item--locked {
    opacity: 0.25;
    cursor: not-allowed;
    pointer-events: none;
}

.map-dropdown-indicator {
    width: 13px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.map-dropdown-dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.map-dropdown-dot--active {
    background: #f59e0b;
    border-color: rgba(245, 158, 11, 0.5);
    box-shadow: 0 0 7px rgba(245, 158, 11, 0.85);
}

.map-dropdown-label {
    flex: 1;
}

/* 手機易讀性：地圖選單（章節名／下拉段名）放大（電腦版維持原樣） */
@media (max-width: 768px) {
    .map-chapter-name {
        font-size: 16px;
    }

    .map-dropdown-item {
        font-size: 16px;
    }

    .map-dropdown-chapter-label {
        font-size: 13px;
    }
}

/* ── Bottom HUD ── */
.map-hud-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 25;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 14px calc(env(safe-area-inset-bottom, 0px) + 8px) 170px;
    background: linear-gradient(to top,
            rgba(2, 6, 23, 0.55) 0%,
            rgba(10, 15, 40, 0.28) 60%,
            transparent 95%);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-top: none;
    pointer-events: none;
}

.map-hud-bottom>* {
    pointer-events: auto;
}

.map-hud-avatar {
    position: absolute;
    bottom: 0;
    left: 14px;
    z-index: 26;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: visible;
}

.map-hud-avatar-img {
    height: 140px;
    width: auto;
    display: block;
    object-fit: contain;
    filter: none;
    align-self: center;
}

.map-hud-exp-bar {
    position: relative;
    width: clamp(62px, 17vw, 96px);
    max-width: 88%;
    margin-top: 1px;
    z-index: 12;
    align-self: center;
    pointer-events: none;
}

.map-hud-exp-track {
    width: 100%;
    height: 5px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.map-hud-exp-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #b45309 0%, #fbbf24 55%, #fde68a 100%);
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.45);
}

.map-hud-bars {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    max-width: 180px;
}

.map-hud-bar-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Unified HUD Bar Styling (Map & Battle) ── */
.hud-bar-label {
    font-size: 11px;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.08em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    font-family: inherit;
    line-height: 1;
}

.hud-bar-label--hp {
    color: #34d399;
    /* emerald-400 */
}

.hud-bar-label--sp {
    color: #22d3ee;
    /* cyan-400 */
}

.hud-bar-value {
    font-family: 'monospace';
    font-weight: 800;
    font-size: 11px;
    color: rgba(226, 232, 240, 0.9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
    line-height: 1;
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.hud-bar-track {
    background: rgba(15, 23, 42, 0.6);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.5);
    position: relative;
    min-height: 4px;
    /* Ensure visibility if no height class is present */
}

/* Map specific bar track sizing */
.map-hud-bar-track {
    height: 6px;
    flex: 1;
}

.hud-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hud-bar-hp-fill {
    background: linear-gradient(90deg, #059669, #34d399);
    /* Emerald Gradient */
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.45);
}

.hud-bar-hp-fill.danger {
    background: linear-gradient(90deg, #dc2626, #f87171) !important;
    box-shadow: 0 0 15px rgba(220, 38, 38, 0.6) !important;
}

.hud-bar-sp-fill {
    background: linear-gradient(90deg, #0891b2, #22d3ee);
    /* Cyan Gradient */
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.35);
}

.map-hud-bar-val--sp {
    color: rgba(139, 250, 250, 0.88);
}

.map-hud-actions {
    display: flex;
    gap: 7px;
    flex-shrink: 0;
}

.map-hud-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.11);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    line-height: 1;
    transition: all 0.18s;
    cursor: pointer;
    flex-shrink: 0;
}

.map-hud-btn--monster-codex {
    background:
        radial-gradient(circle at 35% 28%, rgba(251, 191, 36, 0.16), transparent 48%),
        rgba(255, 255, 255, 0.055);
    border-color: rgba(251, 191, 36, 0.18);
}

.map-hud-btn--monster-codex span {
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.55));
}

/* ── Mobile HUD: width tracks actual map image rendered width ── */
/* HUD POSITIONING STRATEGY:
   - .map-hud-bottom: fixed shell, width = --map-visible-width, centered, fixed height
   - .map-hud-center: inner group (HP/SP + buttons), flex-row, centered inside shell
   - .map-hud-avatar: fixed left:0 bottom:0, sits to the left of the shell
   - On narrow phones, .map-hud-center nudged right via translateX to clear avatar
*/
.map-page-container .map-ui-mobile-zone .map-hud-bottom {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: 0;
    z-index: 48;
    width: var(--map-visible-width, 100vw);
    max-width: 100vw;
    transform: translateX(-50%);
    /* Fixed height prevents toolbar-show/hide from changing HUD thickness */
    height: clamp(52px, 6.5dvh, 72px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 12px;
    pointer-events: auto;
    box-sizing: border-box;
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 5px);
}

/* Inner content group: HP/SP bars + action buttons as one centered unit */
.map-page-container .map-ui-mobile-zone .map-hud-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 2.5vw, 22px);
    flex-shrink: 0;
    height: 100%;
}

/* Tablet Landscape: lock HUD height so Safari toolbars or dvh don't thicken it */
@media (orientation: landscape) and (min-width: 640px) {
    .map-page-container .map-ui-mobile-zone .map-hud-bottom {
        height: 56px;
        min-height: 56px;
        max-height: 56px;
        padding-top: 0;
        padding-bottom: 0;
        box-sizing: border-box;
        align-items: center;
    }
}

/* On narrow phones (<640px): nudge the center group right to clear the avatar */
@media (max-width: 639px) {
    .map-page-container .map-ui-mobile-zone .map-hud-center {
        transform: translateX(clamp(42px, 12vw, 68px));
    }
}

.map-page-container .map-ui-mobile-zone .map-hud-avatar {
    position: fixed;
    left: calc(env(safe-area-inset-left, 0px) + 13px);
    bottom: max(env(safe-area-inset-bottom, 0px), 5px);
    z-index: 49;
    pointer-events: none;
    overflow: visible;
    align-items: center;
}

.map-page-container .map-ui-mobile-zone .map-hud-avatar-img {
    height: auto;
    width: clamp(88px, 24vw, 132px);
    display: block;
    pointer-events: none;
}

.map-page-container .map-ui-mobile-zone .map-hud-exp-bar {
    width: clamp(62px, 17vw, 96px);
    max-width: 88%;
    margin-top: 1px;
    align-self: center;
}

.map-page-container .map-ui-desktop-zone .map-hud-bars,
.map-page-container .map-ui-mobile-zone .map-hud-bars {
    flex: 0 0 auto;
    width: clamp(120px, 34vw, 150px);
    max-width: clamp(120px, 34vw, 150px);
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 8px;
    border-radius: 14px;
    background: rgba(5, 15, 25, 0.34);
    border: 1px solid rgba(255, 255, 255, 0.13);
    box-shadow:
        0 4px 14px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
    --battle-hud-label-col: 1.375rem;
    --battle-hud-value-col: 1.875rem;
}

.map-page-container .map-ui-desktop-zone .map-hud-bar-row,
.map-page-container .map-ui-mobile-zone .map-hud-bar-row {
    display: grid;
    grid-template-columns: var(--battle-hud-label-col) minmax(0, 1fr) var(--battle-hud-value-col);
    align-items: center;
    column-gap: 6px;
    width: 100%;
    gap: 0;
}

.map-page-container .map-ui-desktop-zone .map-hud-bar-track,
.map-page-container .map-ui-mobile-zone .map-hud-bar-track {
    width: 100%;
    min-width: 0;
    height: 6px;
    min-height: 6px;
    flex: none;
    border-width: 1.5px;
}

.map-page-container .map-ui-desktop-zone .map-hud-bar-row .hud-bar-label,
.map-page-container .map-ui-mobile-zone .map-hud-bar-row .hud-bar-label {
    font-size: 11px;
    line-height: 1;
    width: auto;
    justify-self: start;
}

.map-page-container .map-ui-desktop-zone .map-hud-bar-row .hud-bar-value,
.map-page-container .map-ui-mobile-zone .map-hud-bar-row .hud-bar-value {
    font-size: 11px;
    font-family: monospace;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    min-width: var(--battle-hud-value-col);
    max-width: var(--battle-hud-value-col);
    text-align: right;
    justify-self: end;
}

.map-hud-btn:active {
    transform: scale(0.87);
    background: rgba(255, 255, 255, 0.12);
}

/* ── Map node book icons ── */
.map-stage-node-book-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
    transition: transform 0.15s;
}

.map-stage-node:not(:disabled):hover .map-stage-node-book-img {
    transform: scale(1.08);
}

.map-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.map-back-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.map-back-btn:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.2);
}

.map-title-box {
    text-align: center;
}

.map-area-title {
    font-size: 1.25rem;
    font-weight: 900;
    color: #fde047;
    text-shadow: 0 0 10px rgba(253, 224, 71, 0.4);
}

.map-area-progress {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: bold;
    margin-top: 0.25rem;
}

.map-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 1rem 6rem;
    display: flex;
    justify-content: center;
}

/* ── Map viewport + image: height-fill strategy ──
   Fallback for non-graphical map list view.
   Overridden below for .map-page-container context. */
.map-nodes-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: 100%;
    max-width: 400px;
}

/* ── Graphical map: viewport fills container, image fills height ── */
.map-page-container .map-viewport {
    position: absolute;
    inset: 0;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.map-load-state {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: radial-gradient(circle at center, rgba(30, 41, 59, 0.82), rgba(15, 23, 42, 0.96));
}

.map-load-state__panel {
    width: min(26rem, 100%);
    padding: 1.5rem;
    border: 1px solid rgba(196, 181, 253, 0.4);
    border-radius: 1.25rem;
    background: rgba(15, 23, 42, 0.88);
    color: #f8fafc;
    text-align: center;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.45);
}

.map-load-state__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 900;
}

.map-load-state__message {
    margin: 0.55rem 0 0;
    color: #cbd5e1;
    font-size: 0.9rem;
}

.map-load-state__retry {
    margin-top: 1rem;
    padding: 0.7rem 1.2rem;
    border: 1px solid rgba(253, 230, 138, 0.75);
    border-radius: 999px;
    background: #fbbf24;
    color: #422006;
    font-weight: 900;
}

.map-load-state__retry:disabled {
    cursor: wait;
    opacity: 0.6;
}

/* 手機：地圖填滿高度後寬度超出畫面，改為可水平滑動，避免兩側關卡（書本）被裁掉看不到。
   safe center：放得下時置中、放不下時靠左且兩端皆可完整捲動（避免 flex 置中把起點裁掉的 bug）。 */
@media (max-width: 768px) {
    .map-page-container .map-viewport {
        overflow-x: auto;
        overflow-y: hidden;
        justify-content: safe center;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
    }

    .map-page-container .map-viewport::-webkit-scrollbar {
        display: none;
    }
}

.map-page-container .map-nodes-container {
    /* Image-driven width: never clamped to 400px, fills full viewport height */
    display: flex !important;
    /* flex makes max-content and centering more robust */
    justify-content: center;
    height: 100% !important;
    width: max-content !important;
    max-width: none !important;
    flex-shrink: 0 !important;
    position: relative;
}

.map-page-container .map-base-img {
    /* Height fills viewport, width is natural (may letterbox or slightly crop) */
    display: block;
    height: 100% !important;
    width: auto !important;
    max-width: none !important;
    object-fit: cover;
    /* fill = stretch to exact h:100% without cropping — eliminates black stripe */
    pointer-events: none;
}

/* Tablet portrait: same strategy, no special overrides needed.
   Removed conflicting align-items:stretch / justify-content:center block. */
@media (min-width: 640px) and (max-width: 1023px) and (orientation: portrait) {

    /* Battle question text size tweak — unrelated to map layout, kept here */
    #question-area>div.battle-question-cn:last-child {
        font-size: clamp(22px, 2.8vw, 28px) !important;
        line-height: 1.45 !important;
    }
}

.stage-node-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    position: relative;
}

.stage-node-btn {
    width: 85%;
    max-width: 320px;
    padding: 1rem;
    border-radius: 20px;
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: left;
}

.stage-node-btn:disabled {
    opacity: 0.5;
    filter: grayscale(1);
    cursor: not-allowed;
}

.stage-node-wrap.is-unlocked .stage-node-btn {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.stage-node-wrap.is-unlocked .stage-node-btn:active {
    transform: scale(0.95);
    background: rgba(30, 41, 59, 0.8);
}

.stage-node-wrap.is-current .stage-node-btn {
    border-color: #fde047;
    box-shadow: 0 0 20px rgba(253, 224, 71, 0.3), inset 0 0 10px rgba(253, 224, 71, 0.1);
    animation: node-pulse 2s infinite ease-in-out;
}

@keyframes node-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
        box-shadow: 0 0 30px rgba(253, 224, 71, 0.4), inset 0 0 15px rgba(253, 224, 71, 0.2);
    }
}

.stage-node-wrap.is-cleared .node-icon {
    background: linear-gradient(135deg, #fde047, #f59e0b);
    color: #422006;
}

.node-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    transition: all 0.3s;
}

.node-info {
    flex: 1;
}

.node-number {
    font-size: 0.7rem;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.node-title {
    font-size: 1.1rem;
    font-weight: 900;
    color: #f8fafc;
    margin-top: 2px;
}

.node-connector {
    width: 4px;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    margin: 4px 0;
    transition: all 0.3s;
}

.node-connector.is-unlocked {
    background: rgba(253, 224, 71, 0.3);
}

/* Glass Panel for generic use */
.glass-panel {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ── Node Landmark Labels ── */
.node-landmark-label {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 11px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8), 0 0 2px rgba(0, 0, 0, 1), 0 1px 2px rgba(0, 0, 0, 1);
    z-index: 20;
    pointer-events: none;
    transition: all 0.3s ease;
}

.node-landmark-label--top {

    bottom: 46px;
    /* Tightened from 54px */

}



.node-landmark-label--bottom {

    top: 48px;
    /* Adjusted from 42px for better spacing */

}

/* Map node label & rank readability (CSS-only; beats index.html inline) */
.map-page-container .stage-node-wrap .node-landmark-label {
    font-size: 0.8125rem;
    letter-spacing: 0.04em;
    color: #f8fafc;
    text-shadow:
        0 0 2px rgba(0, 0, 0, 0.82),
        0 1px 2px rgba(0, 0, 0, 0.72),
        0 2px 6px rgba(0, 0, 0, 0.58),
        0 0 1px rgba(255, 255, 255, 0.22);
}

@media (max-width: 768px) {
    /* 手機關卡名稱白字加大約兩個字級，改善老花可讀性（電腦版維持原樣） */
    .map-page-container .stage-node-wrap .node-landmark-label {
        font-size: 1.15rem;
    }
}

.map-page-container .stage-node-wrap .grade-badge {
    outline: 1px solid rgba(255, 255, 255, 0.3);
    outline-offset: 0;
    -webkit-text-stroke: 0.85px rgba(255, 255, 255, 0.55);
    paint-order: stroke fill;
    text-shadow:
        0 0 1.5px rgba(0, 0, 0, 0.92),
        0 1px 0 rgba(255, 255, 255, 0.35),
        0 2px 3px rgba(0, 0, 0, 0.78),
        0 0 7px rgba(0, 0, 0, 0.42),
        0 0 4px rgba(255, 255, 255, 0.12);
}

.map-page-container .stage-node-wrap .text-yellow-400.grade-badge,
.map-page-container .stage-node-wrap .text-yellow-300.grade-badge {
    filter: brightness(1.3) drop-shadow(0 0 4px rgba(0, 0, 0, 0.58)) drop-shadow(0 2px 5px rgba(0, 0, 0, 0.5));
    -webkit-text-stroke: 0.85px rgba(255, 255, 255, 0.42);
}

.map-page-container .stage-node-wrap .text-blue-400.grade-badge,
.map-page-container .stage-node-wrap .text-cyan-400.grade-badge {
    filter: brightness(1.2) drop-shadow(0 0 4px rgba(0, 0, 0, 0.58)) drop-shadow(0 2px 5px rgba(0, 0, 0, 0.5));
}

.map-page-container .stage-node-wrap .text-slate-200.grade-badge,
.map-page-container .stage-node-wrap .text-gray-200.grade-badge {
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.62)) drop-shadow(0 2px 5px rgba(0, 0, 0, 0.52));
    -webkit-text-stroke: 0.85px rgba(255, 255, 255, 0.58);
}

.map-page-container .stage-node-wrap .text-orange-400.grade-badge,
.map-page-container .stage-node-wrap .text-amber-600.grade-badge {
    outline: 1.5px solid rgba(255, 255, 255, 0.35) !important;
    -webkit-text-stroke: 0.85px rgba(255, 255, 255, 0.55) !important;
    text-shadow:
        0 0 1.5px rgba(0, 0, 0, 0.92),
        0 1px 0 rgba(255, 255, 255, 0.38),
        0 2px 4px rgba(0, 0, 0, 0.75),
        0 0 6px rgba(0, 0, 0, 0.45) !important;
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.65)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55)) !important;
}


/* Glow Layers for Independent Pulses (Ch 5+) */
.map-ambient-glow-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
    /* Below particles(5) and nodes(10) */
    overflow: hidden;
}

.glow-pulse {
    position: absolute;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    mix-blend-mode: screen;
}

/* Ch 5 Abyss Specifics: Cool Blue-White Crystal Glow */
.map-ambient-abyss .glow-pulse {
    background: radial-gradient(circle, rgba(56, 189, 248, 0.75) 0%, rgba(14, 165, 233, 0.25) 50%, transparent 80%);
    filter: blur(25px);
    mix-blend-mode: screen;
}

.map-ambient-abyss .glow-entrance {
    animation: abyss-glow-entrance 4s ease-in-out infinite alternate;
}

.map-ambient-abyss .glow-left {
    animation: abyss-glow-left 5s ease-in-out infinite alternate;
    animation-delay: -1s;
}

.map-ambient-abyss .glow-right {
    animation: abyss-glow-right 6s ease-in-out infinite alternate;
    animation-delay: -3s;
}



/* Ch 5 Updraft / Rising Wisps */

.glow-updraft-1,
.glow-updraft-2,
.glow-updraft-3 {

    position: absolute;

    width: 6% !important;

    height: 30% !important;

    transform: translateX(-50%);

    mix-blend-mode: screen;

}



.pulse-updraft {

    background: linear-gradient(to top, transparent, rgba(56, 189, 248, 0.5) 50%, transparent);

}



.pulse-updraft-low {

    background: linear-gradient(to top, transparent, rgba(14, 165, 233, 0.3) 50%, transparent);

}



.map-ambient-abyss .glow-updraft-1 {
    animation: abyss-updraft-flow 2.2s cubic-bezier(0.1, 0, 0.4, 1) infinite;
}

.map-ambient-abyss .glow-updraft-2 {
    animation: abyss-updraft-flow 3.0s cubic-bezier(0.1, 0, 0.4, 1) infinite;
    animation-delay: -0.5s;
}

.map-ambient-abyss .glow-updraft-3 {
    animation: abyss-updraft-flow 3.8s cubic-bezier(0.1, 0, 0.4, 1) infinite;
    animation-delay: -1.5s;
}



@keyframes abyss-updraft-flow {

    0% {
        transform: translateX(-50%) translateY(0) scaleX(0.7);
        opacity: 0;
    }

    30% {
        opacity: 0.5;
    }

    70% {
        opacity: 0.5;
    }

    100% {
        transform: translateX(-50%) translateY(-240px) scaleX(1.3);
        opacity: 0;
    }

}



@keyframes abyss-glow-entrance {
    0% {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0.3;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.25);
        opacity: 0.95;
    }
}

@keyframes abyss-glow-left {
    0% {
        transform: translate(-50%, -50%) scale(0.85);
        opacity: 0.2;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.15);
        opacity: 0.75;
    }
}

@keyframes abyss-glow-right {
    0% {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0.2;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 0.65;
    }
}



/* Ch 6 Sacred Specifics: Red-Purple Ultra-Heavy Haze Masses */

.map-ambient-sacred .glow-pulse {

    mix-blend-mode: screen;

    filter: blur(85px);
    /* Ultra heavy blur for massive clumpy presence */

    border-radius: 20% 80% 40% 60% / 60% 40% 70% 30%;
    /* Extreme irregular clumpy mass */

}



.pulse-haze-ultra {

    background: radial-gradient(circle, rgba(107, 33, 168, 0.65) 0%, rgba(76, 29, 149, 0.4) 50%, rgba(30, 10, 50, 0.2) 80%, transparent 100%);

}



.pulse-haze-heavy {

    background: radial-gradient(circle, rgba(185, 28, 28, 0.50) 0%, rgba(127, 29, 29, 0.3) 60%, transparent 95%);

}



.pulse-haze-dark {

    background: radial-gradient(circle, rgba(76, 29, 149, 0.60) 0%, rgba(15, 10, 20, 0.4) 70%, transparent 100%);

}



/* Haggard writhing animations for "living corruption" masses */

.map-ambient-sacred .glow-haze-throne {
    animation: sacred-haze-ultra-wriggle 12s ease-in-out infinite alternate;
    opacity: 0.85;
}

.map-ambient-sacred .glow-haze-gate {
    animation: sacred-haze-ultra-wriggle 16s ease-in-out infinite alternate-reverse;
    animation-delay: -5s;
    opacity: 0.7;
}

.map-ambient-sacred .glow-haze-library {
    animation: sacred-haze-pulse 9s ease-in-out infinite alternate;
    animation-delay: -3s;
    opacity: 0.6;
}



@keyframes sacred-haze-ultra-wriggle {

    0% {
        transform: translate(-50%, -50%) rotate(0deg) skew(0deg) scale(1.0);
        opacity: 0.55;
    }

    50% {
        transform: translate(-46%, -54%) rotate(15deg) skew(12deg) scale(1.4);
        opacity: 0.9;
    }

    100% {
        transform: translate(-54%, -46%) rotate(-10deg) skew(-8deg) scale(0.85);
        opacity: 0.55;
    }

}



@keyframes sacred-haze-pulse {

    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.45;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0.85;
    }

}



/* Ch 6 Spirit Lights: Ghost Flames */

.pulse-ghost-flame {
    background: radial-gradient(circle,
            rgba(255, 255, 255, 0.98) 0%,
            rgba(255, 255, 255, 0.95) 10%,
            rgba(255, 120, 220, 0.95) 22%,
            rgba(120, 80, 255, 0.75) 42%,
            rgba(70, 20, 120, 0.18) 62%,
            rgba(0, 0, 0, 0) 72%);
    box-shadow:
        0 0 14px rgba(255, 120, 220, 0.9),
        0 0 28px rgba(120, 80, 255, 0.75),
        0 0 42px rgba(120, 80, 255, 0.45);
    filter: blur(0.2px);
    border-radius: 50%;
    mix-blend-mode: normal;
    opacity: 0.9;
    z-index: 6;
}



[class*="glow-flame-"] {

    animation: ghost-flame-float 9s ease-in-out infinite alternate,

        ghost-flame-flicker 4s ease-in-out infinite alternate;

}



.map-ambient-sacred .glow-flame-t2 {
    animation-delay: -2s, -1s;
}

.map-ambient-sacred .glow-flame-t3 {
    animation-delay: -4s, -2.5s;
}

.map-ambient-sacred .glow-flame-g2 {
    animation-delay: -1.5s, -0.8s;
}

.map-ambient-sacred .glow-flame-l2 {
    animation-delay: -6s, -3s;
}

.map-ambient-sacred .glow-flame-l3 {
    animation-delay: -3.5s, -1.2s;
}



@keyframes ghost-flame-float {
    0% {
        transform: translate(-50%, -50%) translateY(0) scale(0.96);
    }

    50% {
        transform: translate(-50%, -50%) translateY(-10px) scale(1.04);
    }

    100% {
        transform: translate(-50%, -50%) translateY(-20px) scale(0.98);
    }
}

@keyframes ghost-flame-flicker {
    0% {
        opacity: 0.45;
    }

    20% {
        opacity: 0.95;
    }

    45% {
        opacity: 0.55;
    }

    70% {
        opacity: 1.0;
    }

    100% {
        opacity: 0.7;
    }
}



/* ── Suble Background Motion (Handheld Camera Drift) — Ch 4, 5, 6 ── */

.map-ambient-ruins .map-base-img,

.map-ambient-abyss .map-base-img,

.map-ambient-sacred .map-base-img {

    will-change: transform;

    transform-origin: center center;

}



/* Ch 4 Ruins: Horizontal Drift + Slight Sink (Misty Valley Feel) */

.map-ambient-ruins .map-base-img {

    animation: ruins-bg-drift 13s ease-in-out infinite alternate;

}



@keyframes ruins-bg-drift {

    0% {
        transform: scale(1.005) translateX(0) translateY(0) rotate(0deg);
    }

    50% {
        transform: scale(1.008) translateX(3px) translateY(2px) rotate(0.06deg);
    }

    100% {
        transform: scale(1.005) translateX(-2px) translateY(1px) rotate(-0.04deg);
    }

}



/* Ch 5 Abyss: Vertical Chasm Breathing (Breezy Altitude Feel) */

.map-ambient-abyss .map-base-img {

    animation: abyss-bg-twitch 10s ease-in-out infinite alternate;

}



@keyframes abyss-bg-twitch {

    0% {
        transform: scale(1.0) translateY(0);
    }

    35% {
        transform: scale(1.012) translateY(-3.5px);
    }

    70% {
        transform: scale(1.005) translateY(1.5px);
    }

    100% {
        transform: scale(1.0) translateY(0);
    }

}



/* Ch 6 Sacred: Cursed Oppression (Heavy Scale + Slow Sway) */

.map-ambient-sacred .map-base-img {

    animation: sacred-bg-oppress 16s ease-in-out infinite alternate;

}



@keyframes sacred-bg-oppress {

    0% {
        transform: scale(1.0) translateX(0) rotate(0deg);
    }

    50% {
        transform: scale(1.018) translateX(3px) rotate(0.12deg);
    }

    100% {
        transform: scale(1.0) translateX(-1px) rotate(-0.08deg);
    }

}

/* Ch 7 Final Sanctuary: Sacred Light Dynamics */

.map-ambient-final .map-base-img {

    will-change: transform;

    transform-origin: center center;

    animation: final-bg-drift 16s ease-in-out infinite alternate;

}



@keyframes final-bg-drift {

    0% {
        transform: scale(1.008) translateX(0) translateY(0) rotate(0deg);
    }

    100% {
        transform: scale(1.015) translateX(2.5px) translateY(1.5px) rotate(0.06deg);
    }

}



/* Whole Sky Pulse (Brightness Breathing - 7.5s cycle) */

.pulse-sacred-pulse {

    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, rgba(186, 230, 253, 0.1) 40%, transparent 80%);

    mix-blend-mode: color-dodge;

    filter: blur(40px);

    animation: sacred-sky-breath 7.5s ease-in-out infinite alternate;

}



@keyframes sacred-sky-breath {

    0% {
        opacity: 0.3;
        filter: brightness(1) blur(40px);
    }

    50% {
        opacity: 0.85;
        filter: brightness(1.25) blur(30px);
    }

    100% {
        opacity: 0.3;
        filter: brightness(1) blur(40px);
    }

}



/* Cloud Thunder Flashes (Irregular Bursts) */

.pulse-cloud-flash {

    background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0%, rgba(186, 230, 253, 0.6) 30%, transparent 70%);

    mix-blend-mode: screen;

    filter: blur(25px);

    opacity: 0;

}



.map-ambient-final .glow-flash-top {
    animation: cloud-thunder-flash 8s linear infinite;
    animation-delay: -2s;
}

.map-ambient-final .glow-flash-left {
    animation: cloud-thunder-flash 11s linear infinite;
    animation-delay: -5s;
}

.map-ambient-final .glow-flash-right {
    animation: cloud-thunder-flash 14.5s linear infinite;
    animation-delay: -9s;
}

.map-ambient-final .glow-flash-bottom-right {
    animation: cloud-thunder-flash 18s linear infinite;
    animation-delay: -13s;
}



@keyframes cloud-thunder-flash {

    0%,
    84%,
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1);
    }

    86% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(1.15);
    }

    87% {
        opacity: 0.4;
        transform: translate(-50%, -50%) scale(1.1);
    }

    89% {
        opacity: 0.95;
        transform: translate(-50%, -50%) scale(1.25);
    }

    92% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1);
    }

}



.map-ambient-ch1,
.map-ambient-highland,
.map-ambient-ice,
.map-ambient-ruins,
.map-ambient-abyss,
.map-ambient-sacred,
.map-ambient-final,
.map-ambient-void {
    overflow: hidden;
}

/* Subtle Overlays & Main Visuals via :before/:after */
.map-ambient-final::before,
.map-ambient-void::before,
.map-ambient-final::after,
.map-ambient-void::after,
.map-ambient-ruins::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
    opacity: 0;
    transition: opacity 1s ease;
}

/* Ch 4 Ruins/Valley: High-Visibility Drifting Mist Sweep */
.map-ambient-ruins::before {
    content: '';
    position: absolute;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.55) 0%, transparent 80%);
    width: 200%;
    height: 50%;
    top: 55%;
    left: -200%;
    opacity: 0.8;
    filter: blur(50px);
    animation: ruins-mist-sweep 16s linear infinite;
    pointer-events: none;
    z-index: 4;
}

.map-ambient-ruins::after {
    background: radial-gradient(ellipse at center, rgba(230, 240, 255, 0.45) 0%, transparent 75%);
    width: 180%;
    height: 45%;
    top: 50%;
    left: -180%;
    opacity: 0.6;
    filter: blur(60px);
    animation: ruins-mist-sweep 24s linear infinite;
    animation-delay: -8s;
}

@keyframes ruins-mist-sweep {
    0% {
        left: -200%;
        opacity: 0;
        transform: translateX(0);
    }

    15% {
        opacity: 0.8;
    }

    85% {
        opacity: 0.8;
    }

    100% {
        left: 200%;
        opacity: 0;
        transform: translateX(50px);
    }
}

/* Ch 7 Final: Vertical Light Rays */
.map-ambient-final::before {
    background: repeating-linear-gradient(90deg,
            transparent,
            transparent 40px,
            rgba(253, 224, 71, 0.08) 60px,
            transparent 80px);
    opacity: 1;
    animation: ambient-rays-flow 15s linear infinite;
    filter: blur(8px);
}

.map-ambient-final::after {
    background: radial-gradient(circle at center, rgba(253, 224, 71, 0.1) 0%, transparent 70%);
    opacity: 1;
    animation: ambient-pulse-soft 10s ease-in-out infinite alternate;
}

/* Ch 8 Void: Red Throne Surge */
.map-ambient-void::before {
    background: radial-gradient(circle at 50% 65%, rgba(153, 27, 27, 0.6) 0%, transparent 55%);
    opacity: 1;
    animation: ambient-core-surge 4s ease-in-out infinite alternate;
    filter: blur(15px);
}

.map-ambient-void::after {
    background: radial-gradient(circle at center, transparent 20%, rgba(0, 0, 0, 0.7) 100%);
    opacity: 1;
    animation: ambient-vignette-pulse 6s ease-in-out infinite alternate;
}

/* Ch 8 Void: Handheld Camera Sway (Subtle Drift) */
.map-ambient-void .map-base-img {
    will-change: transform;
    transform-origin: center center;
    animation: void-bg-sway 18s ease-in-out infinite alternate;
}

@keyframes void-bg-sway {
    0% {
        transform: scale(1.015) translate(0, 0) rotate(0deg);
    }

    40% {
        transform: scale(1.015) translate(4px, 2px) rotate(0.04deg);
    }

    80% {
        transform: scale(1.015) translate(-3px, 4px) rotate(-0.03deg);
    }

    100% {
        transform: scale(1.015) translate(1px, -1px) rotate(0.02deg);
    }
}

@keyframes ambient-rays-flow {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 400px 0;
    }
}

@keyframes ambient-pulse-soft {
    from {
        opacity: 0.4;
        transform: scale(1.0);
    }

    to {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

@keyframes ambient-core-surge {
    0% {
        transform: scale(0.9);
        opacity: 0.4;
    }

    100% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

@keyframes ambient-vignette-pulse {
    0% {
        opacity: 0.5;
    }

    100% {
        opacity: 0.9;
    }
}

/* ── Battle HUD Utility Buttons (Unified Fantasy Glass) ── */
.hud-tool-btn {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.4),
        inset 0 0 12px rgba(255, 255, 255, 0.04);
    cursor: pointer;
    overflow: visible;
    /* Allow badge overflow */
    padding: 0;
}

@media (min-width: 640px) {
    .hud-tool-btn {
        width: 44px;
        height: 44px;
    }
}

.hud-tool-btn:hover {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(255, 255, 255, 0.35);
    transform: translateY(-2px);
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.5),
        inset 0 0 15px rgba(255, 255, 255, 0.08);
}

.hud-tool-btn:active {
    transform: translateY(0) scale(0.92);
    filter: brightness(0.85);
}

/* Icon refinement */
.hud-tool-btn span {
    font-size: 17px;
    transition: transform 0.2s;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (min-width: 640px) {
    .hud-tool-btn span {
        font-size: 20px;
    }
}

.hud-tool-btn:hover span {
    transform: scale(1.1);
}

/* Potion Inventory Integration */
.hud-tool-btn.is-potion-ready {
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.2), rgba(15, 23, 42, 0.7));
    border-color: rgba(52, 211, 153, 0.4);
    box-shadow:
        0 4px 15px rgba(16, 185, 129, 0.15),
        inset 0 0 12px rgba(52, 211, 153, 0.06);
}

.hud-tool-btn.is-potion-ready:hover {
    border-color: rgba(52, 211, 153, 0.6);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.25);
}

/* Skill Book Glow Integration */
.hud-tool-btn.is-skill-ready {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.2), rgba(15, 23, 42, 0.7));
    border-color: rgba(129, 140, 248, 0.45);
}

.hud-tool-label {
    font-size: 11px;
    font-weight: 800;
    color: rgba(199, 210, 254, 0.85);
    letter-spacing: 0.04em;
    line-height: 1;
    pointer-events: none;
}

@media (min-width: 640px) {
    .hud-tool-label {
        font-size: 11px;
    }
}

/* Unified Badge Style */
.hud-tool-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    border: 1.5px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.hud-tool-badge span {
    color: #fff;
    font-size: 11px !important;
    font-weight: 900 !important;
    transform: none !important;
    /* Prevent hover scale */
    font-family: sans-serif;
}

/* Global Disabled State */
.hud-tool-btn.is-disabled {
    filter: grayscale(1) opacity(0.5);
    cursor: not-allowed;
    pointer-events: none;
    transform: none !important;
    box-shadow: none !important;
}

/* ---- Floating Damage UI ---- */
@keyframes floating-dmg-gira-punch {
    0% {
        filter: brightness(1) saturate(1) contrast(1);
    }

    9% {
        filter: brightness(1.78) saturate(1.42) contrast(1.08);
        letter-spacing: 0.08em;
    }

    28% {
        filter: brightness(1.35) saturate(1.28) contrast(1.04);
        letter-spacing: 0.04em;
    }

    100% {
        filter: brightness(1) saturate(1) contrast(1);
        letter-spacing: 0;
    }
}

@keyframes float-dmg-bounce {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.5);
    }

    25% {
        opacity: 1;
        transform: translate(calc(-50% + var(--dx) * 0.35), calc(-50% + var(--dy) - 40px)) scale(1.3) rotate(calc(var(--rot) * 0.35));
    }

    50% {
        opacity: 1;
        transform: translate(calc(-50% + var(--dx) * 0.7), calc(-50% + var(--dy))) scale(1.0) rotate(calc(var(--rot) * 0.7));
    }

    70% {
        opacity: 1;
        transform: translate(calc(-50% + var(--dx) * 0.85), calc(-50% + var(--dy) - var(--bounce1))) scale(0.95) rotate(calc(var(--rot) * 0.85));
    }

    85% {
        opacity: 0.9;
        transform: translate(calc(-50% + var(--dx) * 0.95), calc(-50% + var(--dy))) scale(0.9) rotate(calc(var(--rot) * 0.95));
    }

    100% {
        opacity: 0;
        transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.8) rotate(var(--rot));
    }
}

.floating-dmg-ui {
    position: absolute;
    font-weight: 900;
    font-family: monospace;
    pointer-events: none;
    z-index: 9999;
    text-shadow: 2px 2px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 0 2px 0 #000, 0 -2px 0 #000, 2px 0 0 #000, -2px 0 0 #000;
    animation: float-dmg-bounce 0.9s ease-out forwards;
}

.floating-dmg-monster {
    color: #fff;
    text-shadow: 2px 2px 0 #b91c1c, -2px -2px 0 #b91c1c, 2px -2px 0 #b91c1c, -2px 2px 0 #b91c1c, 0 2px 0 #b91c1c, 0 -2px 0 #b91c1c, 2px 0 0 #b91c1c, -2px 0 0 #b91c1c;
}

.floating-dmg-monster.floating-dmg-giragira-strike {
    animation: float-dmg-bounce 0.9s ease-out forwards, floating-dmg-gira-punch 0.62s cubic-bezier(0.12, 1, 0.32, 1) forwards;
    color: #f0faff;
    text-shadow:
        2px 2px 0 #0369a1,
        -2px -2px 0 #0369a1,
        2px -2px 0 #0369a1,
        -2px 2px 0 #0369a1,
        0 0 12px rgba(224, 247, 255, 0.95),
        0 0 22px rgba(56, 189, 248, 0.8),
        0 0 36px rgba(14, 165, 233, 0.5);
}

.floating-dmg-player {
    color: #ef4444;
}

@keyframes float-buff-up {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.8);
    }

    15% {
        opacity: 1;
        transform: translate(-50%, calc(-50% - 12px)) scale(1.15);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, calc(-50% - 60px)) scale(1.0);
    }
}

.floating-dmg-sp,
.floating-dmg-heal {
    animation: float-buff-up 1.1s ease-out forwards;
}

/* ============================================================
   BATTLE BUFF OVERLAY — GIRAGIRA & future buffs
   z-47: above #heroAvatar (z-45), below #hud (z-50), way below modals (z-2000+)
   marginBottom synced from #heroAvatar via JS (updateHeroStatusBar)
   ============================================================ */
.battle-buff-overlay {
    position: fixed;
    z-index: 47;
    pointer-events: none;
    overflow: visible;
    display: none;
    /* Default hidden; JS will set display:block and calculate pos from heroAvatar */
}

/* Pulsing glow ring around hero */
.aura-giragira-ring {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 2px solid rgba(251, 191, 36, 0.85);
    box-shadow:
        0 0 10px 3px rgba(251, 191, 36, 0.55),
        0 0 22px 7px rgba(251, 191, 36, 0.25),
        inset 0 0 10px rgba(251, 191, 36, 0.12);
    animation: giragira-pulse 1.1s ease-in-out infinite;
}

/* Rotating outer halo */
.aura-giragira-spikes {
    position: absolute;
    inset: -18px;
    border-radius: 50%;
    animation: giragira-rotate 3.5s linear infinite;
}

.aura-giragira-spikes::before,
.aura-giragira-spikes::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px dashed rgba(251, 191, 36, 0.35);
}

.aura-giragira-spikes::after {
    transform: rotate(60deg);
    border-color: rgba(251, 191, 36, 0.2);
}

/* Badge list anchored to top-right of overlay container */
.hero-buff-list {
    position: absolute;
    top: -12px;
    right: -12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 2;
}

/* Base badge */
.buff-badge {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 2px 5px 2px 4px;
    border-radius: 10px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* GIRAGIRA badge colours */
.buff-badge-giragira {
    background: rgba(146, 64, 14, 0.88);
    border: 1px solid rgba(251, 191, 36, 0.9);
    color: #fef3c7;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

.buff-badge-icon {
    font-size: 11px;
    font-weight: 900;
}

.buff-badge-label {
    font-size: 8px;
    opacity: 0.85;
    letter-spacing: 0.03em;
}

.buff-badge-count {
    font-size: 14px;
    font-weight: 900;
    color: #fbbf24;
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.9);
    min-width: 12px;
    text-align: center;
}

@keyframes giragira-pulse {

    0%,
    100% {
        opacity: 0.75;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.06);
    }
}

@keyframes giragira-rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* 🌚 Defeat Sequence Styles */
.grayscale-filter {
    filter: grayscale(100%) brightness(0.7) contrast(1.1);
    transition: filter 1.5s ease;
}

#defeatOverlay:not(.hidden) {
    display: flex !important;
    animation: defeat-fade-in 0.8s ease-out forwards;
}

@keyframes defeat-fade-in {
    0% {
        opacity: 0;
        transform: scale(1.5);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* [UTOUTO] Sleep Visuals */
@keyframes zzz-float {
    0% {
        transform: translate(0, 0) scale(0.7);
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    100% {
        transform: translate(30px, -60px) scale(1.2);
        opacity: 0;
    }
}

.zzz-indicator-wrap {
    position: absolute;
    top: -1.25rem;
    left: 50%;
    transform: translateX(-15%);
    pointer-events: none;
    z-index: 50;
    user-select: none;
}

.zzz-item {
    position: absolute;
    font-family: 'serif';
    font-weight: 950;
    color: #f8fafc;
    text-shadow:
        0 0 10px rgba(168, 85, 247, 0.8),
        0 0 20px rgba(59, 130, 246, 0.4),
        -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000,
        0 4px 8px rgba(0, 0, 0, 0.8);
    animation: zzz-float 3s infinite linear;
    opacity: 0;
}

/* [ODOODO] Persistent debuff — body micro-shake + faint echo (under boss aura) */
.odoodo-jitter-root {
    position: relative;
    animation: odoodo-sprite-tremor 1.45s linear infinite;
    transform: translateZ(0);
}

/* 約 0.84s 橫向抖動（幅度加大，手機可辨）→ 約 0.61s 靜止 */
@keyframes odoodo-sprite-tremor {

    0%,
    58%,
    100% {
        transform: translate3d(0, 0, 0);
    }

    1% {
        transform: translate3d(-2.42px, 0, 0);
    }

    3% {
        transform: translate3d(2.12px, 0, 0);
    }

    5% {
        transform: translate3d(-1.89px, 0, 0);
    }

    7% {
        transform: translate3d(1.66px, 0, 0);
    }

    9% {
        transform: translate3d(-2.25px, 0, 0);
    }

    11% {
        transform: translate3d(1.43px, 0, 0);
    }

    13% {
        transform: translate3d(-1.56px, 0, 0);
    }

    15% {
        transform: translate3d(2.02px, 0, 0);
    }

    17% {
        transform: translate3d(-1.2px, 0, 0);
    }

    19% {
        transform: translate3d(1.1px, 0, 0);
    }

    21% {
        transform: translate3d(-2.12px, 0, 0);
    }

    23% {
        transform: translate3d(1.79px, 0, 0);
    }

    25% {
        transform: translate3d(-1.33px, 0, 0);
    }

    27% {
        transform: translate3d(1.52px, 0, 0);
    }

    29% {
        transform: translate3d(-2.35px, 0, 0);
    }

    31% {
        transform: translate3d(1.2px, 0, 0);
    }

    33% {
        transform: translate3d(-1.43px, 0, 0);
    }

    35% {
        transform: translate3d(1.89px, 0, 0);
    }

    37% {
        transform: translate3d(-1.66px, 0, 0);
    }

    39% {
        transform: translate3d(1.33px, 0, 0);
    }

    41% {
        transform: translate3d(-2.02px, 0, 0);
    }

    43% {
        transform: translate3d(0.97px, 0, 0);
    }

    45% {
        transform: translate3d(-1.1px, 0, 0);
    }

    47% {
        transform: translate3d(1.66px, 0, 0);
    }

    49% {
        transform: translate3d(-1.75px, 0, 0);
    }

    51% {
        transform: translate3d(1.2px, 0, 0);
    }

    53% {
        transform: translate3d(-1.33px, 0, 0);
    }

    55% {
        transform: translate3d(0.87px, 0, 0);
    }

    57% {
        transform: translate3d(-0.74px, 0, 0);
    }
}

.odoodo-echo {
    position: absolute;
    pointer-events: none;
    z-index: 0;
}

.odoodo-echo--back {
    width: 90%;
    height: 90%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) translateX(-3px);
    border-radius: 50%;
    background: radial-gradient(ellipse 72% 88% at 46% 50%,
            rgba(15, 23, 42, 0.26) 0%,
            rgba(15, 118, 110, 0.07) 48%,
            transparent 70%);
    opacity: 0.5;
    filter: blur(0.6px);
}

.odoodo-echo--left {
    width: 26%;
    height: 74%;
    left: 0;
    top: 50%;
    transform: translateY(-50%) translateX(-2px);
    border-radius: 45%;
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.2) 0%, rgba(6, 78, 59, 0.06) 55%, transparent 100%);
    opacity: 0.35;
    filter: blur(1.2px);
}

.odoodo-echo--right {
    width: 26%;
    height: 74%;
    right: 0;
    left: auto;
    top: 50%;
    transform: translateY(-50%) translateX(2px);
    border-radius: 45%;
    background: linear-gradient(270deg, rgba(15, 23, 42, 0.18) 0%, rgba(6, 95, 70, 0.05) 55%, transparent 100%);
    opacity: 0.32;
    filter: blur(1.2px);
}

/* 頭頂兩顆小冷汗（跟隨 jitter-root；停頓時變淡） */
.odoodo-sweat-cluster {
    position: absolute;
    left: 0;
    right: 0;
    top: -20px;
    height: 50px;
    pointer-events: none;
    z-index: 4;
}

.odoodo-sweat {
    position: absolute;
    width: 7px;
    height: 11px;
    /* Teardrop: round at bottom-right, pointed at top-left */
    border-radius: 0% 50% 50% 50%;
    background: linear-gradient(135deg, rgba(224, 247, 255, 0.96) 0%, rgba(125, 211, 252, 0.88) 55%, rgba(14, 165, 233, 0.65) 100%);
    box-shadow: 0 0 0 1px rgba(7, 182, 213, 0.18), 0 1px 3px rgba(0, 30, 60, 0.16);
    opacity: 0;
    animation: odoodo-sweat-fly var(--sw-dur, 1.5s) ease-out infinite;
    animation-delay: var(--sw-delay, 0s);
}

/* --sw-ox: horizontal drift in screen space (negative=left, positive=right)  */
/* --sw-apex: peak height in screen space (negative = upward)                  */
.odoodo-sweat--1 { left: 8%;   top: 8px;  width: 8px;  height: 13px; --sw-ang: -52deg; --sw-ox: -18px; --sw-apex: -28px; --sw-delay: 0s;     --sw-dur: 1.6s; }
.odoodo-sweat--2 { left: 24%;  top: 14px; width: 6px;  height: 10px; --sw-ang: -40deg; --sw-ox: -14px; --sw-apex: -22px; --sw-delay: 0.32s;  --sw-dur: 1.5s; }
.odoodo-sweat--3 { left: 42%;  top: 5px;  width: 7px;  height: 11px; --sw-ang: -12deg; --sw-ox:  -4px; --sw-apex: -30px; --sw-delay: 0.65s;  --sw-dur: 1.55s; }
.odoodo-sweat--4 { right: 26%; top: 11px; width: 6px;  height: 9px;  --sw-ang:  38deg; --sw-ox:  13px; --sw-apex: -22px; --sw-delay: 0.98s;  --sw-dur: 1.45s; }
.odoodo-sweat--5 { right: 10%; top: 6px;  width: 5px;  height: 8px;  --sw-ang:  55deg; --sw-ox:  16px; --sw-apex: -26px; --sw-delay: 1.28s;  --sw-dur: 1.4s; }

/* Parabolic arc: translateX/Y are in screen space (before rotate), rotate only tilts the teardrop visually */
@keyframes odoodo-sweat-fly {
    0%   { opacity: 0;    transform: translateX(0)                             translateY(0)                           scale(0.3)  rotate(var(--sw-ang)); }
    10%  { opacity: 0.95; transform: translateX(calc(var(--sw-ox) * 0.15))    translateY(calc(var(--sw-apex) * 0.55)) scale(1)    rotate(var(--sw-ang)); }
    38%  { opacity: 0.82; transform: translateX(calc(var(--sw-ox) * 0.5))     translateY(calc(var(--sw-apex) * 1.05)) scale(0.88) rotate(var(--sw-ang)); }
    65%  { opacity: 0.36; transform: translateX(calc(var(--sw-ox) * 0.82))    translateY(calc(var(--sw-apex) * 0.6))  scale(0.68) rotate(var(--sw-ang)); }
    100% { opacity: 0;    transform: translateX(var(--sw-ox))                 translateY(calc(var(--sw-apex) * 0.12)) scale(0.28) rotate(var(--sw-ang)); }
}

/* RWD: iPad Landscape 900px-1180px
   Shrink the battle field on horizontal iPads. Do not gate iPad rules on pointer/hover. */
@media (orientation: landscape) and (min-width: 900px) and (max-width: 1180px) {
    :root {
        --battle-landscape-scale: 0.84;
    }

    .battle-top-ui-layer {
        scale: var(--battle-landscape-scale);
        transform-origin: top center;
    }

    .battle-monster-layer {
        scale: var(--battle-landscape-scale);
        transform-origin: center center;
    }

    #hud {
        transform: translateX(-50%) scale(var(--battle-landscape-scale)) !important;
        transform-origin: bottom center;
        left: 50% !important;
        /* Lock to explicit center to override any external inline lefts */
    }

    #heroAvatar {
        transform: translateX(-50%) scale(var(--battle-landscape-scale)) !important;
        transform-origin: bottom center;
    }

    /* ── Question Card Compression ── */
    .battle-top-ui-layer .question-card {
        padding: 6px 16px !important;
    }

    /* Main Japanese Text Row */
    .battle-top-ui-layer #question-area>div:first-child {
        gap: var(--battle-question-row-gap, 2px) !important;
        margin-bottom: 2px !important;
    }

    /* Main Japanese Characters (clamp keeps one line longer; Tailwind sizes overridden on .battle-question-jp) */
    .battle-top-ui-layer .battle-question-jp {
        font-size: var(--battle-question-jp-size, clamp(13px, 2.35vmin + 0.55rem, 24px)) !important;
        line-height: 1.1 !important;
    }

    /* Blank Slot specific */
    .battle-top-ui-layer .blank-slot {
        padding: 0px 8px 4px 8px !important;
        min-height: 28px !important;
    }

    /* Furigana (Ruby) */
    .battle-top-ui-layer .ruby-text rt {
        font-size: 10px !important;
        /* down 2 steps from 14px */
        margin-bottom: 0px !important;
        line-height: 1 !important;
    }

    /* Chinese Hint */
    .battle-top-ui-layer .battle-question-cn {
        font-size: 16px !important;
        /* restored from 13px for readability */
        line-height: 1.25 !important;
        margin-top: 2px !important;
    }

}

/* ── Resonance Wheel (共鳴輪) UI ── */
.battle-hud-root {
    --battle-hud-status-height: 62px;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 0 !important;
    gap: 0 !important;
    overflow: visible !important;
    pointer-events: none;
}

.battle-hud-root .hud-inner-wrap,
.battle-hud-root .hud-interactive-rows {
    pointer-events: none;
}

.battle-hud-root .resonance-wheel-shell,
.battle-hud-root .battle-tap-attack-row,
.battle-hud-root .battle-status-panel {
    pointer-events: auto;
}

/* Shell and inner wheel are layout/decoration — only the actual slot buttons need events */
.resonance-wheel-shell,
.resonance-wheel-stage,
.resonance-wheel {
    pointer-events: none;
}

.resonance-slot {
    pointer-events: auto;
}

/* ぴったり：非正解小助靈消失動畫（瞬間移動感） */
@keyframes pittari-vanish {
    0%   { opacity: 1;    transform: scale(1)                             translateX(0);    filter: blur(0px)  brightness(1); }
    18%  { opacity: 1;    transform: scale(1.14)                          translateX(3px);  filter: blur(0px)  brightness(3.0); }
    48%  { opacity: 0.55; transform: scaleX(1.9) scaleY(0.52)            translateX(20px); filter: blur(5px)  brightness(1.6); }
    78%  { opacity: 0.12; transform: scaleX(2.8) scaleY(0.18)            translateX(40px); filter: blur(11px) brightness(1); }
    100% { opacity: 0;    transform: scaleX(3.4) scaleY(0)               translateX(56px); filter: blur(16px); }
}

.pittari-vanish {
    animation: pittari-vanish 0.82s cubic-bezier(0.55, 0, 1, 1) forwards;
    pointer-events: none !important;
    transform-origin: center center;
}

.pittari-sealed {
    visibility: hidden;
    opacity: 0;
    pointer-events: none !important;
}

/* 真名共鳴：共鳴輪選項外觀（不影響命中／權重；裝飾層 pointer-events: none） */
.resonance-slot.resonance-slot--true-resonance .resonance-icon-wrap {
    position: relative;
}

.resonance-slot.resonance-slot--true-resonance {
    position: relative;
}

.resonance-slot.resonance-slot--true-resonance::before,
.resonance-slot.resonance-slot--true-resonance::after {
    content: "";
    position: absolute;
    left: 50%;
    pointer-events: none;
    z-index: 0;
}

.resonance-slot.resonance-slot--true-resonance::before {
    top: 12%;
    width: min(106px, 62%);
    height: min(126px, 68%);
    transform: translateX(-50%);
    border-radius: 44% 56% 52% 48% / 60% 40% 58% 42%;
    background:
        radial-gradient(circle at 54% 18%, rgba(255, 250, 235, 0.16), transparent 34%),
        conic-gradient(from 190deg,
            rgba(255, 248, 220, 0.06),
            rgba(191, 219, 254, 0.08),
            rgba(233, 213, 255, 0.07),
            rgba(250, 204, 21, 0.05),
            rgba(255, 248, 220, 0.06));
    filter: blur(10px);
    opacity: 0.28;
    animation: resonance-true-ki-wave 3.4s ease-in-out infinite;
}

.resonance-slot.resonance-slot--true-resonance::after {
    bottom: 2%;
    width: min(92px, 54%);
    height: min(22px, 14%);
    transform: translateX(-50%);
    border-radius: 50%;
    background:
        radial-gradient(ellipse at center, rgba(255, 248, 220, 0.16) 0%, rgba(251, 191, 36, 0.1) 36%, transparent 70%),
        radial-gradient(ellipse at center, rgba(191, 219, 254, 0.06) 0%, transparent 64%);
    filter: blur(4px);
    opacity: 0.36;
}

.resonance-slot.resonance-slot--true-resonance.resonance-option--true-resonance .resonance-icon-wrap::before,
.resonance-slot.resonance-slot--true-resonance .resonance-icon-wrap::before {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(circle,
            rgba(255, 253, 245, 0.18) 0%,
            rgba(253, 230, 138, 0.12) 30%,
            rgba(251, 191, 36, 0.08) 54%,
            transparent 74%);
    box-shadow:
        0 0 0 1px rgba(254, 240, 200, 0.22),
        0 0 8px rgba(251, 191, 48, 0.12);
    opacity: 0.58;
}

.resonance-slot.resonance-slot--true-resonance.resonance-option--true-resonance .resonance-icon-wrap::after,
.resonance-slot.resonance-slot--true-resonance .resonance-icon-wrap::after {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(circle, transparent 60%, rgba(253, 244, 200, 0.1) 76%, rgba(226, 210, 255, 0.05) 90%, transparent 95%),
        conic-gradient(from 0deg, rgba(255, 248, 220, 0.02), rgba(191, 219, 254, 0.05), rgba(233, 213, 255, 0.04), rgba(255, 248, 220, 0.02));
    box-shadow: 0 0 0 1px rgba(253, 230, 180, 0.16);
    opacity: 0.38;
    animation: resonance-true-moon-halo 5.6s ease-in-out infinite;
}

.resonance-slot.resonance-slot--true-resonance .resonance-spirit-aura::before,
.resonance-slot.resonance-slot--true-resonance .resonance-spirit-aura::after {
    content: "";
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
}

.resonance-slot.resonance-slot--true-resonance .resonance-spirit-aura::before {
    inset: -18%;
    background:
        conic-gradient(from 16deg,
            rgba(255, 248, 220, 0.04),
            rgba(191, 219, 254, 0.05),
            rgba(233, 213, 255, 0.05),
            rgba(250, 204, 21, 0.04),
            rgba(255, 248, 220, 0.04));
    filter: blur(10px);
    opacity: 0.24;
    transform: rotate(-5deg) scale(1.02, 1.06);
    animation: resonance-true-aura-flow 4.2s ease-in-out infinite;
}

.resonance-slot.resonance-slot--true-resonance .resonance-spirit-aura::after {
    inset: -22%;
    background:
        radial-gradient(circle at 25% 24%, rgba(254, 243, 199, 0.12) 0 1px, transparent 2px),
        radial-gradient(circle at 68% 20%, rgba(191, 219, 254, 0.09) 0 1px, transparent 2px),
        radial-gradient(circle at 80% 64%, rgba(233, 213, 255, 0.08) 0 1px, transparent 2px);
    opacity: 0.28;
    animation: resonance-true-stardust 3.3s ease-in-out infinite;
}

@keyframes resonance-true-moon-halo {

    0%,
    100% {
        opacity: 0.58;
        transform: scale(1);
    }

    50% {
        opacity: 0.9;
        transform: scale(1.06);
    }
}

@keyframes resonance-true-aura-flow {

    0%,
    100% {
        opacity: 0.42;
        transform: rotate(-6deg) scale(1.01, 1.1);
    }

    50% {
        opacity: 0.86;
        transform: rotate(9deg) scale(1.1, 1.22);
    }
}

@keyframes resonance-true-ki-wave {

    0%,
    100% {
        opacity: 0.48;
        transform: translateX(-50%) translateY(2px) scale(0.94, 1.02);
    }

    50% {
        opacity: 0.8;
        transform: translateX(-50%) translateY(-4px) scale(1.04, 1.16);
    }
}

@keyframes resonance-true-stardust {

    0%,
    100% {
        opacity: 0.3;
        transform: scale(0.95);
    }

    50% {
        opacity: 0.54;
        transform: scale(1.06);
    }
}

@media (prefers-reduced-motion: reduce) {

    .resonance-slot.resonance-slot--true-resonance .resonance-icon-wrap::after,
    .resonance-slot.resonance-slot--true-resonance::before,
    .resonance-slot.resonance-slot--true-resonance::after,
    .resonance-slot.resonance-slot--true-resonance .resonance-spirit-aura::before,
    .resonance-slot.resonance-slot--true-resonance .resonance-spirit-aura::after,
    .resonance-slot.resonance-slot--true-resonance-burst .resonance-icon-wrap::before,
    .resonance-slot.resonance-slot--true-resonance-burst .resonance-icon-wrap::after,
    .resonance-slot.resonance-slot--true-resonance-burst .resonance-spirit-aura::before,
    .resonance-slot.resonance-slot--true-resonance-burst .resonance-spirit-aura::after,
    .resonance-true-burst-text {
        animation: none;
        opacity: 0.72;
        transform: none;
    }
}

.resonance-slot.resonance-slot--true-resonance .resonance-spirit-aura {
    opacity: 0.32;
    filter: blur(3px) brightness(0.94);
    background:
        radial-gradient(circle at 45% 38%, rgba(255, 252, 240, 0.14) 0%, rgba(251, 191, 36, 0.12) 42%, transparent 72%);
}

.resonance-slot.resonance-slot--true-resonance .resonance-spirit-icon,
.resonance-slot.resonance-slot--true-resonance .resonance-spirit-rune {
    position: relative;
    z-index: 1;
}

.battle-status-panel {
    min-height: var(--battle-hud-status-height);
    padding-top: 0.32rem !important;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 0.3rem) !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.battle-status-content {
    justify-content: center;
    gap: clamp(8px, 2.5vw, 16px) !important;
    padding-left: clamp(8px, 2.6vw, 14px);
    padding-right: clamp(8px, 2.6vw, 14px);
}

.battle-hud-bars {
    flex: 0 1 clamp(128px, 36vw, 190px) !important;
    max-width: clamp(128px, 36vw, 190px) !important;
    min-width: 0;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 7px 9px;
    border-radius: 14px;
    background: rgba(5, 15, 25, 0.34);
    border: 1px solid rgba(255, 255, 255, 0.13);
    box-shadow:
        0 4px 14px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
}

.battle-hud-bars .hud-bar-value {
    font-size: 12px;
    width: 2.5rem;
    min-width: 2.5rem;
    flex-shrink: 0;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

.battle-hud-actions {
    gap: clamp(6px, 2vw, 12px) !important;
}

/* Unified pill/card shape for all three battle action buttons */
.battle-hud-actions .hud-tool-btn {
    width: auto;
    height: auto;
    min-height: 38px;
    border-radius: 10px;
    padding: 3px 8px;
    flex-direction: column;
    gap: 1px;
}

@media (min-width: 640px) {
    .battle-hud-actions .hud-tool-btn {
        min-height: 44px;
        padding: 4px 10px;
    }
}

.level-passive-badge-tray {
    position: absolute;
    right: -24px;
    top: 14%;
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-end;
    pointer-events: none;
}

.level-passive-badge {
    min-width: 30px;
    height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    display: inline-grid;
    grid-auto-flow: column;
    gap: 2px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(251, 191, 36, 0.58);
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.92), rgba(120, 53, 15, 0.78));
    color: #fff7d6;
    font-size: 0.86rem;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.34), 0 0 12px rgba(251, 191, 36, 0.28);
}

.level-passive-badge__count {
    font-size: 0.72rem;
    color: #fde68a;
}

/* ============================================================
 *  技能 / 能力解鎖面板（統一慶祝視覺）
 *  Panel A：.result-milestone-float（升級里程碑，結算浮層）
 *  Panel B：.skill-unlock-modal（魔王通關，獨立 modal）
 *  共用：金色標題 + 英文副標 + ✨ + 技能卡(icon) + 金橘 CTA
 * ============================================================ */

/* ---- 共用容器：覆蓋層 ---- */
.result-milestone-float,
.skill-unlock-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    pointer-events: auto;
    background: rgba(2, 6, 23, 0.64);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.result-milestone-float {
    z-index: 90;
}

.skill-unlock-modal {
    z-index: 3000;
}

/* ---- 共用：面板本體 ---- */
.result-milestone-float__panel,
.skill-unlock-modal__panel {
    position: relative;
    width: min(92vw, 410px);
    max-height: 86vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    border-radius: 22px;
    border: 2px solid rgba(245, 158, 11, 0.92);
    background:
        radial-gradient(circle at 50% -8%, rgba(251, 191, 36, 0.22), transparent 55%),
        linear-gradient(180deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.99));
    padding: 24px 18px 18px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), 0 0 48px rgba(245, 158, 11, 0.32);
    animation: skill-unlock-pop 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.25);
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

@keyframes skill-unlock-pop {
    0% {
        opacity: 0;
        transform: scale(0.92) translateY(10px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ---- 共用：✨ 慶祝閃光 ---- */
.result-milestone-float__spark,
.skill-unlock-modal__spark {
    line-height: 1;
    filter: drop-shadow(0 0 14px rgba(251, 191, 36, 0.6));
    animation: skill-unlock-spark 1.7s ease-in-out infinite;
}

.result-milestone-float__spark {
    font-size: 2.3rem;
}

.skill-unlock-modal__spark {
    font-size: 3.1rem;
}

@keyframes skill-unlock-spark {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-6px) scale(1.08);
    }
}

/* ---- 共用：標題 + 英文副標 ---- */
.result-milestone-float__title,
.skill-unlock-modal__title {
    color: #fbbf24;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-align: center;
    text-shadow: 0 2px 12px rgba(245, 158, 11, 0.4);
}

.result-milestone-float__title {
    font-size: 1.35rem;
}

.skill-unlock-modal__title {
    font-size: 1.55rem;
}

.result-milestone-float__subtitle,
.skill-unlock-modal__subtitle {
    color: #94a3b8;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    text-align: center;
    margin-top: -3px;
}

/* ---- Panel A：reward 卡片清單 ---- */
.result-milestone-float__list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.result-milestone-card {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    gap: 11px;
    border-radius: 14px;
    border: 1px solid rgba(251, 191, 36, 0.42);
    background:
        radial-gradient(circle at 12% 0%, rgba(253, 230, 138, 0.18), transparent 44%),
        linear-gradient(135deg, rgba(120, 53, 15, 0.42), rgba(15, 23, 42, 0.9));
    padding: 11px 13px;
    box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.1), 0 8px 20px rgba(0, 0, 0, 0.24);
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.result-milestone-card__icon {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    line-height: 1;
    border-radius: 12px;
    border: 1px solid rgba(251, 191, 36, 0.34);
    background: rgba(15, 23, 42, 0.6);
}

.result-milestone-card__body {
    position: relative;
    z-index: 1;
    flex: 1;
    min-width: 0;
}

.result-milestone-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.result-milestone-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.12) 45%, transparent 68%);
    opacity: 0.5;
    pointer-events: none;
}

.result-milestone-card__heading {
    color: #fde68a;
    font-size: 0.9rem;
    font-weight: 900;
}

.result-milestone-card__level {
    flex-shrink: 0;
    color: #cbd5e1;
    font-size: 0.82rem;
    font-weight: 800;
}

.result-milestone-card__name {
    margin-top: 5px;
    color: #ffffff;
    font-size: 0.96rem;
    font-weight: 900;
}

.result-milestone-card__desc {
    margin-top: 2px;
    color: #e2e8f0;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* ---- Panel B：能力卡片（置中、icon 在上）---- */
.skill-unlock-modal__card {
    position: relative;
    overflow: hidden;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    margin-top: 4px;
    border-radius: 16px;
    border: 1px solid rgba(251, 191, 36, 0.42);
    background:
        radial-gradient(circle at 50% 0%, rgba(253, 230, 138, 0.18), transparent 58%),
        linear-gradient(135deg, rgba(120, 53, 15, 0.42), rgba(15, 23, 42, 0.9));
    padding: 18px 16px;
    box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.1);
}

.skill-unlock-modal__card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.1) 45%, transparent 68%);
    opacity: 0.5;
    pointer-events: none;
}

.skill-unlock-modal__icon {
    position: relative;
    z-index: 1;
    width: 64px;
    height: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    line-height: 1;
    border-radius: 16px;
    border: 1px solid rgba(251, 191, 36, 0.34);
    background: rgba(15, 23, 42, 0.6);
}

.skill-unlock-modal__name {
    position: relative;
    z-index: 1;
    color: #fcd34d;
    font-size: 1.3rem;
    font-weight: 900;
    text-align: center;
}

.skill-unlock-modal__desc {
    position: relative;
    z-index: 1;
    color: #e2e8f0;
    font-size: 1rem;
    line-height: 1.5;
    text-align: center;
}

/* ---- 共用：金橘 CTA 按鈕 ---- */
.result-milestone-float__cta,
.skill-unlock-modal__cta {
    width: 100%;
    margin-top: 6px;
    padding: 13px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(180deg, #fbbf24, #f59e0b);
    color: #1e293b;
    font-weight: 900;
    letter-spacing: 0.04em;
    box-shadow: 0 4px 0 #92400e;
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.08s ease;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.result-milestone-float__cta {
    font-size: 1.02rem;
}

.skill-unlock-modal__cta {
    font-size: 1.12rem;
}

.result-milestone-float__cta:active,
.skill-unlock-modal__cta:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #92400e;
}

/* ---- skill-unlock-modal：操作提示行 ---- */
.skill-unlock-modal__hint {
    font-size: 13px;
    color: rgba(148, 163, 184, 0.8);
    text-align: center;
    padding: 0 4px;
    margin-top: -3px;
}

/* ---- skill list modal：readability bump ---- */
[class*="skill-card--"] h3 {
    font-size: 15px;
}

[class*="skill-card--"] p {
    font-size: 15px;
}

/* SP cost badge — use structural selector; no dedicated class in HTML */
[class*="skill-card--"] .flex-1 > div:first-child > span:last-child {
    font-size: 14px;
}

/* ---- 共用：進出場過場（Panel A 的 Vue transition）---- */
.result-milestone-float-enter-active,
.result-milestone-float-leave-active {
    transition: opacity 0.28s ease;
}

.result-milestone-float-enter-from,
.result-milestone-float-leave-to {
    opacity: 0;
}

.result-milestone-float-enter-to,
.result-milestone-float-leave-from {
    opacity: 1;
}

/* ---- 窄螢幕微調 ---- */
@media (max-width: 360px) {

    .result-milestone-float__title {
        font-size: 1.2rem;
    }

    .skill-unlock-modal__title {
        font-size: 1.35rem;
    }

    .skill-unlock-modal__icon {
        width: 56px;
        height: 56px;
        font-size: 2.2rem;
    }
}

.level-passive-vfx {
    --passive-vfx-color: rgba(251, 191, 36, 0.9);
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.level-passive-vfx__burst {
    display: none;
}

.level-passive-vfx__card {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    transform: skew(-7deg);
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    animation: level-passive-card 2.5s ease-out both;
}

.level-passive-vfx__label {
    color: #fff7d6;
    font-size: clamp(2.15rem, 10vw, 4.6rem);
    font-weight: 900;
    letter-spacing: 0;
    line-height: 0.9;
    -webkit-text-stroke: 2px rgba(15, 23, 42, 0.86);
    text-shadow: 0 4px 0 rgba(0, 0, 0, 0.55), 0 0 16px var(--passive-vfx-color);
}

.level-passive-vfx__text {
    color: var(--passive-vfx-color);
    font-size: 0.95rem;
    font-weight: 900;
    letter-spacing: 0;
}

.level-passive-vfx--shikkari .level-passive-vfx__card {
    animation-name: level-passive-card, level-passive-impact-jolt;
    animation-duration: 2.5s, 0.48s;
    animation-timing-function: ease-out, steps(2, end);
    animation-fill-mode: both, both;
}

.level-passive-vfx--gatchiri {
    --passive-vfx-color: rgba(125, 211, 252, 0.95);
}

.level-passive-vfx--bacchiri {
    --passive-vfx-color: rgba(248, 113, 113, 0.95);
}

.level-passive-vfx--gatchiri .level-passive-vfx__card,
.level-passive-vfx--bacchiri .level-passive-vfx__card {
    display: none;
}

.passive-combo-hold-vfx {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: min(70.5vw, 462px);
    max-height: 20dvh;
    filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.42));
    animation: passive-combo-hold-image 2.5s ease-in-out both;
}

.passive-combo-hold-vfx__chain {
    position: relative;
    z-index: 2;
    width: 100%;
    max-height: 22dvh;
    object-fit: contain;
    opacity: 0.85;
}

.passive-combo-hold-vfx__text {
    position: absolute;
    z-index: 1;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scaleX(1.08);
    font-family: Impact, "Arial Black", system-ui, sans-serif;
    color: #7f1d1d;
    font-size: clamp(2.35rem, 9.9vw, 4.2rem);
    font-weight: 900;
    font-stretch: condensed;
    line-height: 0.9;
    letter-spacing: -0.04em;
    -webkit-text-stroke: 2.6px rgba(255, 255, 255, 0.98);
    text-shadow:
        0 4px 0 rgba(43, 8, 8, 1),
        0 0 0.5px rgba(255, 255, 255, 0.95),
        3px 0 0 rgba(43, 8, 8, 0.9),
        -3px 0 0 rgba(43, 8, 8, 0.9),
        0 0 10px rgba(254, 202, 202, 0.42),
        0 0 28px rgba(43, 8, 8, 0.78);
}

@keyframes level-passive-card {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.92) skew(-7deg);
    }

    14%,
    82% {
        opacity: 1;
        transform: translateY(0) scale(1) skew(-7deg);
    }

    100% {
        opacity: 0;
        transform: translateY(-8px) scale(0.98) skew(-7deg);
    }
}

.gatchiri-hero-shield-vfx {
    position: absolute;
    inset: -6% -10% 6% -10%;
    z-index: 3;
    pointer-events: none;
    animation: gatchiri-hero-shield-impact 0.28s ease-out both;
}

.gatchiri-hero-shield-vfx__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.gatchiri-hero-shield-vfx__image--base {
    opacity: 0;
    filter: drop-shadow(0 0 18px rgba(125, 211, 252, 0.78));
    animation: gatchiri-hero-shield-base 1.45s ease-out both;
}

.gatchiri-hero-shield-vfx__image--crack {
    opacity: 0;
    filter: drop-shadow(0 0 20px rgba(224, 242, 254, 0.88));
    animation: gatchiri-hero-shield-crack 1.05s ease-out both;
}

@keyframes level-passive-impact-jolt {

    0%,
    100% {
        margin-left: 0;
    }

    25% {
        margin-left: -10px;
    }

    50% {
        margin-left: 12px;
    }

    75% {
        margin-left: -6px;
    }
}

@keyframes passive-combo-hold-image {
    0% {
        opacity: 0;
        transform: translate(78vw, 12dvh) scale(0.96);
    }

    14%,
    72% {
        opacity: 1;
        transform: translate(0, 12dvh) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-78vw, 12dvh) scale(0.98);
    }
}

@keyframes gatchiri-hero-shield-impact {
    0% {
        transform: translateX(0) rotate(0deg);
    }

    24% {
        transform: translateX(-4px) rotate(-2deg);
    }

    48% {
        transform: translateX(5px) rotate(2deg);
    }

    72% {
        transform: translateX(-2px) rotate(-1deg);
    }

    100% {
        transform: translateX(0) rotate(0deg);
    }
}

@keyframes gatchiri-hero-shield-base {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }

    10%,
    72% {
        opacity: 0.68;
        transform: scale(1.03);
    }

    100% {
        opacity: 0;
        transform: scale(1.08);
    }
}

@keyframes gatchiri-hero-shield-crack {

    0%,
    12% {
        opacity: 0;
        transform: scale(0.94);
    }

    18%,
    62% {
        opacity: 1;
        transform: scale(1.04);
    }

    100% {
        opacity: 0;
        transform: scale(1.1);
    }
}

.bacchiri-counter-slash-vfx {
    position: absolute;
    inset: -18%;
    z-index: 8;
    pointer-events: none;
    filter: drop-shadow(0 0 16px rgba(248, 113, 113, 0.9));
}

.bacchiri-counter-slash-vfx__cut,
.bacchiri-counter-slash-vfx__spark {
    position: absolute;
    left: 50%;
    top: 50%;
    display: block;
    transform-origin: center;
}

.bacchiri-counter-slash-vfx__cut {
    width: 106%;
    height: 20px;
    border-radius: 999px;
    background:
        radial-gradient(ellipse at 50% 45%, rgba(255, 255, 255, 0.96) 0 12%, rgba(254, 202, 202, 0.8) 18%, transparent 62%),
        linear-gradient(90deg, transparent, rgba(255, 247, 237, 0.95) 16%, rgba(248, 113, 113, 0.88) 58%, transparent);
    box-shadow: 0 0 24px rgba(248, 113, 113, 0.78);
    clip-path: ellipse(48% 28% at 50% 50%);
    transform: translate(-50%, -50%) rotate(-13deg);
    animation: bacchiri-counter-cut 0.78s ease-out both;
}

.bacchiri-counter-slash-vfx__spark {
    width: 28%;
    aspect-ratio: 1;
    border: 3px solid rgba(255, 255, 255, 0.78);
    border-left-color: transparent;
    border-bottom-color: transparent;
    border-radius: 999px;
    transform: translate(-48%, -50%) rotate(34deg) scale(0.2);
    animation: bacchiri-counter-spark 0.78s ease-out both;
}

@keyframes bacchiri-counter-cut {
    0% {
        opacity: 0;
        transform: translate(-42%, -50%) rotate(-13deg) scaleX(0.18) scaleY(0.72);
    }

    16%,
    52% {
        opacity: 1;
        transform: translate(-50%, -50%) rotate(-13deg) scaleX(1) scaleY(1);
    }

    100% {
        opacity: 0;
        transform: translate(-56%, -50%) rotate(-13deg) scaleX(1.08) scaleY(0.88);
    }
}

@keyframes bacchiri-counter-spark {
    0% {
        opacity: 0;
        scale: 0.2;
    }

    24%,
    58% {
        opacity: 0.9;
        scale: 1;
    }

    100% {
        opacity: 0;
        scale: 1.28;
    }
}

.battle-mode-toggle {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.battle-mode-toggle button {
    min-width: 38px;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    color: rgba(226, 232, 240, 0.68);
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.02em;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.battle-mode-toggle button.is-active {
    background: linear-gradient(180deg, #fbbf24, #f59e0b);
    color: #0f172a;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.28);
}

.battle-answer-feedback-overlay {
    position: fixed !important;
    inset: auto auto calc(env(safe-area-inset-bottom, 0px) + var(--battle-hud-status-height) + 120px) 50% !important;
    width: min(92vw, 520px) !important;
    height: auto !important;
    transform: translateX(-50%);
    z-index: 72 !important;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.battle-answer-feedback-overlay>div {
    min-height: 42px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.battle-tap-attack-row {
    height: auto !important;
    min-height: 42px;
    margin-top: 0;
    margin-bottom: clamp(10px, 2.8vw, 18px);
    padding-top: 2px !important;
    padding-bottom: 6px !important;
    padding-left: clamp(12px, 3vw, 18px) !important;
    padding-right: clamp(12px, 3vw, 18px) !important;
    position: relative;
    z-index: 60;
}

.battle-tap-attack-row button {
    width: clamp(150px, 34vw, 220px) !important;
    max-width: 220px !important;
    min-height: 34px;
}

.resonance-wheel-shell {
    position: relative;
    width: 100%;
    min-height: clamp(100px, 28vw, 136px);
    height: auto;
    margin-top: -14px;
    z-index: 58;
    pointer-events: auto;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding-left: clamp(10px, 3vw, 18px) !important;
    padding-right: clamp(10px, 3vw, 18px) !important;
}

.resonance-wheel-stage {
    width: 100%;
    height: 100%;
}

.resonance-wheel {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(10px, 3vw, 18px);
    width: 100%;
    min-height: clamp(96px, 26vw, 128px);
    padding: 2px clamp(8px, 3.2vw, 16px) 0;
    position: relative;
}

/* Resonance Track - Gentle Downward Arc (Smile) */
.resonance-wheel::before {
    content: '';
    position: absolute;
    left: 15%;
    right: 15%;
    bottom: clamp(40px, 11vw, 66px);
    height: clamp(62px, 18vw, 100px);
    border-bottom: 1.5px solid rgba(251, 191, 36, 0.22);
    border-radius: 0 0 50% 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(0.5px);
}

.resonance-slot {
    flex: 1 1 0;
    min-width: 0;
    max-width: 28vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding-top: 6px;
    padding-bottom: 4px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    outline: none;
    z-index: 1;
    touch-action: manipulation;
}

.resonance-slot:hover {
    transform: translateY(-2px);
}

.resonance-slot:active {
    transform: scale(0.95);
}

.resonance-slot.is-selected {
    transform: translateY(-2px);
}

.resonance-slot.is-correct,
.resonance-slot.is-wrong {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

@keyframes resonanceShake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-4px);
    }

    40% {
        transform: translateX(4px);
    }

    60% {
        transform: translateX(-2px);
    }

    80% {
        transform: translateX(2px);
    }
}

.resonance-icon-wrap {
    position: relative;
    width: min(132px, 100%);
    max-width: min(132px, 24vw);
    aspect-ratio: 1;
    height: auto;
    margin-inline: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.12),
        0 6px 16px rgba(0, 0, 0, 0.38),
        0 0 12px rgba(251, 191, 36, 0.08);
    pointer-events: none;
    transition: box-shadow 0.3s ease, transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 桌機限定：小助靈作為選項按鈕縮至 100px（約原 132px 的 76%），與英雄頭像相當，降低版面佔比；
   2/3/4 選項在桌機都頂到此上限，故同時達成「統一尺寸」。手機/平板（≤900px）不受影響。 */
@media (min-width: 901px) {
    .resonance-icon-wrap {
        width: min(100px, 100%);
        max-width: min(100px, 24vw);
    }
}

.resonance-spirit-icon {
    position: relative;
    width: 90%;
    height: 90%;
    object-fit: contain;
    pointer-events: none;
    z-index: 6;
    filter:
        drop-shadow(0 0 8px rgba(255, 250, 235, 0.4)) drop-shadow(0 0 18px rgba(251, 191, 36, 0.45)) drop-shadow(0 2px 5px rgba(0, 0, 0, 0.5));
}

.resonance-spirit-aura {
    position: absolute;
    inset: -6%;
    background: radial-gradient(circle at 40% 35%, rgba(255, 252, 240, 0.1) 0%, rgba(251, 191, 36, 0.12) 42%, transparent 70%);
    border-radius: 50%;
    animation: auraPulse 2.5s infinite alternate ease-in-out;
    pointer-events: none;
    z-index: 1;
    opacity: 0.5;
}

.resonance-slot--full-bond {
    filter: saturate(1.12) brightness(1.05);
}

.resonance-slot--full-bond .resonance-icon-wrap {
    overflow: visible;
    isolation: isolate;
    box-shadow:
        0 0 0 1px rgba(248, 113, 113, 0.78),
        0 8px 18px rgba(0, 0, 0, 0.42),
        0 0 16px rgba(239, 68, 68, 0.32),
        0 0 26px rgba(255, 245, 210, 0.22) !important;
}

.resonance-slot--full-bond .resonance-spirit-aura {
    inset: -12% -10% -7%;
    border-radius: 48% 52% 42% 46%;
    opacity: 0.74;
    z-index: 1;
    background:
        radial-gradient(ellipse at 50% 88%, rgba(255, 250, 225, 0.34) 0%, rgba(248, 113, 113, 0.26) 28%, transparent 56%),
        radial-gradient(ellipse at 25% 54%, rgba(255, 228, 230, 0.3) 0%, transparent 45%),
        radial-gradient(ellipse at 76% 48%, rgba(239, 68, 68, 0.2) 0%, transparent 44%),
        linear-gradient(90deg, transparent 0%, rgba(239, 68, 68, 0.18) 18%, transparent 34%, transparent 66%, rgba(255, 245, 210, 0.18) 84%, transparent 100%);
    filter: blur(1.6px) drop-shadow(0 0 12px rgba(248, 113, 113, 0.45));
    animation: full-bond-idle-aura 2.5s ease-in-out infinite;
}

.resonance-slot--full-bond .resonance-icon-wrap::before {
    content: "";
    position: absolute;
    left: 8%;
    right: 8%;
    bottom: 5%;
    height: 92%;
    border-radius: 46% 54% 38% 44%;
    pointer-events: none;
    z-index: 2;
    background:
        radial-gradient(circle at 46% 16%, rgba(255, 255, 255, 0.68) 0 1px, transparent 3px),
        radial-gradient(circle at 28% 36%, rgba(254, 202, 202, 0.52) 0 1px, transparent 4px),
        radial-gradient(circle at 72% 30%, rgba(248, 113, 113, 0.42) 0 1px, transparent 4px),
        radial-gradient(circle at 64% 70%, rgba(253, 224, 71, 0.32) 0 1px, transparent 5px),
        linear-gradient(76deg, transparent 0%, rgba(239, 68, 68, 0.2) 13%, transparent 27%, transparent 72%, rgba(255, 245, 210, 0.18) 88%, transparent 100%);
    filter: blur(0.7px) drop-shadow(0 0 9px rgba(248, 113, 113, 0.42));
    opacity: 0.64;
    transform-origin: 50% 100%;
    animation: full-bond-idle-wisp 2.2s ease-in-out infinite;
}

.resonance-slot--full-bond .resonance-icon-wrap::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 6%;
    width: 74%;
    height: 28%;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    background:
        radial-gradient(ellipse at 50% 70%, rgba(255, 250, 225, 0.58) 0%, rgba(248, 113, 113, 0.24) 28%, transparent 64%),
        radial-gradient(ellipse at 28% 62%, rgba(254, 202, 202, 0.24) 0%, transparent 56%),
        radial-gradient(ellipse at 74% 66%, rgba(253, 224, 71, 0.18) 0%, transparent 58%);
    filter: blur(2.6px) drop-shadow(0 0 11px rgba(248, 113, 113, 0.36));
    opacity: 0.68;
    transform: translateX(-50%) scale(0.94);
    transform-origin: 50% 100%;
    animation: full-bond-idle-ember-bed 1.8s ease-in-out infinite;
}

.resonance-slot--full-bond .resonance-spirit-icon,
.resonance-slot--full-bond .resonance-spirit-rune {
    filter:
        drop-shadow(0 0 3px rgba(255, 255, 255, 0.9)) drop-shadow(0 0 8px rgba(254, 202, 202, 0.78)) drop-shadow(0 0 15px rgba(239, 68, 68, 0.56)) drop-shadow(0 3px 5px rgba(0, 0, 0, 0.58));
}

/* GIRAGIRA buff VFX: per resonance slot (HP-bar anchor no longer draws hero ring) */
.resonance-icon-wrap .aura-giragira-choice-shell {
    position: absolute;
    inset: -12%;
    pointer-events: none;
    z-index: 4;
    overflow: visible;
}

.resonance-icon-wrap .aura-giragira-choice-ring {
    position: absolute;
    inset: 5%;
    border-radius: 50%;
    border: 2px solid rgba(251, 191, 36, 0.82);
    box-shadow:
        0 0 12px 3px rgba(251, 191, 36, 0.55),
        0 0 26px 8px rgba(245, 158, 11, 0.28),
        inset 0 0 14px rgba(251, 191, 36, 0.12);
    animation: giragira-pulse 1.05s ease-in-out infinite;
}

.resonance-icon-wrap .aura-giragira-choice-halo {
    position: absolute;
    inset: -2%;
    border-radius: 50%;
    pointer-events: none;
    animation: giragira-rotate 3.6s linear infinite;
}

.resonance-icon-wrap .aura-giragira-choice-halo::before,
.resonance-icon-wrap .aura-giragira-choice-halo::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px dashed rgba(251, 191, 36, 0.55);
}

.resonance-icon-wrap .aura-giragira-choice-halo::after {
    transform: rotate(62deg);
    border-color: rgba(253, 224, 71, 0.32);
}

.resonance-slot:nth-child(1) .aura-giragira-choice-halo {
    animation-delay: -0.6s;
}

.resonance-slot:nth-child(2) .aura-giragira-choice-halo {
    animation-delay: -1.8s;
}

.resonance-slot:nth-child(3) .aura-giragira-choice-halo {
    animation-delay: -3s;
}

.resonance-slot:nth-child(4) .aura-giragira-choice-halo {
    animation-delay: -1.1s;
}

.resonance-slot:nth-child(1) .aura-giragira-choice-ring {
    animation-delay: 0s;
}

.resonance-slot:nth-child(2) .aura-giragira-choice-ring {
    animation-delay: -0.38s;
}

.resonance-slot:nth-child(3) .aura-giragira-choice-ring {
    animation-delay: -0.76s;
}

.resonance-slot:nth-child(4) .aura-giragira-choice-ring {
    animation-delay: -1.12s;
}

.resonance-icon-wrap::after {
    content: '';
    position: absolute;
    inset: auto;
    bottom: -9%;
    left: 50%;
    width: 70%;
    height: 18%;
    transform: translateX(-50%);
    background: radial-gradient(ellipse at center, rgba(251, 191, 36, 0.08), transparent 68%);
    filter: blur(3px);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.resonance-spirit-rune {
    position: relative;
    width: 80%;
    height: 80%;
    max-width: 120px;
    max-height: 120px;
    aspect-ratio: 1;
    border: 1.5px solid rgba(251, 191, 36, 0.45);
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 1) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Kaisei Tokumin", serif;
    font-weight: 900;
    color: #fffbeb;
    font-size: clamp(1.05rem, 5vmin, 1.45rem);
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.6);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 4px 14px rgba(0, 0, 0, 0.55),
        0 0 16px rgba(251, 191, 36, 0.25);
    transition: all 0.3s ease;
    white-space: nowrap;
    line-height: 1;
    z-index: 6;
}

@keyframes auraPulse {
    0% {
        transform: scale(0.85);
        opacity: 0.3;
    }

    100% {
        transform: scale(1.15);
        opacity: 0.6;
    }
}

@keyframes full-bond-idle-aura {

    0%,
    100% {
        opacity: 0.58;
        transform: translateY(1px) scale(0.96, 1.02) rotate(-2deg);
    }

    50% {
        opacity: 0.9;
        transform: translateY(-3px) scale(1.05, 1.14) rotate(3deg);
    }
}

@keyframes full-bond-idle-wisp {

    0%,
    100% {
        opacity: 0.42;
        transform: translateY(3px) skewX(-4deg) scale(0.94, 0.96);
    }

    45% {
        opacity: 0.78;
        transform: translateY(-4px) skewX(5deg) scale(1.05, 1.14);
    }
}

@keyframes full-bond-idle-ember-bed {

    0%,
    100% {
        opacity: 0.5;
        transform: translateX(-50%) scale(0.88, 0.82);
    }

    50% {
        opacity: 0.82;
        transform: translateX(-50%) scale(1.08, 1.05);
    }
}

/* Flick specific overrides */
#flickLayer {
    touch-action: none;
    user-select: none;
}

#flickLayer .resonance-slot {
    padding-top: 6px;
    touch-action: none;
}

#flickLayer .resonance-slot.is-active .resonance-spirit-rune {
    border-color: rgba(251, 191, 36, 0.8);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
    transform: scale(1.1);
}

#flickLayer .resonance-slot.is-active .resonance-icon-wrap {
    box-shadow:
        0 0 0 2px rgba(251, 191, 36, 0.45),
        0 8px 20px rgba(0, 0, 0, 0.4),
        0 0 28px rgba(251, 191, 36, 0.45);
    transform: translateY(-1px);
}

#flickLayer .resonance-slot.is-active .resonance-spirit-icon {
    filter:
        drop-shadow(0 0 8px rgba(255, 250, 235, 0.45)) drop-shadow(0 0 22px rgba(251, 191, 36, 0.58)) drop-shadow(0 3px 5px rgba(0, 0, 0, 0.5));
}

.resonance-slot.resonance-slot--true-resonance-burst .resonance-icon-wrap::before {
    animation: resonance-true-burst-ring 0.56s ease-out;
}

.resonance-slot.resonance-slot--true-resonance-burst .resonance-icon-wrap::after {
    animation: resonance-true-burst-ring-outer 0.62s ease-out;
}

.resonance-slot.resonance-slot--true-resonance-burst .resonance-spirit-aura::before {
    animation: resonance-true-aura-burst 0.6s ease-out;
}

.resonance-slot.resonance-slot--true-resonance-burst .resonance-spirit-aura::after {
    animation: resonance-true-stardust-burst 0.62s ease-out;
}

.resonance-slot.resonance-slot--true-resonance-burst::before {
    animation: resonance-true-ki-burst 0.62s ease-out;
}

.resonance-true-burst-text {
    position: absolute;
    left: 50%;
    top: -22%;
    transform: translate(-50%, 0);
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    border: 1px solid rgba(252, 211, 77, 0.54);
    background: linear-gradient(180deg, rgba(255, 250, 230, 0.95), rgba(255, 243, 197, 0.84));
    color: rgba(120, 53, 15, 0.95);
    font-size: clamp(0.66rem, 1.9vw, 0.82rem);
    font-weight: 900;
    letter-spacing: 0.06em;
    white-space: nowrap;
    pointer-events: none;
    z-index: 9;
    box-shadow: 0 0 16px rgba(250, 204, 21, 0.36);
    animation: resonance-true-burst-text 0.62s ease-out;
}

@keyframes resonance-true-burst-ring {
    0% {
        transform: scale(0.9);
        opacity: 0.95;
    }

    100% {
        transform: scale(1.44);
        opacity: 0;
    }
}

@keyframes resonance-true-burst-ring-outer {
    0% {
        transform: scale(0.94);
        opacity: 0.82;
    }

    100% {
        transform: scale(1.56);
        opacity: 0;
    }
}

@keyframes resonance-true-aura-burst {
    0% {
        opacity: 0.7;
        transform: rotate(-4deg) scale(0.98, 1.02);
    }

    100% {
        opacity: 0;
        transform: rotate(7deg) scale(1.35, 1.5);
    }
}

@keyframes resonance-true-stardust-burst {
    0% {
        opacity: 0.6;
        transform: scale(0.92);
    }

    100% {
        opacity: 0;
        transform: scale(1.45);
    }
}

@keyframes resonance-true-ki-burst {
    0% {
        opacity: 0.82;
        transform: translateX(-50%) translateY(2px) scale(0.9, 0.94);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-8px) scale(1.28, 1.46);
    }
}

@keyframes resonance-true-burst-text {
    0% {
        opacity: 0;
        transform: translate(-50%, 8px) scale(0.96);
    }

    36% {
        opacity: 1;
        transform: translate(-50%, -4px) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -16px) scale(1);
    }
}

/* Arc Positioning - Concave (Smile) - Default / Flick Mode */
.resonance-wheel:not(.tap-mode) .resonance-slot:nth-child(1),
.resonance-wheel:not(.tap-mode) .resonance-slot:nth-last-child(1) {
    transform: translateY(-4px);
}

.resonance-wheel:not(.tap-mode) .resonance-slot:nth-child(2):nth-last-child(2),
.resonance-wheel:not(.tap-mode) .resonance-slot:nth-child(2):nth-last-child(3),
.resonance-wheel:not(.tap-mode) .resonance-slot:nth-child(3):nth-last-child(2) {
    transform: translateY(10px);
}

/* GLOBAL: 2 Options — TAP mode (lower specificity is fine, tap-mode class adds distinction) */
.resonance-wheel.tap-mode .resonance-slot:nth-child(1):nth-last-child(2),
.resonance-wheel.tap-mode .resonance-slot:nth-child(2):nth-last-child(1) {
    flex: 0 0 auto;
    transform: translateY(-4px);
}

.resonance-wheel.tap-mode .resonance-slot:nth-child(1):nth-last-child(2) {
    margin-right: clamp(14px, 3vw, 28px);
}

.resonance-wheel.tap-mode .resonance-slot:nth-child(2):nth-last-child(1) {
    margin-left: clamp(14px, 3vw, 28px);
}

/* Flick 2 options use the same inner stance as the middle two slots in the 4-option arc. */
#flickLayer.resonance-wheel:has(> .resonance-slot:nth-child(2):last-child) {
    justify-content: center;
    gap: clamp(42px, 7vw, 70px);
}

#flickLayer.resonance-wheel .resonance-slot:nth-child(1):nth-last-child(2),
#flickLayer.resonance-wheel .resonance-slot:nth-child(2):nth-last-child(1) {
    flex: 0 0 auto !important;
    max-width: none;
    margin-inline: 0;
    transform: translateY(10px);
}

/* --- TAP Mode DOM Rhythm --- */
.hud-tap-mode .resonance-wheel-shell {
    min-height: clamp(84px, 20vw, 108px);
    height: auto;
    margin-top: -6px;
}

.hud-tap-mode .resonance-wheel {
    min-height: clamp(80px, 19vw, 104px);
}

/* --- TAP Mode Visual Layout --- */
/* NO translateY here — that creates an invisible dead-zone over the attack button */
.resonance-wheel.tap-mode {
    justify-content: center;
}

/* TAP: 3 Options */
/* Keep the default wheel horizontal distribution; only lift the 3-slot arc. */
.resonance-wheel.tap-mode .resonance-slot:nth-child(1):nth-last-child(3),
.resonance-wheel.tap-mode .resonance-slot:nth-child(3):nth-last-child(1) {
    transform: translateY(-18px);
}

.resonance-wheel.tap-mode .resonance-slot:nth-child(2):nth-last-child(2) {
    transform: translateY(-4px);
}

/* TAP: 4 Options */
/* Retain original default flex sizing so 4 items fit automatically within max-width. Just flatten the arc slightly. */
.resonance-wheel.tap-mode .resonance-slot:nth-child(1):nth-last-child(4),
.resonance-wheel.tap-mode .resonance-slot:nth-child(4):nth-last-child(1) {
    transform: translateY(-6px);
}

.resonance-wheel.tap-mode .resonance-slot:nth-child(2):nth-last-child(3),
.resonance-wheel.tap-mode .resonance-slot:nth-child(3):nth-last-child(2) {
    transform: translateY(0px);
}

/* Feedback Glows */
.resonance-slot.is-selected .resonance-spirit-rune {
    border-color: #fbbf24;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
}

.resonance-slot.is-correct .resonance-spirit-rune {
    border-color: #10b981;
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.5);
}

.resonance-slot.is-wrong .resonance-spirit-rune {
    border-color: #f43f5e;
    box-shadow: 0 0 15px rgba(244, 63, 94, 0.4);
    animation: resonanceShake 0.4s ease-in-out;
}

.resonance-slot.is-selected .resonance-icon-wrap {
    box-shadow:
        0 0 0 2px rgba(251, 191, 36, 0.4),
        0 8px 20px rgba(0, 0, 0, 0.4),
        0 0 28px rgba(251, 191, 36, 0.42);
}

.resonance-slot.is-selected .resonance-spirit-icon {
    filter:
        drop-shadow(0 0 8px rgba(255, 250, 235, 0.45)) drop-shadow(0 0 24px rgba(251, 191, 36, 0.55)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.resonance-slot.is-correct .resonance-icon-wrap {
    box-shadow:
        0 0 0 2px rgba(16, 185, 129, 0.45),
        0 8px 20px rgba(0, 0, 0, 0.4),
        0 0 28px rgba(16, 185, 129, 0.42);
}

.resonance-slot.is-correct .resonance-spirit-icon {
    filter:
        drop-shadow(0 0 8px rgba(209, 250, 229, 0.45)) drop-shadow(0 0 26px rgba(16, 185, 129, 0.55)) drop-shadow(0 2px 5px rgba(0, 0, 0, 0.5));
}

.resonance-slot.is-wrong .resonance-icon-wrap {
    box-shadow:
        0 0 0 2px rgba(244, 63, 94, 0.4),
        0 8px 20px rgba(0, 0, 0, 0.4),
        0 0 24px rgba(244, 63, 94, 0.35);
}

.resonance-slot.is-wrong .resonance-spirit-icon {
    filter:
        drop-shadow(0 0 8px rgba(255, 228, 235, 0.35)) drop-shadow(0 0 20px rgba(244, 63, 94, 0.5)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* RWD: iPhone <= 699px */
@media (max-width: 699px) and (orientation: portrait) {
    .battle-hud-root {
        --battle-hud-status-height: 60px;
        /* HP/SP panel sits above status-row buff/passive capsule strip */
        --mobile-hp-panel-bottom: calc(env(safe-area-inset-bottom, 0px) + 34px);
    }

    #heroAvatar {
        position: fixed !important;
        top: auto !important;
        left: clamp(12px, 5.5vw, 26px) !important;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 12px) !important;
        width: clamp(90px, 23vw, 116px) !important;
        height: clamp(90px, 23vw, 116px) !important;
        margin-bottom: 0 !important;
        transform: scale(0.92) !important;
        transform-origin: bottom left !important;
        z-index: 56 !important;
    }

    /* Unified bottom HUD: single fixed wrapper owns position + gap so HP/SP and
       tool buttons sit in one horizontal row (no center-vs-right collision).
       Anchored bottom-right; bars stay left-of-buttons so the JS-positioned
       #battleBuffOverlay keeps ~28px clearance + on-screen centre below the bars. */
    .battle-status-content {
        position: fixed;
        left: auto;
        right: clamp(10px, 3vw, 16px);
        bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
        width: auto;
        max-width: min(80vw, 360px);
        min-height: 0;
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: flex-start;
        justify-content: flex-end;
        gap: clamp(8px, 2.5vw, 12px) !important;
        padding: 0;
        z-index: 57;
        pointer-events: auto;
    }

    .battle-hud-bars {
        position: relative;
        transform: none;
        flex: 0 0 auto !important;
        width: clamp(126px, 35vw, 160px);
        max-width: clamp(126px, 35vw, 160px) !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 6px 8px;
        z-index: 55;
        --battle-hud-label-col: 1.25rem;
        --battle-hud-value-col: 2rem;
        align-items: stretch;
    }

    .battle-hud-bars>div {
        display: grid !important;
        grid-template-columns: var(--battle-hud-label-col) minmax(0, 1fr) var(--battle-hud-value-col);
        align-items: center;
        column-gap: 2px;
        width: 100%;
    }

    .battle-hud-bars .hud-bar-label {
        width: auto !important;
        justify-self: start;
    }

    .battle-hud-bars .hud-bar-track {
        width: calc(100% + 3px);
        max-width: calc(100% + 3px);
        min-width: 0;
        height: 6px !important;
        flex: none !important;
    }

    .battle-hud-bars .hud-bar-value {
        width: auto !important;
        min-width: var(--battle-hud-value-col);
        max-width: var(--battle-hud-value-col);
        justify-self: end;
    }

    .battle-hud-actions {
        position: relative;
        transform: none;
        gap: 4px !important;
        flex: 0 0 auto;
        align-items: center;
        pointer-events: auto;
        z-index: 57;
    }

    .battle-hud-actions .hud-tool-btn {
        padding: 3px 6px;
    }

    .battle-mode-toggle {
        transform: scale(0.92);
        transform-origin: right center;
    }

    .battle-top-ui-layer .question-card.glass-panel {
        min-height: clamp(80px, 13dvh, 140px);
        max-height: clamp(116px, 21dvh, 184px);
        height: auto;
        padding: clamp(10px, 1.8dvh, 14px) clamp(14px, 3.8vw, 20px) !important;
        overflow: hidden;
        contain: paint;
    }

    .battle-top-ui-layer #question-area {
        --battle-question-jp-size: clamp(1.52rem, 3.9vmin + 1.08rem, 2.42rem);
        --battle-question-row-gap: 0.44rem;
        --battle-particle-slot-min: 2.05em;
        --battle-particle-slot-pad-x: 0.18em;
        --battle-particle-slot-border: max(2px, 0.075em);
        padding-top: 0.25rem;
        padding-bottom: 0.35rem;
        padding-left: clamp(0.7rem, 2.8vw, 1rem);
        padding-right: clamp(0.7rem, 2.8vw, 1rem);
        overflow: hidden;
    }

    .battle-top-ui-layer #question-area.question-size-medium {
        --battle-question-jp-size: clamp(1.56rem, 4.15vmin + 0.98rem, 2.38rem);
        --battle-question-row-gap: 0.34rem;
    }

    .battle-top-ui-layer #question-area.question-size-long {
        --battle-question-jp-size: clamp(1.25rem, 3.2vmin + 0.8rem, 1.88rem);
        --battle-question-row-gap: 0.22rem;
    }

    .battle-top-ui-layer #question-area.question-size-very-long {
        --battle-question-jp-size: clamp(1.02rem, 2.35vmin + 0.64rem, 1.42rem);
        --battle-question-row-gap: 0.14rem;
    }

    .battle-top-ui-layer #question-area.question-compact {
        --battle-question-row-gap: 0.12rem;
    }

    .battle-top-ui-layer #question-area.question-ultra-compact {
        --battle-question-jp-size: clamp(1.06rem, 2.45vmin + 0.66rem, 1.52rem);
        --battle-question-row-gap: 0.06rem;
    }

    .battle-top-ui-layer #question-area .battle-question-main-row {
        flex-wrap: nowrap;
        justify-content: center;
        align-items: baseline !important;
        overflow-wrap: normal;
        word-break: normal;
        row-gap: 0.2rem;
        max-width: 100%;
        min-width: 0;
        overflow: visible;
    }

    .battle-top-ui-layer #question-area.question-size-medium .battle-question-main-row,
    .battle-top-ui-layer #question-area.question-size-long .battle-question-main-row,
    .battle-top-ui-layer #question-area.question-size-very-long .battle-question-main-row {
        flex-wrap: nowrap;
        row-gap: 0.18rem;
    }

    .battle-top-ui-layer #question-area .battle-question-jp {
        font-size: var(--battle-question-jp-size) !important;
        line-height: 1.15 !important;
        white-space: nowrap;
        max-width: 100%;
        overflow-wrap: normal;
        word-break: normal;
    }

    .battle-top-ui-layer #question-area.question-size-medium .battle-question-jp,
    .battle-top-ui-layer #question-area.question-size-long .battle-question-jp,
    .battle-top-ui-layer #question-area.question-size-very-long .battle-question-jp,
    .battle-top-ui-layer #question-area.question-ultra-compact .battle-question-jp {
        white-space: nowrap;
        overflow-wrap: normal;
        word-break: normal;
        line-height: 1.2;
    }

    .battle-top-ui-layer #question-area .battle-question-text {
        display: inline-flex;
        align-items: baseline;
        flex: 0 1 auto;
        min-width: 0;
        max-width: 100%;
    }

    .battle-top-ui-layer #question-area .battle-question-phrase {
        display: inline-flex;
        align-items: baseline;
        justify-content: center;
        flex: 0 0 auto;
        max-width: none;
        overflow: visible;
        white-space: nowrap;
    }

    .battle-top-ui-layer #question-area .blank-slot,
    .battle-top-ui-layer #question-area .particle-input {
        display: inline-flex !important;
        align-items: flex-end !important;
        justify-content: center !important;
        box-sizing: border-box;
        position: relative;
        top: -1px;
        flex: 0 0 auto;
        width: auto !important;
        min-width: var(--battle-particle-slot-min) !important;
        padding: 0 var(--battle-particle-slot-pad-x) 0.04em var(--battle-particle-slot-pad-x) !important;
        margin-inline: 0.06em !important;
        border-top: 0 !important;
        border-right: 0 !important;
        border-bottom: var(--battle-particle-slot-border) solid currentColor !important;
        border-left: 0 !important;
        border-radius: 0 !important;
        line-height: 1 !important;
        white-space: nowrap !important;
        vertical-align: baseline !important;
        transform: none !important;
        box-shadow: none !important;
    }

    .battle-top-ui-layer #question-area .blank-slot:hover {
        transform: none !important;
    }

    .battle-top-ui-layer #question-area .ruby-text rt {
        position: relative;
        top: 4px;
    }

    .battle-top-ui-layer #question-area.question-size-long .battle-question-jp,
    .battle-top-ui-layer #question-area.question-size-very-long .battle-question-jp {
        line-height: 1.22;
    }

    .battle-top-ui-layer .battle-question-cn,
    .battle-top-ui-layer #question-area>div.battle-question-cn:last-child {
        font-size: clamp(1.2rem, 2.8vmin + 0.92rem, 1.5rem) !important;
        line-height: 1.34 !important;
        margin-top: 0.25rem !important;
        overflow-wrap: normal;
        word-break: normal;
    }

    .battle-top-ui-layer #question-area.question-size-medium .battle-question-cn,
    .battle-top-ui-layer #question-area.question-size-medium>div.battle-question-cn:last-child {
        font-size: clamp(1.1rem, 2.5vmin + 0.82rem, 1.38rem) !important;
        line-height: 1.32 !important;
    }

    .battle-top-ui-layer #question-area.question-size-long .battle-question-cn,
    .battle-top-ui-layer #question-area.question-size-long>div.battle-question-cn:last-child {
        font-size: clamp(0.98rem, 2.1vmin + 0.66rem, 1.2rem) !important;
        line-height: 1.3 !important;
    }

    .battle-top-ui-layer #question-area.question-size-very-long .battle-question-cn,
    .battle-top-ui-layer #question-area.question-size-very-long>div.battle-question-cn:last-child {
        font-size: clamp(0.9rem, 1.85vmin + 0.58rem, 1.08rem) !important;
        line-height: 1.28 !important;
    }

    .battle-top-ui-layer .ruby-text rt,
    .battle-top-ui-layer #question-area .ruby-text rt {
        font-size: clamp(0.52em, 1.45vmin + 0.38em, 0.6em) !important;
        line-height: 1 !important;
    }

    .battle-top-ui-layer #question-area.question-size-long .ruby-text rt,
    .battle-top-ui-layer #question-area.question-size-very-long .ruby-text rt {
        font-size: clamp(0.48em, 1.25vmin + 0.32em, 0.54em) !important;
    }

    .battle-answer-feedback-overlay {
        inset: auto auto calc(env(safe-area-inset-bottom, 0px) + var(--battle-hud-status-height) + 112px) 50% !important;
    }

    .resonance-wheel-shell {
        min-height: clamp(108px, 30vw, 136px);
        margin-top: -12px;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .resonance-wheel {
        gap: clamp(7px, 2.3vw, 12px);
        padding: 2px 0 0;
        min-height: clamp(102px, 29vw, 132px);
        justify-content: center;
    }

    .resonance-slot {
        max-width: min(28vw, 108px);
        padding-top: 2px;
    }

    .resonance-icon-wrap {
        max-width: min(138px, 22vw);
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.14),
            0 8px 20px rgba(0, 0, 0, 0.42),
            0 0 28px rgba(251, 191, 36, 0.24);
    }

    /* 約為原 ~44→110pxWrap 的倍率；實際寬度會受 flex slot 平分略小 */
    .resonance-spirit-icon {
        width: 88%;
        height: 88%;
    }

    .resonance-wheel:not(.tap-mode) .resonance-slot:nth-child(1),
    .resonance-wheel:not(.tap-mode) .resonance-slot:nth-last-child(1) {
        transform: translateY(-20px);
    }

    .resonance-wheel:not(.tap-mode) .resonance-slot:nth-child(2):nth-last-child(2),
    .resonance-wheel:not(.tap-mode) .resonance-slot:nth-child(2):nth-last-child(3),
    .resonance-wheel:not(.tap-mode) .resonance-slot:nth-child(3):nth-last-child(2) {
        transform: translateY(3px);
    }

    .resonance-wheel.tap-mode .resonance-slot:nth-child(1):nth-last-child(3),
    .resonance-wheel.tap-mode .resonance-slot:nth-child(3):nth-last-child(1) {
        transform: translateY(-30px);
    }

    .resonance-wheel.tap-mode .resonance-slot:nth-child(2):nth-last-child(2) {
        transform: translateY(-10px);
    }

    .resonance-wheel.tap-mode .resonance-slot:nth-child(1):nth-last-child(4),
    .resonance-wheel.tap-mode .resonance-slot:nth-child(4):nth-last-child(1) {
        transform: translateY(-24px);
    }

    .resonance-wheel.tap-mode .resonance-slot:nth-child(2):nth-last-child(3),
    .resonance-wheel.tap-mode .resonance-slot:nth-child(3):nth-last-child(2) {
        transform: translateY(-8px);
    }

    #flickLayer.resonance-wheel .resonance-slot:nth-child(1):nth-last-child(2),
    #flickLayer.resonance-wheel .resonance-slot:nth-child(2):nth-last-child(1) {
        transform: translateY(3px);
    }

    .battle-tap-attack-row {
        padding-left: 8px !important;
        padding-right: 8px !important;
        justify-content: center !important;
        margin-bottom: 10px;
    }

    .battle-tap-attack-row button {
        width: clamp(150px, 45vw, 220px) !important;
        max-width: 220px !important;
        height: 30px !important;
        font-size: 11px !important;
    }

    .monster-codex-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-top: 12px;
        padding: 10px;
    }

    .monster-codex-stats div {
        padding: 7px 8px;
    }

    .monster-codex-stats span {
        font-size: 0.82rem;
    }

    .monster-codex-stats strong {
        font-size: 0.88rem;
    }

    .monster-codex-kicker {
        font-size: 0.86rem;
    }

    .monster-codex-trait {
        font-size: 1rem;
        line-height: 1.52;
    }

    .map-page-container .map-ui-mobile-zone .map-hud-avatar {
        left: calc(env(safe-area-inset-left, 0px) + 13px);
    }
}

/* RWD: Desktop / wide battle — readable short lines; shrink long lines inside card (mobile portrait: block above) */
@media (min-width: 900px) {
    .battle-top-ui-layer > .w-full.max-w-md {
        max-width: min(42rem, 94vw) !important;
        width: min(100%, 42rem);
    }

    .battle-top-ui-layer .question-card.glass-panel {
        overflow-x: clip;
        overflow-y: visible;
        min-height: clamp(105px, 13vh, 145px);
        padding: clamp(15px, 1.6vh, 21px) clamp(18px, 2.4vw, 28px) !important;
        background: rgba(15, 23, 42, 0.32) !important;
        backdrop-filter: blur(8px) saturate(1.1) brightness(0.94) !important;
        -webkit-backdrop-filter: blur(8px) saturate(1.1) brightness(0.94) !important;
        border-color: rgba(255, 255, 255, 0.3) !important;
        box-shadow:
            0 10px 40px rgba(0, 0, 0, 0.55),
            inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    }

    .battle-top-ui-layer #question-area {
        container-type: inline-size;
        container-name: jpapp-battle-question;
        overflow-x: clip;
        overflow-y: visible;
        max-width: 100%;
        min-height: clamp(80px, 9.5vh, 113px);
        padding: 0.48rem 0.55rem 0.52rem;
    }

    .battle-top-ui-layer #question-area .battle-question-main-row {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        margin-bottom: 0.5rem !important;
    }

    .battle-top-ui-layer #question-area .battle-question-phrase {
        max-width: 100%;
        min-width: 0;
        flex: 1 1 auto;
        justify-content: center;
    }

    .battle-top-ui-layer #question-area.question-size-short,
    .battle-top-ui-layer #question-area.question-size-medium {
        --battle-question-row-gap: 0.42rem;
    }

    .battle-top-ui-layer #question-area.question-size-short {
        --battle-question-jp-size: clamp(1.35rem, 2.35vmin + 0.88rem, 2.35rem);
        --battle-question-cn-size: clamp(1.44rem, 1.68vmin + 0.86rem, 1.8rem);
    }

    .battle-top-ui-layer #question-area.question-size-medium {
        --battle-question-jp-size: clamp(1.2rem, 2vmin + 0.76rem, 2.05rem);
        --battle-question-cn-size: clamp(1.32rem, 1.54vmin + 0.79rem, 1.68rem);
        --battle-question-row-gap: 0.34rem;
    }

    .battle-top-ui-layer #question-area.question-size-long {
        --battle-question-jp-size: clamp(0.88rem, 1.15vmin + 0.52rem, 1.48rem);
        --battle-question-cn-size: clamp(1.2rem, 1.34vmin + 0.7rem, 1.44rem);
        --battle-question-row-gap: 0.16rem;
    }

    .battle-top-ui-layer #question-area.question-size-very-long {
        --battle-question-jp-size: clamp(0.74rem, 0.92vmin + 0.42rem, 1.2rem);
        --battle-question-cn-size: clamp(1.1rem, 1.22vmin + 0.62rem, 1.32rem);
        --battle-question-row-gap: 0.1rem;
    }

    .battle-top-ui-layer #question-area .battle-question-jp {
        max-width: 100%;
        font-size: var(--battle-question-jp-size) !important;
        line-height: 1.2 !important;
        text-shadow:
            0 0 2px rgba(0, 0, 0, 0.95),
            0 1px 4px rgba(0, 0, 0, 0.9),
            0 2px 12px rgba(0, 0, 0, 0.82) !important;
    }

    .battle-top-ui-layer #question-area .battle-question-text {
        text-shadow:
            0 0 2px rgba(0, 0, 0, 0.95),
            0 1px 4px rgba(0, 0, 0, 0.9),
            0 2px 10px rgba(0, 0, 0, 0.85) !important;
    }

    @supports (width: 1cqi) {
        .battle-top-ui-layer #question-area.question-size-long .battle-question-jp,
        .battle-top-ui-layer #question-area.question-size-very-long .battle-question-jp,
        .battle-top-ui-layer #question-area.question-compact .battle-question-jp,
        .battle-top-ui-layer #question-area.question-ultra-compact .battle-question-jp {
            font-size: min(var(--battle-question-jp-size), clamp(0.64rem, 5.6cqi, var(--battle-question-jp-size))) !important;
        }
    }

    .battle-top-ui-layer #question-area .ruby-text {
        max-width: 100%;
    }

    .battle-top-ui-layer #question-area .ruby-text rt {
        position: relative;
        top: -4px !important;
        font-size: clamp(0.48em, 2.2cqi, 0.58em) !important;
        line-height: 1 !important;
        margin-bottom: 0.08em !important;
        white-space: nowrap;
        text-shadow:
            0 0 2px rgba(0, 0, 0, 0.95),
            0 1px 4px rgba(0, 0, 0, 0.9),
            0 0 10px rgba(120, 53, 15, 0.4) !important;
    }

    .battle-top-ui-layer #question-area.question-size-long .ruby-text rt,
    .battle-top-ui-layer #question-area.question-size-very-long .ruby-text rt {
        top: -3px !important;
        font-size: clamp(0.42em, 1.9cqi, 0.5em) !important;
    }

    .battle-top-ui-layer #question-area .battle-question-cn,
    .battle-top-ui-layer #question-area>div.battle-question-cn:last-child,
    .battle-top-ui-layer #question-area.question-size-short .battle-question-cn,
    .battle-top-ui-layer #question-area.question-size-short>div.battle-question-cn:last-child {
        max-width: 100%;
        overflow-wrap: anywhere;
        font-size: var(--battle-question-cn-size, clamp(1.44rem, 1.68vmin + 0.86rem, 1.8rem)) !important;
        line-height: 1.36 !important;
        color: rgba(255, 252, 248, 0.98) !important;
        font-weight: 900;
        text-shadow:
            0 0 2px rgba(0, 0, 0, 1),
            0 1px 5px rgba(0, 0, 0, 0.96),
            0 2px 12px rgba(0, 0, 0, 0.9),
            0 0 16px rgba(0, 0, 0, 0.55) !important;
        -webkit-text-stroke: 0.5px rgba(0, 0, 0, 0.42);
        paint-order: stroke fill;
    }

    .battle-top-ui-layer #question-area.question-size-medium .battle-question-cn,
    .battle-top-ui-layer #question-area.question-size-medium>div.battle-question-cn:last-child {
        font-size: var(--battle-question-cn-size) !important;
        line-height: 1.34 !important;
    }

    .battle-top-ui-layer #question-area.question-size-long .battle-question-cn,
    .battle-top-ui-layer #question-area.question-size-long>div.battle-question-cn:last-child {
        font-size: var(--battle-question-cn-size) !important;
        line-height: 1.3 !important;
    }

    .battle-top-ui-layer #question-area.question-size-very-long .battle-question-cn,
    .battle-top-ui-layer #question-area.question-size-very-long>div.battle-question-cn:last-child {
        font-size: var(--battle-question-cn-size) !important;
        line-height: 1.28 !important;
    }

    .battle-top-ui-layer #question-area.question-compact {
        --battle-question-jp-size: clamp(0.86rem, 1.08vmin + 0.5rem, 1.32rem);
        --battle-question-row-gap: 0.12rem;
    }

    .battle-top-ui-layer #question-area.question-ultra-compact {
        --battle-question-jp-size: clamp(0.76rem, 0.88vmin + 0.42rem, 1.1rem);
        --battle-question-row-gap: 0.08rem;
    }

    .battle-top-ui-layer #question-area.question-compact .battle-question-jp,
    .battle-top-ui-layer #question-area.question-ultra-compact .battle-question-jp {
        line-height: 1.14 !important;
    }
}

/* RWD: Desktop >= 1181px
   Hover-only decoration; iPad behavior must not depend on hover/pointer queries. */
@media (min-width: 1181px) and (hover:hover) {
    .resonance-icon-wrap:hover {
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.16),
            0 8px 18px rgba(0, 0, 0, 0.4),
            0 0 26px rgba(251, 191, 36, 0.3);
    }
}

/* RWD: Desktop >= 1181px */
@media (min-width: 1181px) {
    .battle-hud-root {
        width: min(72vw, 820px) !important;
        max-width: 820px !important;
    }

    .battle-status-content {
        width: min(100%, 760px);
        max-width: min(100%, 760px);
        margin-inline: auto !important;
        display: flex;
        justify-content: center;
        align-items: flex-end;
        padding-left: 0;
        padding-right: 0;
        gap: clamp(24px, 2.8vw, 36px) !important;
    }

    .battle-hud-bars {
        position: fixed !important;
        left: 50% !important;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 46px) !important;
        transform: translateX(-50%) !important;
        width: clamp(168px, 20vw, 224px) !important;
        flex-basis: auto !important;
        max-width: clamp(168px, 20vw, 224px) !important;
        z-index: 55;
    }

    .battle-hud-actions {
        position: fixed !important;
        left: calc(50% + 150px) !important;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 42px) !important;
        margin-left: 0;
        gap: 10px !important;
        pointer-events: auto;
        z-index: 82;
    }

    .battle-hud-actions .hud-tool-btn {
        pointer-events: auto;
        width: auto;
        height: auto;
        min-height: 44px;
        padding: 4px 10px;
    }

    .battle-hud-actions .hud-tool-btn>span,
    .battle-hud-actions .hud-tool-badge {
        pointer-events: none;
    }

    #heroAvatar {
        position: fixed !important;
        left: calc(50% - 318px) !important;
        margin-left: 0 !important;
        margin-bottom: 0 !important;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 18px) !important;
        transform: scale(0.86) !important;
        transform-origin: bottom center !important;
        z-index: 54 !important;
    }

    .resonance-wheel-shell {
        min-height: clamp(108px, 16vw, 144px);
        width: min(100vw, 760px);
        margin-left: auto;
        margin-right: auto;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .resonance-slot {
        position: relative;
        top: var(--slot-arc-top, 0px);
        max-width: min(200px, 25vw);
        margin-bottom: 0 !important;
        transform: none !important;
        transition: transform 0.18s ease, filter 0.18s ease;
    }

    .resonance-icon-wrap {
        max-width: min(112px, 19vw);
    }

    .resonance-wheel {
        min-height: clamp(118px, 16vw, 152px);
        width: min(720px, 62vw);
        max-width: 720px;
        margin-inline: auto;
        justify-content: space-between;
        align-items: flex-end;
        gap: clamp(14px, 1.5vw, 22px);
    }

    #flickLayer.resonance-wheel:has(> .resonance-slot:nth-child(2):last-child) {
        justify-content: center;
        gap: clamp(56px, 5vw, 76px);
    }

    .resonance-wheel::before {
        left: 5%;
        right: 5%;
        bottom: clamp(20px, 3.4vw, 38px);
        height: clamp(132px, 16vw, 188px);
        border-bottom: 2.5px solid rgba(251, 191, 36, 0.46);
        box-shadow:
            0 6px 14px rgba(251, 191, 36, 0.18),
            inset 0 -6px 12px rgba(255, 255, 255, 0.04);
        filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.28));
        opacity: 0.95;
    }

    .resonance-wheel::after {
        content: '';
        position: absolute;
        left: 10%;
        right: 10%;
        bottom: clamp(25px, 3.8vw, 44px);
        height: clamp(108px, 13.5vw, 158px);
        border-bottom: 1px solid rgba(255, 237, 180, 0.28);
        border-radius: 0 0 50% 50%;
        pointer-events: none;
        z-index: 0;
        filter: blur(0.4px);
    }

    /* 桌機共鳴輪弧度：單一 layout top 方案；hover/狀態只做微互動 */
    .resonance-wheel>.resonance-slot:nth-child(1):nth-last-child(4),
    .resonance-wheel>.resonance-slot:nth-child(4):nth-last-child(1) {
        --slot-arc-top: -56px;
        transform: none !important;
    }

    .resonance-wheel>.resonance-slot:nth-child(2):nth-last-child(3),
    .resonance-wheel>.resonance-slot:nth-child(3):nth-last-child(2) {
        --slot-arc-top: -18px;
        transform: none !important;
    }

    .resonance-wheel>.resonance-slot:nth-child(1):nth-last-child(3),
    .resonance-wheel>.resonance-slot:nth-child(3):nth-last-child(1) {
        --slot-arc-top: -48px;
        transform: none !important;
    }

    .resonance-wheel>.resonance-slot:nth-child(2):nth-last-child(2) {
        --slot-arc-top: -12px;
        transform: none !important;
    }

    .resonance-wheel.tap-mode>.resonance-slot:nth-child(1):nth-last-child(3),
    .resonance-wheel.tap-mode>.resonance-slot:nth-child(3):nth-last-child(1) {
        --slot-arc-top: -62px;
    }

    .resonance-wheel.tap-mode>.resonance-slot:nth-child(2):nth-last-child(2) {
        --slot-arc-top: -26px;
    }

    .resonance-wheel>.resonance-slot:nth-child(1):nth-last-child(2),
    .resonance-wheel>.resonance-slot:nth-child(2):nth-last-child(1) {
        --slot-arc-top: -30px;
        transform: none !important;
    }

    #flickLayer.resonance-wheel>.resonance-slot:nth-child(1):nth-last-child(2),
    #flickLayer.resonance-wheel>.resonance-slot:nth-child(2):nth-last-child(1) {
        --slot-arc-top: -18px;
        flex: 0 0 auto !important;
        margin-inline: 0 !important;
    }

    .resonance-wheel>.resonance-slot:hover,
    .resonance-wheel>.resonance-slot.is-selected {
        transform: translateY(-3px) scale(1.02) !important;
        filter: brightness(1.08);
    }

    .resonance-wheel>.resonance-slot:active {
        transform: scale(0.96) !important;
    }

    .resonance-wheel>.resonance-slot.is-correct,
    .resonance-wheel>.resonance-slot.is-wrong {
        transform: none !important;
    }

    #flickLayer .resonance-slot.is-active {
        transform: translateY(-2px) scale(1.02) !important;
    }

    .battle-tap-attack-row {
        justify-content: center !important;
        margin-bottom: clamp(24px, 2.4vw, 34px);
    }

    .battle-tap-attack-row button {
        width: clamp(150px, 18vw, 210px) !important;
    }
}

/* RWD: Desktop >= 1181px */
@media (min-width: 1181px) {
    .map-ui-desktop-zone .map-hud-avatar {
        left: 38px !important;
    }

    .map-ui-desktop-zone .map-hud-bottom {
        padding-left: 162px !important;
    }
}

/* RWD: iPad Landscape 900px-1180px */
@media (min-width: 900px) and (max-width: 1180px) {
    .map-ui-desktop-zone .map-hud-avatar {
        position: fixed !important;
        left: calc(50% - clamp(250px, 25vw, 292px)) !important;
        bottom: 0 !important;
    }

    .map-ui-desktop-zone .map-hud-avatar-img {
        height: clamp(112px, 13vw, 128px) !important;
    }

    .map-ui-desktop-zone .map-hud-bottom {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        transform: none !important;
        justify-content: center !important;
        padding-left: clamp(136px, 15vw, 180px) !important;
        padding-right: clamp(18px, 4vw, 44px) !important;
        padding-bottom: max(env(safe-area-inset-bottom, 0px), 6px) !important;
        min-height: 64px !important;
    }

    .map-ui-desktop-zone .map-hud-bars {
        flex: 0 0 auto;
        width: clamp(184px, 20vw, 216px);
        max-width: none;
    }

    .map-page-container .map-ui-mobile-zone .map-hud-bottom {
        left: 50%;
        bottom: 0;
        width: 100vw;
        height: 64px;
        min-height: 64px;
        max-height: 64px;
        padding-left: 0;
        padding-right: 0;
        padding-bottom: max(env(safe-area-inset-bottom, 0px), 5px);
    }

    .map-page-container .map-ui-mobile-zone .map-hud-center {
        transform: none;
        gap: clamp(12px, 2vw, 20px);
        width: 100%;
        max-width: clamp(540px, 76vw, 680px);
        margin-inline: auto;
        padding-left: clamp(112px, 15vw, 142px);
        box-sizing: border-box;
    }

    .map-page-container .map-ui-mobile-zone .map-hud-avatar {
        left: calc(50% - clamp(250px, 34vw, 300px));
        bottom: max(env(safe-area-inset-bottom, 0px), 5px);
    }

    .map-page-container .map-ui-mobile-zone .map-hud-avatar-img {
        width: clamp(108px, 14.5vw, 126px);
    }

    .map-page-container .map-ui-mobile-zone .map-hud-bars {
        width: clamp(176px, 23vw, 208px);
    }

    .monster-codex-panel {
        max-width: min(94vw, 960px);
    }

    .monster-codex-body {
        grid-template-columns: minmax(288px, 40%) minmax(0, 60%);
    }

    .monster-codex-list {
        gap: 10px;
        padding: 14px;
    }

    .monster-codex-card {
        min-height: 58px;
        padding: 11px 13px;
        gap: 12px;
        border-radius: 18px;
    }

    .monster-codex-card-icon {
        width: 36px;
        height: 36px;
        border-radius: 12px;
        font-size: 1rem;
    }

    .monster-codex-card-main strong {
        font-size: 0.98rem;
    }

    .monster-codex-card-main small {
        font-size: 0.85rem;
    }

    .monster-codex-detail {
        padding: 22px 24px;
    }

    .monster-codex-trait {
        font-size: 0.96rem;
        line-height: 1.72;
    }

    .battle-hud-root {
        --battle-hud-status-height: 54px;
        bottom: 0 !important;
        width: min(76vw, 720px) !important;
        max-width: 720px !important;
    }

    .battle-status-panel {
        min-height: var(--battle-hud-status-height);
        padding-top: 0 !important;
        padding-bottom: max(env(safe-area-inset-bottom, 0px), 0px) !important;
    }

    .battle-hud-bars {
        position: fixed !important;
        left: 50% !important;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 18px) !important;
        transform: translateX(-50%) !important;
        width: clamp(184px, 23vw, 222px) !important;
        max-width: clamp(184px, 23vw, 222px) !important;
        flex-basis: auto !important;
        z-index: 55;
    }

    .battle-hud-actions {
        position: fixed !important;
        left: calc(50% + clamp(110px, 14vw, 140px)) !important;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 26px) !important;
        margin-left: 0;
        gap: 10px !important;
        pointer-events: auto;
        z-index: 82;
    }

    .battle-hud-actions .hud-tool-btn {
        pointer-events: auto;
        width: auto;
        height: auto;
        min-height: 44px;
        padding: 4px 10px;
    }

    .battle-hud-actions .hud-tool-btn>span,
    .battle-hud-actions .hud-tool-badge {
        pointer-events: none;
    }

    #heroAvatar {
        position: fixed !important;
        left: calc(50% - clamp(176px, 21vw, 226px)) !important;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 2px) !important;
        margin-left: 0 !important;
        margin-bottom: 0 !important;
        transform: translateX(-50%) scale(0.84) !important;
        transform-origin: bottom center !important;
        z-index: 54 !important;
    }

    .resonance-icon-wrap {
        max-width: min(106px, 18.5vw);
    }

    .resonance-spirit-icon {
        width: 86%;
        height: 86%;
    }

    .resonance-wheel-shell {
        min-height: clamp(88px, 12vw, 112px);
        width: min(100vw, 760px);
        margin-left: auto;
        margin-right: auto;
        margin-top: -8px;
        margin-bottom: 8px;
        padding-left: clamp(12px, 2vw, 18px) !important;
        padding-right: clamp(12px, 2vw, 18px) !important;
    }

    .resonance-slot {
        position: relative;
        top: var(--slot-arc-top, 0px);
        max-width: min(200px, 25vw);
        margin-bottom: 0 !important;
        transform: none !important;
        transition: transform 0.18s ease, filter 0.18s ease;
    }

    .resonance-wheel {
        min-height: clamp(86px, 11.5vw, 108px);
        width: min(700px, 66vw);
        max-width: 700px;
        margin-inline: auto;
        justify-content: space-between;
        align-items: flex-end;
        gap: clamp(14px, 1.5vw, 22px);
        padding-bottom: clamp(4px, 1vw, 8px);
    }

    #flickLayer.resonance-wheel:has(> .resonance-slot:nth-child(2):last-child) {
        justify-content: center;
        gap: clamp(56px, 5vw, 76px);
    }

    .resonance-wheel::before {
        left: 6%;
        right: 6%;
        bottom: clamp(10px, 1.6vw, 18px);
        height: clamp(96px, 12vw, 132px);
        border-bottom: 2.5px solid rgba(251, 191, 36, 0.46);
        box-shadow:
            0 6px 14px rgba(251, 191, 36, 0.18),
            inset 0 -6px 12px rgba(255, 255, 255, 0.04);
        filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.28));
        opacity: 0.95;
    }

    .resonance-wheel::after {
        content: '';
        position: absolute;
        left: 12%;
        right: 12%;
        bottom: clamp(15px, 2.1vw, 24px);
        height: clamp(76px, 9.5vw, 104px);
        border-bottom: 1px solid rgba(255, 237, 180, 0.28);
        border-radius: 0 0 50% 50%;
        pointer-events: none;
        z-index: 0;
        filter: blur(0.4px);
    }

    .resonance-wheel>.resonance-slot:nth-child(1):nth-last-child(4),
    .resonance-wheel>.resonance-slot:nth-child(4):nth-last-child(1) {
        --slot-arc-top: -38px;
        transform: none !important;
    }

    .resonance-wheel>.resonance-slot:nth-child(2):nth-last-child(3),
    .resonance-wheel>.resonance-slot:nth-child(3):nth-last-child(2) {
        --slot-arc-top: -10px;
        transform: none !important;
    }

    .resonance-wheel>.resonance-slot:nth-child(1):nth-last-child(3),
    .resonance-wheel>.resonance-slot:nth-child(3):nth-last-child(1) {
        --slot-arc-top: -34px;
        transform: none !important;
    }

    .resonance-wheel>.resonance-slot:nth-child(2):nth-last-child(2) {
        --slot-arc-top: -8px;
        transform: none !important;
    }

    .resonance-wheel.tap-mode>.resonance-slot:nth-child(1):nth-last-child(2),
    .resonance-wheel.tap-mode>.resonance-slot:nth-child(2):nth-last-child(1) {
        --slot-arc-top: -22px;
        transform: none !important;
    }

    .resonance-wheel.tap-mode>.resonance-slot:nth-child(1):nth-last-child(3),
    .resonance-wheel.tap-mode>.resonance-slot:nth-child(3):nth-last-child(1) {
        --slot-arc-top: -34px;
        transform: none !important;
    }

    .resonance-wheel.tap-mode>.resonance-slot:nth-child(2):nth-last-child(2) {
        --slot-arc-top: -8px;
        transform: none !important;
    }

    .resonance-wheel.tap-mode>.resonance-slot:nth-child(1):nth-last-child(4),
    .resonance-wheel.tap-mode>.resonance-slot:nth-child(4):nth-last-child(1) {
        --slot-arc-top: -38px;
        transform: none !important;
    }

    .resonance-wheel.tap-mode>.resonance-slot:nth-child(2):nth-last-child(3),
    .resonance-wheel.tap-mode>.resonance-slot:nth-child(3):nth-last-child(2) {
        --slot-arc-top: -10px;
        transform: none !important;
    }

    .resonance-wheel>.resonance-slot:nth-child(1):nth-last-child(2),
    .resonance-wheel>.resonance-slot:nth-child(2):nth-last-child(1) {
        --slot-arc-top: -22px;
        transform: none !important;
    }

    #flickLayer.resonance-wheel {
        padding-bottom: clamp(4px, 1vw, 8px);
    }

    #flickLayer.resonance-wheel>.resonance-slot:nth-child(1):nth-last-child(2),
    #flickLayer.resonance-wheel>.resonance-slot:nth-child(2):nth-last-child(1) {
        --slot-arc-top: -22px;
        flex: 0 0 auto !important;
        margin-inline: 0 !important;
        transform: none !important;
    }

    #flickLayer.resonance-wheel>.resonance-slot:nth-child(1):nth-last-child(3),
    #flickLayer.resonance-wheel>.resonance-slot:nth-child(3):nth-last-child(1) {
        --slot-arc-top: -34px;
        transform: none !important;
    }

    #flickLayer.resonance-wheel>.resonance-slot:nth-child(2):nth-last-child(2) {
        --slot-arc-top: -8px;
        transform: none !important;
    }

    #flickLayer.resonance-wheel>.resonance-slot:nth-child(1):nth-last-child(4),
    #flickLayer.resonance-wheel>.resonance-slot:nth-child(4):nth-last-child(1) {
        --slot-arc-top: -38px;
        transform: none !important;
    }

    #flickLayer.resonance-wheel>.resonance-slot:nth-child(2):nth-last-child(3),
    #flickLayer.resonance-wheel>.resonance-slot:nth-child(3):nth-last-child(2) {
        --slot-arc-top: -10px;
        transform: none !important;
    }

    #flickLayer.resonance-wheel .resonance-slot {
        transform: none !important;
    }

    .hud-tap-mode .resonance-wheel-shell {
        margin-bottom: 10px;
    }

    .battle-tap-attack-row {
        justify-content: center !important;
        min-height: 32px !important;
        padding-top: 0 !important;
        padding-bottom: 3px !important;
        margin-bottom: clamp(16px, 2vw, 24px);
    }

    .battle-tap-attack-row button {
        width: clamp(150px, 18vw, 210px) !important;
        min-height: 28px !important;
        height: 28px !important;
        font-size: 11px !important;
    }
}

/* RWD: iPad Portrait 700px-899px */
@media (min-width: 700px) and (max-width: 899px) {
    .map-ui-desktop-zone .map-hud-avatar {
        position: fixed !important;
        left: calc(50% - clamp(250px, 25vw, 292px)) !important;
        bottom: 0 !important;
    }

    .map-ui-desktop-zone .map-hud-avatar-img {
        height: clamp(112px, 13vw, 128px) !important;
    }

    .map-ui-desktop-zone .map-hud-bottom {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        transform: none !important;
        justify-content: center !important;
        padding-left: clamp(136px, 15vw, 180px) !important;
        padding-right: clamp(18px, 4vw, 44px) !important;
        padding-bottom: max(env(safe-area-inset-bottom, 0px), 6px) !important;
        min-height: 64px !important;
    }

    .map-ui-desktop-zone .map-hud-bars {
        flex: 0 0 auto;
        width: clamp(184px, 20vw, 216px);
        max-width: none;
    }

    #heroAvatar {
        position: fixed !important;
        left: calc(50% - clamp(176px, 21vw, 226px)) !important;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 2px) !important;
        margin-left: 0 !important;
        margin-bottom: 0 !important;
        transform: translateX(-50%) scale(1.00) !important;
        transform-origin: bottom center !important;
        z-index: 54 !important;
    }

    .battle-hud-bars {
        position: fixed !important;
        left: 50% !important;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 18px) !important;
        transform: translateX(-50%) !important;
        width: clamp(184px, 23vw, 222px) !important;
        max-width: clamp(184px, 23vw, 222px) !important;
        flex-basis: auto !important;
        z-index: 55;
    }

    .battle-hud-actions {
        position: fixed !important;
        left: calc(50% + clamp(110px, 14vw, 140px)) !important;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 12px) !important;
        margin-left: 0;
        gap: 10px !important;
        pointer-events: auto;
        z-index: 82;
    }

    .resonance-wheel::before {
        left: 6%;
        right: 6%;
        bottom: clamp(16px, 2.8vw, 28px);
        height: clamp(104px, 15vw, 138px);
        border-bottom: 2.5px solid rgba(251, 191, 36, 0.48);
        box-shadow:
            0 6px 14px rgba(251, 191, 36, 0.18),
            inset 0 -6px 12px rgba(255, 255, 255, 0.04);
        filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.3));
        opacity: 0.95;
    }

    .resonance-wheel::after {
        content: '';
        position: absolute;
        left: 12%;
        right: 12%;
        bottom: clamp(22px, 3.4vw, 34px);
        height: clamp(82px, 12vw, 112px);
        border-bottom: 1px solid rgba(255, 237, 180, 0.3);
        border-radius: 0 0 50% 50%;
        pointer-events: none;
        z-index: 0;
        filter: blur(0.4px);
    }

    .resonance-wheel.tap-mode>.resonance-slot:nth-child(1):nth-last-child(2),
    .resonance-wheel.tap-mode>.resonance-slot:nth-child(2):nth-last-child(1) {
        transform: translateY(-38px);
    }

    .resonance-wheel.tap-mode>.resonance-slot:nth-child(1):nth-last-child(3),
    .resonance-wheel.tap-mode>.resonance-slot:nth-child(3):nth-last-child(1) {
        transform: translateY(-54px);
    }

    .resonance-wheel.tap-mode>.resonance-slot:nth-child(2):nth-last-child(2) {
        transform: translateY(-20px);
    }

    .resonance-wheel.tap-mode>.resonance-slot:nth-child(1):nth-last-child(4),
    .resonance-wheel.tap-mode>.resonance-slot:nth-child(4):nth-last-child(1) {
        transform: translateY(-58px);
    }

    .resonance-wheel.tap-mode>.resonance-slot:nth-child(2):nth-last-child(3),
    .resonance-wheel.tap-mode>.resonance-slot:nth-child(3):nth-last-child(2) {
        transform: translateY(-22px);
    }

    #flickLayer.resonance-wheel>.resonance-slot:nth-child(1):nth-last-child(2),
    #flickLayer.resonance-wheel>.resonance-slot:nth-child(2):nth-last-child(1) {
        transform: translateY(-38px);
    }

    #flickLayer.resonance-wheel>.resonance-slot:nth-child(1):nth-last-child(3),
    #flickLayer.resonance-wheel>.resonance-slot:nth-child(3):nth-last-child(1) {
        transform: translateY(-54px);
    }

    #flickLayer.resonance-wheel>.resonance-slot:nth-child(2):nth-last-child(2) {
        transform: translateY(-20px);
    }

    #flickLayer.resonance-wheel>.resonance-slot:nth-child(1):nth-last-child(4),
    #flickLayer.resonance-wheel>.resonance-slot:nth-child(4):nth-last-child(1) {
        transform: translateY(-58px);
    }

    #flickLayer.resonance-wheel>.resonance-slot:nth-child(2):nth-last-child(3),
    #flickLayer.resonance-wheel>.resonance-slot:nth-child(3):nth-last-child(2) {
        transform: translateY(-22px);
    }

    .map-page-container .map-ui-mobile-zone .map-hud-bottom {
        left: 50%;
        bottom: 0;
        width: 100vw;
        height: 64px;
        min-height: 64px;
        max-height: 64px;
        padding-left: 0;
        padding-right: 0;
        padding-bottom: max(env(safe-area-inset-bottom, 0px), 5px);
    }

    .map-page-container .map-ui-mobile-zone .map-hud-center {
        transform: none;
        gap: clamp(12px, 2vw, 20px);
        width: 100%;
        max-width: clamp(540px, 76vw, 680px);
        margin-inline: auto;
        padding-left: clamp(112px, 15vw, 142px);
        box-sizing: border-box;
    }

    .map-page-container .map-ui-mobile-zone .map-hud-avatar {
        left: calc(50% - clamp(250px, 34vw, 300px));
        bottom: max(env(safe-area-inset-bottom, 0px), 5px);
    }

    .map-page-container .map-ui-mobile-zone .map-hud-avatar-img {
        width: clamp(108px, 14.5vw, 126px);
    }

    .map-page-container .map-ui-mobile-zone .map-hud-bars {
        width: clamp(176px, 23vw, 208px);
    }

    .monster-codex-panel {
        max-width: min(94vw, 960px);
    }

    .monster-codex-body {
        grid-template-columns: minmax(220px, 35%) minmax(0, 65%);
    }

    .monster-codex-list {
        gap: 10px;
        padding: 14px;
    }

    .monster-codex-card {
        min-height: 58px;
        padding: 11px 13px;
        gap: 12px;
        border-radius: 18px;
    }

    .monster-codex-card-icon {
        width: 36px;
        height: 36px;
        border-radius: 12px;
        font-size: 1rem;
    }

    .monster-codex-card-main strong {
        font-size: 0.98rem;
    }

    .monster-codex-card-main small {
        font-size: 0.85rem;
    }

    .monster-codex-detail {
        padding: 22px 24px;
    }

    .monster-codex-trait {
        font-size: 0.96rem;
        line-height: 1.72;
    }
}

/* Spirit Breathing Animation */
@keyframes spirit-breathe {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-2px) scale(1.02);
    }
}

@media (prefers-reduced-motion: no-preference) {
    .resonance-spirit-icon {
        animation: spirit-breathe 3s ease-in-out infinite;
    }

    .resonance-slot:nth-child(1) .resonance-spirit-icon {
        animation-delay: 0.0s;
    }

    .resonance-slot:nth-child(2) .resonance-spirit-icon {
        animation-delay: -0.7s;
    }

    .resonance-slot:nth-child(3) .resonance-spirit-icon {
        animation-delay: -1.4s;
    }

    .resonance-slot:nth-child(4) .resonance-spirit-icon {
        animation-delay: -2.1s;
    }

    .resonance-slot.is-active .resonance-spirit-icon,
    .resonance-slot.is-selected .resonance-spirit-icon,
    .resonance-slot.is-correct .resonance-spirit-icon,
    .resonance-slot.is-wrong .resonance-spirit-icon,
    .resonance-slot:active .resonance-spirit-icon,
    .resonance-slot[disabled] .resonance-spirit-icon {
        animation-play-state: paused;
    }
}

/* Bond MAX state: late in the file so it wins over the base resonance wheel styling. */
.resonance-slot.is-bond-max {
    position: relative;
    filter: saturate(1.08) brightness(1.04);
}

.resonance-slot.is-bond-max.resonance-slot--true-resonance::before,
.resonance-slot.is-bond-max.resonance-slot--true-resonance::after {
    display: none;
}

.resonance-slot.is-bond-max.resonance-slot--true-resonance .resonance-spirit-aura,
.resonance-slot.is-bond-max.resonance-slot--true-resonance .resonance-spirit-aura::before,
.resonance-slot.is-bond-max.resonance-slot--true-resonance .resonance-spirit-aura::after {
    background: none;
    box-shadow: none;
    filter: none;
    opacity: 0.52;
    animation: resonance-bond-body-shimmer 2.6s ease-in-out infinite;
}

.resonance-slot.is-bond-max.resonance-slot--true-resonance .resonance-spirit-aura,
.resonance-slot.is-bond-max .resonance-spirit-aura {
    inset: 3% 8% 10%;
    border-radius: 46% 46% 40% 40%;
    background:
        radial-gradient(ellipse at 50% 100%, rgba(255, 247, 214, 0.42) 0%, rgba(250, 204, 21, 0.28) 24%, transparent 52%),
        linear-gradient(90deg, transparent 0%, rgba(251, 191, 36, 0.18) 13%, transparent 28%, transparent 72%, rgba(251, 191, 36, 0.18) 87%, transparent 100%);
    filter: drop-shadow(0 0 14px rgba(250, 204, 21, 0.42));
    z-index: 1;
}

.resonance-slot.is-bond-max .resonance-icon-wrap {
    overflow: visible;
    isolation: isolate;
    box-shadow:
        0 0 0 1px rgba(255, 245, 190, 0.86),
        0 8px 18px rgba(0, 0, 0, 0.38),
        0 0 12px rgba(250, 204, 21, 0.26) !important;
}

.resonance-slot.is-bond-max.resonance-slot--true-resonance .resonance-icon-wrap::before,
.resonance-slot.is-bond-max .resonance-icon-wrap::before {
    content: "";
    position: absolute;
    left: 9%;
    right: 9%;
    bottom: 10%;
    height: 78%;
    border-radius: 44% 44% 38% 38%;
    pointer-events: none;
    z-index: 1;
    background:
        radial-gradient(circle at 50% 91%, rgba(255, 247, 214, 0.58) 0 3px, transparent 7px),
        radial-gradient(circle at 41% 84%, rgba(251, 191, 36, 0.32) 0 2px, transparent 6px),
        radial-gradient(circle at 59% 86%, rgba(253, 186, 116, 0.28) 0 2px, transparent 6px),
        linear-gradient(82deg, transparent 0%, rgba(251, 191, 36, 0.16) 14%, transparent 26%, transparent 74%, rgba(253, 230, 138, 0.14) 87%, transparent 100%);
    filter: blur(1px) drop-shadow(0 0 12px rgba(250, 204, 21, 0.42));
    opacity: 0.5;
    transform-origin: 50% 100%;
    animation: resonance-bond-side-wisp 2.35s ease-in-out infinite;
}

.resonance-slot.is-bond-max.resonance-slot--true-resonance .resonance-icon-wrap::after,
.resonance-slot.is-bond-max .resonance-icon-wrap::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 7%;
    width: 58%;
    height: 24%;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    background:
        radial-gradient(ellipse at 50% 76%, rgba(255, 255, 240, 0.62) 0%, rgba(253, 230, 138, 0.36) 22%, transparent 60%),
        radial-gradient(ellipse at 30% 68%, rgba(251, 191, 36, 0.28) 0%, transparent 58%),
        radial-gradient(ellipse at 70% 70%, rgba(251, 146, 60, 0.22) 0%, transparent 56%);
    filter: blur(2px) drop-shadow(0 0 14px rgba(250, 204, 21, 0.54));
    opacity: 0.72;
    transform: translateX(-50%) scale(0.94);
    transform-origin: 50% 100%;
    animation: resonance-bond-foot-glow 1.85s ease-in-out infinite;
    animation-delay: -0.38s;
}

.resonance-slot.is-bond-max .resonance-bond-max-ring {
    position: absolute;
    left: 6%;
    right: 6%;
    bottom: 8%;
    height: 74%;
    border-radius: 999px;
    pointer-events: none;
    z-index: 1;
    border: 0;
    background:
        radial-gradient(ellipse at 50% 98%, rgba(255, 247, 214, 0.48) 0%, rgba(250, 204, 21, 0.34) 22%, transparent 48%),
        linear-gradient(90deg, transparent 0%, rgba(251, 191, 36, 0.24) 9%, transparent 22%, transparent 78%, rgba(251, 191, 36, 0.24) 91%, transparent 100%),
        linear-gradient(90deg, transparent 0%, rgba(255, 247, 214, 0.14) 28%, transparent 38%, transparent 62%, rgba(255, 247, 214, 0.14) 72%, transparent 100%);
    filter: drop-shadow(0 0 22px rgba(250, 204, 21, 0.86));
    opacity: 0.98;
    transform-origin: 50% 100%;
    animation: resonance-bond-updraft 1.55s ease-in-out infinite;
}

.resonance-slot.is-bond-max .resonance-spirit-icon,
.resonance-slot.is-bond-max .resonance-spirit-rune {
    position: relative;
    z-index: 2;
    filter:
        drop-shadow(0 0 2px rgba(255, 255, 240, 0.95)) drop-shadow(0 0 6px rgba(255, 247, 214, 0.86)) drop-shadow(0 0 14px rgba(250, 204, 21, 0.82)) drop-shadow(0 0 24px rgba(245, 158, 11, 0.52)) drop-shadow(0 3px 5px rgba(0, 0, 0, 0.56));
}

.resonance-slot.is-bond-max.is-selected .resonance-icon-wrap,
.resonance-slot.is-bond-max.is-active .resonance-icon-wrap {
    box-shadow:
        0 8px 22px rgba(0, 0, 0, 0.42),
        0 0 0 1px rgba(255, 245, 190, 0.9),
        0 0 16px rgba(250, 204, 21, 0.34) !important;
}

.resonance-slot.is-bond-max.is-selected .resonance-bond-max-ring,
.resonance-slot.is-bond-max.is-active .resonance-bond-max-ring {
    opacity: 0.95;
    filter: drop-shadow(0 0 9px rgba(250, 204, 21, 0.5));
}

@media (max-width: 640px) and (orientation: portrait) {
    .resonance-slot.is-bond-max .resonance-bond-max-ring {
        left: 8%;
        right: 8%;
        bottom: 9%;
        height: 70%;
    }
}

@media (prefers-reduced-motion: reduce) {

    .resonance-slot.is-bond-max .resonance-spirit-aura,
    .resonance-slot.is-bond-max .resonance-bond-max-ring,
    .resonance-slot.is-bond-max .resonance-icon-wrap::before,
    .resonance-slot.is-bond-max .resonance-icon-wrap::after,
    .resonance-slot--full-bond .resonance-spirit-aura,
    .resonance-slot--full-bond .resonance-icon-wrap::before,
    .resonance-slot--full-bond .resonance-icon-wrap::after {
        animation: none;
    }
}

@keyframes resonance-bond-side-wisp {

    0%,
    100% {
        opacity: 0.42;
        transform: translateY(4px) scaleX(0.96) scaleY(0.96);
    }

    43% {
        opacity: 0.64;
        transform: translateY(-5px) scaleX(1.04) scaleY(1.05);
    }

    72% {
        opacity: 0.5;
        transform: translateY(-1px) scaleX(1) scaleY(1.02);
    }
}

@keyframes resonance-bond-foot-glow {

    0%,
    100% {
        opacity: 0.58;
        transform: translateX(-50%) translateY(4px) scale(0.9, 0.88);
    }

    47% {
        opacity: 0.82;
        transform: translateX(-50%) translateY(-3px) scale(1.04, 1.05);
    }
}

@keyframes resonance-bond-updraft {

    0%,
    100% {
        opacity: 0.78;
        transform: translateY(5px) scaleX(0.94) scaleY(0.98);
    }

    50% {
        opacity: 1;
        transform: translateY(-8px) scaleX(1.1) scaleY(1.16);
    }
}

@keyframes resonance-bond-body-shimmer {

    0%,
    100% {
        opacity: 0.5;
        transform: translateY(3px) scale(0.96, 0.98);
    }

    50% {
        opacity: 0.82;
        transform: translateY(-5px) scale(1.05, 1.08);
    }
}

/* ── Training Palace ─────────────────────────────── */

.training-palace-node {
    position: absolute;
    right: 6%;
    bottom: 8%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    z-index: 15;
    animation: training-palace-float 3s ease-in-out infinite;
}

.training-palace-glow {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.35) 0%, transparent 70%);
    pointer-events: none;
    animation: training-palace-pulse 2.5s ease-in-out infinite;
}

.training-palace-icon {
    font-size: 2.8rem;
    line-height: 1;
    filter: drop-shadow(0 4px 12px rgba(14, 165, 233, 0.6));
    position: relative;
    z-index: 1;
}

.training-palace-label {
    font-size: 0.85rem;
    font-weight: 900;
    color: #bae6fd;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9), 0 0 12px rgba(14, 165, 233, 0.8);
    letter-spacing: 0.08em;
    white-space: nowrap;
    position: relative;
    z-index: 1;
    background: rgba(0,0,0,0.5);
    padding: 1px 6px;
    border-radius: 6px;
    border: 1px solid rgba(14, 165, 233, 0.3);
}

@keyframes training-palace-float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-5px); }
}

@keyframes training-palace-pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50%       { opacity: 1;   transform: scale(1.15); }
}


.training-stage-list::-webkit-scrollbar {
    width: 4px;
}
.training-stage-list::-webkit-scrollbar-thumb {
    background: rgba(14, 165, 233, 0.3);
    border-radius: 2px;
}

.training-stage-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    min-width: 0;
}

.training-stage-chip.is-selected {
    background: rgba(14, 165, 233, 0.15);
    border-color: rgba(14, 165, 233, 0.5);
    box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.2);
}

.training-stage-chip:active {
    transform: scale(0.95);
}

.training-stage-chip-num {
    font-size: 0.78rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.training-stage-chip.is-selected .training-stage-chip-num {
    color: rgba(14, 165, 233, 0.8);
}

.training-stage-chip-particle {
    font-size: 1rem;
    font-weight: 900;
    color: #e2e8f0;
    font-family: 'Noto Sans JP', sans-serif;
    flex-shrink: 0;
    min-width: 1.2ch;
}

.training-stage-chip-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.training-stage-chip.is-selected .training-stage-chip-label {
    color: rgba(186, 230, 253, 0.8);
}
