@font-face {
    font-family: "PoxiaoPixel";
    src: url("../fonts/PoxiaoPixel.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: block;
}

/* ====== 全局重置与布局 ====== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #54e3d9;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    position: fixed;
    top: 0;
    left: 0;
    font-family: "PoxiaoPixel";
}

#mainCanvas {
    display: block;
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background: #54e3d9;
}

.intro-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    overflow: hidden;
    pointer-events: auto;
    background:
        radial-gradient(circle at 50% 42%, rgba(152, 0, 43, 0.34) 0%, rgba(78, 0, 26, 0.22) 26%, rgba(12, 0, 8, 0.94) 72%),
        linear-gradient(180deg, rgba(4, 10, 18, 0.9), rgba(8, 0, 3, 0.98));
    transform-origin: center center;
    animation: intro-overlay-exit 0.9s cubic-bezier(0.76, 0, 0.24, 1) 2.5s forwards;
}

.intro-shake-layer {
    position: absolute;
    inset: 0;
    animation: intro-screen-shake 0.2s steps(2, end) 1.2s 1;
}

.intro-vignette {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 58%, rgba(255, 215, 0, 0.05) 0%, rgba(255, 215, 0, 0) 24%),
        radial-gradient(circle at 50% 52%, rgba(0, 255, 255, 0.08) 0%, rgba(0, 255, 255, 0) 30%);
    mix-blend-mode: screen;
    opacity: 0.85;
}

.intro-incense {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, 14vh);
    color: #0ff;
    font-size: clamp(24px, 5.2vw, 44px);
    line-height: 1.2;
    letter-spacing: 0.28em;
    white-space: nowrap;
    text-shadow:
        0 0 8px rgba(0, 255, 255, 0.95),
        0 0 18px rgba(0, 255, 255, 0.65),
        0 0 36px rgba(0, 255, 255, 0.35);
    opacity: 0;
    animation: intro-incense-rise 1.2s cubic-bezier(0.22, 0.68, 0.18, 1) forwards;
}

.intro-stamp-wrap {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(52vw, 280px);
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
}

.intro-shockwave {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 22%;
    aspect-ratio: 1;
    border: 4px solid rgba(255, 215, 0, 0.95);
    border-radius: 50%;
    box-shadow:
        0 0 10px rgba(255, 215, 0, 0.95),
        0 0 28px rgba(255, 215, 0, 0.55);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.18);
    animation: intro-shockwave-ring 0.55s ease-out 1.3s forwards;
}

.intro-stamp {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    place-items: center;
    padding: 14%;
    color: #ffeaa0;
    background:
        linear-gradient(180deg, rgba(255, 58, 170, 0.78), rgba(116, 0, 56, 0.9)),
        radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 42%);
    border: 8px solid #ffd700;
    outline: 3px solid rgba(255, 244, 176, 0.95);
    outline-offset: -10px;
    box-shadow:
        0 0 0 2px rgba(60, 0, 23, 0.92) inset,
        0 0 18px rgba(255, 215, 0, 0.9),
        0 0 42px rgba(255, 0, 170, 0.42),
        0 26px 34px rgba(0, 0, 0, 0.42);
    opacity: 0;
    transform: translateY(-62vh) scale(3) rotate(-12deg);
    animation: intro-stamp-slam 0.92s cubic-bezier(0.18, 1.18, 0.34, 1) 1.2s forwards;
}

.intro-stamp::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 2px solid rgba(255, 247, 201, 0.82);
    pointer-events: none;
}

.intro-stamp::after {
    content: "";
    position: absolute;
    inset: -16%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.2) 0%, rgba(255, 215, 0, 0) 68%);
    filter: blur(10px);
    z-index: -1;
}

.intro-stamp span {
    font-size: clamp(42px, 10vw, 78px);
    line-height: 1;
    text-shadow:
        0 0 6px rgba(255, 245, 185, 0.9),
        0 0 18px rgba(255, 215, 0, 0.72),
        3px 3px 0 rgba(82, 0, 31, 0.95);
}

.intro-overlay.is-done {
    display: none;
    pointer-events: none;
}

@keyframes intro-incense-rise {
    0% {
        opacity: 0;
        transform: translate(-50%, 26vh) translateX(-8px);
        filter: blur(8px);
    }
    18% {
        opacity: 0.42;
        transform: translate(-50%, 18vh) translateX(4px);
        filter: blur(3px);
    }
    45% {
        opacity: 0.82;
        transform: translate(-50%, 8vh) translateX(-4px);
        filter: blur(1px);
    }
    72% {
        opacity: 1;
        transform: translate(-50%, -2vh) translateX(3px);
        filter: blur(0);
    }
    100% {
        opacity: 0.94;
        transform: translate(-50%, -8vh) translateX(0);
        filter: blur(0);
    }
}

@keyframes intro-stamp-slam {
    0% {
        opacity: 0;
        transform: translateY(-62vh) scale(3) rotate(-12deg);
    }
    52% {
        opacity: 1;
        transform: translateY(0) scale(0.9) rotate(0deg);
    }
    68% {
        opacity: 1;
        transform: translateY(-3.5vh) scale(1.08) rotate(1deg);
    }
    82% {
        opacity: 1;
        transform: translateY(0.8vh) scale(0.97) rotate(-0.5deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
    }
}

.fortune-overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: max(32px, env(safe-area-inset-top)) 18px 32px;
    pointer-events: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.fortune-overlay::before,
.fortune-overlay::after {
    content: "";
    flex: auto;
}

.fortune-overlay[hidden] {
    display: none !important;
}

.fortune-shell {
    position: relative;
    width: min(92vw, 430px);
    isolation: isolate;
    flex-shrink: 0;
}

.fortune-panel {
    position: relative;
    z-index: 1;
    background:
        linear-gradient(180deg, #160f29, #0d0818),
        repeating-linear-gradient(
            0deg,
            rgba(0, 243, 255, 0.03) 0 2px,
            rgba(0, 243, 255, 0) 2px 6px
        ),
        #0d0818;
    border: 4px solid #00f3ff;
    box-shadow:
        0 0 0 4px #0d0818 inset,
        0 0 0 8px rgba(0, 243, 255, 0.15) inset,
        8px 8px 0 rgba(0, 0, 0, 0.8),
        0 0 20px rgba(0, 243, 255, 0.3);
    padding: 70px 24px 24px;
}

.fortune-panel::before,
.fortune-panel::after {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    background: #ff007a;
    box-shadow: 0 0 8px rgba(255, 0, 122, 0.6);
}

.fortune-panel::before {
    left: 12px;
    top: 12px;
}

.fortune-panel::after {
    right: 12px;
    bottom: 12px;
}

.fortune-back {
    position: absolute;
    left: 0;
    top: -6px;
    z-index: 3;
    min-width: 92px;
    height: 42px;
    border: 3px solid #00f3ff;
    background: linear-gradient(180deg, #0f2540, #081426);
    color: #00f3ff;
    font: 15px "PoxiaoPixel", sans-serif;
    box-shadow:
        0 0 0 3px #050a14 inset,
        4px 4px 0 rgba(0, 0, 0, 0.9),
        0 0 12px rgba(0, 243, 255, 0.4);
}

.fortune-title {
    margin: 0 auto 16px;
    width: fit-content;
    padding: 10px 18px 8px;
    border: 3px solid #ffbd00;
    background:
        linear-gradient(180deg, #ff007a, #b30056),
        #ff007a;
    color: #ffffff;
    text-align: center;
    font-size: 26px;
    letter-spacing: 0.08em;
    box-shadow:
        0 0 0 3px #4d0025 inset,
        4px 4px 0 rgba(0, 0, 0, 0.92);
    text-shadow:
        0 2px 0 #b30056,
        0 0 8px rgba(255, 0, 122, 0.8);
}

.fortune-rule {
    min-height: 86px;
    padding: 14px 14px 12px;
    border: 3px solid #00f3ff;
    background:
        linear-gradient(180deg, rgba(0, 243, 255, 0.08), rgba(0, 243, 255, 0.03)),
        repeating-linear-gradient(
            180deg,
            rgba(0, 243, 255, 0.05) 0 2px,
            rgba(0, 243, 255, 0) 2px 8px
        ),
        #0d0818;
    color: #e0ffff;
    text-align: center;
    line-height: 1.8;
    font-size: 15px;
    box-shadow:
        0 0 0 3px #050a14 inset,
        0 0 14px rgba(0, 243, 255, 0.15);
    text-shadow: none;
}

.fortune-core {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 260px;
    margin: 14px 0 18px;
    border: 4px solid #ff007a;
    background: radial-gradient(circle at center, #2a1145 0%, #0a0414 100%);
    box-shadow:
        0 0 0 4px #0a0414 inset,
        0 0 16px rgba(255, 0, 122, 0.2);
}

.fortune-tube-wrap {
    position: relative;
    width: 172px;
    height: 228px;
}

.fortune-tube-wrap.is-shaking {
    animation: fortune-tube-shake 0.14s steps(2, end) 11;
}

.fortune-tube-glow {
    position: absolute;
    inset: 10px;
    background: radial-gradient(circle, rgba(255, 189, 0, 0.4) 0%, rgba(255, 0, 122, 0.2) 40%, rgba(0, 0, 0, 0) 70%);
    filter: blur(12px);
}

.fortune-stick {
    position: absolute;
    left: 50%;
    bottom: 110px;
    width: 56px;
    height: auto;
    transform: translateX(-50%);
    z-index: 1;
    opacity: 0;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

.fortune-stick.is-rising {
    animation: fortune-stick-rise 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.fortune-tube {
    position: absolute;
    left: 50%;
    bottom: 10px;
    width: 140px;
    height: auto;
    transform: translateX(-50%);
    z-index: 2;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.6));
}

.fortune-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fortune-primary,
.fortune-secondary,
.fortune-modal-cancel,
.fortune-modal-confirm {
    border: 3px solid #00f3ff;
    background: linear-gradient(180deg, #0f2540, #081426);
    color: #00f3ff;
    font: 15px "PoxiaoPixel", sans-serif;
    padding: 14px 16px 12px;
    box-shadow:
        0 0 0 3px #050a14 inset,
        4px 4px 0 rgba(0, 0, 0, 0.92);
    transition: transform 0.08s steps(2, end), box-shadow 0.08s steps(2, end);
}

.fortune-primary:active,
.fortune-secondary:active,
.fortune-modal-cancel:active,
.fortune-modal-confirm:active {
    transform: translate(4px, 4px);
    box-shadow:
        0 0 0 3px #050a14 inset,
        0 0 6px rgba(0, 243, 255, 0.2);
}

.fortune-primary,
.fortune-modal-confirm {
    border-color: #ffbd00;
    background: linear-gradient(180deg, #ff007a, #b30056);
    color: #ffffff;
    box-shadow:
        0 0 0 3px #4d0025 inset,
        4px 4px 0 rgba(0, 0, 0, 0.92),
        0 0 12px rgba(255, 0, 122, 0.4);
}

.fortune-primary:active,
.fortune-modal-confirm:active {
    box-shadow:
        0 0 0 3px #4d0025 inset,
        0 0 8px rgba(255, 0, 122, 0.5);
}

.fortune-primary:disabled,
.fortune-secondary:disabled {
    opacity: 0.55;
}

.fortune-modal {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(22, 10, 7, 0.72);
    pointer-events: auto;
}

.fortune-modal[hidden] {
    display: none !important;
}

.fortune-modal-card {
    position: relative;
    z-index: 1;
    width: 100%;
    background:
        linear-gradient(180deg, #160f29, #0d0818),
        repeating-linear-gradient(
            0deg,
            rgba(0, 243, 255, 0.05) 0 2px,
            rgba(0, 243, 255, 0) 2px 6px
        );
    border: 4px solid #ff007a;
    box-shadow:
        0 0 0 4px #0d0818 inset,
        0 0 16px rgba(255, 0, 122, 0.4);
    padding: 24px 20px 20px;
}

.fortune-modal-card::before,
.fortune-modal-card::after {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    background: #ffbd00;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(255, 189, 0, 0.6);
}

.fortune-modal-card::before {
    left: 10px;
    top: 10px;
}

.fortune-modal-card::after {
    right: 10px;
    bottom: 10px;
}

.fortune-modal-title {
    color: #ffbd00;
    text-align: center;
    font-size: 22px;
    margin-bottom: 14px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    font-weight: bold;
}

.fortune-modal-body {
    color: #e0ffff;
    text-align: center;
    line-height: 1.8;
    font-size: 15px;
    min-height: 104px;
    font-weight: bold;
    text-shadow: 0 2px 2px rgba(0, 0, 0, 0.8);
}

.fortune-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.fortune-modal-cancel,
.fortune-modal-confirm {
    flex: 1;
}

@keyframes fortune-tube-shake {
    0% { transform: translateX(0) rotate(0deg); }
    20% { transform: translateX(-8px) rotate(-3deg); }
    40% { transform: translateX(8px) rotate(3deg); }
    60% { transform: translateX(-6px) rotate(-2deg); }
    80% { transform: translateX(6px) rotate(2deg); }
    100% { transform: translateX(0) rotate(0deg); }
}

@keyframes fortune-stick-rise {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(40px);
    }
    20% {
        opacity: 1;
        transform: translateX(-50%) translateY(0px);
    }
    70% {
        opacity: 1;
        transform: translateX(-50%) translateY(-110px);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(-130px);
    }
}

@keyframes intro-screen-shake {
    0% {
        transform: translate(0, 0);
    }
    12% {
        transform: translate(5px, -4px);
    }
    24% {
        transform: translate(-6px, 5px);
    }
    36% {
        transform: translate(4px, 3px);
    }
    48% {
        transform: translate(-5px, -4px);
    }
    60% {
        transform: translate(3px, 5px);
    }
    72% {
        transform: translate(-4px, 2px);
    }
    84% {
        transform: translate(2px, -3px);
    }
    100% {
        transform: translate(0, 0);
    }
}

@keyframes intro-shockwave-ring {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.18);
    }
    18% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(5.4);
    }
}

@keyframes intro-overlay-exit {
    0% {
        opacity: 1;
        transform: scaleY(1);
        filter: brightness(1);
    }
    68% {
        opacity: 1;
        transform: scaleY(0.08);
        filter: brightness(1.45);
    }
    100% {
        opacity: 0;
        transform: scaleY(0.015);
        filter: brightness(2);
    }
}

@keyframes worship-desktop-pulse {
    0%, 100% { opacity: 0.55; }
    50%       { opacity: 1; }
}

#meritBadge {
    position: fixed;
    top: max(14px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
    z-index: 20;
    padding: 10px 14px;
    color: #fff2c1;
    background: rgba(36, 17, 63, 0.9);
    border: 3px solid #63efff;
    outline: 3px solid #ff58b3;
    outline-offset: -7px;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.18);
    font-size: 14px;
    letter-spacing: 0.5px;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
}

.toast-host {
    position: fixed;
    left: 50%;
    top: calc(max(18px, env(safe-area-inset-top)) + 54px);
    transform: translateX(-50%);
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    pointer-events: none;
}

.toast {
    min-width: 220px;
    max-width: min(86vw, 360px);
    padding: 12px 16px;
    color: #fff2c1;
    background: rgba(36, 17, 63, 0.94);
    border: 3px solid #63efff;
    outline: 3px solid #ff58b3;
    outline-offset: -7px;
    text-align: center;
    line-height: 1.4;
    font-size: 13px;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    border-color: #ffd84c;
}

.toast-warning {
    border-color: #ff8a3d;
}

.toast-danger {
    border-color: #ff5a48;
}

@media (max-width: 520px) and (orientation: portrait) {
    #meritBadge {
        top: max(10px, env(safe-area-inset-top));
        right: max(10px, env(safe-area-inset-right));
        padding: 8px 10px;
        border-width: 2px;
        outline-width: 2px;
        outline-offset: -5px;
        font-size: 12px;
        letter-spacing: 0;
    }

    .toast-host {
        top: calc(max(12px, env(safe-area-inset-top)) + 40px);
    }
}

/* ====== 错误提示覆盖层 ====== */
#errorOverlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(23, 11, 47, 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

#errorMessage {
    color: #fff2c1;
    font-size: 18px;
    text-align: center;
    padding: 30px;
    background: #30175a;
    border: 4px solid #63efff;
    max-width: 80%;
    line-height: 1.6;
    box-shadow: none;
    outline: 4px solid #ff58b3;
    outline-offset: -10px;
    font-family: "PoxiaoPixel";
}

.share-poster-host {
    position: fixed;
    left: -9999px;
    top: 0;
    width: 430px;
    pointer-events: none;
    opacity: 0;
}

.share-poster {
    position: relative;
    width: 430px;
    min-height: 760px;
    padding: 28px 28px 30px;
    color: #fff2c1;
    background:
        radial-gradient(circle at 18% 16%, rgba(255, 88, 179, 0.35), rgba(255, 88, 179, 0) 28%),
        radial-gradient(circle at 82% 18%, rgba(99, 239, 255, 0.28), rgba(99, 239, 255, 0) 30%),
        linear-gradient(180deg, rgba(17, 9, 40, 0.98), rgba(35, 18, 74, 0.99));
    border: 4px solid #63efff;
    outline: 4px solid #ff58b3;
    outline-offset: -10px;
    overflow: hidden;
    box-shadow: 0 0 0 4px rgba(21, 10, 38, 0.7) inset;
}

.share-poster-grid,
.share-poster-scanline {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.share-poster-grid {
    background-image:
        linear-gradient(rgba(99, 239, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 239, 255, 0.1) 1px, transparent 1px);
    background-size: 22px 22px;
    opacity: 0.4;
}

.share-poster-scanline {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0) 16%);
    mix-blend-mode: screen;
}

.share-poster-header,
.share-poster-main,
.share-poster-footer {
    position: relative;
    z-index: 1;
}

.share-poster-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
}

.share-poster-tag {
    padding: 8px 12px;
    color: #130c2b;
    background: #63efff;
    font-size: 14px;
    letter-spacing: 1px;
}

.share-poster-name {
    max-width: 220px;
    color: #ffea00;
    font-size: 22px;
    text-align: right;
    text-shadow: 0 0 10px rgba(255, 234, 0, 0.5);
}

.share-poster-main {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.share-poster-god-wrap,
.share-poster-copy,
.share-poster-footer {
    background: rgba(17, 10, 40, 0.56);
    border: 3px solid rgba(99, 239, 255, 0.86);
    box-shadow: 0 0 0 3px rgba(255, 88, 179, 0.28) inset;
}

.share-poster-god-wrap {
    padding: 18px;
}

.share-poster-god-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 330px;
    background:
        radial-gradient(circle, rgba(255, 216, 76, 0.2), rgba(255, 216, 76, 0) 62%),
        linear-gradient(180deg, rgba(255, 88, 179, 0.18), rgba(99, 239, 255, 0.1));
    border: 3px solid rgba(255, 216, 76, 0.8);
}

.share-poster-god {
    max-width: 100%;
    max-height: 300px;
    display: block;
    image-rendering: pixelated;
    filter:
        drop-shadow(0 0 8px rgba(99, 239, 255, 0.55))
        drop-shadow(0 0 18px rgba(255, 88, 179, 0.35));
}

.share-poster-god-name {
    margin-top: 14px;
    color: #63efff;
    font-size: 22px;
    text-align: center;
}

.share-poster-copy {
    padding: 20px 18px;
}

.share-poster-copy-label {
    color: #63efff;
    font-size: 15px;
    margin-bottom: 12px;
}

.share-poster-blessing {
    color: #ffea00;
    font-size: 34px;
    line-height: 1.25;
    text-shadow:
        0 0 8px rgba(255, 234, 0, 0.5),
        0 0 18px rgba(255, 88, 179, 0.3);
}

.share-poster-quote {
    margin-top: 14px;
    color: #fff2c1;
    font-size: 18px;
    line-height: 1.6;
}

.share-poster-footer {
    margin-top: 24px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 18px;
}

.share-poster-qr {
    width: 98px;
    height: 98px;
    flex: 0 0 98px;
    image-rendering: pixelated;
    background: #fff;
    border: 3px solid #ffea00;
}

.share-poster-entry-title {
    color: #ff58b3;
    font-size: 20px;
    margin-bottom: 10px;
}

.share-poster-entry-sub {
    color: #fff2c1;
    font-size: 14px;
    line-height: 1.5;
}

.poster-overlay {
    position: fixed;
    inset: 0;
    z-index: 9997;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background:
        radial-gradient(circle at 50% 22%, rgba(99, 239, 255, 0.18), rgba(99, 239, 255, 0) 30%),
        rgba(8, 6, 20, 0.92);
    backdrop-filter: blur(6px);
}

.poster-overlay[hidden] {
    display: none;
}

.poster-overlay-inner {
    width: min(100%, 460px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.poster-preview-image {
    width: 100%;
    max-height: 76vh;
    object-fit: contain;
    image-rendering: pixelated;
    border: 3px solid #63efff;
    outline: 3px solid #ff58b3;
    outline-offset: -9px;
    box-shadow: 0 0 26px rgba(99, 239, 255, 0.24);
}

.poster-overlay-tip {
    color: #ffea00;
    font-size: 15px;
    text-align: center;
    line-height: 1.6;
    text-shadow: 0 0 10px rgba(255, 234, 0, 0.35);
}

.poster-overlay-actions {
    display: flex;
    gap: 12px;
    width: 100%;
}

.poster-overlay-btn {
    flex: 1;
    padding: 12px 10px;
    border: 3px solid #ffd84c;
    background: rgba(255, 216, 76, 0.14);
    color: #fff2c1;
    font: inherit;
    cursor: pointer;
}

.poster-overlay-btn-secondary {
    border-color: #63efff;
    background: rgba(99, 239, 255, 0.12);
}

/* 安全区域适配 (iPhone X+) */
@supports (padding: env(safe-area-inset-top)) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* ====== 全局 BGM 图标 ====== */
.bgm-toggle {
    position: fixed;
    top: max(16px, env(safe-area-inset-top));
    left: max(16px, env(safe-area-inset-left));
    z-index: 9000;
    width: 40px;
    height: 40px;
    background: rgba(36, 17, 63, 0.7);
    border: 2px solid #63efff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 0 10px rgba(99, 239, 255, 0.4);
    transition: transform 0.2s;
}

.bgm-toggle:active {
    transform: scale(0.9);
}

.bgm-icon {
    font-size: 20px;
    line-height: 1;
    user-select: none;
}

.bgm-icon.is-playing {
    animation: bgm-rotate 4s linear infinite;
}

.bgm-cross {
    position: absolute;
    width: 100%;
    height: 3px;
    background: #ff2a2a;
    transform: rotate(45deg);
    box-shadow: 0 0 4px #000;
    display: none;
}

.bgm-toggle.is-muted .bgm-cross {
    display: block;
}

@keyframes bgm-rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
