* { box-sizing: border-box; }
.q-page, .q-page-container { padding: 0 !important; }
.nicegui-content { align-items: stretch !important; width: 100%; padding: 0 !important; gap: 0 !important; }
body {
  background: #111827;
  color: #e2e8f0;
  font-family: system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}
/* ── Nav ──────────────────────────────────────────────────────────── */
nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(17,24,39,0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.09);
  box-shadow: 0 1px 20px rgba(0,0,0,0.3);
}
.nav-inner {
  max-width: 960px; margin: 0 auto; padding: 0 24px;
  height: 54px; display: flex; align-items: center; gap: 16px;
}
.nav-logo {
  font-size: 15px; font-weight: 800; letter-spacing: -0.02em;
  color: #e2e8f0; text-decoration: none; flex-shrink: 0;
}
.nav-logo .kv-gold { color: #f59e0b; }
.nav-logo .kv-blue { color: #60a5fa; }
.nav-sep { color: rgba(255,255,255,0.2); font-size: 12px; }
.nav-link {
  font-size: 13px; font-weight: 500; color: #94a3b8;
  text-decoration: none; transition: color 0.15s;
}
.nav-link:hover { color: #e2e8f0; }
.nav-chat-btn {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 600;
  background: linear-gradient(135deg, #1d4ed8, #c8921a);
  color: #fff; text-decoration: none; transition: opacity 0.15s;
}
.nav-chat-btn:hover { opacity: 0.88; }
/* ── Hero header ──────────────────────────────────────────────────── */
.social-hero {
  background: linear-gradient(135deg, #1a2d4a 0%, #1e1040 50%, #1a2d4a 100%);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 36px 24px 32px;
  position: relative; overflow: hidden;
}
.social-hero::before {
  content: '';
  position: absolute; top: -60px; right: -60px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(220,38,38,0.18) 0%, transparent 70%);
  pointer-events: none;
}
.social-hero::after {
  content: '';
  position: absolute; bottom: -80px; left: 10%;
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(245,158,11,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.hero-inner {
  max-width: 900px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap;
  text-align: center;
}
.hero-title {
  font-size: 1.75rem; font-weight: 900; letter-spacing: -0.03em;
  background: linear-gradient(135deg, #f8fafc 0%, #f59e0b 60%, #ef4444 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  font-size: 0.83rem; color: #64748b; margin-top: 4px;
}
.live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(220,38,38,0.15);
  border: 1px solid rgba(220,38,38,0.35);
  color: #fca5a5;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; padding: 5px 12px; border-radius: 20px;
}
.live-dot {
  width: 7px; height: 7px; background: #ef4444; border-radius: 50%;
  animation: live-pulse 1.5s ease-in-out infinite;
  box-shadow: 0 0 6px #ef4444;
  display: inline-block; flex-shrink: 0;
}
@keyframes live-pulse { 0%,100%{opacity:1;box-shadow:0 0 6px #ef4444} 50%{opacity:0.3;box-shadow:0 0 2px #ef4444} }
/* ── Page layout ─────────────────────────────────────────────────── */
.social-page {
  max-width: 900px; margin: 0 auto; padding: 28px 24px 72px;
}
/* ── Section divider ─────────────────────────────────────────────── */
.sec-divider {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: #475569;
  display: flex; align-items: center; gap: 10px;
  margin: 32px 0 16px;
}
.sec-divider::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,0.08), transparent);
}
/* ── Topic card ──────────────────────────────────────────────────── */
.topic-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.11);
  border-radius: 18px; padding: 24px 26px;
  margin-bottom: 20px;
  position: relative; overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.topic-card.tier-hot {
  border-left: 3px solid #ef4444;
  box-shadow: 0 4px 32px rgba(239,68,68,0.12), inset 0 0 60px rgba(239,68,68,0.03);
}
.topic-card.tier-hot::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, #ef4444, transparent 60%);
}
.topic-card.tier-trending {
  background: rgba(120,53,15,0.25);
  border-left: 3px solid #f59e0b;
  box-shadow: 0 4px 32px rgba(245,158,11,0.10);
}
.topic-card.tier-trending::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, #f59e0b, transparent 60%);
}
.topic-card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}
.topic-name {
  font-size: 1.2rem; font-weight: 800; color: #f1f5f9; letter-spacing: -0.01em;
}
.topic-meta {
  font-size: 0.71rem; color: #64748b; margin-top: 4px;
}
.hot-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5; font-size: 0.7rem; font-weight: 700;
  padding: 5px 12px; border-radius: 20px; flex-shrink: 0;
  white-space: nowrap;
}
.trending-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(245,158,11,0.15); border: 1px solid rgba(245,158,11,0.3);
  color: #fcd34d; font-size: 0.7rem; font-weight: 700;
  padding: 5px 12px; border-radius: 20px; flex-shrink: 0;
  white-space: nowrap;
}
/* ── Aspects grid ────────────────────────────────────────────────── */
.aspects-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px; margin-bottom: 8px;
}
.aspect-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 13px; border-radius: 11px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.09);
}
.aspect-label {
  font-size: 0.71rem; font-weight: 700; color: #cbd5e1; white-space: nowrap;
  min-width: 90px; flex-shrink: 0; padding-top: 1px;
}
.aspect-body { flex: 1; min-width: 0; }
.sentiment-badge {
  display: inline-block; font-size: 0.62rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  padding: 2px 8px; border-radius: 20px; margin-bottom: 4px;
}
.sent-positive { background: rgba(22,163,74,0.2); color: #86efac; border: 1px solid rgba(22,163,74,0.25); }
.sent-negative { background: rgba(220,38,38,0.2); color: #fca5a5; border: 1px solid rgba(220,38,38,0.25); }
.sent-mixed    { background: rgba(245,158,11,0.2); color: #fcd34d; border: 1px solid rgba(245,158,11,0.25); }
.sent-unknown  { background: rgba(100,116,139,0.2); color: #94a3b8; border: 1px solid rgba(100,116,139,0.2); }
.aspect-summary {
  font-size: 0.74rem; color: #94a3b8; line-height: 1.45;
  font-style: italic;
}
/* ── Raw text fallback / summary block ───────────────────────────── */
.raw-text-block {
  font-size: 0.84rem; color: #94a3b8; line-height: 1.6;
  background: rgba(255,255,255,0.06); border-radius: 11px; padding: 14px 16px;
  border: 1px solid rgba(255,255,255,0.09);
}
/* ── Source links (LlamaIndex nodes) ─────────────────────────────── */
.source-links {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px;
}
.source-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px; border-radius: 20px; font-size: 0.71rem; font-weight: 600;
  background: rgba(96,165,250,0.1); border: 1px solid rgba(96,165,250,0.2);
  color: #93c5fd; text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.source-chip:hover { background: rgba(96,165,250,0.18); border-color: rgba(96,165,250,0.35); color: #bfdbfe; }
/* ── Topic tabs ──────────────────────────────────────────────────── */
.topic-tabs {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px;
}
.topic-tab {
  padding: 7px 18px; border-radius: 22px; font-size: 0.8rem; font-weight: 600;
  cursor: pointer;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: #94a3b8;
  transition: all 0.15s;
}
.topic-tab:hover { background: rgba(255,255,255,0.09); color: #e2e8f0; border-color: rgba(255,255,255,0.2); }
.topic-tab.active { background: rgba(239,68,68,0.18); color: #fca5a5; border-color: rgba(239,68,68,0.4); }
.topic-tab.active.tier-trending { background: rgba(245,158,11,0.18); color: #fcd34d; border-color: rgba(245,158,11,0.4); }
/* ── Posts feed ──────────────────────────────────────────────────── */
.posts-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; flex-wrap: wrap; gap: 10px;
}
.posts-section-label {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: #64748b;
}
.posts-meta {
  font-size: 0.72rem; color: #475569; display: flex; align-items: center; gap: 10px;
}
.refresh-btn {
  font-size: 0.72rem; font-weight: 600; color: #93c5fd;
  background: rgba(96,165,250,0.08); border: 1px solid rgba(96,165,250,0.2);
  border-radius: 7px; padding: 4px 10px; cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.refresh-btn:hover:not(:disabled) { background: rgba(96,165,250,0.18); }
.refresh-btn:disabled { opacity: 0.5; cursor: default; }
.refresh-btn .spin { display: inline-block; animation: btn-spin 0.7s linear infinite; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
.post-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 13px; padding: 14px 16px;
  margin-bottom: 10px;
  transition: background 0.15s, border-color 0.15s;
}
.post-card:hover { background: rgba(255,255,255,0.09); border-color: rgba(255,255,255,0.16); }
.post-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 8px; flex-wrap: wrap;
}
.post-source {
  font-size: 0.67rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; background: rgba(96,165,250,0.12); color: #93c5fd;
  padding: 2px 9px; border-radius: 20px; border: 1px solid rgba(96,165,250,0.2);
}
.post-score {
  font-size: 0.67rem; color: #fcd34d; font-weight: 600;
  background: rgba(245,158,11,0.12); padding: 2px 9px; border-radius: 20px;
  border: 1px solid rgba(245,158,11,0.2);
}
.post-title {
  font-size: 0.86rem; font-weight: 600; color: #e2e8f0; line-height: 1.4;
  margin-bottom: 6px;
}
.post-text {
  font-size: 0.78rem; color: #64748b; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; margin-bottom: 8px;
}
.post-link {
  font-size: 0.72rem; font-weight: 600; color: #60a5fa; text-decoration: none;
}
.post-link:hover { color: #f59e0b; text-decoration: underline; }
/* ── Idle state ──────────────────────────────────────────────────── */
.idle-state {
  text-align: center; padding: 64px 24px 52px;
  background: rgba(255,255,255,0.04);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.09);
}
.idle-icon {
  font-size: 3.2rem; margin-bottom: 18px;
  animation: idle-float 3s ease-in-out infinite;
  display: inline-block; filter: drop-shadow(0 0 18px rgba(245,158,11,0.4));
}
@keyframes idle-float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
.idle-title {
  font-size: 1.05rem; font-weight: 700; color: #e2e8f0; margin-bottom: 10px;
}
.idle-sub {
  font-size: 0.85rem; color: #64748b; line-height: 1.6; max-width: 380px; margin: 0 auto;
}
/* ── History section ─────────────────────────────────────────────── */
.history-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  border-left: 3px solid rgba(239,68,68,0.4);
  border-radius: 13px; padding: 16px 20px;
  margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
  transition: background 0.15s;
}
.history-card:hover { background: rgba(255,255,255,0.09); }
.history-card-name {
  font-size: 0.9rem; font-weight: 700; color: #cbd5e1;
}
.history-card-meta {
  font-size: 0.7rem; color: #64748b; margin-top: 3px;
}
.history-card-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.22);
  color: #fca5a5; font-size: 0.67rem; font-weight: 700;
  padding: 3px 10px; border-radius: 20px; flex-shrink: 0;
  white-space: nowrap;
}
.history-placeholder {
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px; padding: 16px 20px;
  font-size: 0.82rem; color: #475569; font-style: italic;
}
/* ── Skeleton ────────────────────────────────────────────────────── */
.sk {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite; border-radius: 14px;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
/* ── Footer ──────────────────────────────────────────────────────── */
footer {
  border-top: 1px solid rgba(255,255,255,0.07); padding: 20px 24px;
  text-align: center; font-size: 0.72rem; color: #475569;
  background: rgba(0,0,0,0.2);
}
footer a { color: #60a5fa; text-decoration: none; }
footer a:hover { color: #f59e0b; }
@media (max-width: 600px) {
  .social-page { padding: 20px 14px 48px; }
  .aspects-grid { grid-template-columns: 1fr; }
  .social-hero { padding: 24px 16px 20px; }
  .hero-title { font-size: 1.4rem; }
}
