/* ================= 赛博氛围增强 ================= */

/* CRT 扫描线叠加层 */
body::after {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
    pointer-events: none;
    z-index: 9998;
}

/* 全局扫描线动画 */
body::before {
    content: '';
    position: fixed;
    top: -10px;
    left: 0;
    width: 100%;
    height: 8px;
    background: linear-gradient(transparent, rgba(0, 255, 255, 0.08), transparent);
    animation: scanline-move 8s linear infinite;
    pointer-events: none;
    z-index: 9997;
}

@keyframes scanline-move {
    0%   { top: -10px; }
    100% { top: 100vh; }
}

/* 霓虹闪烁 */
@keyframes neon-flicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
        opacity: 1;
        text-shadow: 0 0 5px currentColor, 0 0 10px currentColor;
    }
    20%, 24%, 55% {
        opacity: 0.6;
        text-shadow: none;
    }
}

/* ================= 赛博过载开场 ================= */
.cyber-intro-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background-color: #000;
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* CRT 扫描线叠加 */
.cyber-intro-overlay::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 2px,
        rgba(0, 255, 255, 0.03) 2px,
        rgba(0, 255, 255, 0.03) 4px
    );
    animation: overlay-scan 0.5s linear infinite;
    pointer-events: none;
}

@keyframes overlay-scan {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

/* 垂直扫描光带 */
.cyber-intro-overlay::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(
        transparent 0%,
        rgba(0, 255, 255, 0.05) 50%,
        transparent 100%
    );
    animation: glitch-scan 3s linear infinite;
    pointer-events: none;
}

@keyframes glitch-scan {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

.cyber-core {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    animation: coreReveal 1.2s cubic-bezier(0.1, 1, 0.2, 1) 3s both;
}

@keyframes coreReveal {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); filter: blur(20px); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); filter: blur(0); }
}

.tech-rings { position: absolute; width: 500px; height: 500px; z-index: -1; opacity: 0.35; }
.ring { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); border-radius: 50%; border: 2px solid transparent; }
.ring-1 { width: 480px; height: 480px; border-top-color: #0ff; border-left-color: #0ff; animation: spin 6s linear infinite; }
.ring-2 { width: 440px; height: 440px; border-bottom-color: #f0f; border-right-color: #f0f; border-style: dashed; animation: spin-reverse 8s linear infinite; }
.ring-3 { width: 400px; height: 400px; border-top-color: rgba(0, 255, 255, 0.5); border-bottom-color: rgba(0, 255, 255, 0.5); animation: spin 12s steps(24) infinite; }

@keyframes spin { 100% { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes spin-reverse { 100% { transform: translate(-50%, -50%) rotate(-360deg); } }

.glitch-title {
    font-family: 'Courier New', Courier, monospace;
    font-size: 5rem;
    font-weight: 900;
    color: #fff;
    position: relative;
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.8);
    letter-spacing: 8px;
    margin: 0;
}

.glitch-title::before, .glitch-title::after {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: transparent;
}

.glitch-title::before { left: 4px; text-shadow: -2px 0 red; animation: glitch-anim-1 2.5s infinite linear alternate-reverse; }
.glitch-title::after { left: -4px; text-shadow: -2px 0 cyan; animation: glitch-anim-2 3s infinite linear alternate-reverse; }

@keyframes glitch-anim-1 {
    0% { clip-path: inset(20% 0 80% 0); }
    20% { clip-path: inset(60% 0 10% 0); }
    40% { clip-path: inset(40% 0 50% 0); }
    60% { clip-path: inset(80% 0 5% 0); }
    80% { clip-path: inset(10% 0 70% 0); }
    100% { clip-path: inset(30% 0 20% 0); }
}

@keyframes glitch-anim-2 {
    0% { clip-path: inset(10% 0 60% 0); }
    20% { clip-path: inset(30% 0 20% 0); }
    40% { clip-path: inset(70% 0 10% 0); }
    60% { clip-path: inset(20% 0 50% 0); }
    80% { clip-path: inset(50% 0 30% 0); }
    100% { clip-path: inset(5% 0 80% 0); }
}

.blink-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.2rem;
    color: #0ff;
    text-shadow: 0 0 5px #0ff;
    letter-spacing: 2px;
    margin-top: 20px;
    display: inline-block;
    animation: pulse-text 2s infinite, glitch-text 0.1s infinite alternate;
}

@keyframes pulse-text {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; text-shadow: 0 0 15px #0ff; }
}

@keyframes glitch-text {
    0% { transform: translate(0); }
    20% { transform: translate(-1px, 1px); }
    40% { transform: translate(1px, -1px); }
    60% { transform: translate(-1px, -1px); }
    80% { transform: translate(1px, 1px); }
    100% { transform: translate(0); }
}

/* ================= 打破第四面墙 ================= */

/* 系统日志弹窗 */
.meta-log {
    position: fixed;
    bottom: 20px;
    right: 200px;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(0, 255, 255, 0.4);
    border-left: 3px solid #0ff;
    padding: 10px 16px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #0ff;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
    z-index: 9999;
    pointer-events: none;
    max-width: 300px;
    animation: metaLogIn 0.3s ease-out;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.15);
}

.meta-log.warn {
    border-left-color: #ff0;
    color: #ff0;
    text-shadow: 0 0 5px rgba(255, 255, 0, 0.5);
}

.meta-log.system {
    border-left-color: #f0f;
    color: #f0f;
    text-shadow: 0 0 5px rgba(255, 0, 255, 0.5);
}

@keyframes metaLogIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes metaLogOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(20px); }
}

/* 气泡提示 */
.meta-bubble {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    background: rgba(0, 15, 0, 0.9);
    border: 1px solid rgba(255, 0, 255, 0.5);
    color: #f0f;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    padding: 8px 14px;
    border-radius: 4px;
    text-shadow: 0 0 5px rgba(255, 0, 255, 0.5);
    animation: bubbleFade 3s ease-in-out forwards;
    white-space: nowrap;
}

@keyframes bubbleFade {
    0% { opacity: 0; transform: translateY(5px); }
    15% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* ================= 挂件 ================= */
#live2d-widget {
    position: fixed !important;
    bottom: 0 !important;
    right: 0 !important;
    z-index: 9999;
}
