/* ═══════════════════════════════════════════════════
   Web3Listicle Analytics Terminal — Design System
   ═══════════════════════════════════════════════════ */

/* ── DESIGN TOKENS ── */
:root {
  --bg-primary:     #070a0e;
  --bg-secondary:   #0e131b;
  --bg-card:        #111824;
  --bg-elevated:    #161e2c;
  --border-primary: #1c2331;
  --border-accent:  #2a3548;
  --text-primary:   #f0f3f6;
  --text-secondary: #8a94a6;
  --text-muted:     #525e72;
  --accent-brand:   #5b8def;
  --accent-green:   #00ea91;
  --accent-red:     #ff3b30;
  --accent-amber:   #ffb020;
  --font-mono:      'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-sans:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      14px;
  --shadow-glow:    0 0 24px rgba(91,141,239,0.06);
  --shadow-glow-green: 0 0 24px rgba(0,234,145,0.06);
  --shadow-glow-red: 0 0 24px rgba(255,59,48,0.06);
  --transition-fast: 0.18s cubic-bezier(.4,0,.2,1);
  --transition-med:  0.32s cubic-bezier(.4,0,.2,1);
  --header-h:       64px;
  --sidebar-w:      340px;
}

/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

::selection { background: rgba(91,141,239,0.3); color: #fff; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-accent); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

a { color: var(--accent-brand); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: #82aff5; }

/* ── HEADER ── */
#main-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: linear-gradient(180deg, var(--bg-secondary) 0%, rgba(14,19,27,0.96) 100%);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-primary);
}

.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.header-brand { display: flex; align-items: center; gap: 12px; }

.brand-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-primary);
  overflow: hidden;
  box-shadow: 0 0 12px rgba(91, 141, 239, 0.15);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.brand-logo-wrap:hover {
  transform: scale(1.05);
  border-color: var(--accent-brand);
}

.brand-logo {
  object-fit: contain;
  display: block;
}

@keyframes pulse-icon {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .7; transform: scale(0.92); }
}

@keyframes ripple {
  0% { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(1.6); opacity: 0; }
}

#site-title {
  font-family: var(--font-sans);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-accent { color: var(--accent-brand); font-weight: 600; }

.header-status {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: blink-dot 2s ease-in-out infinite;
}

@keyframes blink-dot {
  0%, 100% { opacity: 1; filter: brightness(1.2); }
  50% { opacity: .4; filter: brightness(0.8); }
}

.header-divider {
  width: 1px;
  height: 16px;
  background: var(--border-primary);
}

.header-clock {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.header-refresh {
  color: var(--text-muted);
  cursor: help;
  transition: color var(--transition-fast);
}

.header-refresh:hover {
  color: var(--text-secondary);
}

.mobile-sidebar-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 20px;
  height: 14px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 101;
}

.hamburger-line {
  width: 100%;
  height: 2px;
  background-color: var(--text-primary);
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

/* ── AD CONTAINERS (CLS-LOCKED) ── */
.ad-leaderboard-wrap {
  display: flex;
  justify-content: center;
  padding: 12px 0;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-primary);
}

.ad-container {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border-accent);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 12px rgba(0,0,0,0.2);
}

.ad-leaderboard { width: 728px; height: 90px; }
.ad-sidebar     { width: 300px; height: 250px; }

.ad-label {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
  user-select: none;
  text-shadow: 0 1px 0 rgba(0,0,0,0.5);
  z-index: 1;
}

.ad-container iframe {
  position: relative;
  z-index: 2;
  border: 0;
  display: block;
}

.ad-sidebar-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

/* ── MAIN TERMINAL FRAME ── */
#terminal-frame {
  flex: 1;
  display: flex;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 0;
  position: relative;
}

/* ── SIDEBAR ── */
#sidebar-panel {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-primary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
  transition: transform var(--transition-med);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 8px;
}

.sidebar-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-title-icon {
  color: var(--accent-brand);
  font-size: 0.85rem;
}

.sidebar-count {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-muted);
}

.search-wrap {
  position: relative;
  padding: 8px 16px 12px;
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border-bottom: 1px solid rgba(28,35,49,0.4);
}

.search-icon {
  position: absolute;
  left: 26px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
}

#search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  padding: 9px 34px 9px 32px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

#search-input::placeholder { color: var(--text-muted); }
#search-input:focus {
  border-color: var(--accent-brand);
  box-shadow: 0 0 0 2px rgba(91,141,239,0.15);
}

.search-clear {
  position: absolute;
  right: 26px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: none;
  font-size: 0.75rem;
  padding: 4px;
}

.search-clear:hover {
  color: var(--text-secondary);
}

.asset-list {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* ── ASSET ROW ── */
.asset-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  border-bottom: 1px solid rgba(28,35,49,0.3);
  position: relative;
  user-select: none;
}

.asset-row:hover { background: var(--bg-card); }
.asset-row.active {
  background: var(--bg-elevated);
  border-left: 3px solid var(--accent-brand);
  padding-left: 15px; /* Offset the 3px border */
}

.star-btn {
  background: none;
  border: none;
  font-size: 1.05rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition-fast), transform var(--transition-fast);
  padding: 2px;
  line-height: 1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.star-btn:hover {
  transform: scale(1.2);
  color: var(--text-secondary);
}

.star-btn.starred {
  color: var(--accent-amber);
}

.asset-row-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(255,255,255,0.03);
}

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

.asset-row-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-row-sym {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.asset-row-price {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  text-align: right;
  white-space: nowrap;
  padding: 4px;
  border-radius: 4px;
  transition: background-color var(--transition-med);
}

.asset-row-change {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-align: right;
  min-width: 62px;
}

.change-up   { color: var(--accent-green); }
.change-down { color: var(--accent-red); }
.change-flat { color: var(--text-muted); }

/* ── FLASH ANIMATION (DWELL-TIME ENGINE) ── */
@keyframes flash-green {
  0%   { background-color: rgba(0, 234, 145, 0.35); color: #fff; }
  100% { background-color: transparent; }
}

@keyframes flash-red {
  0%   { background-color: rgba(255, 59, 48, 0.35); color: #fff; }
  100% { background-color: transparent; }
}

.flash-up {
  animation: flash-green 1.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.flash-down {
  animation: flash-red 1.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

/* ── ANALYTICS PANEL ── */
#analytics-panel {
  flex: 1;
  padding: 24px 32px 40px;
  overflow-y: auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── EMPTY STATE ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  padding: 48px 24px;
  opacity: 0.8;
}

.empty-state-icon {
  font-size: 3rem;
  color: var(--border-accent);
  margin-bottom: 16px;
  animation: float 4s ease-in-out infinite;
}

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

.empty-state-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.empty-state-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 420px;
  line-height: 1.5;
}

/* ── TOKEN HERO ── */
.token-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-primary);
}

.token-hero-head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.token-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: var(--bg-secondary);
  border-radius: 50%;
  border: 1px solid var(--border-primary);
}

.token-icon {
  border-radius: 50%;
}

.token-hero-title { display: flex; flex-direction: column; gap: 4px; }

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

#token-name {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.token-symbol {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.token-rank {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--bg-card);
  color: var(--accent-brand);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-primary);
  font-weight: 600;
}

.token-price-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.token-price {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: 6px;
  transition: background-color var(--transition-med);
}

.token-change {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  display: inline-block;
}

.token-change.up   { color: var(--accent-green); background: rgba(0,234,145,0.1); }
.token-change.down { color: var(--accent-red);   background: rgba(255,59,48,0.1); }
.token-change.neutral { color: var(--text-muted); background: var(--bg-card); }

/* ── METRIC GRID ── */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.metric-card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.metric-card-wide {
  grid-column: 1 / -1;
}

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

.metric-icon {
  font-size: 0.95rem;
  color: var(--accent-brand);
}

#card-high .metric-icon { color: var(--accent-green); }
#card-low .metric-icon { color: var(--accent-red); }

.metric-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.metric-sub {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* ── RANGE BAR ── */
.range-bar-wrap {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.range-bar-track {
  position: relative;
  height: 8px;
  background: linear-gradient(90deg, var(--accent-red), var(--accent-amber), var(--accent-green));
  border-radius: 99px;
}

.range-bar-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  background: transparent;
  border-radius: 99px;
}

.range-bar-thumb {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  background: var(--text-primary);
  border: 2px solid var(--bg-primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: left var(--transition-med);
  box-shadow: 0 0 10px rgba(240,243,246,0.4);
}

.range-bar-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.range-current-label {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ── CONVERTER ── */
.converter-widget {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 28px;
}

.converter-header {
  margin-bottom: 16px;
}

.converter-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.converter-title-icon {
  color: var(--accent-brand);
}

.converter-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
}

.converter-field { flex: 1; }

.converter-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.converter-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast);
}

.converter-input::placeholder { color: var(--text-muted); }
.converter-input:focus { border-color: var(--accent-brand); }

/* Hide spinner arrows */
.converter-input::-webkit-inner-spin-button,
.converter-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.converter-input[type=number] { -moz-appearance: textfield; }

.converter-swap {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-brand);
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast);
  margin-bottom: 3px;
  flex-shrink: 0;
}

.converter-swap:hover {
  transform: rotate(180deg);
  border-color: var(--accent-brand);
  background: var(--bg-elevated);
}

.converter-rate {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 12px;
  text-align: right;
}

/* ── SHARE BLOCK ── */
.share-block {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 12px;
}

.share-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.share-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast), color var(--transition-fast);
}

.share-btn:hover { transform: translateY(-1px); }
.share-btn:active { transform: translateY(0); }

.share-btn-twitter {
  background: #1d9bf0;
  color: #ffffff;
  border-color: #1d9bf0;
}

.share-btn-twitter:hover {
  background: #1a8cd8;
  border-color: #1a8cd8;
}

.share-btn-native {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-accent);
}

.share-btn-native:hover {
  background: rgba(255,255,255,0.05);
}

.share-btn-copy {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-primary);
}

.share-btn-copy:hover {
  color: var(--text-primary);
  border-color: var(--border-accent);
  background: var(--bg-secondary);
}

.share-icon { width: 14px; height: 14px; }

/* ── FOOTER ── */
#site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-primary);
  padding: 32px 24px;
}

.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.footer-inner .footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-brand-icon {
  color: var(--accent-brand);
  font-size: 1rem;
}

.footer-brand-text {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

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

.footer-link {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

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

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

.footer-disclosure {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 720px;
  margin: 0 auto;
}

.footer-api-link {
  color: var(--accent-brand);
  font-weight: 500;
}

.footer-copy {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ── SKELETON LOADERS ── */
.loading-skeleton {
  padding: 8px 16px;
}

.skeleton-row {
  height: 48px;
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-elevated) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

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

/* ── RESPONSIVE & MOBILE DRAWERS ── */
@media (max-width: 1024px) {
  #terminal-frame { flex-direction: column; }
  
  #sidebar-panel {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    height: calc(100vh - var(--header-h));
    transform: translateX(-100%);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    border-right: 1px solid var(--border-primary);
  }

  #sidebar-panel.sidebar-open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 5;
    opacity: 0;
    transition: opacity var(--transition-med);
  }

  #sidebar-panel.sidebar-open + .sidebar-overlay {
    display: block;
    opacity: 1;
  }

  .mobile-sidebar-toggle {
    display: flex;
  }

  /* When sidebar is open, show "close" X on hamburger */
  #main-header.sidebar-active .mobile-sidebar-toggle .hamburger-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }
  #main-header.sidebar-active .mobile-sidebar-toggle .hamburger-line:nth-child(2) {
    opacity: 0;
  }
  #main-header.sidebar-active .mobile-sidebar-toggle .hamburger-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .ad-leaderboard-wrap { padding: 8px 12px; }
  .ad-leaderboard { width: 100%; max-width: 728px; height: 90px; }
  
  #analytics-panel {
    padding: 20px 24px 32px;
  }
}

@media (max-width: 768px) {
  .metric-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

@media (max-width: 640px) {
  :root {
    --header-h: 56px;
  }
  
  #site-title { font-size: 0.95rem; }
  .header-status { display: none; }
  
  .ad-leaderboard { height: 60px; } /* responsive height reduction */
  
  .token-price { font-size: 1.8rem; }
  .token-hero { gap: 12px; }
  
  .metric-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  
  .converter-row {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
  
  .converter-swap {
    transform: rotate(90deg);
    margin-bottom: 0;
  }
  
  .converter-swap:hover {
    transform: rotate(270deg);
  }
  
  .converter-field {
    width: 100%;
  }
  
  .share-buttons {
    flex-direction: column;
  }
  
  .share-btn {
    width: 100%;
  }
}

@media (max-width: 400px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }
}

/* ── ADDITIONAL COMPONENTS: CHART, DESCRIPTION, KEYWORDS & NEWS ── */
.chart-container-wrap {
  width: 100%;
  height: 400px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-primary);
  overflow: hidden;
  position: relative;
}

#tradingview-widget {
  width: 100%;
  height: 100%;
}

.description-card {
  gap: 12px;
}

.token-description {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
  text-align: justify;
}

.keywords-wrap {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-primary);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.keywords-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.keywords-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.keyword-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  background: var(--bg-elevated);
  color: var(--accent-brand);
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--border-primary);
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.keyword-tag:hover {
  border-color: var(--border-accent);
  background: var(--bg-secondary);
}

.news-card {
  gap: 12px;
}

.news-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.news-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  border-bottom: 1px solid rgba(28,35,49,0.5);
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

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

.news-item:hover {
  background-color: var(--bg-secondary);
  border-color: var(--border-primary);
}

.news-header-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
}

.news-source {
  font-weight: 600;
  color: var(--accent-brand);
}

.news-time {
  font-variant-numeric: tabular-nums;
}

.news-title-link {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  transition: color var(--transition-fast);
}

.news-title-link:hover {
  color: var(--accent-brand);
}

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

/* SKELETON PLACEHOLDERS FOR NEWS */
.news-skeleton {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0;
}

.skeleton-news-line {
  height: 48px;
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-elevated) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@media (max-width: 640px) {
  .chart-container-wrap {
    height: 300px;
  }
}

