/* ===== CSS Reset & Design System Tokens ===== */
:root {
    --font-main: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    
    /* Dark Theme Core Colors */
    --bg-dark: #080c14;
    --bg-card: rgba(18, 25, 38, 0.75);
    --bg-card-hover: rgba(28, 38, 58, 0.85);
    --bg-glass: rgba(15, 23, 42, 0.65);
    
    --border-light: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.3);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Community Specific Brand Colors */
    --c-fmkorea: #3b82f6;
    --c-fmkorea-bg: rgba(59, 130, 246, 0.12);
    --c-ruliweb: #f97316;
    --c-ruliweb-bg: rgba(249, 115, 22, 0.12);
    --c-theqoo: #a855f7;
    --c-theqoo-bg: rgba(168, 85, 247, 0.12);
    --c-instiz: #14b8a6;
    --c-instiz-bg: rgba(20, 184, 166, 0.12);
    
    /* Stock Communities Colors */
    --c-naver-stock: #03c75a;
    --c-naver-stock-bg: rgba(3, 199, 90, 0.12);
    --c-dc-stock: #ef4444;
    --c-dc-stock-bg: rgba(239, 68, 68, 0.12);
    --c-blind: #60a5fa;
    --c-blind-bg: rgba(96, 165, 250, 0.12);
    --c-toss-stock: #3182f6;
    --c-toss-stock-bg: rgba(49, 130, 246, 0.12);

    /* Real Estate Communities Colors */
    --c-naver-boos: #f59e0b;
    --c-naver-boos-bg: rgba(245, 158, 11, 0.12);
    --c-weolbu: #ea580c;
    --c-weolbu-bg: rgba(234, 88, 12, 0.12);
    --c-hogangnono: #84cc16;
    --c-hogangnono-bg: rgba(132, 204, 22, 0.12);
    --c-dc-realestate: #64748b;
    --c-dc-realestate-bg: rgba(100, 116, 139, 0.12);

    /* Accent & Action Colors */
    --accent-primary: #6366f1;
    --accent-hover: #4f46e5;
    --accent-pulse: #10b981;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.25);
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* ===== Ambient Background Glow ===== */
.glow-bg {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    z-index: 0;
    pointer-events: none;
    opacity: 0.35;
}

.glow-1 {
    width: 450px;
    height: 450px;
    background: #3b82f6;
    top: -100px;
    left: -100px;
}

.glow-2 {
    width: 500px;
    height: 500px;
    background: #a855f7;
    bottom: -150px;
    right: -100px;
}

.glow-3 {
    width: 350px;
    height: 350px;
    background: #10b981;
    top: 40%;
    left: 40%;
    transform: translate(-50%, -50%);
}

/* Glassmorphism Common Style */
.glass {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-soft);
}

/* ===== App Layout Container ===== */
.app-layout {
    position: relative;
    z-index: 1;
    max-width: 1320px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ===== Navbar Header ===== */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-radius: var(--radius-lg);
    gap: 20px;
    flex-wrap: wrap;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo {
    width: 46px;
    height: 46px;
    background: linear-gradient(135deg, var(--accent-primary), #03c75a);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.pulse-icon {
    font-size: 26px;
    animation: iconPulse 2s infinite ease-in-out;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.brand-text h1 {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #ffffff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Timer Widget */
.timer-widget {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 18px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-width: 240px;
}

.timer-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.live-dot {
    width: 9px;
    height: 9px;
    background-color: var(--accent-pulse);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-pulse);
    animation: liveGlow 1.5s infinite alternate;
}

@keyframes liveGlow {
    from { opacity: 0.4; }
    to { opacity: 1; transform: scale(1.2); }
}

.timer-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.timer-countdown {
    margin-left: auto;
    font-family: monospace;
    font-weight: 700;
    color: #38bdf8;
    font-size: 0.95rem;
}

.timer-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.timer-progress-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(to right, #38bdf8, #10b981);
    transition: width 1s linear;
}

.timer-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: right;
}

/* Nav Actions */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-hover));
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-outline {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.badge {
    background: #ef4444;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
}

.icon-spin.spinning {
    animation: spin 1s linear infinite;
}

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

/* ===== Real-Time Hot Keywords Bar ===== */
.trending-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    overflow-x: auto;
}

.trending-title {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    font-size: 0.88rem;
    font-weight: 700;
    color: #fca5a5;
}

.hot-fire {
    color: #ef4444;
    font-size: 20px;
}

.trending-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.trending-tags::-webkit-scrollbar {
    display: none;
}

.tag-chip {
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tag-chip:hover {
    background: rgba(99, 102, 241, 0.2);
    color: #fff;
    border-color: var(--accent-primary);
    transform: scale(1.04);
}

/* ===== Filter Wrapper ===== */
.filter-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    border-radius: var(--radius-lg);
}

/* Sector Tabs (Large Main Categories) */
.sector-tabs {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 12px;
    overflow-x: auto;
}

.sector-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.25s ease;
}

.sector-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.sector-tab.active {
    background: linear-gradient(135deg, var(--accent-primary), #4f46e5);
    color: #fff;
    border-color: var(--accent-primary);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

/* Community Tabs (Pill Buttons) */
.community-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.community-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.community-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.community-tab.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.tab-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Topic Badges & Search Row */
.topic-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.topic-categories {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.topic-badge {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.topic-badge:hover {
    background: rgba(255, 255, 255, 0.09);
    color: #fff;
}

.topic-badge.active {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
    font-weight: 600;
}

/* Search Box */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 280px;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 20px;
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 9px 36px 9px 40px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.88rem;
    outline: none;
    transition: all 0.2s ease;
}

.search-box input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
}

.clear-search {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
}

.clear-search:hover {
    color: #fff;
}

.hidden {
    display: none !important;
}

/* ===== Feed Header ===== */
.feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
}

.feed-count-summary {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.count-number {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.15);
    padding: 3px 10px;
    border-radius: var(--radius-full);
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: var(--radius-md);
}

.sort-btn {
    padding: 6px 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.sort-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* ===== News Grid ===== */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 18px;
}

/* News Card */
.news-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.news-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}

/* Card Top Accent Bar */
.news-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--card-brand-color, var(--accent-primary));
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.community-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--badge-color);
    background: var(--badge-bg);
    border: 1px solid var(--badge-color);
}

.time-ago {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    cursor: pointer;
    transition: color 0.2s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-title:hover {
    color: #38bdf8;
}

.card-snippet {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.card-stats {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-item span {
    font-size: 16px;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-muted);
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-icon-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.action-icon-btn.bookmarked {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
}

/* Empty State */
.empty-feed {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-light);
}

.empty-feed span {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.empty-feed p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ===== Toast Notification ===== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 0.9rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* ===== Modals ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    width: 100%;
    max-width: 620px;
    border-radius: var(--radius-lg);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(0.92);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-card {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-community-badge {
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
}

.close-modal-btn {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.close-modal-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.modal-news-title {
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.4;
}

.modal-meta-row {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.modal-summary-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-summary-box h4 {
    font-size: 0.9rem;
    color: var(--accent-primary);
}

.modal-summary-box p {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

/* Bookmark Drawer */
.drawer-card {
    max-width: 700px;
}

.drawer-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
}

.drawer-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bookmark-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    gap: 12px;
}

.bookmark-item-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    text-decoration: none;
}

.bookmark-item-title:hover {
    color: #38bdf8;
}

/* ===== Responsive Styles ===== */
@media (max-width: 768px) {
    .app-layout {
        padding: 12px;
    }

    .navbar {
        flex-direction: column;
        align-items: stretch;
    }

    .nav-actions {
        justify-content: space-between;
    }

    .news-grid {
        grid-template-columns: 1fr;
    }

    .topic-row {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        min-width: 100%;
    }
}

/* ===== Topic Cluster Cards & Aggregated Metrics Styles ===== */
.cluster-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(245, 158, 11, 0.18);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.4);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 700;
}

.cluster-metrics-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    margin: 10px 0;
}

.metric-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.metric-pill strong {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.cluster-sources-list {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.cluster-sources-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.source-item-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 6px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.source-item-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #38bdf8;
    transform: translateX(3px);
}

.source-community-tag {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    margin-right: 8px;
}


/* ===== 실데이터 수집 UI (스냅샷 이력 · 소스 상태 · 클러스터 카드) ===== */

.pill-count {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 0.72rem;
    font-weight: 700;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.82rem;
}

/* --- 수집 시점 선택기 --- */
.history-control {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.history-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #94a3b8;
}

.history-label .material-symbols-rounded {
    font-size: 1.1rem;
}

.history-select {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(15, 23, 42, 0.9);
    color: #e2e8f0;
    font-size: 0.85rem;
    font-family: inherit;
    min-width: 240px;
    cursor: pointer;
}

/* --- 소스 수집 상태 패널 --- */
.source-status {
    padding: 16px 20px;
    border-radius: 16px;
    margin-bottom: 18px;
}

.source-status-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 0.92rem;
    color: #e2e8f0;
}

.source-status-sum {
    margin-left: auto;
    font-size: 0.82rem;
    color: #94a3b8;
    font-weight: 600;
}

.source-chips {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 10px;
}

.source-chip {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.7);
    border-left: 3px solid #475569;
    font-size: 0.8rem;
}

.source-chip.ok { border-left-color: #22c55e; }
.source-chip.warn { border-left-color: #f59e0b; }
.source-chip.blocked { border-left-color: #ef4444; }
.source-chip.error { border-left-color: #ef4444; }

.source-name {
    font-weight: 700;
    color: #f1f5f9;
}

.source-chip.ok .source-state { color: #4ade80; }
.source-chip.warn .source-state { color: #fbbf24; }
.source-chip.blocked .source-state,
.source-chip.error .source-state { color: #f87171; }

.source-state { font-weight: 600; }
.source-count { color: #94a3b8; }

.source-note,
.source-error {
    font-size: 0.72rem;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- 클러스터 카드 --- */
.card-rank-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.rank-medal {
    background: rgba(245, 158, 11, 0.18);
    color: #fbbf24;
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 0.85rem;
}

.card-group-count {
    font-size: 0.78rem;
    color: #94a3b8;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.4;
    margin-bottom: 10px;
    word-break: break-word;
}

.card-communities {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 12px;
}

.community-badge {
    padding: 3px 9px;
    border-radius: 5px;
    font-weight: 700;
    font-size: 0.74rem;
    white-space: nowrap;
}

.card-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 12px;
}

.metric-box {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.metric-label {
    font-size: 0.72rem;
    color: #94a3b8;
}

.metric-box strong {
    font-size: 1rem;
    color: #fff;
}

/* 지표 결손 경고 — 순위 오해를 막기 위해 숨기지 않는다 */
.basis-warning {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24;
    font-size: 0.76rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.basis-warning .material-symbols-rounded {
    font-size: 1rem;
}

.cluster-sources-label {
    font-size: 0.78rem;
    color: #94a3b8;
    margin-bottom: 8px;
}

.cluster-source {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    margin-top: 6px;
    text-decoration: none;
    color: #fff;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.cluster-source:hover {
    border-color: rgba(56, 189, 248, 0.5);
    transform: translateX(2px);
}

.cluster-source-title {
    font-size: 0.86rem;
    font-weight: 600;
    word-break: break-word;
}

.cluster-source-go {
    background: rgba(56, 189, 248, 0.18);
    color: #38bdf8;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.74rem;
    font-weight: 700;
    white-space: nowrap;
}

/* --- 누적 이력 --- */
.timeline-section {
    margin-top: 26px;
    padding: 20px;
    border-radius: 16px;
}

.timeline-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.timeline-head h2 {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 1.02rem;
    font-weight: 800;
    color: #f1f5f9;
}

.timeline-sub {
    margin-left: auto;
    font-size: 0.8rem;
    color: #94a3b8;
}

.timeline-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 420px;
    overflow-y: auto;
}

.timeline-row {
    display: grid;
    grid-template-columns: 92px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 9px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    color: #cbd5e1;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.timeline-row:hover {
    border-color: rgba(56, 189, 248, 0.4);
    background: rgba(30, 41, 59, 0.8);
}

.timeline-row.active {
    border-color: rgba(56, 189, 248, 0.7);
    background: rgba(56, 189, 248, 0.1);
}

.timeline-time {
    font-size: 0.8rem;
    font-weight: 700;
    color: #38bdf8;
    font-variant-numeric: tabular-nums;
}

.timeline-top1 {
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timeline-meta {
    font-size: 0.74rem;
    color: #64748b;
    white-space: nowrap;
}

/* --- 빈 상태 --- */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 48px 20px;
    color: #94a3b8;
    text-align: center;
}

.empty-state .material-symbols-rounded {
    font-size: 2.6rem;
    opacity: 0.5;
}

.empty-detail {
    font-size: 0.82rem;
    color: #64748b;
    max-width: 560px;
    line-height: 1.6;
}

.empty-detail code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.78rem;
}

.trending-empty {
    font-size: 0.82rem;
    color: #64748b;
}

.tag-count {
    display: inline-block;
    margin-left: 5px;
    padding: 0 5px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 0.7rem;
    font-weight: 700;
}

@media (max-width: 720px) {
    .card-metrics { grid-template-columns: 1fr 1fr; }
    .history-select { min-width: 0; width: 100%; }
    .timeline-row { grid-template-columns: 74px 1fr; }
    .timeline-meta { display: none; }
}

/* --- 일별 요약 이력 --- */
.timeline-group-label {
    margin: 10px 0 4px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #64748b;
    text-transform: uppercase;
}

.timeline-group-label:first-child { margin-top: 0; }

.timeline-none {
    padding: 8px 12px;
    font-size: 0.8rem;
    color: #64748b;
}

.timeline-row.daily {
    background: rgba(56, 189, 248, 0.06);
    border-color: rgba(56, 189, 248, 0.16);
}

.timeline-row.daily .timeline-time { color: #a78bfa; }

.timeline-row.daily:hover {
    border-color: rgba(167, 139, 250, 0.5);
}

.timeline-row.daily.active {
    border-color: rgba(167, 139, 250, 0.8);
    background: rgba(167, 139, 250, 0.12);
}

/* ===== 7일 키워드 시각화 =====
   색 램프는 dataviz 검증기(ordinal · dark · surface #101622) 전 항목 PASS.
   단일 블루 hue 의 명도 단계이며, 색은 글자 크기와 같은 값(노출량)을 중복 인코딩한다. */
.viz-root {
    --kw-1: #cde2fb;
    --kw-2: #9ec5f4;
    --kw-3: #6da7ec;
    --kw-4: #3987e5;
    --kw-5: #1c5cab;
    --viz-grid: rgba(255, 255, 255, 0.07);
}

.keyword-section {
    margin-top: 26px;
    padding: 20px;
    border-radius: 16px;
}

.viz-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.viz-title-group { flex: 1 1 260px; }

.viz-head h2 {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 1.02rem;
    font-weight: 800;
    color: #f1f5f9;
}

.viz-subtitle {
    margin-top: 4px;
    font-size: 0.78rem;
    color: #94a3b8;
}

.viz-views {
    display: flex;
    gap: 4px;
    padding: 3px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.viz-view-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: #94a3b8;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.viz-view-btn:hover { color: #e2e8f0; }

.viz-view-btn.active {
    background: rgba(56, 189, 248, 0.16);
    color: #38bdf8;
}

/* 크기·색이 같은 값을 나타낸다는 것을 밝히는 스케일 범례 */
.viz-scale-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    font-size: 0.74rem;
    color: #64748b;
}

.scale-swatch {
    width: 22px;
    height: 9px;
    border-radius: 2px;
    display: inline-block;
}

.scale-swatch.s1 { background: var(--kw-1); }
.scale-swatch.s2 { background: var(--kw-2); }
.scale-swatch.s3 { background: var(--kw-3); }
.scale-swatch.s4 { background: var(--kw-4); }
.scale-swatch.s5 { background: var(--kw-5); }

.scale-note {
    margin-left: 6px;
    color: #52607a;
}

.viz-panel {
    position: relative;
    width: 100%;
}

.viz-panel.hidden { display: none; }

/* --- 워드클라우드 --- */
.cloud-word {
    position: absolute;
    font-weight: 700;
    line-height: 1.18;
    white-space: nowrap;
    cursor: pointer;
    transition: opacity 0.12s ease, transform 0.12s ease;
}

.cloud-word:hover {
    opacity: 0.75;
    transform: scale(1.04);
}

/* --- 막대 --- */
.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.bar-row {
    display: grid;
    grid-template-columns: 110px 1fr 54px 92px;
    align-items: center;
    gap: 10px;
}

.bar-label {
    font-size: 0.84rem;
    font-weight: 600;
    color: #e2e8f0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-track {
    position: relative;
    height: 12px;
    background: var(--viz-grid);
    border-radius: 2px;
}

/* 데이터 끝만 4px 라운드, 기준선에 붙인다 */
.bar-fill {
    display: block;
    height: 100%;
    background: var(--kw-4);
    border-radius: 2px 4px 4px 2px;
    min-width: 3px;
}

.bar-value {
    font-size: 0.82rem;
    font-weight: 700;
    color: #f1f5f9;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.bar-meta {
    font-size: 0.74rem;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- 표 --- */
.table-scroll {
    max-height: 420px;
    overflow: auto;
}

.viz-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.viz-table thead th {
    position: sticky;
    top: 0;
    background: rgba(15, 23, 42, 0.96);
    color: #94a3b8;
    font-weight: 600;
    text-align: left;
    padding: 9px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.viz-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #cbd5e1;
}

.viz-table td.kw { font-weight: 700; color: #f1f5f9; }
.viz-table th.num, .viz-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.viz-table td.dist { color: #64748b; font-size: 0.76rem; }
.viz-table tbody tr:hover td { background: rgba(56, 189, 248, 0.06); }

.viz-footnote {
    margin-top: 12px;
    font-size: 0.72rem;
    line-height: 1.6;
    color: #52607a;
}

@media (max-width: 720px) {
    .bar-row { grid-template-columns: 84px 1fr 46px; }
    .bar-meta { display: none; }
    .viz-views { width: 100%; }
    .viz-view-btn { flex: 1; }
}

/* 4위 이하 순위 배지 — 메달이 없으므로 톤을 낮춘다 */
.rank-medal.plain {
    background: rgba(148, 163, 184, 0.16);
    color: #cbd5e1;
}

/* ===== 카드 지표 접기 =====
   순위 카드 공간을 아끼려 총조회수·총댓글수·점수를 접는다.
   <details> 를 쓰므로 JS 없이 동작하고 키보드·스크린리더에서도 열린다. */
.metrics-toggle {
    margin-bottom: 12px;
}

.metrics-toggle > summary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 11px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 9px;
    cursor: pointer;
    font-size: 0.78rem;
    color: #94a3b8;
    list-style: none;
    user-select: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

/* 기본 삼각형 마커 제거 (WebKit / 표준) */
.metrics-toggle > summary::-webkit-details-marker { display: none; }
.metrics-toggle > summary::marker { content: ""; }

.metrics-toggle > summary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(56, 189, 248, 0.3);
}

.metrics-toggle > summary .chevron {
    font-size: 1.1rem;
    transition: transform 0.18s ease;
}

.metrics-toggle[open] > summary .chevron {
    transform: rotate(180deg);
}

.metrics-toggle[open] > summary {
    border-radius: 9px 9px 0 0;
    border-bottom-color: transparent;
}

.summary-score {
    margin-left: auto;
    font-weight: 700;
    color: #e2e8f0;
    font-variant-numeric: tabular-nums;
}

.metrics-body {
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-top: none;
    border-radius: 0 0 9px 9px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
}

.metrics-toggle .card-metrics {
    margin-bottom: 0;
    border-radius: 7px;
}

/* 요약줄의 경고 아이콘 — 펼칠 이유가 있다는 신호 */
.summary-warn {
    font-size: 1rem;
    color: #fbbf24;
}

/* 지표 결손 경고 — 접히지 않는 압축 칩 형태 (순위 오해 방지용이라 항상 보인다) */
.basis-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    padding: 5px 9px;
    border-radius: 7px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.26);
    color: #fbbf24;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.35;
}

.basis-chip .material-symbols-rounded {
    font-size: 0.95rem;
    flex-shrink: 0;
}

/* 최하단으로 옮긴 수집 현황판 */
.source-status {
    margin-top: 26px;
    margin-bottom: 0;
}

/* 누적값은 증분보다 보조 정보이므로 톤을 낮춘다 */
.card-metrics.cumulative {
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.03);
}

.card-metrics.cumulative .metric-box strong {
    font-size: 0.9rem;
    color: #cbd5e1;
}
