/* ============================================================
   Social Radar v2 - Bloomberg Dark Mode
   ============================================================ */

/* === CSS Variables === */
:root {
  --color-bg: #121212;
  --color-surface: #1A1F2E;
  --color-surface-hover: #242B3D;
  --color-navbar: #1E1E1E;
  --color-text: #E7E9EA;
  --color-text-secondary: #8B949E;
  --color-border: #30363D;
  --color-accent: #00E5FF;
  --color-accent-hover: #33ECFF;
  --color-accent-text: #4DF0FF;
  --color-accent-bg: rgba(0, 229, 255, 0.12);
  --color-ok-green: #4A9968;
  --color-signal: #D4A843;
  --color-signal-hover: #E0B854;
  --color-trend-up: #FF6B6B;
  --color-trend-down: #6B9FFF;
  --color-trend-stable: #8B949E;
  --color-tier-core: #8A2BE2;
  --color-tier-regular: #1E40AF;
  --color-tier-emerging: #00FFFF;
  --color-bridge-gold: #D4A843;
  --color-muted-text: #C9B88E;
  --font-main: "Microsoft JhengHei", "Noto Sans TC", "PingFang TC", sans-serif;
  --font-mono: "Consolas", "Monaco", monospace;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.5);
  --radius: 8px;
  --sidebar-width: 360px;
}

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

html {
  font-size: 16px;
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-main);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

a {
  color: var(--color-accent-text);
  text-decoration: none;
}

a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

/* === Single Header Bar === */
.header-bar {
  background: var(--color-navbar);
  color: var(--color-text);
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.header-center {
  flex: 55;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
}

.header-right {
  flex: 30;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  border-left: 1px solid #333;
  padding-left: 16px;
}

.header-right-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
}

.navbar-brand:hover {
  text-decoration: none;
  color: var(--color-accent-text);
}

.brand-logo {
  height: 48px;
  width: auto;
  vertical-align: middle;
  margin-right: 2px;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  transition: filter 0.15s;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  list-style: none;
}

.navbar-nav a {
  color: var(--color-text-secondary);
  font-size: 1rem;
  font-weight: 500;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--color-text);
  border-bottom-color: var(--color-accent);
  text-decoration: none;
}

/* === Health Dot (Navbar) === */
.health-dot {
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 4px;
}

.health-dot-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-text-secondary);
  transition: background 0.3s, box-shadow 0.3s;
}

.health-dot.status-healthy .health-dot-indicator {
  background: var(--color-ok-green);
  box-shadow: 0 0 8px var(--color-ok-green), 0 0 16px rgba(74, 153, 104, 0.3);
}

.health-dot.status-degraded .health-dot-indicator {
  background: #FFD93D;
  box-shadow: 0 0 8px #FFD93D, 0 0 20px rgba(255, 217, 61, 0.35);
  animation: healthPulse 2s ease infinite;
}

.health-dot.status-error .health-dot-indicator {
  background: #FF6B6B;
  box-shadow: 0 0 8px #FF6B6B, 0 0 20px rgba(255, 107, 107, 0.35);
  animation: healthPulse 1.5s ease infinite;
}

@keyframes healthPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.health-tooltip {
  display: none;
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(26, 31, 46, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(48, 54, 61, 0.6);
  border-radius: 10px;
  padding: 12px 16px;
  min-width: 200px;
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 200;
  font-size: 0.8rem;
  color: var(--color-text);
  line-height: 1.8;
}

.health-dot:hover .health-tooltip {
  display: block;
}

.health-tooltip-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.health-tooltip-row {
  color: var(--color-text-secondary);
}

/* === Dedup Popover (anchored in graph meta) === */
.dedup-trigger {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted currentColor;
}

.dedup-popover {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.75rem;
  line-height: 1.6;
  white-space: nowrap;
  color: var(--color-text);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 100;
}

.dedup-trigger:hover .dedup-popover {
  display: block;
}

/* === Main Layout (Index Page) === */
.layout-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.layout-main {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
}

.layout-sidebar {
  width: var(--sidebar-width);
  border-left: 1px solid var(--color-border);
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.25);
  background: var(--color-surface);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transition: width 0.25s ease;
}

/* Sidebar collapse toggle — tab-like handle between graph and sidebar */
.sidebar-toggle {
  position: relative;
  width: 20px;
  flex-shrink: 0;
  background: var(--color-surface);
  border: none;
  border-left: 1px solid var(--color-border);
  cursor: pointer;
  color: var(--color-text-secondary);
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: all 0.2s;
  padding: 0;
  writing-mode: vertical-lr;
}

.sidebar-toggle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 40px;
  border-radius: 2px;
  background: var(--color-border);
  transition: all 0.2s;
}

.sidebar-toggle:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
  width: 24px;
}

.sidebar-toggle:hover::after {
  background: var(--color-text-secondary);
  height: 48px;
}

/* Collapsed sidebar */
.layout-sidebar.collapsed {
  width: 0;
  min-width: 0;
  overflow: hidden;
  border-left: none;
}

/* === Graph Container === */
#graph-container {
  flex: 1;
  min-height: 400px;
  overflow: hidden;
  position: relative;
  background:
    radial-gradient(circle at 50% 50%, rgba(191, 160, 101, 0.02) 0%, transparent 70%),
    radial-gradient(circle at 50% 50%, transparent 29%, rgba(191, 160, 101, 0.008) 30%, transparent 31%),
    radial-gradient(circle at 50% 50%, transparent 49%, rgba(191, 160, 101, 0.005) 50%, transparent 51%),
    var(--color-bg);
}

#loading-progress {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1rem;
  color: var(--color-text-secondary);
  z-index: 10;
}

/* Graph Legend */
.graph-legend {
  position: absolute;
  bottom: 12px;
  left: 12px;
  display: flex;
  gap: 12px;
  padding: 6px 12px;
  background: rgba(15, 20, 25, 0.7);
  border-radius: 6px;
  border: 1px solid rgba(48, 54, 61, 0.5);
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  z-index: 10;
  pointer-events: none;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.legend-circle {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid;
  flex-shrink: 0;
}

.legend-circle-core {
  width: 12px;
  height: 12px;
  background: var(--color-tier-core);
  border-color: #7B27CC;
}

.legend-circle-regular {
  width: 10px;
  height: 10px;
  background: var(--color-tier-regular);
  border-color: #1A3A9E;
  opacity: 0.75;
}

.legend-circle-emerging {
  width: 8px;
  height: 8px;
  background: var(--color-tier-emerging);
  border-color: #00D4D4;
  opacity: 0.5;
}

.legend-gold-dash {
  display: inline-block;
  width: 20px;
  height: 0;
  border-top: 2px dashed var(--color-bridge-gold);
  flex-shrink: 0;
}

.graph-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  font-size: 0.85rem;
  color: var(--color-text-dim);
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
  flex-shrink: 0;
  contain: layout;
}

.graph-meta-sep {
  margin: 0 6px;
  color: var(--color-border);
}

.graph-meta-stats {
  display: flex;
  align-items: center;
}

.graph-meta-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.graph-meta-nav a {
  color: var(--color-text-dim);
  text-decoration: none;
  font-size: 0.8rem;
  transition: color 0.15s;
}

.graph-meta-nav a:hover {
  color: var(--color-text);
}

.graph-meta-num {
  font-weight: 700;
  color: var(--color-accent);
  font-variant-numeric: tabular-nums;
}

.graph-meta-scan {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 16px;
  overflow: hidden;
}

.scan-bar {
  display: block;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--color-border) 20%,
    var(--color-accent) 50%,
    var(--color-border) 80%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: scanMove 4s linear infinite;
  opacity: 0.4;
}

@keyframes scanMove {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.freshness-stale {
  color: #FFD93D;
}

/* === vis.js Navigation Buttons — Dark Theme + Auto-hide === */
div.vis-network .vis-navigation .vis-button {
  filter: invert(1) brightness(0.6);
  opacity: 0.15;
  transition: opacity 0.3s ease;
  width: 28px;
  height: 28px;
  background-size: 28px 28px;
}

div.vis-network:hover .vis-navigation .vis-button {
  opacity: 0.6;
}

div.vis-network .vis-navigation .vis-button:hover {
  opacity: 1;
  filter: invert(1) brightness(0.8);
}

div.vis-network .vis-navigation .vis-button:active {
  opacity: 1;
  filter: invert(1) brightness(1);
}

/* === vis.js Tooltip — Dark Theme === */
div.vis-tooltip {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
  font-family: var(--font-main);
  pointer-events: none;
}

.vis-tooltip-custom {
  padding: 10px 14px;
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: 8px;
  border-top: 3px solid var(--color-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  font-size: 0.8rem;
  line-height: 1.6;
  min-width: 140px;
  max-width: 260px;
}

.vis-tooltip-custom strong {
  display: block;
  font-size: 0.9rem;
  color: var(--color-text);
  margin-bottom: 4px;
}

.vis-tooltip-custom .tt-row {
  display: block;
}

.vis-tooltip-custom .tt-label {
  color: var(--color-text-secondary);
  margin-right: 6px;
}

.vis-tooltip-custom .tt-label::after {
  content: "：";
}

/* === Sidebar: Ranking === */
.sidebar-header {
  display: flex;
  align-items: center;
  padding: 16px;
  font-size: 1rem;
  font-weight: 700;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
}

#ranking-container {
  flex: 1;
  overflow-y: auto;
}

.ranking-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background 0.15s;
  opacity: 0;
  animation: rankingFadeIn 0.3s ease forwards;
}

.ranking-item:hover {
  background: var(--color-surface-hover);
}

/* Staggered entrance animation */
@keyframes rankingFadeIn {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

.ranking-item:nth-child(1) { animation-delay: 0ms; }
.ranking-item:nth-child(2) { animation-delay: 50ms; }
.ranking-item:nth-child(3) { animation-delay: 100ms; }
.ranking-item:nth-child(4) { animation-delay: 150ms; }
.ranking-item:nth-child(5) { animation-delay: 200ms; }
.ranking-item:nth-child(6) { animation-delay: 250ms; }
.ranking-item:nth-child(7) { animation-delay: 300ms; }
.ranking-item:nth-child(8) { animation-delay: 350ms; }
.ranking-item:nth-child(9) { animation-delay: 400ms; }
.ranking-item:nth-child(10) { animation-delay: 450ms; }
.ranking-item:nth-child(11) { animation-delay: 500ms; }
.ranking-item:nth-child(12) { animation-delay: 550ms; }
.ranking-item:nth-child(13) { animation-delay: 600ms; }
.ranking-item:nth-child(14) { animation-delay: 650ms; }
.ranking-item:nth-child(15) { animation-delay: 700ms; }

.ranking-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-bg);
  background: var(--color-text-secondary);
  flex-shrink: 0;
}

.rank-1 { background: #FF6B6B; }
.rank-2 { background: #FFD93D; color: var(--color-bg); }
.rank-3 { background: var(--color-accent-text); }

.ranking-top .keyword {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text);
}

.ranking-top .heat {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
}

.ranking-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
}

.heat-bar-bg {
  flex: 1;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  overflow: hidden;
}

.heat-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-text));
  border-radius: 2px;
  transition: width 0.3s;
}

.gap-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.gap-media_hype { background: rgba(255, 107, 107, 0.15); color: #FF6B6B; }
.gap-underground_swell { background: var(--color-accent-bg); color: var(--color-accent-text); }
.gap-aligned { background: rgba(191, 160, 101, 0.15); color: var(--color-signal); }

.article-counts {
  color: var(--color-text-secondary);
  white-space: nowrap;
}

/* === Trend Indicators === */
.trend-up { color: var(--color-trend-up); font-weight: 500; font-size: 0.75rem; }
.trend-down { color: var(--color-trend-down); font-weight: 500; font-size: 0.75rem; }
.trend-stable { color: var(--color-trend-stable); font-weight: 500; font-size: 0.75rem; }

/* === Keyword Detail Page === */
.page-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
  flex: 1;
  overflow-y: auto;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 1.8rem;
  margin-bottom: 4px;
  color: var(--color-text);
}

.page-header .heat-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--color-accent-bg);
  color: var(--color-accent-text);
  border-radius: 16px;
  font-size: 0.9rem;
  font-weight: 600;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

.back-link:hover {
  color: var(--color-accent-text);
  text-decoration: none;
}

/* === Cards === */
.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.card-header {
  padding: 14px 20px;
  font-weight: 700;
  font-size: 1rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
}

.card-body {
  padding: 20px;
}

/* === Related Keywords === */
#related-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.related-keyword-item {
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  min-width: 140px;
  transition: all 0.2s;
  text-decoration: none;
  color: var(--color-text);
  background: var(--color-surface);
}

.related-keyword-item:hover {
  box-shadow: var(--shadow-md);
  text-decoration: none;
  transform: translateY(-1px);
  background: var(--color-surface-hover);
}

.relation-obvious { border-left: 3px solid var(--color-obvious); }
.relation-hidden { border-left: 3px solid var(--color-hidden); box-shadow: -2px 0 8px rgba(191, 160, 101, 0.2); }
.relation-alternative { border-left: 3px solid var(--color-alternative); }

.rk-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text);
}

.rk-type {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

.rk-scores {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--color-text-secondary);
  margin-top: 4px;
}

/* === Trend Chart === */
.chart-container {
  position: relative;
  height: 300px;
  overflow: hidden;
}

/* === Sample Articles === */
.article-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  text-decoration: none;
  transition: background 0.15s;
}

.article-item:last-child {
  border-bottom: none;
}

.article-item:hover {
  text-decoration: none;
  color: var(--color-accent-text);
}

.article-source {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--color-bg);
  color: var(--color-text-secondary);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  border: 1px solid var(--color-border);
}

.article-title {
  flex: 1;
  font-size: 0.9rem;
}

.article-time {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* === Not Available === */
.not-available {
  color: var(--color-text-secondary);
  font-style: italic;
  padding: 16px 0;
}

/* === Error Message === */
.error-msg {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-secondary);
  font-size: 1.1rem;
}

/* === Secondary Page Header (no search/filters/spotlight) === */
.header-bar-secondary .header-center {
  display: none;
}

.header-bar-secondary .header-right {
  flex: unset;
  border-left: none;
  padding-left: 0;
}

/* === Page Containers === */
.sources-page,
.transparency-page,
.devlog-page {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
}

/* === About / Sources Page === */
.sources-content {
  max-width: 1200px;
  margin: 0 auto;
  line-height: 1.8;
}

.sources-content h1 {
  font-size: 1.6rem;
  margin-bottom: 12px;
  color: var(--color-text);
}

.sources-content h2 {
  font-size: 1.15rem;
  margin: 32px 0 12px;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 8px;
}

.sources-content p {
  margin-bottom: 12px;
  color: var(--color-text-secondary);
}

.sources-content ul {
  margin: 8px 0 16px 20px;
}

.sources-content li {
  margin-bottom: 4px;
  color: var(--color-text-secondary);
}

.sources-content li strong {
  color: var(--color-text);
}

.sources-content h3 {
  font-size: 1rem;
  margin: 0 0 8px;
  color: var(--color-text);
}

/* Source Lists (news vs social) */
.source-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 16px 0;
}

.source-group {
  padding: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.source-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.source-group li {
  padding: 4px 0;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
}

.source-group li:last-child {
  border-bottom: none;
}

.source-summary {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
}

.source-group-meta {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin-left: 8px;
}

.source-list-detail li {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.source-pct {
  font-size: 0.8rem;
  color: var(--color-muted-text);
  font-variant-numeric: tabular-nums;
}

/* Update Log */
.update-log {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}

.update-log h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin: 0 0 8px;
}

.update-log ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.update-log li {
  font-size: 0.78rem;
  color: var(--color-muted-text);
  padding: 3px 0;
  font-variant-numeric: tabular-nums;
}



/* Legacy about-content (kept for compatibility) */
.about-content {
  line-height: 1.8;
}

.about-content h1 {
  color: var(--color-text);
}

.about-content h2 {
  font-size: 1.3rem;
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-accent);
  color: var(--color-text);
}

.about-content h3 {
  font-size: 1.1rem;
  margin: 16px 0 8px;
  color: var(--color-text);
}

.about-content p {
  margin-bottom: 12px;
  color: var(--color-text-secondary);
}

.about-content ul {
  margin: 8px 0 16px 20px;
}

.about-content li {
  margin-bottom: 4px;
  color: var(--color-text-secondary);
}

.about-content li strong {
  color: var(--color-text);
}

/* === Info Tip Dialogs (Main Page) === */
.info-tip-wrap {
  position: relative;
  display: inline-block;
}

.info-tip-btn-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
  line-height: 1;
  vertical-align: middle;
  margin-left: 6px;
}

.info-tip-btn-inline:hover {
  border-color: var(--color-signal);
  color: var(--color-text);
  background: var(--color-surface-hover);
}

.info-tip-dialog {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 280px;
  max-width: 380px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 100;
  animation: infoTipFadeIn 0.15s ease;
}

.info-tip-dialog.open {
  display: block;
}

.info-tip-dialog.expanded {
  border-color: var(--color-signal);
  box-shadow: 0 0 0 1px var(--color-signal), 0 8px 32px rgba(0, 0, 0, 0.4);
}

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

.info-tip-dialog-header {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--color-text);
}

.info-tip-dialog-header span:first-child {
  flex: 1;
}

.info-tip-close {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  transition: color 0.15s;
}

.info-tip-close:hover {
  color: var(--color-text);
}

.info-tip-dialog-summary {
  padding: 12px 14px 8px;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.info-tip-expand-btn {
  display: block;
  margin: 0 14px 12px;
  padding: 0;
  border: none;
  background: none;
  color: var(--color-accent);
  font-size: 0.8rem;
  cursor: pointer;
  font-family: var(--font-main);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

.info-tip-expand-btn::after {
  content: " \203A";
}

.info-tip-expand-btn:hover {
  color: var(--color-accent-hover);
  text-decoration: underline solid;
}

.info-tip-dialog-detail {
  display: none;
  padding: 0 14px 12px;
}

.info-tip-dialog.expanded .info-tip-dialog-detail {
  display: block;
}

/* Sidebar variant: dialog opens below the header, frosted glass */
.sidebar-header .info-tip-dialog {
  bottom: auto;
  top: calc(100% + 6px);
  left: 0;
  right: auto;
  transform: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(26, 31, 46, 0.88);
}

/* Edge hover relation type dialog */
.edge-type-dialog {
  position: absolute;
  max-width: 320px;
  padding: 10px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-signal);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  z-index: 60;
  pointer-events: none;
  animation: infoTipFadeIn 0.12s ease;
}

.edge-type-dialog-body {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.info-tip-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
}

.info-tip-item:last-child {
  border-bottom: none;
}

.info-tip-item .rt-line {
  display: inline-block;
  width: 24px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
  margin-top: 10px;
}

.info-tip-item strong {
  display: block;
  font-size: 0.85rem;
  color: var(--color-text);
  margin-bottom: 2px;
}

.info-tip-item span {
  display: block;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.info-tip-item em {
  display: block;
  font-size: 0.75rem;
  color: var(--color-muted-text);
  margin-top: 4px;
}

.info-tip-note {
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--color-border);
}

/* === Footer === */
.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px;
  font-size: 0.75rem;
  color: var(--color-text-dim, var(--color-text-secondary));
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
  flex-shrink: 0;
}

.footer a {
  color: var(--color-text-dim, var(--color-text-secondary));
  text-decoration: none;
  transition: color 0.15s;
}

.footer a:hover {
  color: var(--color-text);
}

.footer-sep {
  opacity: 0.4;
}

.footer-minimal {
  opacity: 0.5;
  font-size: 0.7rem;
  padding: 8px 16px;
}

/* === Scrollbar styling === */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-secondary);
}

/* === Underground Swell Alert (Sidebar) === */
.swell-alert {
  padding: 12px 16px;
  background: rgba(191, 160, 101, 0.08);
  border-left: 3px solid var(--color-signal);
  border-bottom: 1px solid var(--color-border);
  font-size: 0.8rem;
  color: var(--color-text);
  position: sticky;
  top: 0;
  z-index: 5;
}

.swell-alert-header {
  margin-bottom: 8px;
  color: var(--color-text-secondary);
  line-height: 1.4;
}

.swell-alert-count {
  color: var(--color-signal);
  font-weight: 700;
  font-size: 1.1rem;
}

.swell-alert-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.swell-chip {
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(191, 160, 101, 0.15);
  border: 1px solid rgba(191, 160, 101, 0.3);
  color: var(--color-signal);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.swell-chip:hover {
  background: rgba(191, 160, 101, 0.25);
  border-color: var(--color-signal);
}

/* Search */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  font-size: 1rem;
  pointer-events: none;
  z-index: 1;
}

.search-box input {
  width: 20vw;
  min-width: 160px;
  max-width: 280px;
  height: 38px;
  padding: 0 14px 0 38px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text);
  font-family: var(--font-main);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.search-box input::placeholder {
  color: var(--color-text-secondary);
}

.search-box input:focus {
  border-color: var(--color-signal);
  background: rgba(255, 255, 255, 0.14);
}

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 0 0 var(--radius) var(--radius);
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: var(--shadow-md);
}

.search-suggestion-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--color-text);
  transition: background 0.1s;
}

.search-suggestion-item:hover {
  background: var(--color-surface-hover);
}

/* Spotlight Chips */
.spotlight-chips {
  display: flex;
  gap: 6px;
  align-items: center;
}

.spotlight-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: transparent;
  color: var(--color-text-secondary);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.spotlight-chip:hover {
  border-color: var(--color-text-secondary);
  color: var(--color-text);
}

.spotlight-chip[data-type="core"].active {
  border-color: var(--color-tier-core);
  background: rgba(138, 43, 226, 0.2);
  color: var(--color-tier-core);
}

.spotlight-chip[data-type="regular"].active {
  border-color: var(--color-tier-regular);
  background: rgba(30, 64, 175, 0.2);
  color: var(--color-tier-regular);
}

.spotlight-chip[data-type="emerging"].active {
  border-color: var(--color-tier-emerging);
  background: rgba(0, 255, 255, 0.15);
  color: var(--color-tier-emerging);
}

.spotlight-chip.disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* Chip line indicators (legend) */
.chip-line {
  display: inline-block;
  width: 14px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

.chip-line-core { background: var(--color-tier-core); }
.chip-line-regular { background: var(--color-tier-regular); opacity: 0.75; }
.chip-line-emerging { background: var(--color-tier-emerging); opacity: 0.5; }

/* Relation Gear (Visibility Popover) */
.relation-gear-wrap {
  position: relative;
}

.relation-gear-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.relation-gear-btn:hover {
  border-color: var(--color-text-secondary);
  color: var(--color-text);
  background: var(--color-surface-hover);
}

.relation-gear-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 8px 0;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  min-width: 180px;
}

.relation-vis-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--color-text);
  transition: background 0.1s;
}

.relation-vis-row:hover {
  background: var(--color-surface-hover);
}

.relation-vis-row input[type="checkbox"] {
  accent-color: var(--color-accent);
  cursor: pointer;
}

.relation-vis-label {
  flex: 1;
}

.relation-vis-count {
  font-size: 0.7rem;
  color: var(--color-text-secondary);
  font-family: var(--font-mono);
}

/* Category Capsule Buttons (underline-accent style) */
.capsule-group {
  display: flex;
  gap: 2px;
  align-items: center;
  overflow-x: auto;
}

.capsule-btn {
  padding: 6px 10px;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #999;
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, font-weight 0.15s;
  white-space: nowrap;
  outline: none;
}

.capsule-all {
  font-weight: 600;
}

.capsule-all.active {
  color: var(--color-text);
  border-bottom-color: var(--color-text);
  font-weight: 700;
}

.capsule-btn:hover {
  color: #ccc;
}

.capsule-btn.active {
  color: var(--capsule-color, var(--color-text));
  border-bottom-color: var(--capsule-color, var(--color-text));
  font-weight: 600;
}

/* Filtered meta highlight */
.meta-filtered {
  font-weight: 600;
}

.meta-highlight-core {
  color: var(--color-tier-core);
}

.meta-highlight-regular {
  color: var(--color-tier-regular);
}

.meta-highlight-emerging {
  color: var(--color-tier-emerging);
}

/* Edge Detail Card */
.edge-detail-card {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 320px;
  background: rgba(26, 31, 46, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(48, 54, 61, 0.6);
  border-top: 3px solid var(--color-signal);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 80;
  animation: slideUp 0.2s ease;
}

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

.edge-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-text);
}

.edge-detail-close {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}

.edge-detail-close:hover {
  color: var(--color-text);
}

.edge-detail-body {
  padding: 12px 16px;
}

.edge-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--color-border);
}

.edge-detail-row:last-of-type {
  border-bottom: none;
}

.edge-detail-label {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

.edge-detail-value {
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--color-text);
}

.edge-detail-note {
  font-size: 0.78rem;
  color: var(--color-signal);
  background: rgba(191, 160, 101, 0.08);
  border-left: 3px solid var(--color-signal);
  padding: 6px 10px;
  margin: 6px 0;
  border-radius: 0 4px 4px 0;
  line-height: 1.5;
}

.edge-detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
}

.edge-detail-link {
  flex: 1;
  text-align: center;
  padding: 6px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-family: var(--font-main);
  color: var(--color-accent-text);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

.edge-detail-link:hover {
  background: var(--color-accent-bg);
  border-color: var(--color-accent);
  text-decoration: none;
}

/* Natural language edge explanation */
.edge-detail-explain {
  font-size: 0.82rem;
  color: var(--color-text);
  line-height: 1.6;
  padding: 10px 12px;
  background: rgba(0, 229, 255, 0.08);
  border-radius: 6px;
  margin-bottom: 10px;
}

.edge-detail-explain .explain-label {
  display: block;
  font-size: 0.7rem;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.edge-detail-raw {
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  font-family: var(--font-mono);
}

/* ============================================================
   Phase 3A: Side Detail Drawer
   ============================================================ */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.detail-drawer {
  position: fixed;
  top: 64px;
  right: 0;
  width: 420px;
  height: calc(100vh - 64px);
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.4);
}

.detail-drawer.open {
  transform: translateX(0);
}

.drawer-close-bar {
  display: flex;
  justify-content: flex-end;
  padding: 12px 16px 0;
  flex-shrink: 0;
}

.drawer-close-btn {
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  line-height: 1;
}

.drawer-close-btn:hover {
  color: var(--color-text);
  border-color: var(--color-text-secondary);
  background: var(--color-surface-hover);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 20px;
}

/* Drawer content sections */
.drawer-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0 16px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 16px;
}

.drawer-keyword {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-text);
  width: 100%;
  margin-bottom: 4px;
}

.drawer-category-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

.drawer-section {
  margin-bottom: 28px;
}

.drawer-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Drawer: core metrics */
.drawer-metrics {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border);
}

.drawer-metric-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

.drawer-heat-big {
  font-family: var(--font-mono);
  font-size: 3.2rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
}

.drawer-trend-badge {
  font-size: 1rem;
  font-weight: 600;
}

.drawer-metric-sub {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

/* Drawer: chart */
.drawer-chart-container {
  height: 260px;
  position: relative;
  overflow: hidden;
}

/* Drawer: article list */
.drawer-articles {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.drawer-article-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
  color: var(--color-text);
  transition: background 0.15s;
}

.drawer-article-item:last-child {
  border-bottom: none;
}

.drawer-article-item:hover {
  text-decoration: none;
  color: var(--color-accent-text);
}

.drawer-article-source {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--color-bg);
  color: var(--color-text-secondary);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  border: 1px solid var(--color-border);
}

.drawer-article-title {
  flex: 1;
  font-size: 0.82rem;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.drawer-article-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.drawer-article-exticon {
  font-size: 0.7rem;
  opacity: 0.5;
}

.drawer-article-item:hover .drawer-article-exticon {
  opacity: 1;
}

.drawer-empty {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  font-style: italic;
  padding: 8px 0;
}

/* ============================================================
   Phase 3B: Onboarding Coach Marks
   ============================================================ */

.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 2000;
}

.onboarding-highlight {
  position: fixed;
  border: 2px solid var(--color-signal);
  border-radius: var(--radius);
  z-index: 2001;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
}

.onboarding-tooltip {
  position: fixed;
  z-index: 2002;
  background: var(--color-surface);
  border: 1px solid var(--color-signal);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  max-width: 340px;
}

.onboarding-text {
  font-size: 0.95rem;
  color: var(--color-text);
  line-height: 1.6;
  margin-bottom: 12px;
}

.onboarding-progress {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
}

.onboarding-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.onboarding-skip {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: color 0.15s;
}

.onboarding-skip:hover {
  color: var(--color-text);
}

.onboarding-next {
  padding: 6px 20px;
  background: var(--color-accent);
  color: var(--color-text);
  border: none;
  border-radius: 20px;
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.onboarding-next:hover {
  background: var(--color-accent-hover);
}

/* Tooltip arrows */
.onboarding-tooltip.arrow-top::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid var(--color-signal);
}

.onboarding-tooltip.arrow-right::after {
  content: "";
  position: absolute;
  top: 20px;
  right: -8px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 8px solid var(--color-signal);
}

.onboarding-tooltip.arrow-bottom::before {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid var(--color-signal);
}

.onboarding-tooltip.arrow-left::after {
  content: "";
  position: absolute;
  top: 20px;
  left: -8px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 8px solid var(--color-signal);
}

/* ============================================================
   Phase 3C: Help Button
   ============================================================ */

/* Help button in header */
.help-btn-header {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.help-btn-header:hover {
  background: var(--color-accent);
  color: var(--color-text);
  border-color: var(--color-accent);
}

/* ============================================================
   About page: Quick Start & Visual Flow
   ============================================================ */
.about-content h1 {
  font-size: 1.6rem;
  margin-bottom: 24px;
  color: var(--color-text);
}

.about-content h2 {
  font-size: 1.15rem;
  margin: 32px 0 12px;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 8px;
}

/* How It Works flow diagram */
.how-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 24px 0 32px;
  overflow-x: auto;
}

.how-flow-step {
  text-align: center;
  padding: 16px 12px;
  min-width: 120px;
  flex-shrink: 0;
}

.how-flow-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--color-accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin: 0 auto 8px;
}

.how-flow-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
}

.how-flow-sub {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.how-flow-arrow {
  font-size: 1.2rem;
  color: var(--color-accent-text);
  flex-shrink: 0;
  margin: 0 4px;
}

/* Relation type cards */
.relation-types {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 16px 0;
}

.relation-type-card {
  padding: 16px;
  border-radius: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.relation-type-card h3 {
  font-size: 0.95rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.relation-type-card .rt-line {
  display: inline-block;
  width: 24px;
  height: 3px;
  border-radius: 2px;
}

.relation-type-card p {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin: 0;
}

.relation-type-card .rt-example {
  font-size: 0.78rem;
  color: var(--color-muted-text);
  margin-top: 6px;
  font-style: italic;
}

/* ============================================================
   About page: Minimal Header
   ============================================================ */
.header-bar-minimal {
  justify-content: space-between;
}

.header-right-minimal {
  flex: unset;
  border-left: none;
  padding-left: 0;
}

/* ============================================================
   Transparency Page (tp-* prefix)
   ============================================================ */

.tp-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.tp-section {
  margin-bottom: 48px;
}

.tp-section-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

.tp-section-desc {
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

/* Page Title */
.tp-page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 4px;
}

.tp-page-desc {
  color: var(--color-text-secondary);
  font-size: 0.88rem;
  margin-bottom: 24px;
}

/* Hero Stats Grid */
.tp-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.tp-hero-card {
  padding: 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  text-align: center;
}

.tp-hero-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}

.tp-hero-label {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

.tp-hero-sub {
  font-size: 0.75rem;
  color: var(--color-muted-text);
  margin-top: 2px;
}

/* Pipeline Flow */
.tp-pipeline {
  margin-bottom: 32px;
}

.tp-phase {
  margin-bottom: 0;
}

.tp-phase-header {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-accent-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 16px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius) var(--radius) 0 0;
}

.tp-phase-steps {
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--color-surface);
}

.tp-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-border);
}

.tp-step:last-child {
  border-bottom: none;
}

.tp-step-status {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.tp-step-ok .tp-step-status { color: var(--color-ok-green); }
.tp-step-warning .tp-step-status { color: #FFD93D; }
.tp-step-error .tp-step-status { color: #FF6B6B; }
.tp-step-not_enabled .tp-step-status { color: var(--color-text-secondary); }

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

.tp-step-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-text);
}

.tp-step-meta {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.tp-step-errors {
  color: #FF6B6B;
  font-weight: 600;
}

.tp-phase-arrow {
  text-align: center;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  padding: 6px 0;
}

/* Source Breakdown */
.tp-sources {
  margin-bottom: 32px;
}

.tp-source-summary {
  margin-bottom: 20px;
}

.tp-stacked-bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--color-border);
  margin-bottom: 10px;
}

.tp-bar-news {
  background: var(--color-accent-text);
  transition: width 0.3s;
}

.tp-bar-social {
  background: var(--color-signal);
  transition: width 0.3s;
}

.tp-bar-legend {
  display: flex;
  gap: 20px;
  font-size: 0.82rem;
  color: var(--color-text-secondary);
}

.tp-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tp-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tp-dot-news { background: var(--color-accent-text); }
.tp-dot-social { background: var(--color-signal); }

/* Source Table */
.tp-source-table {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tp-source-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.tp-source-row:last-child {
  border-bottom: none;
}

.tp-source-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 160px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
}

.tp-type-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.tp-type-news {
  background: rgba(0, 229, 255, 0.12);
  color: var(--color-accent-text);
}

.tp-type-social {
  background: rgba(191, 160, 101, 0.15);
  color: var(--color-signal);
}

.tp-type-planned {
  background: rgba(139, 148, 158, 0.15);
  color: var(--color-text-secondary);
}

.tp-source-detail {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  min-width: 0;
}

.tp-source-count {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}

.tp-source-pct {
  font-family: var(--font-mono);
  white-space: nowrap;
}

.tp-source-method {
  white-space: nowrap;
}

.tp-source-fresh {
  white-space: nowrap;
  color: var(--color-muted-text);
}

.tp-source-desc {
  font-style: italic;
}

.tp-source-bar-bg {
  width: 100%;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  overflow: hidden;
  flex-basis: 100%;
}

.tp-source-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-text));
  border-radius: 2px;
  transition: width 0.3s;
}

/* Inactive sources */
.tp-source-inactive {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.tp-source-inactive-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}

.tp-source-disabled {
  opacity: 0.5;
}

/* Methodology Cards */
.tp-method-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.tp-method-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.tp-method-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.tp-method-header:hover {
  background: var(--color-surface-hover);
}

.tp-method-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.tp-method-title {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
}

.tp-method-summary {
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  font-weight: 400;
  flex: 2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tp-method-chevron {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.expanded .tp-method-chevron {
  transform: rotate(90deg);
}

.tp-method-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.tp-method-body-inner {
  padding: 0 16px 16px;
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
}

.expanded .tp-method-body {
  max-height: 600px;
  animation: infoTipFadeIn 0.15s ease;
}

.tp-method-formula {
  margin: 12px 0;
  padding: 10px 14px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent-text);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--color-text);
  white-space: pre-wrap;
  word-break: break-all;
}

.tp-method-params {
  margin-top: 12px;
  padding: 12px;
  background: var(--color-bg);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

.tp-method-params-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tp-param-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid var(--color-border);
}

.tp-param-row:last-child {
  border-bottom: none;
}

.tp-param-key {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

.tp-param-value {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text);
}

/* Methodology labels (e.g., heat score labels) */
.tp-method-labels {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tp-label-row {
  padding: 8px 12px;
  background: var(--color-bg);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.tp-label-row strong {
  color: var(--color-text);
}

.tp-label-threshold {
  display: inline-block;
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-muted-text);
}

/* Known Limitations */
.tp-limitations {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid #FFD93D;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 20px 24px;
  margin-bottom: 32px;
}

.tp-limitations-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 12px;
}

.tp-limitations-icon {
  color: #FFD93D;
  margin-right: 6px;
}

.tp-limitations ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tp-limitations li {
  position: relative;
  padding: 6px 0 6px 20px;
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.tp-limitations li::before {
  content: "\2022";
  position: absolute;
  left: 4px;
  color: var(--color-text-secondary);
}

/* Update Log */
.tp-update-log {
  margin-bottom: 32px;
}

.tp-update-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.tp-update-row:last-child {
  border-bottom: none;
}

.tp-update-time {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-muted-text);
  white-space: nowrap;
  flex-shrink: 0;
}

.tp-update-summary {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.tp-update-errors {
  color: #FF6B6B;
  font-weight: 600;
}

/* Pipeline Flow Steps */
.tp-flow-step {
  cursor: pointer;
  border-bottom: 3px solid transparent;
  border-radius: 4px 4px 0 0;
  transition: border-color 0.2s, background 0.15s;
}

.tp-flow-step:hover {
  background: var(--color-surface-hover);
}

.tp-flow-step.active {
  border-bottom-color: var(--color-signal);
}

.tp-flow-step.active .how-flow-icon {
  border-color: var(--color-signal);
  box-shadow: 0 0 12px rgba(191, 160, 101, 0.25);
}

/* Pipeline status dot (inline, reuses health-dot visual) */
.tp-flow-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-left: 4px;
  vertical-align: middle;
}

.tp-flow-status.healthy {
  background: var(--color-ok-green);
  box-shadow: 0 0 6px rgba(74, 153, 104, 0.4);
}

.tp-flow-status.degraded {
  background: #FFD93D;
  animation: healthPulse 2s ease infinite;
}

/* Pipeline detail panel */
.tp-flow-detail {
  display: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 8px;
  animation: infoTipFadeIn 0.15s ease;
}

.tp-flow-detail.open {
  display: block;
}

.tp-flow-detail-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
}

.tp-flow-detail-body {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
}

.tp-flow-detail-body code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: var(--color-bg);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--color-muted-text);
}

/* Source Bar (stacked) */
.tp-source-bar-wrap {
  margin-bottom: 24px;
}

.tp-source-bar {
  display: flex;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--color-border);
  margin-bottom: 10px;
}

.tp-source-bar-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: #121212;
  transition: width 0.3s;
}

.tp-source-bar-news {
  background: var(--color-accent-text);
}

.tp-source-bar-social {
  background: var(--color-signal);
}

.tp-source-bar-legend {
  display: flex;
  gap: 20px;
  font-size: 0.82rem;
  color: var(--color-text-secondary);
}

.tp-source-bar-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tp-source-bar-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.tp-source-bar-legend-dot.news { background: var(--color-accent-text); }
.tp-source-bar-legend-dot.social { background: var(--color-signal); }

/* Source Groups (2-column) */
.source-group h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 12px;
}

.source-group-meta {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--color-text-secondary);
}

/* Source Card List */
.tp-source-card-list {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Source Items */
.tp-source-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.85rem;
}

.tp-source-item:last-of-type {
  border-bottom: none;
}

.tp-source-item .tp-source-name {
  flex: 1;
  min-width: auto;
}

.tp-source-item .tp-source-count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}

.tp-source-item .tp-source-pct {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  white-space: nowrap;
  min-width: 40px;
  text-align: right;
}

/* Collapsed/expanded pattern */
.tp-source-item.collapsed {
  display: none;
}

.tp-source-card-list.expanded .tp-source-item.collapsed {
  display: flex;
}

/* Source expand button */
.tp-source-expand-btn {
  display: block;
  width: 100%;
  padding: 8px;
  border: none;
  border-top: 1px solid var(--color-border);
  background: transparent;
  color: #D4A843;
  font-family: var(--font-main);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s;
}

.tp-source-expand-btn:hover {
  background: rgba(191, 160, 101, 0.05);
}

/* Show More Button */
.tp-show-more {
  display: block;
  width: 100%;
  padding: 8px;
  margin-top: 4px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-text-secondary);
  font-family: var(--font-main);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s;
}

.tp-show-more:hover {
  border-color: var(--color-signal);
  color: #D4A843;
  background: rgba(191, 160, 101, 0.05);
}




.tp-method-summary {
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  font-weight: 400;
}

/* Update log hidden entries */
.tp-log-hidden {
  display: none;
}

/* ========================================
   Developer Journal Page (dl-*)
   ======================================== */

.dl-content {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.dl-section {
  margin-bottom: 48px;
}

.dl-section-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

.dl-section-desc {
  color: var(--color-text-dim);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

/* Origin Story */
.dl-origin {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 24px;
  line-height: 1.8;
}

.dl-origin p {
  color: var(--color-text-dim);
  font-size: 0.9rem;
  margin: 0 0 12px;
}

.dl-origin p:last-child {
  margin-bottom: 0;
}

.dl-origin strong {
  color: #D4A843;
}

/* Stats Grid */
.dl-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.dl-stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 20px 16px;
  text-align: center;
}

.dl-stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #D4A843;
}

.dl-stat-label {
  font-size: 0.8rem;
  color: var(--color-text-dim);
  margin-top: 4px;
}

/* Timeline */
.dl-timeline {
  position: relative;
  padding-left: 32px;
}

.dl-timeline::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}

.dl-timeline-entry {
  position: relative;
  margin-bottom: 24px;
}

.dl-timeline-dot {
  position: absolute;
  left: -32px;
  top: 16px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-border);
  border: 2px solid var(--color-bg);
  z-index: 1;
}

/* Connector line from dot to card */
.dl-timeline-entry::after {
  content: "";
  position: absolute;
  left: -20px;
  top: 21px;
  width: 20px;
  height: 2px;
  background: var(--color-border);
}

/* Current: large gold dot with healthPulse animation */
.dl-timeline-current .dl-timeline-dot {
  width: 16px;
  height: 16px;
  left: -34px;
  top: 14px;
  background: #D4A843;
  box-shadow: 0 0 8px rgba(191, 160, 101, 0.5);
  animation: healthPulse 2s ease infinite;
}

.dl-timeline-current::after {
  left: -18px;
  width: 18px;
  top: 22px;
  background: #D4A843;
}

/* Milestone: gold-filled dot (12px) */
.dl-timeline-milestone .dl-timeline-dot {
  background: #D4A843;
}

.dl-timeline-milestone::after {
  background: #D4A843;
}

/* Done: green-filled dot (12px) */
.dl-timeline-done .dl-timeline-dot {
  background: var(--color-accent);
}

.dl-timeline-done::after {
  background: var(--color-accent);
}

.dl-timeline-content {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
}

.dl-timeline-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.dl-timeline-header:hover {
  background: rgba(255,255,255,0.03);
}

.dl-timeline-meta {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.dl-timeline-version {
  font-size: 0.75rem;
  font-weight: 600;
  color: #D4A843;
  background: rgba(191, 160, 101, 0.15);
  padding: 2px 8px;
  border-radius: 3px;
}

.dl-timeline-date {
  font-size: 0.75rem;
  color: var(--color-text-dim);
  align-self: center;
}

.dl-timeline-title {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
}

.dl-timeline-toggle {
  color: var(--color-text-dim);
  font-size: 0.7rem;
  transition: transform 0.3s;
}

.dl-expanded .dl-timeline-toggle {
  transform: rotate(180deg);
}

.dl-timeline-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 16px;
}

.dl-expanded .dl-timeline-body {
  max-height: 500px;
  padding: 0 16px 16px;
}

.dl-timeline-body ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.dl-timeline-body li {
  position: relative;
  padding: 4px 0 4px 16px;
  font-size: 0.85rem;
  color: var(--color-text-dim);
  line-height: 1.5;
}

.dl-timeline-body li::before {
  content: "\203A";
  position: absolute;
  left: 0;
  color: var(--color-accent);
  font-weight: bold;
}

/* Roadmap */
.dl-roadmap-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.dl-roadmap-filter-btn {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-dim);
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.dl-roadmap-filter-btn:hover {
  border-color: var(--color-text-dim);
}

.dl-roadmap-filter-btn.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
}

.dl-roadmap-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dl-roadmap-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.85rem;
  transition: opacity 0.3s;
}

.dl-roadmap-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 600;
  flex-shrink: 0;
  min-width: 50px;
  text-align: center;
}

.dl-badge-progress {
  background: rgba(191, 160, 101, 0.2);
  color: #D4A843;
}

.dl-badge-planned {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

.dl-badge-done {
  background: rgba(0, 229, 255, 0.15);
  color: var(--color-accent);
}

.dl-roadmap-text {
  color: var(--color-text);
}

/* Tech Stack */
.dl-tech-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.dl-tech-group {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 16px;
}

.dl-tech-group-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-dim);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dl-tech-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dl-tech-pill {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

/* Developer Section */
.dl-developer {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dl-dev-profile {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 20px;
}

.dl-dev-avatar {
  flex-shrink: 0;
}

.dl-dev-avatar-img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-border);
}

.dl-dev-info {
  flex: 1;
}

.dl-dev-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 4px;
}

.dl-dev-bio {
  font-size: 0.85rem;
  color: var(--color-text-dim);
  line-height: 1.5;
}

/* Contact Links Grid */
.dl-dev-links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.dl-dev-link-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 16px;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}

.dl-dev-link-card:hover {
  border-color: var(--color-accent);
  background: rgba(0, 229, 255, 0.04);
}

.dl-dev-link-icon {
  font-size: 1.3rem;
}

.dl-dev-link-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
}

.dl-dev-link-desc {
  font-size: 0.75rem;
  color: var(--color-text-dim);
}

/* Sponsor Section */
.dl-sponsor-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  background-image: linear-gradient(135deg, rgba(191, 160, 101, 0.05) 0%, transparent 60%);
}

.dl-sponsor-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 8px;
}

.dl-sponsor-section-desc {
  font-size: 0.85rem;
  color: var(--color-text-dim);
  margin: 0 0 20px;
}

.dl-sponsor-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.dl-sponsor-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
}

.dl-sponsor-btn-primary {
  background: #D4A843;
  color: #121212;
}

.dl-sponsor-btn-primary:hover {
  background: #d4b577;
}

.dl-sponsor-btn-secondary {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.dl-sponsor-btn-secondary:hover {
  border-color: var(--color-text-dim);
}

.dl-sponsor-note {
  font-size: 0.75rem;
  color: var(--color-text-dim);
  margin: 0;
  opacity: 0.7;
}

/* Page Title */
.dl-page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 4px;
}

/* Roadmap Phases (horizontal flow) */
.dl-roadmap-phases {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.dl-phase-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 16px 20px;
  min-width: 130px;
  text-align: center;
  flex-shrink: 0;
}

.dl-phase-card.dl-phase-current {
  border-color: #D4A843;
  box-shadow: 0 0 12px rgba(191, 160, 101, 0.15);
}

.dl-phase-card.dl-phase-planned {
  opacity: 0.6;
}

.dl-phase-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 3px;
  margin-bottom: 6px;
}

.dl-phase-version {
  font-size: 0.78rem;
  color: var(--color-text-dim);
  margin-bottom: 4px;
}

.dl-phase-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
}

.dl-phase-arrow {
  font-size: 1.2rem;
  color: var(--color-text-dim);
  flex-shrink: 0;
}


/* ============================================================
   Mobile-only elements (hidden on desktop)
   ============================================================ */
.hamburger-btn,
.search-toggle-btn,
.search-close-btn,
.mobile-view-tabs {
  display: none;
}

.hamburger-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.hamburger-btn:hover {
  border-color: var(--color-text-secondary);
  color: var(--color-text);
  background: var(--color-surface-hover);
}

.search-toggle-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 1rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.search-close-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: var(--color-border);
  color: var(--color-text);
  font-size: 0.9rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Mobile View Tabs */
.mobile-view-tabs {
  background: var(--color-navbar);
  border-bottom: 1px solid var(--color-border);
  padding: 0;
  gap: 0;
  flex-shrink: 0;
}

.mobile-tab {
  flex: 1;
  padding: 10px 0;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--color-text-secondary);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.mobile-tab.active {
  color: var(--color-text);
  border-bottom-color: var(--color-accent-text);
}

/* Drawer drag handle (mobile bottom sheet) */
.drawer-drag-handle {
  display: none;
}

.drawer-drag-handle span {
  display: block;
  width: 36px;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  margin: 0 auto;
}

/* ============================================================
   Tablet Breakpoint (1024px)
   ============================================================ */
@media (max-width: 1024px) {
  .layout-sidebar {
    width: 280px;
  }

  .search-box input {
    width: 16vw;
    min-width: 140px;
    max-width: 220px;
  }

  .capsule-group {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .capsule-btn {
    font-size: 0.9rem;
    padding: 5px 8px;
  }

  .header-bar {
    gap: 12px;
    padding: 0 14px;
  }

  .header-right {
    gap: 10px;
  }

  .navbar-nav a {
    font-size: 0.9rem;
  }
}

/* ============================================================
   Mobile Breakpoint (768px)
   ============================================================ */
@media (max-width: 768px) {
  /* Graph meta bar */
  .graph-meta {
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
    font-size: 0.7rem;
  }

  /* Header */
  .header-bar {
    padding: 0 10px;
    padding-top: env(safe-area-inset-top);
    height: auto;
    min-height: 48px;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
  }

  .header-left {
    flex-shrink: 0;
  }

  .navbar-brand {
    font-size: 0.95rem;
  }

  .brand-logo {
    height: 40px;
  }

  /* Search: collapse to icon */
  .search-box {
    display: none;
  }

  .search-box.mobile-open {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    padding: 8px 12px;
    background: var(--color-navbar);
    z-index: 150;
    align-items: center;
  }

  .search-box.mobile-open input {
    width: 100%;
    max-width: none;
    min-width: unset;
    height: 40px;
    font-size: 1rem;
  }

  .search-box.mobile-open .search-close-btn {
    display: flex;
  }

  .search-toggle-btn {
    display: flex;
  }

  /* Category chips horizontal scroll */
  .header-center {
    flex: 1;
    overflow: hidden;
  }

  .capsule-group {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(to right, black 85%, transparent);
    -webkit-mask-image: linear-gradient(to right, black 85%, transparent);
  }

  .capsule-btn {
    font-size: 0.85rem;
    min-height: 44px;
    padding: 4px 8px;
  }

  /* Right section: hide content, show hamburger */
  .header-right {
    flex: unset;
    border-left: none;
    padding-left: 0;
    position: relative;
  }

  .header-right-content {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 12px 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 120;
    min-width: 200px;
    flex-direction: column;
    gap: 12px;
  }

  .header-right-content.mobile-open {
    display: flex;
  }

  .header-right-content .navbar-nav {
    flex-direction: column;
    gap: 4px;
  }

  .header-right-content .navbar-nav a {
    font-size: 0.95rem;
    padding: 8px 4px;
    display: block;
  }

  .header-right-content .spotlight-chips {
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
  }

  .header-right-content .spotlight-chip {
    min-height: 44px;
    font-size: 0.85rem;
  }

  .hamburger-btn {
    display: flex;
  }

  /* Mobile View Tabs */
  .mobile-view-tabs {
    display: flex;
  }

  /* Layout: default show ranking, hide graph */
  .layout-container {
    flex-direction: column;
    height: auto;
    overflow: auto;
    flex: 1;
  }

  .layout-main {
    display: none;
    min-height: 0;
    flex: 1;
  }

  .layout-container.show-graph .layout-main {
    display: flex;
    min-height: 60vh;
  }

  .layout-container.show-graph .layout-sidebar {
    display: none;
  }

  .graph-legend {
    bottom: 8px;
    left: 8px;
    font-size: 0.65rem;
    gap: 8px;
    padding: 4px 8px;
  }

  .layout-sidebar {
    width: 100%;
    border-left: none;
    border-top: none;
    flex: 1;
    max-height: none;
  }

  #graph-container {
    min-height: 300px;
  }

  /* Detail drawer → bottom sheet */
  .detail-drawer {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 75vh;
    border-radius: 16px 16px 0 0;
    border-left: none;
    border-top: 1px solid var(--color-border);
    transform: translateY(100%);
    transition: transform 0.3s ease;
  }

  .detail-drawer.open {
    transform: translateY(0);
  }

  .drawer-drag-handle {
    display: flex;
    justify-content: center;
    padding: 10px 0 4px;
    cursor: grab;
    flex-shrink: 0;
  }

  /* Page content (About page) */
  .page-container {
    padding: 16px;
  }

  .page-header h1 {
    font-size: 1.4rem;
  }

  #related-keywords {
    flex-direction: column;
  }

  .related-keyword-item {
    min-width: auto;
  }

  .article-item {
    flex-wrap: wrap;
    gap: 4px;
  }

  .article-time {
    width: 100%;
    text-align: right;
  }

  .chart-container {
    height: 250px;
  }

  .swell-alert {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .edge-detail-card {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
  }

  /* Hide sidebar toggle on mobile (already using tabs) */
  .sidebar-toggle {
    display: none;
  }

  /* Secondary page responsive */
  .sources-page,
  .transparency-page,
  .devlog-page {
    padding: 16px;
  }

  /* Transparency page responsive */
  .tp-content {
    padding: 20px 16px 32px;
  }

  .tp-hero {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .source-lists {
    grid-template-columns: 1fr;
  }

  .tp-method-summary {
    display: none;
  }

  .how-flow {
    flex-wrap: wrap;
    gap: 4px;
  }

  /* Devlog page responsive */
  .dl-content {
    padding: 20px 16px 32px;
  }

  .dl-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .dl-stat-value {
    font-size: 1.4rem;
  }

  .dl-tech-grid {
    grid-template-columns: 1fr;
  }

  .dl-dev-links {
    grid-template-columns: 1fr;
  }

  .dl-sponsor-buttons {
    flex-direction: column;
    align-items: center;
  }

  .dl-roadmap-phases {
    flex-wrap: wrap;
    justify-content: center;
  }

  .dl-phase-arrow {
    display: none;
  }

  .dl-phase-card {
    min-width: 100px;
    padding: 12px 14px;
  }

  .dl-roadmap-filters {
    flex-wrap: wrap;
  }

  /* Footer responsive */
  .footer {
    gap: 8px;
    padding: 10px 12px;
  }

  .source-lists {
    grid-template-columns: 1fr;
  }

  .quick-start {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .relation-types {
    grid-template-columns: 1fr;
  }

  .how-flow {
    flex-wrap: wrap;
    gap: 4px;
  }

  .info-tip-dialog {
    min-width: 260px;
    max-width: calc(100vw - 32px);
    left: auto;
    right: 0;
    transform: none;
    position: fixed;
    top: auto;
    bottom: 16px;
    margin: 0 16px;
  }
}

@media (max-width: 480px) {
  .ranking-bottom {
    flex-wrap: wrap;
  }

  .article-counts {
    width: 100%;
    margin-top: 2px;
  }

  .navbar-brand span:last-child {
    display: none;
  }
}

/* ============================================================
   Schema v3.0 — Confidence Tier Badges
   ============================================================ */
.badge-tier {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-core {
  background: rgba(138, 43, 226, 0.2);
  color: var(--color-tier-core);
  border: 1px solid rgba(138, 43, 226, 0.4);
}

.badge-regular {
  background: rgba(30, 64, 175, 0.2);
  color: var(--color-tier-regular);
  border: 1px solid rgba(30, 64, 175, 0.4);
}

.badge-emerging {
  background: rgba(0, 255, 255, 0.15);
  color: var(--color-tier-emerging);
  border: 1px solid rgba(0, 255, 255, 0.3);
}

/* ============================================================
   Schema v3.0 — Burst Animation (is_burst nodes)
   ============================================================ */
@keyframes burst-glow {
  0%, 100% {
    box-shadow: 0 0 4px rgba(255, 160, 64, 0.3);
  }
  50% {
    box-shadow: 0 0 12px rgba(255, 160, 64, 0.7), 0 0 24px rgba(255, 160, 64, 0.3);
  }
}

.node-burst {
  animation: burst-glow 2s ease-in-out infinite;
  border: 2px solid #FFA040 !important;
  border-radius: 50%;
}

/* ============================================================
   Schema v3.0 — New Issue Badge (is_new)
   ============================================================ */
.badge-new {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(0, 229, 255, 0.15);
  color: var(--color-accent-text);
  border: 1px solid rgba(0, 229, 255, 0.3);
  margin-left: 4px;
  vertical-align: middle;
}

/* ============================================================
   Schema v3.0 — Keyword Chips (top_keywords in ranking items)
   ============================================================ */
.keyword-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.keyword-chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.7rem;
  color: var(--color-text-secondary);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--color-border);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.keyword-chip:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--color-text);
}

/* ============================================================
   Schema v3.0 — Issue vs Keyword Tooltip Widths
   ============================================================ */
.vis-tooltip-issue {
  max-width: 360px;
  min-width: 240px;
}

.vis-tooltip-keyword {
  max-width: 260px;
  min-width: 160px;
}

/* ============================================================
   View Mode Toggle Button
   ============================================================ */
.view-mode-btn {
  padding: 5px 14px;
  margin-left: 8px;
  border: 1px solid var(--color-signal);
  border-bottom: none;
  border-radius: 4px;
  background: rgba(191, 160, 101, 0.10);
  color: var(--color-signal);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
  outline: none;
  vertical-align: middle;
}

.view-mode-btn:hover {
  background: rgba(191, 160, 101, 0.22);
  color: var(--color-signal-hover);
  border-color: var(--color-signal-hover);
}
