:root {
    --bg-liquid-1: #c3e2f7;
    --bg-liquid-2: #e0f2f7;
    --bg-liquid-3: #f0e6fa;
    --text-main: #2d3436;
    --text-sub: #636e72;
    --card-shadow: 0 20px 60px rgba(31, 38, 135, 0.15);
    --visualizer-color: #2d3436;
    --particle-color: 45, 52, 54;
}

body.dark-mode {
    --bg-liquid-1: #0f1c2b;
    --bg-liquid-2: #1a2a3a;
    --bg-liquid-3: #223545;
    --text-main: #e0e7eb;
    --text-sub: #b2bec3;
    --card-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    --visualizer-color: #e0e7eb;
    --particle-color: 224, 231, 235;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Poppins', 'Noto Sans SC', system-ui, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #1a2a3a;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(120, 180, 255, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(200, 160, 255, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(160, 250, 200, 0.35) 0%, transparent 50%),
        radial-gradient(ellipse at 10% 90%, rgba(255, 180, 220, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 90% 70%, rgba(255, 220, 150, 0.3) 0%, transparent 50%);
    background-size: 100% 100%;
    color: var(--text-main);
    overflow: hidden;
    transition: color 0.8s ease;
    perspective: 1000px;
}

/* 动态背景网格 - 折射素材层 */
.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.07) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(ellipse 80% 70% at 50% 50%, black, transparent);
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 50%, black, transparent);
}

#interactive-lines {
    position: fixed; inset: 0;
    width: 100%; height: 100%;
    z-index: 1; pointer-events: none;
}

.liquid-particles {
    position: absolute; inset: 0;
    pointer-events: none; overflow: hidden; z-index: 0;
}

.liquid-particle {
    position: absolute;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.12), transparent);
    border-radius: 50%;
    animation: floatAndFade 30s ease-in-out infinite;
    filter: blur(8px);
}

@keyframes floatAndFade {
    0% { transform: translateY(0) translateX(0) scale(1); opacity: 0; }
    20% { opacity: 0.6; }
    100% { transform: translateY(-110vh) translateX(30vw) scale(2); opacity: 0; }
}

/* ===== 液态玻璃卡片 ===== */
.glass-card {
    position: relative;
    z-index: 10;
    width: 90%; max-width: 500px;
    padding: 45px 35px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 35px;
    box-shadow: var(--card-shadow);
    text-align: center;
    opacity: 0;
    transform: translateY(30px) scale(0.9);
    animation: liquidPopIn 1.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    transform-style: preserve-3d;
    transition: box-shadow 0.8s, background 0.8s;
    will-change: transform;
    user-select: none;
    overflow: hidden;
}

/* 液态玻璃效果由 JS 初始化 */
body.dark-mode .glass-card {
    background: rgba(20, 20, 30, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes liquidPopIn {
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* 卡片内容 */
.avatar-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
}

.avatar {
    width: 120px; height: 120px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.3);
    object-fit: cover;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    transition: border-color 0.5s, transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.avatar-wrapper:hover .avatar {
    border-color: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
}

.avatar-wrapper:hover .avatar.animating {
    animation: avatarSpin 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes avatarSpin {
    0%   { transform: rotate(0deg) scale(1); }
    100% { transform: rotate(360deg) scale(1.1); }
}

.status-badge {
    position: absolute; bottom: 8px; right: 8px;
    background: #2ecc71;
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.4);
    animation: pulse 3s infinite ease-in-out;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.6); }
    70% { box-shadow: 0 0 0 15px rgba(46, 204, 113, 0); }
    100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

h1 {
    font-size: 2.2em; margin: 10px 0;
    letter-spacing: 1.5px; font-weight: 700;
    position: relative; display: inline-block;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

h1:hover::before, h1:hover::after {
    content: attr(data-text);
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
}

h1:hover::before {
    left: 2px;
    text-shadow: -1px 0 #ff00c1;
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
    animation: glitch-anim 0.3s infinite linear alternate-reverse;
}

h1:hover::after {
    left: -2px;
    text-shadow: -1px 0 #00fff9;
    clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
    animation: glitch-anim2 0.3s infinite linear alternate-reverse;
}

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

@keyframes glitch-anim2 {
    0% { clip-path: polygon(0 0, 100% 0, 100% 10%, 0 10%); }
    20% { clip-path: polygon(0 20%, 100% 20%, 100% 30%, 0 30%); }
    40% { clip-path: polygon(0 40%, 100% 40%, 100% 50%, 0 50%); }
    60% { clip-path: polygon(0 60%, 100% 60%, 100% 70%, 0 70%); }
    80% { clip-path: polygon(0 80%, 100% 80%, 100% 90%, 0 90%); }
    100% { clip-path: polygon(0 100%, 100% 100%, 100% 0, 0 0); }
}

.bio {
    color: var(--text-sub);
    font-size: 1.1em;
    margin-bottom: 35px;
    min-height: 1.5em;
    font-weight: 400;
    line-height: 1.6;
}

.link-section {
    display: flex; flex-direction: column;
    gap: 20px;
}

/* ===== 液态玻璃按钮 ===== */
.link-item {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 18px;
    border-radius: 20px;
    text-decoration: none;
    color: white;
    font-weight: 600;
    font-size: 1.1em;
    letter-spacing: 0.8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.5s, background 0.4s;
    will-change: transform;
}

.link-item.animate-in {
    animation: slideUpLiquid 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes slideUpLiquid {
    to { opacity: 1; transform: translateY(0); }
}

.link-item:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.18);
}

.link-item::after {
    content: '';
    position: absolute; top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: none; opacity: 0;
}

.link-item:hover::after {
    left: 100%;
    transition: left 0.8s ease;
    opacity: 1;
}

.footer {
    margin-top: 40px;
    font-size: 0.9em;
    color: var(--text-sub);
    opacity: 0.6;
    transition: opacity 0.5s;
}

.footer:hover { opacity: 1; }

/* ===== 控制面板按钮 - 液态玻璃 ===== */
.controls-group {
    position: absolute; top: 30px; right: 30px;
    display: flex; gap: 15px; z-index: 100;
}

.control-btn {
    width: 48px; height: 48px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    font-size: 1.3em;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    position: relative;
}

.control-btn:hover {
    transform: scale(1.15);
    background: rgba(255, 255, 255, 0.35);
}

body.dark-mode .control-btn {
    background: rgba(20, 20, 30, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode .control-btn:hover {
    background: rgba(40, 40, 60, 0.65);
}

.camera-active::after {
    content: '';
    position: absolute; top: 0; right: 0;
    width: 12px; height: 12px;
    background: #e74c3c;
    border-radius: 50%;
    border: 2px solid #fff;
    animation: blink 1.5s infinite;
}

@keyframes blink { 50% { opacity: 0.5; } }

#webcam-preview {
    position: fixed; bottom: 30px; right: 30px;
    width: 160px; height: 120px;
    border-radius: 15px; overflow: hidden;
    z-index: 90;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    opacity: 0; transform: translateY(20px);
    transition: opacity 0.5s, transform 0.5s;
    pointer-events: none; background: #000;
}

#webcam-preview.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
#webcam-video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
#gesture-status {
    position: absolute; bottom: 5px; left: 0; width: 100%;
    text-align: center; color: white; font-size: 10px;
    background: rgba(0,0,0,0.5); padding: 2px 0;
}

#gesture-canvas {
    position: fixed; inset: 0; width: 100%; height: 100%;
    z-index: 10000; pointer-events: none; display: none;
}
#gesture-canvas.active { display: block; }

.falling-emoji {
    position: fixed; top: -60px;
    font-size: 26px; pointer-events: none;
    z-index: 1; opacity: 0.5;
    animation: fallLiquid linear forwards;
    filter: blur(0.5px);
}

@keyframes fallLiquid { to { transform: translateY(110vh) rotate(360deg); } }

.ripple {
    position: absolute; border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple-anim 0.8s linear;
    pointer-events: none; z-index: 9998;
}

@keyframes ripple-anim { to { transform: scale(6); opacity: 0; } }

/* ===== 音乐播放器 - 液态玻璃 ===== */
.music-control-group {
    position: fixed; bottom: 30px; left: 30px;
    display: flex; align-items: flex-end; gap: 10px; z-index: 100;
}

.music-player {
    width: 50px; height: 50px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s;
}

.music-player:hover { transform: scale(1.1); }

body.dark-mode .music-player {
    background: rgba(20, 20, 30, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.music-disc {
    font-size: 24px;
    animation: spin 4s linear infinite;
    animation-play-state: paused;
}

.music-player.playing .music-disc { animation-play-state: running; }

.music-player.playing {
    border-color: #2ecc71;
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.4);
}

@keyframes spin { to { transform: rotate(360deg); } }

.music-visualizer {
    display: flex; gap: 4px;
    height: 25px; align-items: flex-end;
    margin-bottom: 10px; opacity: 0.6; transition: opacity 0.3s;
}

.music-visualizer.active { opacity: 1; }

.bar {
    width: 4px; background: var(--visualizer-color);
    border-radius: 2px; height: 4px;
    transition: background-color 0.8s;
}

.music-visualizer.active .bar:nth-child(1) { animation: sound 0.8s infinite ease-in-out alternate; }
.music-visualizer.active .bar:nth-child(2) { animation: sound 0.9s infinite ease-in-out alternate -0.4s; }
.music-visualizer.active .bar:nth-child(3) { animation: sound 1.1s infinite ease-in-out alternate -0.2s; }
.music-visualizer.active .bar:nth-child(4) { animation: sound 0.7s infinite ease-in-out alternate -0.6s; }

@keyframes sound {
    0% { height: 4px; }
    100% { height: 24px; }
}

.beian-container {
    margin-top: 8px;
    display: flex; justify-content: center;
    align-items: center; flex-wrap: wrap; gap: 15px;
}

.beian-link {
    display: inline-flex; align-items: center;
    text-decoration: none; color: inherit;
    transition: color 0.3s, transform 0.3s;
}

.beian-link:hover { color: var(--text-main); transform: translateY(-2px); }

.beian-icon {
    width: 16px; height: 16px; margin-right: 5px; vertical-align: middle;
}

#loading-toast {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.15);
    padding: 20px 40px; border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: var(--card-shadow);
    z-index: 10001; opacity: 0; pointer-events: none;
    transition: opacity 0.3s; font-weight: 600;
}

#loading-toast.show { opacity: 1; }

.noscript-warning {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: #f5f5f5; font-size: 1.2em; color: #333;
    z-index: 99999; text-align: center; padding: 20px;
}

@media (max-width: 768px) {
    body { overflow-y: auto; display: block; height: auto; padding: 40px 0; }
    .glass-card { width: 90%; margin: 0 auto; padding: 35px 25px; }
    h1 { font-size: 2em; }
    #webcam-preview { display: none; }
    .controls-group { top: 15px; right: 15px; }
    .music-control-group { bottom: 15px; left: 15px; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
    .music-visualizer { display: none !important; }
}
