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

/* ==================== 主题系统 ==================== */

/* --- 赛博朋克 (默认) --- */
.theme-cyberpunk {
    --bg-primary: #0a0a1a;
    --bg-gradient: linear-gradient(135deg, #0a0a1a 0%, #1a0a2e 50%, #0a1a2e 100%);
    --accent: #00d4ff;
    --accent2: #7b2cbf;
    --accent3: #ff006e;
    --text-primary: #fff;
    --text-secondary: rgba(255,255,255,0.6);
    --panel-bg: rgba(255,255,255,0.06);
    --panel-border: rgba(255,255,255,0.1);
    --glow: rgba(0,212,255,0.5);
    --title-gradient: linear-gradient(90deg, #00d4ff, #7b2cbf, #ff006e);
    --particle-colors: rgba(0,212,255,0.6), rgba(123,44,191,0.5), rgba(255,0,110,0.4), rgba(0,255,136,0.4), rgba(255,190,0,0.4);
}

/* --- 霓虹派对 --- */
.theme-neon {
    --bg-primary: #0d0d1a;
    --bg-gradient: linear-gradient(135deg, #0d0d1a 0%, #1a0d1a 50%, #0d1a0d 100%);
    --accent: #ff00ff;
    --accent2: #00ff88;
    --accent3: #ffea00;
    --text-primary: #fff;
    --text-secondary: rgba(255,255,255,0.6);
    --panel-bg: rgba(255,255,255,0.06);
    --panel-border: rgba(255,255,255,0.1);
    --glow: rgba(255,0,255,0.5);
    --title-gradient: linear-gradient(90deg, #ff00ff, #00ff88, #ffea00);
    --particle-colors: rgba(255,0,255,0.6), rgba(0,255,136,0.5), rgba(255,234,0,0.4), rgba(0,255,255,0.4), rgba(255,100,0,0.4);
}

/* --- 中国红金 --- */
.theme-chinese {
    --bg-primary: #1a0505;
    --bg-gradient: linear-gradient(135deg, #1a0505 0%, #2a1010 50%, #1a1005 100%);
    --accent: #ff3333;
    --accent2: #ffb700;
    --accent3: #ff6600;
    --text-primary: #fff;
    --text-secondary: rgba(255,255,255,0.6);
    --panel-bg: rgba(255,255,255,0.06);
    --panel-border: rgba(255,180,0,0.15);
    --glow: rgba(255,180,0,0.5);
    --title-gradient: linear-gradient(90deg, #ff3333, #ffb700, #ff6600);
    --particle-colors: rgba(255,50,50,0.6), rgba(255,183,0,0.5), rgba(255,102,0,0.4), rgba(255,200,50,0.4), rgba(200,0,0,0.4);
}

/* --- 科技蓝 --- */
.theme-techblue {
    --bg-primary: #0a0f1a;
    --bg-gradient: linear-gradient(135deg, #0a0f1a 0%, #0a1a2a 50%, #0a1525 100%);
    --accent: #00aaff;
    --accent2: #00ffcc;
    --accent3: #3388ff;
    --text-primary: #fff;
    --text-secondary: rgba(255,255,255,0.6);
    --panel-bg: rgba(255,255,255,0.06);
    --panel-border: rgba(0,170,255,0.15);
    --glow: rgba(0,170,255,0.5);
    --title-gradient: linear-gradient(90deg, #00aaff, #00ffcc, #3388ff);
    --particle-colors: rgba(0,170,255,0.6), rgba(0,255,204,0.5), rgba(51,136,255,0.4), rgba(0,200,255,0.4), rgba(100,200,255,0.4);
}

/* --- 黑金奢华 --- */
.theme-darkgold {
    --bg-primary: #0a0a0a;
    --bg-gradient: linear-gradient(135deg, #0a0a0a 0%, #1a140a 50%, #0a0a0a 100%);
    --accent: #d4af37;
    --accent2: #c5a028;
    --accent3: #ffd700;
    --text-primary: #fff;
    --text-secondary: rgba(255,255,255,0.6);
    --panel-bg: rgba(255,255,255,0.06);
    --panel-border: rgba(212,175,55,0.15);
    --glow: rgba(212,175,55,0.5);
    --title-gradient: linear-gradient(90deg, #d4af37, #c5a028, #ffd700);
    --particle-colors: rgba(212,175,55,0.6), rgba(255,215,0,0.5), rgba(200,160,50,0.4), rgba(255,200,0,0.4), rgba(180,140,40,0.4);
}

/* --- 森林绿 --- */
.theme-forest {
    --bg-primary: #051a0a;
    --bg-gradient: linear-gradient(135deg, #051a0a 0%, #0a1a10 50%, #051a15 100%);
    --accent: #00ff88;
    --accent2: #66ffaa;
    --accent3: #00cc66;
    --text-primary: #fff;
    --text-secondary: rgba(255,255,255,0.6);
    --panel-bg: rgba(255,255,255,0.06);
    --panel-border: rgba(0,255,136,0.15);
    --glow: rgba(0,255,136,0.5);
    --title-gradient: linear-gradient(90deg, #00ff88, #66ffaa, #00cc66);
    --particle-colors: rgba(0,255,136,0.6), rgba(102,255,170,0.5), rgba(0,204,102,0.4), rgba(100,255,150,0.4), rgba(50,200,100,0.4);
}

/* ==================== 基础样式 ==================== */
body {
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
    background: var(--bg-gradient);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: relative;
    transition: background 0.5s ease;
}

/* ========== 粒子背景 ========== */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    animation: float 8s infinite ease-in-out;
}

@keyframes float {
    0%, 100% { transform: translateY(0) translateX(0); opacity: 0.4; }
    25% { transform: translateY(-30px) translateX(15px); opacity: 0.8; }
    50% { transform: translateY(-50px) translateX(-10px); opacity: 1; }
    75% { transform: translateY(-20px) translateX(20px); opacity: 0.6; }
}

/* ========== 顶部标题 ========== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    text-align: center;
    padding: 20px 0;
    background: linear-gradient(180deg, var(--bg-primary) 0%, rgba(10,10,26,0.4) 70%, transparent 100%);
    pointer-events: none;
}

.title {
    font-size: 42px;
    font-weight: 700;
    background: var(--title-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 4px;
    animation: titleGlow 3s ease-in-out infinite alternate;
    pointer-events: auto;
}

@keyframes titleGlow {
    from { filter: drop-shadow(0 0 20px var(--glow)); }
    to { filter: drop-shadow(0 0 40px var(--glow)); }
}

.subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin-top: 6px;
    letter-spacing: 2px;
    pointer-events: auto;
}

/* ========== 词云容器 ========== */
.wordcloud-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70vw;
    height: 65vh;
    z-index: 5;
}

#wordcloud-canvas {
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* ========== 3D 词云容器 ========== */
.cloud3d-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70vw;
    height: 65vh;
    z-index: 5;
    perspective: 1200px;
    overflow: hidden;
}

.cloud3d-scene {
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    animation: rotate3d 30s linear infinite;
    position: relative;
}

@keyframes rotate3d {
    from { transform: rotateY(0deg) rotateX(10deg); }
    to { transform: rotateY(360deg) rotateX(10deg); }
}

.cloud3d-word {
    position: absolute;
    font-weight: bold;
    white-space: nowrap;
    transform-style: preserve-3d;
    transition: all 0.3s ease;
    cursor: pointer;
    text-shadow: 0 0 10px var(--glow);
}

.cloud3d-word:hover {
    transform: scale(1.2) translateZ(50px) !important;
    z-index: 100;
}

/* ========== 弹幕层 ========== */
.danmu-layer {
    position: fixed;
    top: 80px;
    left: 0;
    right: 0;
    height: calc(100vh - 160px);
    z-index: 6;
    pointer-events: none;
    overflow: hidden;
}

.danmu-item {
    position: absolute;
    white-space: nowrap;
    font-size: 18px;
    font-weight: 600;
    pointer-events: none;
    animation: danmuMove linear forwards;
    text-shadow: 0 0 8px currentColor;
    opacity: 0.9;
}

@keyframes danmuMove {
    from { transform: translateX(100vw); }
    to { transform: translateX(-100%); }
}

/* ========== 右侧信息面板 ========== */
.info-panel {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 200px;
}

.qr-section {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 14px;
    text-align: center;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.qr-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

#qrcode {
    display: flex;
    justify-content: center;
}

#qrcode img {
    border-radius: 8px;
    width: 120px !important;
    height: 120px !important;
}

.qr-url {
    font-size: 10px;
    color: rgba(255,255,255,0.35);
    margin-top: 6px;
    word-break: break-all;
    line-height: 1.3;
}

/* ========== 排行榜 ========== */
.ranking-section {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 14px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    max-height: 280px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.ranking-section.hidden { display: none; }

.ranking-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--panel-border);
}

.ranking-icon { font-size: 16px; }

.ranking-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    max-height: 220px;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    transition: all 0.2s ease;
}

.ranking-item:hover {
    background: rgba(255,255,255,0.06);
}

.ranking-rank {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
}

.ranking-item.top1 .ranking-rank { background: linear-gradient(135deg, #ffd700, #ffaa00); color: #000; }
.ranking-item.top2 .ranking-rank { background: linear-gradient(135deg, #c0c0c0, #a0a0a0); color: #000; }
.ranking-item.top3 .ranking-rank { background: linear-gradient(135deg, #cd7f32, #b87333); color: #fff; }

.ranking-word {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ranking-votes {
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
}

/* ========== 统计 ========== */
.stats-section {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 14px;
    text-align: center;
    backdrop-filter: blur(10px);
    display: flex;
    gap: 12px;
    justify-content: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
    text-shadow: 0 0 15px var(--glow);
    line-height: 1.1;
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 3px;
}

/* ========== 底部控制栏 ========== */
.controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 10px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 30px;
    padding: 8px 14px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.ctrl-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.08);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.ctrl-btn:hover {
    background: var(--panel-bg);
    color: var(--accent);
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--glow);
}

.ctrl-btn.active {
    background: rgba(0,0,0,0.2);
    color: var(--accent);
    box-shadow: 0 0 12px var(--glow);
    border: 1px solid var(--accent);
}

/* ========== 悬浮提示 ========== */
.tooltip {
    position: fixed;
    background: rgba(0,0,0,0.85);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    color: var(--accent);
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.tooltip.show { opacity: 1; }

/* ========== 主题弹窗 ========== */
.theme-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.theme-modal.show { display: flex; }

.theme-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
}

.theme-modal-content {
    position: relative;
    background: var(--bg-primary);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    padding: 24px;
    width: 520px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: modalIn 0.3s ease;
    z-index: 1;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.theme-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.theme-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: color 0.2s;
}

.theme-modal-close:hover { color: var(--accent); }

.theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.theme-option {
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    text-align: center;
}

.theme-option:hover { transform: translateY(-2px); }
.theme-option.active { border-color: var(--accent); }

.theme-preview {
    height: 60px;
    border-radius: 10px 10px 0 0;
}

.cyberpunk-preview { background: linear-gradient(135deg, #0a0a1a, #1a0a2e, #0a1a2e); }
.neon-preview { background: linear-gradient(135deg, #0d0d1a, #1a0d1a, #0d1a0d); }
.chinese-preview { background: linear-gradient(135deg, #1a0505, #2a1010, #1a1005); }
.techblue-preview { background: linear-gradient(135deg, #0a0f1a, #0a1a2a, #0a1525); }
.darkgold-preview { background: linear-gradient(135deg, #0a0a0a, #1a140a, #0a0a0a); }
.forest-preview { background: linear-gradient(135deg, #051a0a, #0a1a10, #051a15); }

.theme-name {
    display: block;
    padding: 8px 0;
    font-size: 13px;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.03);
}

.theme-option.active .theme-name { color: var(--accent); font-weight: 600; }

/* ========== 响应式 ========== */
@media (max-width: 1200px) {
    .info-panel { right: 16px; width: 170px; }
    .title { font-size: 32px; }
    .wordcloud-container, .cloud3d-container { width: 68vw; }
    .theme-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .info-panel { display: none; }
    .title { font-size: 24px; }
    .wordcloud-container, .cloud3d-container { width: 90vw; height: 60vh; }
    .danmu-layer { display: none; }
}

/* ========== 动画效果 ========== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.header, .info-panel, .controls {
    animation: fadeInUp 0.8s ease-out;
}

/* ========== 涟漪效果 ========== */
@keyframes rippleExpand {
    to { width: 100px; height: 100px; opacity: 0; }
}

/* ========== 排行波动画 ========== */
@keyframes rankUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); background: rgba(0,212,255,0.1); }
    100% { transform: scale(1); }
}

.ranking-item.updating {
    animation: rankUpdate 0.6s ease;
}
