/**
 * 蘑菇王彩蛋 — 首頁 footer 互動
 */
.mushmom-egg {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 0;
    z-index: 60;
    pointer-events: none;
    overflow: visible;
}

.mushmom-egg__actor {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 72px;
    pointer-events: auto;
    cursor: crosshair;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    will-change: left, bottom;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35));
    z-index: 2;
}

.mushmom-egg__actor.is-hit {
    animation: mushmom-hit-shake 0.28s ease;
}

.mushmom-egg__actor.is-dodge {
    transition: left 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2), bottom 0.18s ease;
}

.mushmom-egg__sprite {
    display: block;
    width: 72px;
    height: auto;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    pointer-events: none;
}

.mushmom-egg__hp {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
    width: 64px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 5;
}

.mushmom-egg__hp.is-visible {
    opacity: 1;
}

.mushmom-egg__hp-label {
    display: block;
    text-align: center;
    font-size: 10px;
    font-weight: 800;
    color: #fff8e7;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    margin-bottom: 2px;
    letter-spacing: 0.02em;
}

.mushmom-egg__hp-track {
    height: 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 248, 231, 0.35);
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.mushmom-egg__hp-fill {
    height: 100%;
    width: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #e74c3c 0%, #f39c12 55%, #2ecc71 100%);
    background-size: 64px 100%;
    background-repeat: no-repeat;
    transition: width 0.25s ease;
}

.mushmom-egg__hp-fill.is-critical {
    background: linear-gradient(90deg, #c0392b, #e74c3c);
    animation: mushmom-hp-pulse 0.7s ease infinite;
}

.mushmom-egg__bubble {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 36px);
    transform: translateX(-50%) translateY(4px) scale(0.96);
    min-width: 72px;
    max-width: 180px;
    padding: 7px 11px;
    border-radius: 12px;
    background: #fffdf6;
    border: 2px solid #e5b842;
    color: #2d1f17;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
    white-space: normal;
    word-break: keep-all;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    z-index: 20;
}

.mushmom-egg__bubble::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -8px;
    margin-left: -7px;
    border: 7px solid transparent;
    border-top-color: #fffdf6;
    filter: drop-shadow(0 1px 0 #e5b842);
}

.mushmom-egg__bubble.is-show,
.mushmom-egg__bubble[data-visible="1"] {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
}

.mushmom-egg__fx {
    position: absolute;
    left: 50%;
    top: 40%;
    width: 56px;
    height: 56px;
    margin: -28px 0 0 -28px;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(circle, rgba(255, 220, 80, 0.85) 0%, rgba(255, 80, 40, 0.35) 45%, transparent 70%);
}

.mushmom-egg__fx.is-burst {
    animation: mushmom-burst 0.35s ease-out forwards;
}

.mushmom-egg__slash {
    position: absolute;
    left: 50%;
    top: 35%;
    width: 52px;
    height: 4px;
    margin-left: -26px;
    background: linear-gradient(90deg, transparent, #fff8e7, #ff6b3d, transparent);
    border-radius: 2px;
    opacity: 0;
    pointer-events: none;
    transform: rotate(-28deg) scaleX(0.2);
}

.mushmom-egg__slash.is-slash {
    animation: mushmom-slash 0.28s ease-out forwards;
}

@keyframes mushmom-hit-shake {
    0%, 100% { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35)); }
    25% { filter: drop-shadow(0 0 8px rgba(255, 60, 40, 0.9)) brightness(1.35); }
    50% { filter: drop-shadow(0 0 10px rgba(255, 200, 40, 0.8)) brightness(1.2); }
    75% { filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35)) brightness(1.1); }
}

@keyframes mushmom-burst {
    0% { opacity: 0.95; transform: scale(0.4); }
    100% { opacity: 0; transform: scale(1.6); }
}

@keyframes mushmom-slash {
    0% { opacity: 1; transform: rotate(-28deg) scaleX(0.2); }
    40% { opacity: 1; transform: rotate(-28deg) scaleX(1.1); }
    100% { opacity: 0; transform: rotate(-28deg) scaleX(1.3) translateX(8px); }
}

@keyframes mushmom-hp-pulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.35); }
}

@media (max-width: 600px) {
    .mushmom-egg__actor {
        width: 58px;
    }
    .mushmom-egg__sprite {
        width: 58px;
    }
    .mushmom-egg__bubble {
        font-size: 11px;
        max-width: 130px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mushmom-egg__actor.is-hit,
    .mushmom-egg__fx.is-burst,
    .mushmom-egg__slash.is-slash,
    .mushmom-egg__hp-fill.is-critical {
        animation: none;
    }
}
