/* ═══════════════════════════════════════════════════
   CRYPTARA — Main Stylesheet
   ═══════════════════════════════════════════════════ */

/* ── RESET ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 15px; }
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; line-height: 1.5; min-height: 100vh; transition: background-color .3s, color .3s; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
input, select { font-family: inherit; }

/* ── CSS CUSTOM PROPERTIES ───────────────────────── */
:root {
  /* Dark theme (default) */
  --bg-primary   : #08091d;
  --bg-secondary : #0d0f26;
  --bg-card      : #101229;
  --bg-card-alt  : #141630;
  --bg-hover     : #1a1d3e;
  --bg-input     : #0d0f26;
  --border       : #1e2248;
  --border-light : #252852;

  --text-primary  : #e4e8ff;
  --text-secondary: #8a8fb0;
  --text-muted    : #565a78;
  --text-inverse  : #0a0b1e;

  --accent       : #7c3aed;
  --accent-light : #a78bfa;
  --accent-glow  : rgba(124,58,237,.25);

  --green        : #10b981;
  --green-bg     : rgba(16,185,129,.1);
  --red          : #f43f5e;
  --red-bg       : rgba(244,63,94,.1);
  --yellow       : #f59e0b;
  --blue         : #3b82f6;

  --ad-bg        : rgba(255,255,255,.015);

  --gradient-brand : linear-gradient(135deg, #6d28d9 0%, #0284c7 100%);
  --gradient-text  : linear-gradient(90deg, #a78bfa, #38bdf8);

  --shadow-sm  : 0 1px 4px rgba(0,0,0,.4);
  --shadow-md  : 0 4px 20px rgba(0,0,0,.5);
  --shadow-lg  : 0 12px 48px rgba(0,0,0,.6);
  --shadow-glow: 0 0 40px rgba(124,58,237,.18);

  --radius-sm : 8px;
  --radius-md : 12px;
  --radius-lg : 18px;
  --radius-xl : 24px;

  --header-h : 60px;
  --ticker-h : 36px;
  --max-w    : 1400px;
  --transition: .2s ease;
}

/* Light theme overrides */
[data-theme="light"] {
  --bg-primary   : #f0f2fa;
  --bg-secondary : #e8eaf4;
  --bg-card      : #ffffff;
  --bg-card-alt  : #f8f9ff;
  --bg-hover     : #f0f1ff;
  --bg-input     : #ffffff;
  --border       : #dde0f0;
  --border-light : #cacde0;

  --text-primary  : #1a1c3a;
  --text-secondary: #4a4c6a;
  --text-muted    : #888aaa;
  --text-inverse  : #ffffff;

  --ad-bg  : rgba(0,0,0,.025);
  --shadow-sm : 0 1px 4px rgba(0,0,0,.08);
  --shadow-md : 0 4px 20px rgba(0,0,0,.1);
  --shadow-lg : 0 12px 48px rgba(0,0,0,.12);
  --shadow-glow: 0 0 40px rgba(124,58,237,.08);
}

/* ── LOGO THEME SWITCHING ────────────────────────── */
/* Dark logo visible in dark mode (default), hidden in light mode */
.logo-img.logo-dark  { display: block; }
.logo-img.logo-light { display: none;  }

[data-theme="light"] .logo-img.logo-dark  { display: none;  }
[data-theme="light"] .logo-img.logo-light { display: block; }

/* ── BASE ─────────────────────────────────────────── */
body {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

@media (min-width: 768px) { .container { padding: 0 32px; } }
@media (min-width: 1280px) { .container { padding: 0 40px; } }

/* ── TYPOGRAPHY ──────────────────────────────────── */
.gradient-text {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.green { color: var(--green) !important; }
.red   { color: var(--red)   !important; }

/* ── TICKER BAR ──────────────────────────────────── */
.ticker-wrap {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  height: var(--ticker-h);
  overflow: hidden;
  display: flex;
  align-items: center;
}

.ticker-track {
  display: flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
  animation: ticker-scroll 80s linear infinite;
  will-change: transform;
}

.ticker-wrap:hover .ticker-track { animation-play-state: paused; }

.tick-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 18px;
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.tick-item img { border-radius: 50%; }
.tick-item strong { color: var(--text-primary); }
.tick-price { color: var(--text-primary); }
.tick-sep { color: var(--border-light); padding: 0 4px; }

@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ── HEADER ──────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--header-h);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transition: box-shadow var(--transition);
}
.header.scrolled { box-shadow: var(--shadow-md); }

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
}
/* Logo image — width auto lets the SVG aspect ratio (480:100 = 4.8:1) breathe */
.logo-img { flex-shrink: 0; height: 36px; width: auto; max-width: 220px; }
@media (min-width: 640px) { .logo-img { height: 40px; } }
.footer-logo { height: 34px; }
.logo-text {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -.4px;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Desktop Nav */
.nav {
  display: none;
  align-items: center;
  gap: 4px;
}
@media (min-width: 900px) { .nav { display: flex; } }

.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition), background var(--transition);
}
.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* Header Right */
.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Search */
.search-wrap {
  position: relative;
  display: none;
}
@media (min-width: 640px) { .search-wrap { display: flex; } }

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 15px;
  height: 15px;
  pointer-events: none;
}

.search-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 7px 12px 7px 34px;
  font-size: .85rem;
  color: var(--text-primary);
  outline: none;
  width: 200px;
  transition: border-color var(--transition), box-shadow var(--transition), width var(--transition);
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  width: 260px;
}

.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  overflow: hidden;
  max-height: 380px;
  overflow-y: auto;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  width: 100%;
  transition: background var(--transition);
  text-align: left;
}
.search-result-item:hover { background: var(--bg-hover); }
.search-result-item img { border-radius: 50%; flex-shrink: 0; }
.sri-info { flex: 1; min-width: 0; }
.sri-name { display: block; font-size: .88rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sri-sym  { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; }
.sri-right { text-align: right; flex-shrink: 0; }
.sri-price { display: block; font-size: .85rem; font-weight: 600; }
.sri-pct   { font-size: .75rem; }

/* Currency select */
.currency-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: .8rem;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
}
.currency-select:focus { border-color: var(--accent); }

/* Theme toggle */
.theme-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-secondary);
  transition: all var(--transition);
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle svg { width: 16px; height: 16px; }

[data-theme="dark"] .icon-sun  { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
[data-theme="light"] .icon-sun  { display: block; }
[data-theme="light"] .icon-moon { display: none; }

/* Mobile menu button */
.mobile-menu-btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border-radius: var(--radius-sm);
}
@media (min-width: 900px) { .mobile-menu-btn { display: none; } }
.mobile-menu-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: var(--transition);
}

/* Mobile nav */
.mobile-nav {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 12px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.mobile-nav.open { display: flex; }
@media (min-width: 900px) { .mobile-nav { display: none !important; } }
.mobile-nav .nav-link { padding: 10px 14px; }

/* ── HERO BRAND BANNER ───────────────────────────── */
.hero-banner {
  padding: 28px 0 16px;
  margin-bottom: 4px;
}

.hero-inner {
  display: flex;
  align-items: center;
  gap: 22px;
}

.hero-brand-icon {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
  /* The SVG already has a rounded-square shape built in */
}

.hero-text-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hero-headline {
  font-size: 1.85rem;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -.6px;
  line-height: 1.15;
}

.hero-tagline {
  font-size: .97rem;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 480px;
}

.hero-sub-tagline {
  font-size: .75rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

@media (max-width: 500px) {
  .hero-brand-icon { width: 72px; height: 72px; }
  .hero-headline   { font-size: 1.35rem; }
  .hero-tagline    { font-size: .85rem; }
}

/* ── MAIN ────────────────────────────────────────── */
.main { padding: 24px 0 48px; }

/* ── SECTION HEADERS ─────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}
.section-title svg { color: var(--accent); }

.section-badge {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.see-all-link {
  font-size: .85rem;
  color: var(--accent-light);
  font-weight: 500;
  transition: color var(--transition);
}
.see-all-link:hover { color: var(--accent); }

/* ── MARKET STATS ────────────────────────────────── */
.market-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.stats-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-item.skeleton { width: 100px; height: 36px; border-radius: var(--radius-sm); }

.stat-label {
  font-size: .7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 500;
}
.stat-value {
  font-size: .88rem;
  font-weight: 700;
  color: var(--text-primary);
}
.stat-sub { font-size: .75rem; font-weight: 500; }

.refresh-info {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.refresh-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

.refresh-btn {
  padding: 4px;
  border-radius: 6px;
  color: var(--text-muted);
  transition: color var(--transition), transform var(--transition);
}
.refresh-btn:hover { color: var(--accent); transform: rotate(180deg); }

/* ── AD CONTAINERS ───────────────────────────────── */
.ad-container {
  background: var(--ad-bg);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-md);
  margin: 22px 0;
  position: relative;
  overflow: hidden;
}

.ad-label {
  position: absolute;
  top: 5px;
  left: 10px;
  font-size: .65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  font-weight: 500;
  z-index: 1;
}

.ad-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  padding: 12px;
}

.ad-demo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.ad-demo-text {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.ad-demo-size {
  font-size: .72rem;
  color: var(--text-muted);
  font-family: monospace;
}
.ad-demo-btn {
  display: inline-block;
  margin-top: 4px;
  background: var(--gradient-brand);
  color: white;
  padding: 6px 18px;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 600;
  transition: opacity var(--transition);
}
.ad-demo-btn:hover { opacity: .85; }

.ad-sidebar { min-height: 260px; grid-column: span 2; }
.ad-sidebar .ad-placeholder { min-height: 260px; flex-direction: column; gap: 12px; }
@media (min-width: 768px) { .ad-sidebar { grid-column: span 1; } }

/* ── TRENDING SECTION ────────────────────────────── */
.trending-section { margin-bottom: 28px; }

.trending-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  scroll-snap-type: x mandatory;
}
.trending-track::-webkit-scrollbar { height: 4px; }
.trending-track::-webkit-scrollbar-track { background: transparent; }
.trending-track::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.trending-card {
  flex: 0 0 180px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  scroll-snap-align: start;
  text-align: left;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
}
.trending-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}
.trending-card.skeleton { height: 140px; }

.tc-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.tc-header img { border-radius: 50%; flex-shrink: 0; }
.tc-info { flex: 1; min-width: 0; }
.tc-name { display: block; font-size: .83rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-sym  { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; }
.tc-rank { font-size: .7rem; color: var(--text-muted); background: var(--bg-hover); padding: 2px 6px; border-radius: 10px; flex-shrink: 0; }

.tc-price  { font-size: .88rem; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.tc-change { font-size: .78rem; font-weight: 600; margin-bottom: 8px; }
.tc-spark  { display: flex; justify-content: flex-end; }

.trending-skeleton { display: flex; gap: 14px; }

/* ── GAINERS & LOSERS ────────────────────────────── */
.gainers-losers-section { margin-bottom: 28px; }

.gl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (min-width: 768px) {
  .gl-grid { grid-template-columns: 1fr auto 1fr; }
  .ad-sidebar { width: 280px; }
}

.gl-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  grid-column: span 2;
}
@media (min-width: 768px) { .gl-card { grid-column: span 1; } }

.gl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.gl-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .95rem;
  font-weight: 700;
}
.gl-title.green svg { color: var(--green); }
.gl-title.red   svg { color: var(--red); }
.gl-title.green { color: var(--green); }
.gl-title.red   { color: var(--red); }

.gl-badge {
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 2px 8px;
  border-radius: 10px;
}

.gl-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px;
  width: 100%;
  text-align: left;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  margin-bottom: 2px;
}
.gl-row:hover { background: var(--bg-hover); }
.gl-row img { border-radius: 50%; flex-shrink: 0; }
.gl-row-info { flex: 1; min-width: 0; }
.gl-row-name  { display: block; font-size: .84rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gl-row-price { font-size: .75rem; color: var(--text-secondary); }
.gl-row-pct   { font-size: .83rem; font-weight: 700; flex-shrink: 0; }

/* ── COINS TABLE ─────────────────────────────────── */
.coins-section { margin-bottom: 28px; }

.table-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.filter-tab {
  padding: 5px 14px;
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition);
}
.filter-tab.active {
  background: var(--accent);
  color: white;
}
.filter-tab:not(.active):hover { background: var(--bg-hover); color: var(--text-primary); }

.coin-count {
  font-size: .8rem;
  color: var(--text-muted);
}

.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.table-container::-webkit-scrollbar { height: 5px; }
.table-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.coins-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.coins-table thead tr {
  border-bottom: 1px solid var(--border);
}

.coins-table th {
  padding: 12px 14px;
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  text-align: right;
  user-select: none;
}
.coins-table th:first-child, .coins-table th:nth-child(2) { text-align: left; }
.coins-table th.col-name { text-align: left; }

th.sortable {
  cursor: pointer;
  transition: color var(--transition);
}
th.sortable:hover { color: var(--text-primary); }
th.sort-asc .sort-arrow::after  { content: ' ↑'; }
th.sort-desc .sort-arrow::after { content: ' ↓'; }

.coin-row {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}
.coin-row:hover { background: var(--bg-hover); }
.coin-row:last-child { border-bottom: none; }

.coins-table td {
  padding: 13px 14px;
  font-size: .875rem;
  text-align: right;
  color: var(--text-primary);
}
.coins-table td:first-child, .coins-table td.col-name { text-align: left; }

.col-rank { width: 52px; }
.rank-num { font-size: .78rem; color: var(--text-muted); font-weight: 500; }

.coin-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 160px;
}
.coin-icon { border-radius: 50%; flex-shrink: 0; }
.coin-name-info { display: flex; flex-direction: column; gap: 1px; }
.coin-name-text { font-weight: 700; font-size: .875rem; }
.coin-sym { font-size: .7rem; color: var(--text-muted); text-transform: uppercase; font-weight: 500; }

.price-cell { font-weight: 600; }

/* Flash animations on price change */
@keyframes flashGreen {
  0%   { background: transparent; }
  30%  { background: rgba(16,185,129,.2); }
  100% { background: transparent; }
}
@keyframes flashRed {
  0%   { background: transparent; }
  30%  { background: rgba(244,63,94,.2); }
  100% { background: transparent; }
}
.coin-row.flash-green { animation: flashGreen 1s ease; }
.coin-row.flash-red   { animation: flashRed   1s ease; }

/* Sparklines */
.spark-svg { display: block; margin-left: auto; }
.no-chart { color: var(--text-muted); }

/* Responsive column visibility */
.hide-sm { display: none; }
.hide-md { display: none; }
.hide-lg { display: none; }
.hide-xl { display: none; }

@media (min-width: 640px)  { .hide-sm { display: table-cell; } }
@media (min-width: 900px)  { .hide-md { display: table-cell; } }
@media (min-width: 1100px) { .hide-lg { display: table-cell; } }
@media (min-width: 1300px) { .hide-xl { display: table-cell; } }

/* Empty state */
.empty-state {
  text-align: center !important;
  padding: 60px 20px !important;
  color: var(--text-muted);
}
.empty-icon { font-size: 2.5rem; margin-bottom: 12px; }

/* Skeleton rows */
.skeleton-row td { padding: 0 !important; }
.skeleton-line {
  height: 44px;
  margin: 4px 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeleton-sweep 1.5s ease-in-out infinite;
}

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

/* ── PAGINATION ───────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.page-btn {
  padding: 7px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

.page-numbers { display: flex; align-items: center; gap: 4px; }

.page-num {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: all var(--transition);
}
.page-num:hover { background: var(--bg-hover); color: var(--text-primary); }
.page-num.active { background: var(--accent); color: white; border-color: var(--accent); }

.page-ellipsis { width: 34px; text-align: center; color: var(--text-muted); }

/* ── NEWS SECTION ────────────────────────────────── */
.news-section { margin-bottom: 28px; }

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}

.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.news-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.nc-img-wrap {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--bg-hover);
  flex-shrink: 0;
}
.nc-img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.news-card:hover .nc-img { transform: scale(1.04); }

.nc-body { padding: 14px 16px 18px; flex: 1; display: flex; flex-direction: column; gap: 6px; }

.nc-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nc-source { font-size: .72rem; font-weight: 600; color: var(--accent-light); text-transform: uppercase; }
.nc-time   { font-size: .72rem; color: var(--text-muted); }

.nc-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.news-empty, .news-loading {
  color: var(--text-muted);
  font-size: .88rem;
  padding: 20px 0;
}

/* ── MODAL ───────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

body.modal-open { overflow: hidden; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: min(900px, 100%);
  padding: 28px;
  position: relative;
  margin: auto;
  transform: translateY(24px);
  transition: transform .35s ease;
  box-shadow: var(--shadow-lg);
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text-secondary);
  transition: all var(--transition);
  z-index: 1;
}
.modal-close:hover { border-color: var(--red); color: var(--red); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  padding-right: 44px;
}

.modal-coin-info {
  display: flex;
  align-items: center;
  gap: 14px;
}
.modal-coin-icon { border-radius: 50%; flex-shrink: 0; }
.modal-coin-name { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); }
.modal-coin-symbol {
  display: inline-block;
  font-size: .8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  margin-right: 6px;
}
.modal-coin-rank {
  display: inline-block;
  font-size: .75rem;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.modal-price-info { text-align: right; }
.modal-price { font-size: 2rem; font-weight: 800; color: var(--text-primary); line-height: 1.2; }
.modal-change { font-size: .9rem; }

/* Badge */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 700;
  font-size: .82rem;
}
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.red   { background: var(--red-bg);   color: var(--red); }

/* Chart controls */
.chart-controls { margin-bottom: 14px; }
.timeframe-buttons {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  width: fit-content;
}

.timeframe-btn {
  padding: 5px 14px;
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition);
}
.timeframe-btn.active { background: var(--accent); color: white; }
.timeframe-btn:not(.active):hover { background: var(--bg-hover); color: var(--text-primary); }

/* Chart area */
.chart-container {
  position: relative;
  height: 280px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  overflow: hidden;
}
.chart-container canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }

.chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  font-size: .88rem;
  color: var(--text-muted);
  gap: 8px;
}
.chart-loading::before {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.chart-error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: .88rem;
}

/* Modal stats grid */
.modal-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
@media (min-width: 600px) { .modal-stats-grid { grid-template-columns: repeat(3, 1fr); } }

.modal-stat {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.modal-stat-label { display: block; font-size: .7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.modal-stat-value { font-size: .9rem; font-weight: 700; color: var(--text-primary); }

/* Modal news */
.modal-news { border-top: 1px solid var(--border); padding-top: 20px; }
.modal-news-title { font-size: .95rem; font-weight: 700; margin-bottom: 14px; }
.modal-news-grid { display: grid; gap: 10px; }

.modal-news-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: block;
  transition: border-color var(--transition), background var(--transition);
}
.modal-news-card:hover { border-color: var(--accent); background: var(--bg-hover); }

.mnc-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.mnc-source { font-size: .7rem; font-weight: 600; color: var(--accent-light); text-transform: uppercase; }
.mnc-time   { font-size: .7rem; color: var(--text-muted); }
.mnc-title  { font-size: .84rem; font-weight: 600; color: var(--text-primary); line-height: 1.4; }

/* ── FOOTER ──────────────────────────────────────── */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 48px 0 24px;
  margin-top: 40px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  margin-bottom: 32px;
}
@media (min-width: 640px)  { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }

.footer-brand .logo { margin-bottom: 12px; }
.footer-desc {
  font-size: .83rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 280px;
}

.footer-links h4 {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 14px;
}
.footer-links ul { display: flex; flex-direction: column; gap: 8px; }
.footer-links a {
  font-size: .83rem;
  color: var(--text-secondary);
  transition: color var(--transition);
}
.footer-links a:hover { color: var(--accent-light); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.disclaimer {
  font-size: .75rem;
  color: var(--text-muted);
  line-height: 1.6;
  padding: 10px 14px;
  background: rgba(245,158,11,.06);
  border: 1px solid rgba(245,158,11,.15);
  border-radius: var(--radius-sm);
}

.copyright {
  font-size: .78rem;
  color: var(--text-muted);
  text-align: center;
}
.copyright a { color: var(--accent-light); }
.copyright a:hover { color: var(--accent); }

/* ── SKELETON GLOBAL ────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeleton-sweep 1.5s ease-in-out infinite;
  pointer-events: none;
  color: transparent !important;
  border-radius: var(--radius-sm);
}
.skeleton * { visibility: hidden; }

/* ── TOAST NOTIFICATIONS ────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card-alt, var(--bg-card));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: .83rem;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  transform: translateX(120%);
  transition: transform .35s cubic-bezier(.34,1.56,.64,1);
  pointer-events: all;
  max-width: 300px;
}
.toast.toast-show { transform: translateX(0); }
.toast-success { border-color: var(--green); }
.toast-error   { border-color: var(--red);   }
.toast-warn    { border-color: var(--yellow); }
.toast-info    { border-color: var(--accent); }

/* ── UTILITY ──────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ── SCROLLBAR GLOBAL ───────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ── SEARCH KEYBOARD NAVIGATION & NO-RESULTS ──────── */
.search-item-active {
  background: var(--bg-hover) !important;
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.search-no-results {
  padding: 14px 16px;
  font-size: .83rem;
  color: var(--text-muted);
  text-align: center;
}
.search-no-results strong { color: var(--text-secondary); }

/* ── MODAL PRICE FLASH ANIMATIONS ─────────────────── */
@keyframes priceFlashUp {
  0%   { color: inherit; }
  20%  { color: var(--green); text-shadow: 0 0 14px rgba(16,185,129,.55); }
  100% { color: inherit; }
}

@keyframes priceFlashDown {
  0%   { color: inherit; }
  20%  { color: var(--red); text-shadow: 0 0 14px rgba(244,63,94,.55); }
  100% { color: inherit; }
}

.modal-price.price-flash-up   { animation: priceFlashUp   0.9s ease forwards; }
.modal-price.price-flash-down { animation: priceFlashDown 0.9s ease forwards; }

/* ── SELECTION ──────────────────────────────────── */
::selection { background: var(--accent-glow); color: var(--text-primary); }


/* ═══════════════════════════════════════════════════
   FEATURES — Watchlist · Alerts · Compare · Movers · Detail
   ═══════════════════════════════════════════════════ */

/* ── HEADER FEATURE BUTTONS ──────────────────────── */
.feat-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
}
.feat-btn:hover { border-color: var(--accent); color: var(--accent); }
.feat-label { display: none; }
@media (min-width: 900px) { .feat-label { display: inline; } }

.cmp-badge {
  position: absolute;
  top: -5px; right: -5px;
  background: var(--accent);
  color: white;
  font-size: .65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* ── WATCHLIST STAR IN TABLE ROWS ─────────────────── */
.row-star {
  background: none;
  border: none;
  padding: 2px 4px;
  font-size: .95rem;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition), color var(--transition);
  line-height: 1;
  flex-shrink: 0;
  margin-left: 4px;
}
.coin-row:hover .row-star,
.row-star.watched { opacity: 1; }
.row-star.watched { color: #f59e0b; }
.row-star:hover   { color: #f59e0b; }

/* ── PANEL BACKDROP ──────────────────────────────── */
.panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 350;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.panel-backdrop.visible { opacity: 1; pointer-events: all; }

/* ── SIDE PANELS (Watchlist & Alerts) ────────────── */
.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(400px, 100vw);
  z-index: 400;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--shadow-lg);
}
.side-panel.open { transform: translateX(0); }

.sp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sp-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.sp-close {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--transition);
}
.sp-close:hover { border-color: var(--red); color: var(--red); }

.sp-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

/* Panel empty state */
.panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 48px 20px;
  text-align: center;
}
.pe-icon { font-size: 2.5rem; }
.panel-empty p { font-size: .88rem; color: var(--text-secondary); }
.pe-hint { font-size: .78rem; color: var(--text-muted); }

/* ── WATCHLIST ITEMS ─────────────────────────────── */
.wl-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  transition: background var(--transition);
}
.wl-item:hover { background: var(--bg-hover); }

.wl-coin {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}
.wl-coin img { border-radius: 50%; flex-shrink: 0; }
.wl-info { flex: 1; min-width: 0; }
.wl-name { display: block; font-size: .85rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-sym  { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; }
.wl-prices { text-align: right; flex-shrink: 0; }
.wl-price  { display: block; font-size: .85rem; font-weight: 600; color: var(--text-primary); }
.wl-pct    { font-size: .75rem; font-weight: 600; }

.wl-del {
  width: 26px; height: 26px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  font-size: .85rem;
  flex-shrink: 0;
  transition: all var(--transition);
}
.wl-del:hover { border-color: var(--red); color: var(--red); }

/* ── ALERT ITEMS ─────────────────────────────────── */
.alert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.alert-item img { border-radius: 50%; flex-shrink: 0; }
.ai-info { flex: 1; min-width: 0; }
.ai-name { display: block; font-size: .85rem; font-weight: 600; color: var(--text-primary); }
.ai-cond { font-size: .75rem; color: var(--text-secondary); }
.ai-del  {
  width: 26px; height: 26px; border: 1px solid transparent; border-radius: 6px;
  color: var(--text-muted); cursor: pointer; background: none; font-size: .85rem;
  flex-shrink: 0; transition: all var(--transition);
}
.ai-del:hover { border-color: var(--red); color: var(--red); }

/* ── MODAL ACTION BUTTONS ────────────────────────── */
.modal-actions {
  display: flex;
  gap: 8px;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.modal-action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.modal-action-btn:hover { border-color: var(--accent); color: var(--accent); }
.modal-action-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ── ALERT INLINE FORM ───────────────────────────── */
.alert-form {
  display: none;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  gap: 10px;
  flex-direction: column;
}
.alert-form.open { display: flex; }

.af-header { font-size: .85rem; color: var(--text-secondary); }
.af-header strong { color: var(--text-primary); }

.af-fields {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.af-select, .af-input {
  flex: 1;
  min-width: 140px;
  padding: 7px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: .83rem;
  outline: none;
  transition: border-color var(--transition);
}
.af-select:focus, .af-input:focus { border-color: var(--accent); }

.af-btns { display: flex; gap: 8px; }
.af-btn {
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity var(--transition);
}
.af-btn:hover { opacity: .85; }
.af-confirm { background: var(--accent); color: white; }
.af-cancel  { background: var(--bg-hover); color: var(--text-secondary); border: 1px solid var(--border); }

/* ── MODAL TABS ──────────────────────────────────── */
.modal-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  width: fit-content;
  margin-bottom: 16px;
}
.modal-tab-btn {
  padding: 6px 18px;
  border-radius: 6px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  transition: all var(--transition);
}
.modal-tab-btn.active { background: var(--accent); color: white; }
.modal-tab-btn:not(.active):hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-tab-pane { animation: tabFadeIn .2s ease; }
@keyframes tabFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ── COIN DETAIL TAB ─────────────────────────────── */
.detail-body { padding-bottom: 20px; }

.det-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 32px;
  color: var(--text-muted);
  font-size: .88rem;
}
.det-spin {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

.det-section { margin-bottom: 22px; }
.det-title {
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.det-desc {
  font-size: .88rem;
  color: var(--text-secondary);
  line-height: 1.65;
}
.det-more {
  background: none;
  border: none;
  color: var(--accent-light);
  font-size: .82rem;
  cursor: pointer;
  margin-top: 6px;
  padding: 0;
  transition: color var(--transition);
}
.det-more:hover { color: var(--accent); }

.det-links { display: flex; flex-wrap: wrap; gap: 8px; }
.det-link {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition);
}
.det-link:hover { border-color: var(--accent); color: var(--accent); }

.det-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 600px) { .det-stats-grid { grid-template-columns: repeat(3, 1fr); } }

.det-stat {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.ds-label { display: block; font-size: .69rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 3px; }
.ds-val   { display: block; font-size: .88rem; font-weight: 700; color: var(--text-primary); }
.ds-sub   { display: block; font-size: .72rem; color: var(--text-muted); margin-top: 1px; }

.det-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.det-tag  {
  padding: 3px 10px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: .75rem;
  color: var(--text-secondary);
}
.det-error { color: var(--text-muted); font-size: .88rem; padding: 20px 0; }

/* ── BIGGEST MOVERS SECTION ──────────────────────── */
.movers-section { margin-bottom: 28px; }

.movers-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.movers-tab {
  padding: 4px 14px;
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  transition: all var(--transition);
}
.movers-tab.active { background: var(--accent); color: white; }
.movers-tab:not(.active):hover { background: var(--bg-hover); color: var(--text-primary); }

.movers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) { .movers-grid { grid-template-columns: 1fr; } }

.movers-col {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.movers-col-hdr {
  padding: 10px 14px;
  font-size: .78rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}
.movers-col-hdr.green { color: var(--green); }
.movers-col-hdr.red   { color: var(--red); }

.movers-list { padding: 6px; }
.mover-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  border-radius: var(--radius-sm);
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  transition: background var(--transition);
}
.mover-row:hover { background: var(--bg-hover); }
.mover-row img   { border-radius: 50%; flex-shrink: 0; }
.mover-info { flex: 1; min-width: 0; }
.mover-name  { display: block; font-size: .83rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mover-price { font-size: .75rem; color: var(--text-secondary); }
.mover-pct   { font-size: .83rem; font-weight: 700; flex-shrink: 0; }

/* ── COMPARE PANEL ───────────────────────────────── */
.compare-panel {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 450;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 40px rgba(0,0,0,.4);
  max-height: 65vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
}
.compare-panel.open { transform: translateY(0); }

.cp-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cp-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .95rem;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}
.cp-controls { display: flex; gap: 8px; }
.cp-btn {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  transition: all var(--transition);
}
.cp-btn:hover { border-color: var(--accent); color: var(--accent); }
.cp-close-btn:hover { border-color: var(--red); color: var(--red); }

.cp-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px;
}

.cmp-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: .88rem;
}

.cmp-scroll { overflow-x: auto; }
.cmp-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  font-size: .84rem;
}
.cmp-table th, .cmp-table td {
  padding: 9px 14px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.cmp-table th { background: var(--bg-secondary); font-weight: 600; color: var(--text-secondary); }
.cmp-metric-col, .cmp-label { text-align: left; font-weight: 500; color: var(--text-muted); }

.cmp-coin-h {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.cmp-coin-h img { border-radius: 50%; }
.cmp-coin-name { font-weight: 700; color: var(--text-primary); }
.cmp-rm {
  width: 20px; height: 20px;
  border-radius: 4px; border: 1px solid transparent;
  background: none; color: var(--text-muted); cursor: pointer;
  font-size: .8rem; transition: all var(--transition);
}
.cmp-rm:hover { border-color: var(--red); color: var(--red); }

/* ── COMPARE BAR (sticky pill) ───────────────────── */
.cmp-bar {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 440;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--accent);
  border-radius: 30px;
  color: white;
  font-size: .82rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  animation: slideUp .3s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.cmp-bar button {
  padding: 4px 12px;
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 14px;
  color: white;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition);
}
.cmp-bar button:hover { background: rgba(255,255,255,.35); }

/* ═══════════════════════════════════════════════════
   NEW FEATURES — Chart Toggle · Recently Added · Heatmap · Mobile
   ═══════════════════════════════════════════════════ */

/* ── CHART TYPE TOGGLE ─────────────────────────────── */
.chart-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.chart-type-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  flex-shrink: 0;
}
.chart-type-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.chart-type-btn.active { background: var(--accent); color: white; }
.chart-type-btn:not(.active):hover { background: var(--bg-hover); color: var(--text-primary); }
.chart-type-btn svg { flex-shrink: 0; }

/* ── RECENTLY ADDED SECTION ────────────────────────── */
.recently-added-section { margin-bottom: 28px; }

.ra-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  scroll-snap-type: x mandatory;
}
.ra-track::-webkit-scrollbar { height: 4px; }
.ra-track::-webkit-scrollbar-track { background: transparent; }
.ra-track::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.ra-card {
  flex: 0 0 190px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  scroll-snap-align: start;
  text-align: left;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
  position: relative;
}
.ra-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}
.ra-card.skeleton { height: 150px; }

.ra-new-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--accent);
  color: white;
  font-size: .6rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.ra-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-right: 36px;
}
.ra-header img { border-radius: 50%; flex-shrink: 0; }
.ra-info { flex: 1; min-width: 0; }
.ra-name { display: block; font-size: .83rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ra-sym  { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; }

.ra-price  { font-size: .9rem; font-weight: 700; color: var(--text-primary); margin-bottom: 3px; }
.ra-change { font-size: .78rem; font-weight: 600; margin-bottom: 6px; }
.ra-date   { font-size: .7rem; color: var(--text-muted); }
.ra-empty  { padding: 20px 0; color: var(--text-muted); font-size: .88rem; }
.ra-skeleton { display: flex; gap: 14px; }

/* ── MARKET HEATMAP SECTION ────────────────────────── */
.heatmap-section { margin-bottom: 28px; }

.heatmap-controls {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.heatmap-tf-btn {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  transition: all var(--transition);
}
.heatmap-tf-btn.active { background: var(--accent); color: white; }
.heatmap-tf-btn:not(.active):hover { background: var(--bg-hover); color: var(--text-primary); }

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-auto-rows: 58px;
  gap: 3px;
}
@media (max-width: 1200px) { .heatmap-grid { grid-template-columns: repeat(8, 1fr); } }
@media (max-width: 900px)  { .heatmap-grid { grid-template-columns: repeat(6, 1fr); grid-auto-rows: 54px; } }
@media (max-width: 640px)  { .heatmap-grid { grid-template-columns: repeat(5, 1fr); grid-auto-rows: 56px; } }
@media (max-width: 420px)  { .heatmap-grid { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 62px; } }

.hm-cell {
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: filter .15s ease, transform .15s ease, box-shadow .15s ease;
  overflow: hidden;
  padding: 4px 3px;
  position: relative;
  border: none;
  text-align: center;
}
.hm-cell:hover { filter: brightness(1.2); transform: scale(1.04); z-index: 2; box-shadow: 0 4px 16px rgba(0,0,0,.45); }
.hm-cell:focus { outline: 2px solid rgba(255,255,255,.7); outline-offset: -2px; }
.hm-cell-lg { grid-column: span 2; grid-row: span 2; }
.hm-cell-md { grid-row: span 2; }

.hm-name {
  display: none;
  font-size: .58rem;
  color: rgba(255,255,255,.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
  line-height: 1;
}
.hm-cell-lg .hm-name { display: block; font-size: .7rem; }

.hm-sym {
  font-size: .65rem;
  font-weight: 800;
  color: rgba(255,255,255,.95);
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
  line-height: 1.1;
}
.hm-cell-lg .hm-sym { font-size: .95rem; }
.hm-cell-md .hm-sym { font-size: .78rem; }

.hm-pct {
  font-size: .58rem;
  font-weight: 600;
  color: rgba(255,255,255,.85);
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
  line-height: 1;
}
.hm-cell-lg .hm-pct { font-size: .8rem; }
.hm-cell-md .hm-pct { font-size: .68rem; }

/* ── MOBILE IMPROVEMENTS ────────────────────────────── */

/* Compact header on small phones */
@media (max-width: 480px) {
  .header-inner { gap: 6px; }
  .header-right { gap: 5px; }
  .logo-img { height: 28px; }
  .currency-select { display: none; }
  .feat-btn { padding: 6px 7px; }
}

/* Mobile nav enhancements */
.mobile-search-wrap {
  position: relative;
  padding: 2px 0 8px;
}
.mobile-search-wrap .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  margin-top: -4px;
}
.mobile-search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 12px 9px 36px;
  font-size: .88rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition);
}
.mobile-search-input::placeholder { color: var(--text-muted); }
.mobile-search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.mobile-currency-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.mobile-currency-label {
  font-size: .82rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.mobile-currency-row .currency-select {
  font-size: .82rem;
  padding: 5px 8px;
}

/* Market stats on mobile */
@media (max-width: 640px) {
  .market-stats { padding: 12px 14px; gap: 8px; }
  .stats-wrap { gap: 10px 20px; }
  .refresh-info { width: 100%; justify-content: flex-end; }
}

/* Modal as bottom sheet on mobile */
@media (max-width: 600px) {
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    margin: 0;
    max-height: 92vh;
    overflow-y: auto;
    padding: 24px 16px 36px;
    transform: translateY(100%);
  }
  .modal-overlay.open .modal { transform: translateY(0); }
  .modal-coin-name { font-size: 1.2rem; }
  .modal-price { font-size: 1.5rem; }
  .modal-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-controls-row { flex-direction: column; align-items: flex-start; }
}

/* Full-width side panels on small phones */
@media (max-width: 480px) {
  .side-panel { width: 100vw; }
  .compare-panel { max-height: 80vh; }
}

/* Toast on mobile */
@media (max-width: 480px) {
  .toast-container { bottom: 16px; right: 12px; left: 12px; }
  .toast { max-width: 100%; }
}

/* Trending & RA cards narrower on small phones */
@media (max-width: 420px) {
  .trending-card { flex: 0 0 155px; }
  .ra-card { flex: 0 0 160px; }
}

/* News single-column on very small screens */
@media (max-width: 480px) {
  .news-grid { grid-template-columns: 1fr; }
}

/* GL grid stacks on very small screens */
@media (max-width: 400px) {
  .gl-grid { grid-template-columns: 1fr !important; }
  .gl-card, .ad-sidebar { grid-column: span 1 !important; }
}

/* Pagination compact on mobile */
@media (max-width: 480px) {
  .pagination { gap: 5px; }
  .page-btn { padding: 7px 12px; font-size: .78rem; }
  .page-num { width: 30px; height: 30px; font-size: .78rem; }
}

/* Hero on very small screens */
@media (max-width: 380px) {
  .hero-brand-icon { width: 60px; height: 60px; }
  .hero-headline { font-size: 1.2rem; }
  .hero-tagline { font-size: .82rem; }
}

/* Movers grid stacks on mobile */
@media (max-width: 480px) {
  .movers-grid { grid-template-columns: 1fr; }
}

/* Section header wraps cleanly on mobile */
@media (max-width: 480px) {
  .section-header { gap: 8px; }
  .section-title { font-size: .95rem; }
}

/* ── SHARE BAR ────────────────────────────────────── */
.share-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.share-label {
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-right: 2px;
}
.share-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.share-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,.3); }
.sb-x:hover    { background: #000; border-color: #000; color: white; }
.sb-fb:hover   { background: #1877f2; border-color: #1877f2; color: white; }
.sb-wa:hover   { background: #25d366; border-color: #25d366; color: white; }
.sb-copy:hover { background: var(--accent); border-color: var(--accent); color: white; }
.sb-copy.copied { background: var(--green); border-color: var(--green); color: white; }

/* ── SITE ANNOUNCEMENT BANNER ─────────────────────── */
.site-banner {
  position: relative;
  padding: 9px 0;
  font-size: .84rem;
  font-weight: 500;
  z-index: 180;
  border-bottom: 1px solid transparent;
}
.site-banner[data-type="info"]    { background:rgba(59,130,246,.12); border-color:rgba(59,130,246,.25); color:#93c5fd; }
.site-banner[data-type="success"] { background:rgba(16,185,129,.12); border-color:rgba(16,185,129,.25); color:#6ee7b7; }
.site-banner[data-type="warning"] { background:rgba(245,158,11,.12); border-color:rgba(245,158,11,.25); color:#fcd34d; }
.site-banner[data-type="error"]   { background:rgba(244,63,94,.12);  border-color:rgba(244,63,94,.25);  color:#fca5a5; }
[data-theme="light"] .site-banner[data-type="info"]    { background:rgba(59,130,246,.08);  color:#1d4ed8; }
[data-theme="light"] .site-banner[data-type="success"] { background:rgba(16,185,129,.08);  color:#065f46; }
[data-theme="light"] .site-banner[data-type="warning"] { background:rgba(245,158,11,.1);   color:#92400e; }
[data-theme="light"] .site-banner[data-type="error"]   { background:rgba(244,63,94,.08);   color:#9f1239; }
.sbn-content {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  padding: 0 40px;
}
.sbn-cta {
  padding: 3px 12px;
  border-radius: 12px;
  font-size: .75rem;
  font-weight: 700;
  background: rgba(255,255,255,.18);
  color: inherit;
  flex-shrink: 0;
  transition: background var(--transition);
  text-decoration: none;
}
.sbn-cta:hover { background: rgba(255,255,255,.3); }
.sbn-dismiss {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: inherit;
  opacity: .6;
  cursor: pointer;
  font-size: .9rem;
  padding: 4px 6px;
  border-radius: 4px;
  transition: opacity var(--transition);
  line-height: 1;
}
.sbn-dismiss:hover { opacity: 1; }

/* ── FEATURED COIN HIGHLIGHT ──────────────────────── */
.coin-row.coin-featured { background: rgba(124,58,237,.05); }
.coin-row.coin-featured:hover { background: rgba(124,58,237,.1) !important; }
.coin-row.coin-featured .coin-name-text::after {
  content: ' ✦';
  font-size: .6rem;
  color: var(--accent-light);
  vertical-align: middle;
}

/* ── ADMIN FOOTER LINK ─────────────────────────────── */
.admin-footer-link { opacity: .4; transition: opacity var(--transition); }
.admin-footer-link:hover { opacity: 1; color: var(--accent-light) !important; }

/* ═══════════════════════════════════════════════════
   GLOBAL SEARCH — Enhanced Dropdown
   ═══════════════════════════════════════════════════ */

/* Dropdown container — already defined, these extend it */
.search-results {
  max-height: 440px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.search-results::-webkit-scrollbar { width: 4px; }
.search-results::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Rank badge inside symbol row */
.sri-rank {
  display: inline-block;
  font-size: .62rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 5px;
  margin-left: 5px;
  vertical-align: middle;
  line-height: 1.6;
}

/* Section divider between "Top Results" and "More Coins" */
.search-section-hdr {
  padding: 6px 14px 4px;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  user-select: none;
}

/* "Show all N results" footer */
.search-footer {
  padding: 6px 8px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}
.search-see-all {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 600;
  color: var(--accent-light);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  text-align: left;
  font-family: inherit;
}
.search-see-all:hover { background: var(--bg-hover); color: var(--accent); }
.search-see-all strong { font-weight: 700; color: var(--text-primary); }

/* Loading placeholder icon */
.sri-img-ph {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-hover);
  flex-shrink: 0;
  animation: skeleton-sweep 1.5s ease-in-out infinite;
  background-size: 200% 100%;
}

/* Loading state item */
.search-result-item.sri-loading {
  pointer-events: none;
  opacity: .6;
}
.sri-loading-dots {
  font-size: .9rem;
  color: var(--text-muted);
  letter-spacing: 2px;
}

/* Price flash on live update */
@keyframes srPriceFlash {
  0%   { color: inherit; }
  25%  { color: var(--green); }
  100% { color: inherit; }
}
.sri-price-flash { animation: srPriceFlash 0.9s ease; }

/* ── MOBILE SEARCH RESULTS ──────────────────────────── */
.mobile-search-results {
  position: relative;           /* inside mobile nav flow, not absolute */
  top: auto; left: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin: 0 0 8px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
}

/* ── SEARCH INPUT — wider focus on large screens ────── */
@media (min-width: 900px) {
  .search-input:focus { width: 300px; }
}

/* ── DESKTOP DROPDOWN POSITION FIX ─────────────────── */
.search-results {
  /* Ensure it never bleeds off screen on the right */
  right: 0;
  left: auto;
  min-width: 320px;
}
@media (max-width: 640px) {
  .search-results { min-width: 0; }
}

/* ═══════════════════════════════════════════════════
   AI-POWERED AUTO CONTENT — Styles
   ═══════════════════════════════════════════════════ */

/* ── SOCIAL PROOF BAR ─────────────────────────────── */
.social-proof-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: .78rem;
  color: var(--text-muted);
  overflow: hidden;
}
.spb-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  animation: spb-pulse 2.2s ease-in-out infinite;
}
@keyframes spb-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16,185,129,.55); }
  50%       { opacity: .7; box-shadow: 0 0 0 5px rgba(16,185,129,0); }
}
.spb-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity .4s;
}

/* ── AI MARKET INTELLIGENCE BAR ──────────────────── */
.ai-bar {
  background: linear-gradient(90deg, rgba(124,58,237,.07) 0%, rgba(2,132,199,.05) 100%);
  border: 1px solid rgba(124,58,237,.18);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  margin-bottom: 10px;
  overflow: hidden;
}
.ai-sentiment-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: .78rem;
}
.ai-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-light);
  flex-shrink: 0;
  animation: ai-glow-pulse 2s ease-in-out infinite;
}
@keyframes ai-glow-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(167,139,250,.65); }
  50%       { box-shadow: 0 0 0 5px rgba(167,139,250,0); }
}
.ai-label {
  font-size: .68rem;
  font-weight: 700;
  color: var(--accent-light);
  text-transform: uppercase;
  letter-spacing: .7px;
  flex-shrink: 0;
}
.ai-sentiment-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 600;
  border: 1px solid transparent;
  flex-shrink: 0;
}
.ai-ratio { font-size: .68rem; opacity: .75; }
.ai-divider {
  width: 1px;
  height: 16px;
  background: var(--border-light);
  flex-shrink: 0;
}
.ai-stat {
  font-size: .75rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 3px;
}
.ai-top-move { font-weight: 600; }
.ai-freshness {
  font-size: .68rem;
  color: var(--text-muted);
  margin-left: auto;
  flex-shrink: 0;
}

/* ── AI PRICE ALERT BANNER ───────────────────────── */
.ai-alert-banner {
  background: rgba(245,158,11,.06);
  border: 1px solid rgba(245,158,11,.2);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  margin-bottom: 10px;
  overflow: hidden;
}
.ai-alerts-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}
.ai-alerts-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .68rem;
  font-weight: 700;
  color: var(--yellow);
  text-transform: uppercase;
  letter-spacing: .6px;
  flex-shrink: 0;
  white-space: nowrap;
}
.ai-alerts-scroll {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
  padding-bottom: 1px;
}
.ai-alerts-scroll::-webkit-scrollbar { display: none; }
.ai-alert-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  flex-shrink: 0;
}
.ai-alert-chip img { border-radius: 50%; }
.ai-alert-surge {
  background: var(--green-bg);
  border-color: rgba(16,185,129,.25);
  color: var(--green);
}
.ai-alert-surge:hover { background: rgba(16,185,129,.18); transform: translateY(-1px); }
.ai-alert-drop {
  background: var(--red-bg);
  border-color: rgba(244,63,94,.25);
  color: var(--red);
}
.ai-alert-drop:hover { background: rgba(244,63,94,.18); transform: translateY(-1px); }

/* ── TELEGRAM / REDDIT SHARE BUTTONS ─────────────── */
.sb-tg:hover { background: #2AABEE; border-color: #2AABEE; color: white; }
.sb-rd:hover { background: #ff4500; border-color: #ff4500; color: white; }

/* ── NEWS HEADLINE TICKER BAR ────────────────────── */
.news-ticker-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  overflow: hidden;
}
.ntb-label {
  font-size: .68rem;
  font-weight: 700;
  color: var(--accent-light);
  text-transform: uppercase;
  letter-spacing: .6px;
  white-space: nowrap;
  flex-shrink: 0;
}
.ntb-divider {
  width: 1px;
  height: 14px;
  background: var(--border-light);
  flex-shrink: 0;
}
.ntb-content { flex: 1; min-width: 0; overflow: hidden; }
.ntb-text {
  display: block;
  font-size: .8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity .35s;
}
.ntb-link {
  font-size: .72rem;
  font-weight: 600;
  color: var(--accent-light);
  flex-shrink: 0;
  white-space: nowrap;
  transition: color var(--transition);
  text-decoration: none;
}
.ntb-link:hover { color: var(--accent); }
@media (max-width: 480px) { .ntb-link { display: none; } }

/* ── NEWS SECTION INLINE AD ──────────────────────── */
.ad-news-inline { margin: 0 0 18px; }
.ad-news-inline .ad-placeholder { min-height: 80px; }
.ad-demo-compact { gap: 4px; }

/* ═══════════════════════════════════════════════════
   AI NEWS ENGINE — Cards, Badges, Header, Separator
   ═══════════════════════════════════════════════════ */

/* ── AI News Section Header ──────────────────────── */
.ai-news-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  background: linear-gradient(90deg, rgba(124,58,237,.07) 0%, rgba(2,132,199,.05) 100%);
  border: 1px solid rgba(124,58,237,.18);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.ain-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ain-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-light);
  flex-shrink: 0;
  animation: ai-glow-pulse 2s ease-in-out infinite;
}
.ain-label {
  font-size: .75rem;
  font-weight: 700;
  color: var(--accent-light);
  letter-spacing: .3px;
}
.ain-time {
  font-size: .68rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── AI News Card ─────────────────────────────────── */
/* Inherits .news-card styles — just adds the distinction */
.ai-news-card {
  cursor: pointer;
  border-color: rgba(124,58,237,.2);
  position: relative;
  outline: none;
}
.ai-news-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow), var(--shadow-md);
}
.ai-news-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Image wrapper: canvas images are already 320×180 */
.ai-nc-img-wrap { position: relative; }

.ai-img-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--bg-hover) 0%, rgba(124,58,237,.12) 100%);
}

/* Type badge overlaid on the card image */
.ai-type-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: .68rem;
  font-weight: 700;
  background: rgba(var(--badge-color, #a78bfa), .15);
  color: var(--badge-color, #a78bfa);
  border: 1px solid rgba(var(--badge-color, #a78bfa), .3);
  /* CSS custom property from inline style */
  background: color-mix(in srgb, var(--badge-color) 15%, transparent);
  color: var(--badge-color);
  border-color: color-mix(in srgb, var(--badge-color) 35%, transparent);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
  white-space: nowrap;
}

/* Fallback for browsers without color-mix */
@supports not (color: color-mix(in srgb, red, blue)) {
  .ai-type-badge {
    background: rgba(167,139,250,.15);
    border-color: rgba(167,139,250,.3);
  }
}

/* ── AI Source Label ("Cryptara AI" + live dot) ────── */
.ai-source-label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--accent-light) !important;
}
.ai-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  animation: spb-pulse 2.2s ease-in-out infinite;
}

/* ── News Section Separator ──────────────────────── */
.news-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 18px;
  color: var(--text-muted);
}
.ns-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}
.ns-text {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  white-space: nowrap;
  color: var(--text-muted);
}

/* ── Mobile: make AI badge smaller ──────────────────── */
@media (max-width: 480px) {
  .ai-type-badge { font-size: .6rem; padding: 2px 6px; }
  .ain-label     { font-size: .7rem; }
}

/* ── MOBILE: tighten AI bars on small screens ─────── */
@media (max-width: 600px) {
  .ai-sentiment-inner { gap: 7px; }
  .ai-divider { display: none; }
  .ai-freshness { display: none; }
  .ai-alerts-label { display: none; }
  .news-ticker-bar { padding: 6px 10px; }
}

/* ═══════════════════════════════════════════════════
   AI NEWS ENGINE v2 — Category Badges, Cards,
   Archive Section, Article Reader Modal
   ═══════════════════════════════════════════════════ */

/* ── Category Badge (replaces old ai-type-badge) ──── */
.ai-cat-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: .65rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  background: rgba(0,0,0,.45);
  color: var(--cat-clr, #a78bfa);
  border: 1px solid var(--cat-clr, #a78bfa);
  filter: drop-shadow(0 1px 4px rgba(0,0,0,.4));
}

/* ── Image Placeholder (when no canvas) ────────────── */
.ai-img-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  opacity: .8;
}

/* ── Card footer (read-more + date) ─────────────────── */
.nc-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.nc-read-more {
  font-size: .7rem;
  font-weight: 600;
  color: var(--accent-light);
  transition: color var(--transition);
}
.ai-news-card:hover .nc-read-more { color: var(--accent); }
.nc-pub-date {
  font-size: .65rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Archive Section ──────────────────────────────── */
.ai-archive-section { margin-top: 4px; }
.ai-archive-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}
.aar-label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-secondary);
}
.aar-count {
  font-size: .68rem;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 2px 8px;
  border-radius: 20px;
}

/* Archive cards: slimmer than main grid cards */
.ai-archive-card .nc-img-wrap { max-height: 120px; }
.ai-archive-card .nc-img      { max-height: 120px; object-fit: cover; }
.ai-archive-card .nc-title    { font-size: .82rem; }
.ai-archive-card .nc-excerpt  { display: none; }

/* Load More button */
.ai-archive-controls {
  display: flex;
  justify-content: center;
  padding: 14px 0 4px;
}
.ai-load-more {
  padding: 9px 28px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.ai-load-more:hover {
  border-color: var(--accent);
  color: var(--accent-light);
  background: var(--accent-glow);
}

/* ── Article Reader Modal ─────────────────────────── */
.ar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.ar-modal {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: ar-slide-in .22s ease;
  outline: none;
}
@keyframes ar-slide-in {
  from { opacity:0; transform:translateY(14px) scale(.97); }
  to   { opacity:1; transform:none; }
}
.ar-top-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ar-cat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  background: rgba(0,0,0,.08);
  color: var(--cat-color, var(--accent-light));
  border: 1px solid var(--cat-color, var(--accent-light));
  flex-shrink: 0;
}
[data-theme="light"] .ar-cat { background: rgba(255,255,255,.6); }
.ar-date {
  font-size: .68rem;
  color: var(--text-muted);
  margin-left: auto;
  flex-shrink: 0;
}
.ar-close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
}
.ar-close:hover { background: var(--bg-hover); color: var(--red); border-color: var(--red); }
.ar-img-wrap { flex-shrink: 0; }
.ar-img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  display: block;
}
.ar-img-ph {
  width: 100%;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}
.ar-content {
  padding: 18px 20px 20px;
  overflow-y: auto;
  flex: 1;
}
.ar-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 8px;
}
.ar-excerpt {
  font-size: .82rem;
  color: var(--accent-light);
  font-style: italic;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
}
.ar-body { flex: 1; }
.ar-body p {
  font-size: .85rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 14px;
}
.ar-body p:last-child { margin-bottom: 0; }
.ar-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.ar-chart-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  background: var(--gradient-brand);
  color: white;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition);
  border: none;
  font-family: inherit;
}
.ar-chart-btn:hover { opacity: .85; }
.ar-disclaimer {
  font-size: .65rem;
  color: var(--text-muted);
  flex: 1;
  line-height: 1.4;
}

/* ── Mobile: fullscreen reader ─────────────────────── */
@media (max-width: 640px) {
  .ar-overlay   { padding: 0; align-items: flex-end; }
  .ar-modal     { max-height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-width: 100%; }
  .ar-title     { font-size: .95rem; }
  .ai-cat-badge { font-size: .58rem; }
}

/* ═══════════════════════════════════════════════════
   PUSH NOTIFICATIONS — Bell Button & Status Dot
   ═══════════════════════════════════════════════════ */

/* The bell button uses the existing .feat-btn styles;
   these add the active/denied state and the status dot. */
.notif-bell { position: relative; }

.notif-bell.notif-active svg {
  stroke: var(--accent-light);
  filter: drop-shadow(0 0 4px rgba(167,139,250,.5));
}
.notif-bell.notif-active .feat-label { color: var(--accent-light); }

.notif-bell.notif-denied { opacity: .45; }
.notif-bell.notif-denied:hover { opacity: .7; }

.notif-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--bg-primary);
  pointer-events: none;
  animation: spb-pulse 2.2s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════════
   HONEYPOT — Anti-bot Trap Field (invisible)
   ═══════════════════════════════════════════════════ */
.hp-trap {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  tab-index: -1;
}

/* ═══════════════════════════════════════════════════
   PERFORMANCE — GPU-accelerate animated elements
   ═══════════════════════════════════════════════════ */
.ticker-track,
.trending-track,
.ai-alerts-scroll,
.ntb-text {
  will-change: transform;
}

/* Contain paint for card grids — limits repaint area */
.news-card,
.trending-card,
.ra-card,
.gl-row,
.movers-card {
  contain: layout style;
}

/* Smooth image reveal when lazy-loaded */
img[data-lazy-obs] { opacity: 0; transition: opacity .3s ease; }
img:not([data-lazy-obs]) { opacity: 1; }
