/* ── Reset & Base ─────────────────────────────────────── */
:root {
  --vs-bg: #FFFFFF;
  --vs-surface: #F7FAFC;
  --vs-primary: #14B8A6;
  --vs-secondary: #0EA5E9;
  --vs-accent: #F59E0B;
  --vs-text: #0F172A;
  --vs-border: #E2E8F0;
  --vs-text-muted: #64748B;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--vs-bg);
  color: var(--vs-text);
}

/* ── App canvas (bubbles sit on light field) ─────────── */
#app {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  background: radial-gradient(ellipse at 28% 36%, rgba(20, 184, 166, 0.08) 0%, var(--vs-bg) 55%),
    radial-gradient(ellipse at 78% 72%, rgba(14, 165, 233, 0.07) 0%, transparent 45%),
    var(--vs-bg);
}

/* ── Header ──────────────────────────────────────────── */
#header {
  position: absolute;
  top: 24px;
  left: 32px;
  z-index: 10;
  pointer-events: none;
}

.hdr-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pro-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 20px;
  padding: 0 8px;
  border-radius: 10px;
  background: #000000;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  padding-top: 1px;
  padding-left: 9px;
}

#section-meta {
  margin-top: 10px;
  max-width: 360px;
}

#section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--vs-text);
  letter-spacing: -0.02em;
}

#subtitle {
  margin-top: 3px;
  font-size: 12px;
  color: var(--vs-text-muted);
  line-height: 1.4;
}

#header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--vs-primary), var(--vs-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hdr-live {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.hdr-live-text {
  color: #B45309;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.10em;
}

/* ── Breadcrumb nav ──────────────────────────────────── */
#breadcrumb {
  position: absolute;
  top: 28px;
  left: 300px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

#breadcrumb .crumb {
  color: var(--vs-text-muted);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}

#breadcrumb .crumb:hover {
  background: var(--vs-surface);
  color: var(--vs-text);
}

#breadcrumb .crumb.active {
  color: var(--vs-primary);
  cursor: default;
}

#breadcrumb .sep {
  color: var(--vs-border);
  user-select: none;
}

/* ── SVG container ───────────────────────────────────── */
#canvas-wrap {
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

#viz {
  width: 100%;
  height: 100%;
  display: block;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--vs-accent);
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55);
  animation: livePulse 1.15s ease-in-out infinite;
}

@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55); transform: scale(1); }
  60%  { box-shadow: 0 0 0 12px rgba(245, 158, 11, 0); transform: scale(1.05); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); transform: scale(1); }
}

/* ── News-card shared flag cells (reused in sidebar news list) ─── */
.bp-flag {
  width: 22px;
  height: 16px;
  border-radius: 4px;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
  border: 1px solid var(--vs-border);
}

.bp-flag-empty {
  display: inline-block;
  width: 22px;
  height: 16px;
  border-radius: 4px;
  border: 1px dashed var(--vs-border);
  opacity: 0.5;
}

/* ── News popup ─────────────────────────────────────── */
#news-popup-backdrop {
  position: fixed;
  inset: 0;
  z-index: 320;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#news-popup-backdrop.hidden { display: none; }

#news-popup {
  width: min(760px, 94vw);
  max-height: min(78vh, 820px);
  overflow: auto;
  background: var(--vs-bg);
  border: 1px solid var(--vs-border);
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.12);
  padding: 18px 18px 16px;
  position: relative;
}

#news-popup-close {
  position: absolute;
  right: 10px;
  top: 8px;
  border: 0;
  background: transparent;
  color: var(--vs-text-muted);
  font-size: 24px;
  cursor: pointer;
}

#news-popup-close:hover { color: var(--vs-text); }

#np-title {
  font-size: 18px;
  color: var(--vs-text);
  margin-right: 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
#np-sub { margin-top: 8px; margin-bottom: 12px; color: var(--vs-secondary); line-height: 1.45; font-size: 13px; }

#np-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  row-gap: 8px;
  column-gap: 12px;
  border-top: 1px solid var(--vs-border);
  padding-top: 12px;
}

/* ── Main group transition for panning ───────────────── */
#viz .main-group {
  transition: transform 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* ── Bubble styling ──────────────────────────────────── */
.bubble-group {
  cursor: pointer;
}

.bubble-circle {
  transition: filter 0.25s, stroke-width 0.25s;
  stroke-width: 1.5;
}

.bubble-group:hover .bubble-circle {
  filter: url(#glow);
  stroke-width: 3;
}

/* ── Newsletter count badge on bubbles ───────────────── */
.news-badge circle {
  fill: #DC2626;
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 1;
  filter: url(#shadow);
}

.news-badge text {
  fill: #fff;
  font-size: 11px;
  font-weight: 900;
  text-anchor: middle;
  dominant-baseline: middle;
}

.bubble-label {
  font-family: 'Inter', sans-serif;
  fill: var(--vs-text);
  text-anchor: middle;
  pointer-events: none;
  font-weight: 500;
}

.bubble-sublabel {
  font-family: 'Inter', sans-serif;
  fill: var(--vs-text-muted);
  text-anchor: middle;
  pointer-events: none;
  font-weight: 400;
}

.bubble-flag {
  pointer-events: none;
}

/* ── Connecting lines ────────────────────────────────── */
.link-line {
  fill: none;
  stroke-width: 1.5;
  opacity: 0.5;
  stroke-dasharray: 6 4;
  animation: dash-flow 20s linear infinite;
}

@keyframes dash-flow {
  to { stroke-dashoffset: -200; }
}

/* ── Flag badge (small flag next to company clusters) ── */
.flag-badge {
  pointer-events: none;
}

/* ── Tooltip ─────────────────────────────────────────── */
#tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 100;
  background: var(--vs-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--vs-border);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.1);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--vs-text-muted);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s, transform 0.2s;
  max-width: 260px;
}

#tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

#tooltip .tt-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--vs-text);
  margin-bottom: 2px;
}

#tooltip .tt-cap {
  color: var(--vs-primary);
  font-weight: 500;
}

#tooltip .tt-detail {
  margin-top: 4px;
  font-size: 11px;
  color: var(--vs-text-muted);
}

/* ── Ripple animation ────────────────────────────────── */
.ripple {
  fill: none;
  stroke: rgba(20, 184, 166, 0.5);
  stroke-width: 2;
}


/* ── Particles / ambient ─────────────────────────────── */
.particle {
  fill: rgba(20, 184, 166, 0.14);
}

/* ═══════════════════════════════════════════════════════
   RANKINGS PANEL (fintech: cool slate, navy ink, teal/indigo accents)
   ═══════════════════════════════════════════════════════ */
#rankings-panel {
  --rp-ink: #0c1929;
  --rp-ink-soft: #1e3a5f;
  --rp-muted: #5a6d85;
  --rp-line: rgba(15, 39, 68, 0.1);
  --rp-teal: #0d9488;
  --rp-teal-soft: rgba(13, 148, 136, 0.14);
  --rp-indigo: #2563eb;
  --rp-indigo-soft: rgba(37, 99, 235, 0.12);
  width: 350px;
  flex-shrink: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: linear-gradient(165deg, #dfe8f4 0%, #e8eef6 18%, #f0f4fa 42%, #f7f9fd 100%);
  border-left: 1px solid rgba(12, 45, 82, 0.14);
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.65);
  z-index: 15;
}

.rp-header {
  padding: 20px 18px 14px;
  border-bottom: 1px solid var(--rp-line);
  background: linear-gradient(105deg, rgba(37, 99, 235, 0.07) 0%, rgba(13, 148, 136, 0.05) 45%, transparent 72%);
}

.rp-header h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--rp-ink);
  background: none;
  -webkit-text-fill-color: currentColor;
  position: relative;
  display: inline-block;
}

.rp-header h2::after {
  content: "";
  display: block;
  height: 3px;
  width: 40px;
  margin-top: 10px;
  border-radius: 2px;
  background: linear-gradient(90deg, #b8860b, #eab308, var(--rp-teal), #38bdf8);
}

.rp-sort {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 12px 8px;
}

.rp-sort-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rp-muted);
  margin-right: 2px;
}

.rp-sort-btn {
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 600;
  color: var(--rp-muted);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(100, 116, 139, 0.22);
  border-radius: 14px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.rp-sort-btn:hover {
  color: var(--rp-ink);
  border-color: rgba(37, 99, 235, 0.35);
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.rp-sort-btn.active {
  color: var(--rp-ink);
  font-weight: 700;
  border-color: rgba(13, 148, 136, 0.55);
  background: linear-gradient(145deg, var(--rp-teal-soft), var(--rp-indigo-soft));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 2px 10px rgba(13, 148, 136, 0.12);
}

.rp-sort-btn[data-sort="quality"].active {
  border-color: rgba(37, 99, 235, 0.5);
  background: linear-gradient(145deg, rgba(37, 99, 235, 0.16), var(--rp-teal-soft));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 2px 10px rgba(37, 99, 235, 0.1);
}

.rp-sort-btn[data-sort="cost"].active {
  border-color: rgba(180, 83, 9, 0.45);
  background: linear-gradient(145deg, rgba(245, 158, 11, 0.14), rgba(251, 191, 36, 0.08));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 2px 10px rgba(245, 158, 11, 0.1);
}

.rp-sort-btn[data-sort="latest"].active {
  border-color: rgba(124, 58, 237, 0.45);
  background: linear-gradient(145deg, rgba(167, 139, 250, 0.18), rgba(196, 181, 253, 0.1));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 2px 10px rgba(124, 58, 237, 0.08);
}

.rp-sort-btn[data-sort="top"].active {
  color: #92400e;
  border-color: rgba(180, 83, 9, 0.45);
  background: linear-gradient(145deg, rgba(234, 179, 8, 0.2), rgba(245, 158, 11, 0.1));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 2px 10px rgba(245, 158, 11, 0.1);
}

.rp-sort-btn[data-sort="hot"].active {
  color: #9f1239;
  border-color: rgba(225, 29, 72, 0.4);
  background: linear-gradient(145deg, rgba(244, 63, 94, 0.16), rgba(251, 113, 133, 0.08));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 2px 10px rgba(225, 29, 72, 0.08);
}

.rp-sort-btn[data-sort="new"].active {
  color: #0f766e;
  border-color: rgba(13, 148, 136, 0.5);
  background: linear-gradient(145deg, rgba(13, 148, 136, 0.18), rgba(20, 184, 166, 0.1));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 2px 10px rgba(13, 148, 136, 0.1);
}

.rp-sort-btn[data-sort="rising"].active {
  color: #6d28d9;
  border-color: rgba(124, 58, 237, 0.45);
  background: linear-gradient(145deg, rgba(139, 92, 246, 0.18), rgba(167, 139, 250, 0.1));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 2px 10px rgba(124, 58, 237, 0.08);
}

/* ── Tabs (per-category accent via data-cat) ───────── */
.rp-tabs {
  display: flex;
  gap: 4px;
  padding: 0 12px 8px;
}

.rp-tab {
  flex: 1;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px 4px;
  font-size: 10.5px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  color: var(--rp-muted);
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--rp-line);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
  text-align: center;
  line-height: 1.2;
}

.rp-tab .mod-strip {
  gap: 2px;
}

.rp-tab .mod-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.rp-tab .mod-icon-svg {
  width: 100%;
  height: 100%;
}

.rp-tab-label {
  display: block;
  line-height: 1.15;
}

.rp-tab[data-cat="text-to-video"] {
  border-color: rgba(192, 38, 211, 0.18);
  background: rgba(232, 121, 249, 0.08);
}

.rp-tab[data-cat="text-to-text"] {
  border-color: rgba(124, 58, 237, 0.18);
  background: rgba(196, 181, 253, 0.1);
}

.rp-tab[data-cat="text-to-image"] {
  border-color: rgba(5, 150, 105, 0.2);
  background: rgba(52, 211, 153, 0.1);
}

.rp-tab[data-cat="text-to-speech"] {
  border-color: rgba(2, 132, 199, 0.22);
  background: rgba(56, 189, 248, 0.1);
}

.rp-tab:hover {
  color: var(--rp-ink);
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(37, 99, 235, 0.25);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.rp-tab.active {
  color: var(--rp-ink-soft);
  font-weight: 700;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.07);
}

.rp-tab[data-cat="text-to-video"].active {
  background: linear-gradient(180deg, rgba(232, 121, 249, 0.22), rgba(232, 121, 249, 0.08));
  border-color: rgba(147, 51, 234, 0.45);
}

.rp-tab[data-cat="text-to-text"].active {
  background: linear-gradient(180deg, rgba(167, 139, 250, 0.28), rgba(196, 181, 253, 0.1));
  border-color: rgba(99, 102, 241, 0.45);
}

.rp-tab[data-cat="text-to-image"].active {
  background: linear-gradient(180deg, rgba(52, 211, 153, 0.28), rgba(16, 185, 129, 0.08));
  border-color: rgba(5, 150, 105, 0.45);
}

.rp-tab[data-cat="text-to-speech"].active {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.28), rgba(14, 165, 233, 0.08));
  border-color: rgba(2, 132, 199, 0.45);
}

/* ── Toggles ───────────────────────────────────────── */
.rp-toggles {
  display: flex;
  gap: 5px;
  padding: 0 12px 12px;
  flex-wrap: wrap;
}

.rp-toggle {
  padding: 5px 11px;
  font-size: 10px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  color: var(--rp-muted);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--rp-line);
  border-radius: 20px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.rp-toggle:hover {
  color: var(--rp-ink);
  border-color: rgba(37, 99, 235, 0.28);
  background: #fff;
}

.rp-toggle.active {
  color: var(--rp-ink-soft);
  background: linear-gradient(135deg, rgba(30, 58, 95, 0.09), rgba(13, 148, 136, 0.1));
  border-color: rgba(30, 58, 95, 0.28);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

/* ── Rank List ─────────────────────────────────────── */
.rp-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 12px 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(30, 58, 95, 0.35) transparent;
}

.rp-list::-webkit-scrollbar { width: 6px; }
.rp-list::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.25); border-radius: 4px; }
.rp-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(13, 148, 136, 0.45), rgba(37, 99, 235, 0.4));
  border-radius: 4px;
}

.rp-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  margin-bottom: 5px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(15, 39, 68, 0.07);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: background 0.2s, border-color 0.25s, box-shadow 0.25s, opacity 0.3s;
  cursor: pointer;
}

.rp-card:hover {
  background: #fff;
  border-color: rgba(37, 99, 235, 0.22);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.07);
}

.rp-card.highlighted {
  border-color: rgba(13, 148, 136, 0.45);
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.1), rgba(255, 255, 255, 0.95));
  box-shadow: 0 0 0 1px rgba(13, 148, 136, 0.12), 0 4px 14px rgba(13, 148, 136, 0.1);
}

.rp-card.dimmed {
  opacity: 0.38;
}

.rp-rank {
  width: 22px;
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--rp-muted);
  text-align: center;
  flex-shrink: 0;
}

.rp-card:nth-child(1) .rp-rank {
  color: #b45309;
  text-shadow: 0 0 20px rgba(234, 179, 8, 0.35);
}

.rp-card:nth-child(2) .rp-rank {
  color: #475569;
}

.rp-card:nth-child(3) .rp-rank {
  color: #9a3412;
}

.rp-news-card:nth-child(1) .rp-rank {
  color: #b45309;
  text-shadow: 0 0 20px rgba(234, 179, 8, 0.35);
}

.rp-news-card:nth-child(2) .rp-rank {
  color: #475569;
}

.rp-news-card:nth-child(3) .rp-rank {
  color: #9a3412;
}

.rp-flag {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  flex-shrink: 0;
  object-fit: cover;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.rp-info {
  flex: 1;
  min-width: 0;
}

.rp-name-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  min-width: 0;
}

.rp-name-row .mod-strip {
  flex-shrink: 0;
  flex-wrap: nowrap;
  gap: 1px;
}

.rp-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--rp-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.rp-company {
  font-size: 10px;
  color: var(--rp-muted);
  margin-top: 1px;
}

.rp-scores {
  text-align: right;
  flex-shrink: 0;
}

.rp-quality {
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Score tiers inside rankings (fintech: teal gain, amber neutral, rose risk) */
#rankings-panel .rp-quality.q-high { color: #0f7669; }
#rankings-panel .rp-quality.q-mid { color: #b45309; }
#rankings-panel .rp-quality.q-low { color: #be123c; }

.rp-price {
  font-size: 9.5px;
  color: var(--rp-muted);
  margin-top: 1px;
}

.rp-submetric {
  font-size: 9px;
  color: var(--rp-muted);
  margin-top: 1px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

/* ── Mode switcher (Rankings | News) ─────────────────── */
.rp-mode-switcher {
  display: flex;
  gap: 4px;
  margin-top: 10px;
}

.rp-mode-btn {
  flex: 1;
  padding: 7px 0;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  color: var(--rp-muted);
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--rp-line);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.rp-mode-btn:hover {
  color: var(--rp-ink);
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(37, 99, 235, 0.3);
}

.rp-mode-btn.active {
  color: #fff;
  background: linear-gradient(135deg, #0f766e 0%, #1e40af 100%);
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(15, 64, 175, 0.25);
}

/* ── News card overrides (inherits .rp-card row layout) ── */

/* Multi-source highlight */
.rp-news-card.rp-news-multi {
  border-color: rgba(13, 148, 136, 0.3);
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.06) 0%, rgba(255, 255, 255, 0.95) 100%);
}
.rp-news-card.rp-news-multi:hover {
  border-color: rgba(13, 148, 136, 0.48);
  box-shadow: 0 4px 16px rgba(13, 148, 136, 0.1);
}

/* The rp-name inside news can wrap to 2 lines */
.rp-news-card .rp-name {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}

/* Multi-source label inline with company row */
/* Tiny flags row inside scores column */
.rp-news-flags-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}
.rp-flag-xs {
  width: 14px;
  height: 10px;
  border-radius: 1.5px;
}

/* ── Priority badges ────────────────────────────────── */
.rp-priority {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  flex-shrink: 0;
}

.rp-priority-top {
  color: #92400e;
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.22), rgba(245, 158, 11, 0.18));
  border: 1px solid rgba(180, 83, 9, 0.3);
}

.rp-priority-hot {
  color: #9f1239;
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.18), rgba(251, 113, 133, 0.12));
  border: 1px solid rgba(225, 29, 72, 0.3);
}

.rp-priority-new {
  color: #0f766e;
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.18), rgba(20, 184, 166, 0.12));
  border: 1px solid rgba(13, 148, 136, 0.3);
}

.rp-priority-rising {
  color: #6d28d9;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(167, 139, 250, 0.12));
  border: 1px solid rgba(124, 58, 237, 0.3);
}

/* ── Rumor badge ────────────────────────────────────── */
.rp-rumor {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #92400e;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.35);
  flex-shrink: 0;
}

/* ── Model details popup ────────────────────────────── */
#model-popup-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#model-popup-backdrop.hidden {
  display: none;
}

/* ── Product bubble popup (static summary + rankings metrics) ─ */
#product-popup-backdrop {
  position: fixed;
  inset: 0;
  z-index: 305;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#product-popup-backdrop.hidden {
  display: none;
}

#product-popup {
  width: min(520px, 92vw);
  background: var(--vs-bg);
  border: 1px solid var(--vs-border);
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.12);
  padding: 20px 20px 16px;
  position: relative;
}

#product-popup-close {
  position: absolute;
  right: 10px;
  top: 8px;
  border: 0;
  background: transparent;
  color: var(--vs-text-muted);
  font-size: 24px;
  cursor: pointer;
}

#product-popup-close:hover {
  color: var(--vs-text);
}

#pp-name {
  font-size: 19px;
  color: var(--vs-text);
  margin-right: 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

#pp-summary {
  margin-top: 8px;
  margin-bottom: 10px;
  color: #0F766E;
  line-height: 1.45;
  font-size: 13px;
}

#pp-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  row-gap: 8px;
  column-gap: 12px;
  border-top: 1px solid var(--vs-border);
  padding-top: 12px;
}

#model-popup {
  width: min(540px, 92vw);
  background: var(--vs-bg);
  border: 1px solid var(--vs-border);
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.12);
  padding: 20px 20px 16px;
  position: relative;
}

#model-popup-close {
  position: absolute;
  right: 10px;
  top: 8px;
  border: 0;
  background: transparent;
  color: var(--vs-text-muted);
  font-size: 24px;
  cursor: pointer;
}

#model-popup-close:hover {
  color: var(--vs-text);
}

#mp-name {
  font-size: 20px;
  color: var(--vs-text);
  margin-right: 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Modality pills (video / thinking / image / speech) */
.mod-strip {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  vertical-align: middle;
}

.mod-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 0;
  background: transparent;
  line-height: 0;
  box-shadow: none;
  color: var(--mod-color);
}

.mod-icon-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  flex-shrink: 0;
  shape-rendering: geometricPrecision;
}

/* Compact modality icons in ranking cards and newsletter list */
.rp-name-row .mod-icon {
  width: 14px;
  height: 14px;
}

.bp-company .mod-strip {
  flex-wrap: nowrap;
  gap: 1px;
}

.bp-company .mod-icon {
  width: 13px;
  height: 13px;
}

.mp-v-model {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

#mp-intro {
  margin-top: 8px;
  margin-bottom: 12px;
  color: var(--vs-secondary);
  line-height: 1.45;
  font-size: 13px;
}

.mp-parent-blurb {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: rgba(14, 165, 233, 0.08);
  border-radius: 8px;
  border: 1px solid rgba(14, 165, 233, 0.22);
  color: #0369A1;
  font-size: 12px;
  line-height: 1.5;
}

#mp-grid {
  display: grid;
  grid-template-columns: 170px 1fr;
  row-gap: 8px;
  column-gap: 12px;
  border-top: 1px solid var(--vs-border);
  padding-top: 12px;
}

.mp-k {
  color: var(--vs-text-muted);
  font-size: 12px;
}

.mp-v {
  color: var(--vs-text);
  font-size: 13px;
  font-weight: 500;
}

/* quality color tiers */
.q-high  { color: #059669; }
.q-mid   { color: #D97706; }
.q-low   { color: #DC2626; }

#bottom-left-tools {
  position: fixed;
  left: 18px;
  bottom: 16px;
  z-index: 240;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

#diagnosis-btn {
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(255, 255, 255, 0.9);
  color: var(--vs-text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(14px);
}

#diagnosis-btn:hover {
  background: #fff;
  border-color: rgba(59, 130, 246, 0.35);
}


/* Diagnosis popup */
#diagnosis-popup-backdrop {
  position: fixed;
  inset: 0;
  z-index: 330;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#diagnosis-popup-backdrop.hidden {
  display: none;
}

#diagnosis-popup {
  width: min(940px, 96vw);
  max-height: min(82vh, 900px);
  overflow: auto;
  background: var(--vs-bg);
  border: 1px solid var(--vs-border);
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.12);
  padding: 18px 18px 16px;
  position: relative;
}

#diagnosis-popup-close {
  position: absolute;
  right: 10px;
  top: 8px;
  border: 0;
  background: transparent;
  color: var(--vs-text-muted);
  font-size: 24px;
  cursor: pointer;
}
#diagnosis-popup-close:hover { color: var(--vs-text); }

#dx-title {
  font-size: 18px;
  color: var(--vs-text);
  margin-right: 28px;
}
#dx-sub {
  margin-top: 8px;
  margin-bottom: 12px;
  color: var(--vs-secondary);
  line-height: 1.45;
  font-size: 13px;
}
#dx-summary {
  font-size: 12px;
  color: var(--vs-text-muted);
  margin-bottom: 10px;
  line-height: 1.45;
}
#dx-list {
  border-top: 1px solid var(--vs-border);
  padding-top: 12px;
  display: grid;
  row-gap: 10px;
}
.dx-row {
  border: 1px solid var(--vs-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.75);
  padding: 10px 12px;
}
.dx-row-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.dx-name { font-weight: 700; color: var(--vs-text); }
.dx-status {
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 7px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.7);
}
.dx-status.healthy { color: #166534; border-color: rgba(22, 101, 52, 0.35); background: rgba(34, 197, 94, 0.08); }
.dx-status.partial { color: #92400e; border-color: rgba(146, 64, 14, 0.35); background: rgba(245, 158, 11, 0.1); }
.dx-status.failing, .dx-status.unsupported { color: #991b1b; border-color: rgba(153, 27, 27, 0.35); background: rgba(239, 68, 68, 0.1); }
.dx-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 6px 10px;
  font-size: 11px;
  color: var(--vs-text-muted);
}
.dx-note {
  margin-top: 6px;
  font-size: 11px;
  color: var(--vs-text-muted);
}

@media (max-width: 900px) {
  #bottom-left-tools {
    left: 12px;
    bottom: 12px;
    gap: 6px;
  }
  #diagnosis-btn {
    padding: 7px 10px;
    font-size: 10px;
  }
  .dx-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}
