/* ═══════════════════════════════════════════════════════════════
   菲仕兰中国互动词云 — FrieslandCampina Brand Blue Theme
   品牌蓝 #009ADE · 深底 #001B3A
   ═══════════════════════════════════════════════════════════════ */

:root {
    /* 菲仕兰品牌色系 */
    --fc-blue: #009ADE;
    --fc-blue-light: #33B5F0;
    --fc-blue-dark: #006FA0;
    --fc-navy: #001B3A;
    --fc-navy-light: #002952;

    --bg-primary: var(--fc-navy);
    --bg-card: rgba(0, 100, 180, 0.08);
    --bg-glass: rgba(0, 154, 222, 0.06);
    --bg-glass-strong: rgba(0, 154, 222, 0.1);

    --text-primary: #f0f6ff;
    --text-secondary: rgba(220, 240, 255, 0.6);
    --text-muted: rgba(180, 215, 245, 0.35);

    --accent-cyan: var(--fc-blue-light);
    --accent-violet: #7cb8f0;
    --accent-pink: #f472b6;
    --accent-amber: #fbbf24;
    --accent-emerald: #34d399;
    --accent-blue: var(--fc-blue);

    --gradient-main: linear-gradient(135deg, #33B5F0 0%, #009ADE 40%, #006FA0 100%);
    --gradient-bar: linear-gradient(90deg, #33B5F0 0%, #009ADE 50%, #006FA0 100%);

    --border-subtle: rgba(0, 154, 222, 0.12);
    --border-glow: rgba(0, 154, 222, 0.25);

    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --radius-pill: 999px;

    --font: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', monospace;

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    height: 100vh;
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ── Particle Canvas ── */
#particle-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* ── Aurora — 菲仕兰蓝色光晕 ── */
.aurora {
    position: fixed;
    border-radius: 50%;
    filter: blur(110px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}
.aurora-1 {
    width: 500px; height: 500px;
    top: -18%; left: -4%;
    background: radial-gradient(circle, rgba(0, 154, 222, 0.2), transparent 70%);
    animation: drift1 18s ease-in-out infinite alternate;
}
.aurora-2 {
    width: 420px; height: 420px;
    top: -12%; right: 8%;
    background: radial-gradient(circle, rgba(51, 181, 240, 0.16), transparent 70%);
    animation: drift2 22s ease-in-out infinite alternate;
}
.aurora-3 {
    width: 380px; height: 380px;
    bottom: -12%; left: 35%;
    background: radial-gradient(circle, rgba(0, 111, 160, 0.14), transparent 70%);
    animation: drift3 25s ease-in-out infinite alternate;
}
@keyframes drift1 { to { transform: translate(70px, 35px) scale(1.12); } }
@keyframes drift2 { to { transform: translate(-50px, 40px) scale(1.08); } }
@keyframes drift3 { to { transform: translate(40px, -25px) scale(1.15); } }

/* ── Shell ── */
.screen-shell {
    position: relative;
    z-index: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}

/* ═══════════════════════════════════
   紧凑顶栏
   ═══════════════════════════════════ */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 3.6rem;
    padding: 0 1.5rem;
    background: rgba(0, 27, 58, 0.75);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    z-index: 10;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.topbar-logo {
    height: 2.2rem;
    width: auto;
    object-fit: contain;
    filter: brightness(1.1);
}

.topbar-divider {
    width: 1px;
    height: 1.6rem;
    background: var(--border-subtle);
}

.topbar-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: 0.02em;
    background: var(--gradient-main);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-flow 6s ease infinite;
}

@keyframes gradient-flow {
    0%   { background-position: 0% center; }
    50%  { background-position: 100% center; }
    100% { background-position: 0% center; }
}

.live-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.18);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 6px #ef4444;
    animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.topbar-stats {
    display: flex;
    gap: 0.5rem;
}

.stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.65rem;
    border-radius: var(--radius-pill);
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.stat-chip.muted {
    color: var(--text-muted);
}

.chip-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent-emerald);
    box-shadow: 0 0 5px var(--accent-emerald);
}

/* ── 形状选择器 ── */
.shape-picker {
    display: flex;
    gap: 0.3rem;
    padding: 0.2rem;
    border-radius: var(--radius-pill);
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
}

.shape-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1.5px solid transparent;
    border-radius: 50%;
    background: transparent;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s var(--ease);
    padding: 0;
    line-height: 1;
}

.shape-btn:hover {
    background: var(--bg-glass-strong);
    transform: scale(1.12);
}

.shape-btn.active {
    background: rgba(34, 211, 238, 0.12);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.2);
}

/* ═══════════════════════════════════
   主内容区
   ═══════════════════════════════════ */
.main-stage {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 17rem;
    gap: 0.75rem;
    padding: 0.75rem;
    min-height: 0;
}

/* ── 词云舞台 ── */
.cloud-stage {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(16px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 1px rgba(255, 255, 255, 0.04);
}

.cloud-stage::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    background:
        radial-gradient(ellipse at 20% 35%, rgba(0, 154, 222, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 65%, rgba(51, 181, 240, 0.04) 0%, transparent 50%);
    pointer-events: none;
}

.empty-state {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-muted);
    font-size: 2rem;
    font-weight: 900;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 0.4rem;
    animation: float-bounce 3s ease-in-out infinite;
}

@keyframes float-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* ── 词云文字 — 支持横竖混排 ── */
.cloud-word {
    --hue: 0;
    --rotation: 0deg;
    position: absolute;
    left: var(--x);
    top: var(--y);
    transform: translate(-50%, -50%) rotate(var(--rotation));
    color: hsl(var(--hue), 90%, 72%);
    font-size: var(--size);
    font-weight: 900;
    line-height: 0.95;
    white-space: nowrap;
    text-shadow:
        0 0 12px hsla(var(--hue), 100%, 65%, 0.35),
        0 2px 4px rgba(0, 0, 0, 0.3);
    transition: filter 0.3s var(--ease), opacity 0.3s var(--ease),
                text-shadow 0.3s var(--ease);
    will-change: opacity;
    cursor: default;
}

.cloud-word:hover {
    text-shadow:
        0 0 24px hsla(var(--hue), 100%, 65%, 0.6),
        0 2px 4px rgba(0, 0, 0, 0.3);
    filter: brightness(1.15);
}

.cloud-word.is-dim {
    opacity: 0.64;
}

.cloud-word.is-top-group {
    filter: brightness(1.18) saturate(1.2);
    text-shadow:
        0 0 20px hsla(var(--hue), 100%, 68%, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.32);
}

.cloud-word.is-active {
    color: var(--fc-navy);
    -webkit-text-fill-color: var(--fc-navy);
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 0.08em 0.22em 0.12em;
    text-shadow: none;
    box-shadow:
        0 0 0 3px rgba(0, 154, 222, 0.6),
        0 0 36px rgba(0, 154, 222, 0.25),
        0 12px 32px rgba(0, 0, 0, 0.3);
    z-index: 4;
    animation: winner-glow 2.5s ease-in-out infinite;
}

@keyframes winner-glow {
    0%, 100% { box-shadow: 0 0 0 3px rgba(0, 154, 222, 0.6), 0 0 36px rgba(0, 154, 222, 0.25), 0 12px 32px rgba(0, 0, 0, 0.3); }
    50% { box-shadow: 0 0 0 4px rgba(51, 181, 240, 0.7), 0 0 52px rgba(51, 181, 240, 0.3), 0 12px 32px rgba(0, 0, 0, 0.3); }
}

/* ═══════════════════════════════════
   右侧面板
   ═══════════════════════════════════ */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
}

/* ── 二维码卡片 ── */
.qr-card {
    position: relative;
    flex-shrink: 0;
}

.qr-card-glow {
    position: absolute;
    inset: -1px;
    border-radius: calc(var(--radius-lg) + 1px);
    background: var(--gradient-main);
    opacity: 0.2;
    filter: blur(1px);
    animation: border-pulse 4s ease-in-out infinite alternate;
}

@keyframes border-pulse {
    0% { opacity: 0.12; }
    100% { opacity: 0.28; }
}

.qr-card-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.65rem;
    border-radius: var(--radius-lg);
    background: rgba(0, 27, 58, 0.88);
    backdrop-filter: blur(20px);
}

.qr-image-wrap {
    width: 100%;
    aspect-ratio: 1;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    background: #fff;
}

.qr-image-wrap img {
    display: block;
    width: 100%;
    height: 100%;
}

.qr-info {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.45rem;
}

.qr-label {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text-primary);
}

.qr-url {
    font-size: 0.65rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-align: right;
    overflow-wrap: anywhere;
    line-height: 1.3;
}

/* ── 排行榜卡片 ── */
.result-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(16px);
    overflow: hidden;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 0.85rem 0.5rem;
    flex-shrink: 0;
}

.result-title {
    font-size: 0.95rem;
    font-weight: 900;
}

.live-clock {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 600;
}

.result-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.6rem 0.6rem;
    display: grid;
    gap: 0.4rem;
    align-content: start;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.06) transparent;
}

.result-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.65rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}

.result-item:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.1);
}

.result-item:first-child {
    border-color: rgba(34, 211, 238, 0.18);
    background: rgba(34, 211, 238, 0.05);
}

.result-bar {
    position: absolute;
    inset: auto auto 0 0;
    height: 2px;
    width: var(--bar);
    background: var(--gradient-bar);
    border-radius: 0 1px 0 0;
}

.result-main {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.result-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: 800;
    flex-shrink: 0;
}
.result-rank.rank-1 { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #0a0e1a; }
.result-rank.rank-2 { background: linear-gradient(135deg, #94a3b8, #cbd5e1); color: #0a0e1a; }
.result-rank.rank-3 { background: linear-gradient(135deg, #d97706, #b45309); color: #fff; }
.result-rank.rank-other { background: var(--bg-glass); color: var(--text-muted); border: 1px solid var(--border-subtle); }

.result-name {
    min-width: 0;
    overflow: hidden;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-votes {
    flex: none;
    font-size: 1rem;
    font-weight: 900;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-meta {
    margin-top: 0.15rem;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
}

.result-examples {
    margin-top: 0.15rem;
    color: rgba(255, 255, 255, 0.18);
    font-size: 0.62rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-empty {
    color: var(--text-muted);
    font-weight: 800;
    font-size: 0.82rem;
    text-align: center;
    padding: 1.5rem 0;
}

.result-summary,
.result-total {
    border-radius: var(--radius-sm);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.035);
}

.result-summary {
    padding: 0.55rem 0.65rem;
}

.summary-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 850;
}

.summary-main strong {
    color: var(--accent-cyan);
    font-size: 0.95rem;
}

.summary-meta {
    margin-top: 0.12rem;
    color: var(--text-muted);
    font-size: 0.66rem;
    font-weight: 700;
}

.result-total {
    padding: 0.48rem 0.65rem;
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 900;
    text-align: center;
}

/* ── Entrance ── */
@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.topbar { animation: fade-in-up 0.6s ease-out; }
.main-stage { animation: fade-in-up 0.6s ease-out 0.1s both; }

/* ── Responsive ── */
@media (max-width: 860px) {
    .main-stage {
        grid-template-columns: 1fr;
    }
    .side-panel {
        display: none;
    }
    .topbar-stats {
        display: none;
    }
    .shape-picker {
        display: none;
    }
    .topbar-title {
        font-size: 1rem;
    }
}
