html,
body {
    height: 100%;
    margin: 0;
}

body {
    height: 100vh;
    margin: 0;
    display: grid;
    place-items: center;
    color: white;
    font-size: 2rem;
    font-family: system-ui, sans-serif;
    overflow: hidden;
}

/* Base class for rainbow text */
.rainbow-text {
    background: linear-gradient(to right,
            #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #8b00ff, #ff0000);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: rainbowShift 3s linear infinite;
    display: inline-block;
    /* Required for background-clip on some elements */
}

@keyframes rainbowShift {
    to {
        background-position: 200% center;
    }
}

.bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background-size: 150% 150%;
    animation: bgFlow 20s ease infinite;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    filter: saturate(2.5) contrast(2) brightness(1.2) hue-rotate(15deg);
    transform: translateZ(0);
    will-change: transform, opacity, filter;
}

.bg-layer.active {
    opacity: 1;
}

/* 
 * Stable HDR Layer
 * This layer stays at 100% opacity to prevent browser power-saving culling
 * while injecting raw HDR brightness into the color composition.
 */
.hdr-brightener {
    position: fixed;
    inset: 0;
    z-index: 0;
    /* Above backgrounds, below UI */
    pointer-events: none;
    /* Permanent subtle HDR baseglow */
    background: radial-gradient(circle at center, color(display-p3 1.5 1.2 1.8) 0%, transparent 80%);
    mix-blend-mode: plus-lighter;
    opacity: 1;
    transition: filter 0.1s ease-out, transform 0.1s ease-out;
    transform: translateZ(0);
    will-change: filter, transform;
}

/* Beat-reactive Flash Spike */
.hdr-brightener.flash {
    filter: brightness(3.5) saturate(3);
    transform: scale(1.1) translateZ(0);
    /* Immediate spike, no transition on entry for better sync */
    transition: none;
}

@keyframes bgFlow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.rain-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
}

.rain-container span {
    position: absolute;
    width: 2px;
    height: 20px;
    background: linear-gradient(transparent, rgba(255, 255, 255, 0.7));
    top: -20px;
    border-radius: 50%;
    animation: fall linear infinite;
}

@keyframes fall {
    to {
        transform: translateY(105vh);
    }
}

.page-center {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
}

.profile-card {
    width: min(92vw, 520px);
    padding: 22px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}

.avatar {
    width: 84px;
    height: 84px;
    border-radius: 18px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, .25);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .22);
}

@keyframes zoomavatar {
    0% {
        scale: 1;
        rotate: 0deg;
    }

    25% {
        scale: 2.5;
        rotate: 90deg;
    }

    50% {
        scale: 4;
        rotate: 180deg;
    }

    75% {
        scale: 2.5;
        rotate: 270deg;
    }

    100% {
        scale: 1;
        rotate: 360deg;
    }
}

.name {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    display: inline-block;
    animation: titleSpinZoom 1.5s infinite linear, rainbowShift 3s linear infinite;
    background: linear-gradient(to right,
            #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #8b00ff, #ff0000);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

@keyframes titleSpinZoom {
    0% {
        transform: scale(1) rotate(0deg);
    }

    50% {
        transform: scale(2) rotate(180deg);
    }

    100% {
        transform: scale(1) rotate(360deg);
    }
}

.bio {
    margin: 10px 0 0;
    line-height: 1.6;
    display: block;
    background: linear-gradient(to right,
            #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #8b00ff, #ff0000);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: rainbowShift 3s linear infinite;
}

.row {
    display: flex;
    gap: 16px;
    align-items: center;
}

.beian-link {
    display: block;
    text-align: center;
    margin: 14px 0 6px;
    font-size: clamp(11px, 2.3vw, 15px);
    text-decoration: none;
    background: linear-gradient(to right,
            #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #8b00ff, #ff0000);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: rainbowShift 3s linear infinite;
}

/* Ensure breathe and rainbow can co-exist */
.beian-link.breathe-link {
    animation: breatheEffect 0.5s infinite alternate ease-in-out, rainbowShift 3s linear infinite;
}

.breathe-link {
    animation: breatheEffect 0.5s infinite alternate ease-in-out;
}

@keyframes breatheEffect {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(2.6);
    }
}

.music-wrap {
    margin-top: 5px;
    display: flex;
    justify-content: center;
    overflow: hidden;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.music-wrap>div {
    width: 92%;
    max-width: 420px;
    transform: scale(0.65);
    transform-origin: center;
}

@media (max-width: 420px) {
    .row {
        flex-direction: column;
        align-items: flex-start;
    }

    .avatar {
        width: 92px;
        height: 92px;
        border-radius: 20px;
    }
}

.iframe-body-sty {
    position: relative;
    overflow: hidden;
    height: 400px;
    width: 400px !important;
    background-color: red;
}

.iframe-body-sty>#iframe-shrink {
    position: absolute;
    transform: scale(1);
    left: -400px;
    top: -170px;
}

.iframe-body-sty-1 {
    position: relative;
    overflow: hidden;
    height: 400px;
    width: 400px !important;
    background-color: red;
}

.iframe-body-sty-1>#iframe-shrink-1 {
    position: absolute;
    transform: scale(1);
    left: -400px;
    top: -170px;
}

#l2d1,
#morel2d,
#iframe-body-sty,
#iframe-body-sty-1 {
    width: 400px !important;
    max-width: 400px !important;
    min-width: 400px !important;
    overflow: hidden;
    display: block;
}

#l2d1,
#zhiren {
    position: fixed;
    z-index: 9999;
}

.ad-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.ad-backdrop.active {
    opacity: 1;
}

.ad-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 999;
    display: none;
}

.ad-overlay.active {
    display: block;
}

.ad-modal {
    position: relative;
    background: white;
    padding: 40px 30px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 400px;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.4s ease;
}

.ad-backdrop.active .ad-modal {
    transform: translateY(0);
    opacity: 1;
}

.ad-modal img {
    width: 100%;
    max-width: 250px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.ad-modal p {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 25px;
    line-height: 1.5;
}

.ad-modal .go-button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    display: block;
    width: 80%;
    margin: 0 auto;
}

.ad-modal .go-button:hover {
    background-color: #0056b3;
    transform: scale(1.05);
}

.ad-modal .close-button {
    position: absolute;
    background: #e9ecef;
    color: #6c757d;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 30px;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.ad-modal .close-button:hover {
    background: #dc3545;
    color: white;
}

#real-close-btn {
    bottom: 10px;
    right: 10px;
}

.fake-close-button {
    opacity: 0.5;
    cursor: not-allowed;
}

.firework-particle {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    width: 6px;
    height: 6px;
    background-color: var(--p-color);
    animation: crazyFirework 1.5s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
    will-change: transform, opacity;
    mix-blend-mode: plus-lighter;
}

@keyframes crazyFirework {
    0% {
        transform: translate(0, 0) scale(0) rotate(0deg) skew(0deg);
        opacity: 1;
    }

    30% {
        transform: translate(calc(var(--tx) * 0.4), calc(var(--ty) * 0.4)) scale(15) rotate(180deg) skew(50deg);
        opacity: 1;
        filter: brightness(3);
    }

    70% {
        transform: translate(calc(var(--tx) * 0.8), calc(var(--ty) * 0.8)) scale(8) rotate(360deg) skew(-40deg);
        opacity: 0.8;
    }

    100% {
        transform: translate(var(--tx), var(--ty)) scale(0.1) rotate(720deg) skew(90deg);
        opacity: 0;
    }
}

/* MDUI Overrides (Ensuring secondary text is ALWAYS rainbow) */
.mdui-text-color-white-secondary,
.profile-card .mdui-text-color-white-secondary {
    background: linear-gradient(to right,
            #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #8b00ff, #ff0000) !important;
    background-size: 200% auto !important;
    background-clip: text !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
    animation: rainbowShift 3s linear infinite !important;
    display: inline-block !important;
}