/* =========================================================================
   Cauldron Radar — design tokens
   Palette: near-black lab console + cauldron-green (#0ac18e) signal color +
   a warm copper accent (#c9884a) standing in for "molten metal" alerts.
   Display type: Space Grotesk. Data/numeric type: JetBrains Mono (matches
   the rest of the BCH Lab family).
   Signature element: a slow radar sweep behind the hero stats + a subtle
   scanline overlay across the whole app, tying "Radar" to the visual.
   ========================================================================= */

:root {
  --bg: #050805;
  --bg-elevated: #0a120d;
  --surface: #0e1a14;
  --surface-hover: #122019;
  --border: #1c2e26;
  --border-bright: #234233;

  --accent: #0ac18e;
  --accent-soft: rgba(10, 193, 142, 0.14);
  --accent-glow: rgba(10, 193, 142, 0.35);

  --copper: #c9884a;
  --copper-soft: rgba(201, 136, 74, 0.14);

  --up: #24d19b;
  --down: #ef6a5f;

  --text: #e8f0ea;
  --text-dim: #8fa89b;
  --text-faint: #5e766a;

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --header-h: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(10, 193, 142, 0.07), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 0%, rgba(201, 136, 74, 0.05), transparent 55%);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
::selection { background: var(--accent); color: #04140f; }

/* Subtle CRT-style scanlines across the whole app, very low opacity so it
   reads as texture rather than a gimmick. */
.scanline-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.012) 0px,
    rgba(255, 255, 255, 0.012) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}
@media (prefers-reduced-motion: reduce) {
  .scanline-overlay { display: none; }
}

/* ---------------------------------------------------------------------- */
/* Topbar                                                                  */
/* ---------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(6, 10, 8, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 20px;
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark { color: var(--accent); display: flex; }
.brand-mark .bubble { opacity: 0.85; animation: bubble-rise 2.6s ease-in-out infinite; }
.brand-mark .b2 { animation-delay: 0.6s; }
.brand-mark .b3 { animation-delay: 1.2s; }
@keyframes bubble-rise {
  0%   { transform: translateY(0); opacity: 0.9; }
  50%  { transform: translateY(-3px); opacity: 0.4; }
  100% { transform: translateY(0); opacity: 0.9; }
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: 0.2px; }
.brand-sub { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.09em; }

.main-nav { display: flex; gap: 4px; flex: 1; }
.main-nav a {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-dim);
  transition: color 0.15s, background 0.15s;
}
.main-nav a:hover { color: var(--text); background: var(--surface); }
.main-nav a.active { color: var(--accent); background: var(--accent-soft); }

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.icon-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: border-color 0.15s, color 0.15s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--border-bright); }
.icon-btn svg { flex-shrink: 0; }
.icon-btn.spinning svg { animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.api-status { display: flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); box-shadow: 0 0 0 0 currentColor; }
.api-status.ok .status-dot { background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); animation: pulse-dot 2s ease-in-out infinite; }
.api-status.error .status-dot { background: var(--down); }
.api-status.ok .status-text { color: var(--accent); }
.api-status.error .status-text { color: var(--down); }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.mobile-nav-toggle { display: none; background: none; border: none; color: var(--text); font-size: 20px; position: absolute; right: 14px; top: 14px; }
.mobile-nav { display: none; flex-direction: column; background: var(--bg-elevated); border-bottom: 1px solid var(--border); }
.mobile-nav a { padding: 12px 20px; border-top: 1px solid var(--border); color: var(--text-dim); }
.mobile-nav a.active { color: var(--accent); }
.mobile-nav.open { display: flex; }

/* ---------------------------------------------------------------------- */
/* Layout helpers                                                          */
/* ---------------------------------------------------------------------- */

.app-view { max-width: 1280px; margin: 0 auto; padding: 28px 20px 60px; min-height: 60vh; }
.view-header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.view-title { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.view-subtitle { color: var(--text-dim); font-size: 13.5px; margin-top: 4px; }
.mono { font-family: var(--font-mono); }

.boot-loader { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 120px 0; color: var(--text-dim); font-family: var(--font-mono); font-size: 13px; }
.boot-spinner { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }

.state-panel { text-align: center; padding: 60px 20px; color: var(--text-dim); border: 1px dashed var(--border); border-radius: var(--radius); background: var(--bg-elevated); }
.state-panel.error { border-color: rgba(239, 106, 95, 0.4); color: var(--down); }
.state-panel h3 { color: var(--text); margin: 0 0 8px; font-size: 16px; }
.state-panel p { margin: 0 auto; max-width: 480px; font-size: 13.5px; }
.state-panel button { margin-top: 16px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(10, 193, 142, 0.35);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  transition: background 0.15s;
}
.btn:hover { background: rgba(10, 193, 142, 0.24); }
.btn.ghost { background: var(--surface); color: var(--text-dim); border-color: var(--border); }
.btn.ghost:hover { color: var(--text); border-color: var(--border-bright); }
.btn.small { padding: 5px 11px; font-size: 12px; }

/* ---------------------------------------------------------------------- */
/* Dashboard — hero + radar sweep                                          */
/* ---------------------------------------------------------------------- */

.hero {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--bg-elevated), var(--surface));
  padding: 34px 28px;
  margin-bottom: 28px;
  overflow: hidden;
}
.radar-sweep {
  position: absolute;
  top: 50%; right: -80px;
  transform: translateY(-50%);
  width: 380px; height: 380px;
  border-radius: 50%;
  border: 1px solid var(--border-bright);
  pointer-events: none;
  opacity: 0.5;
}
.radar-sweep::before, .radar-sweep::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--border);
}
.radar-sweep::before { inset: 60px; }
.radar-sweep::after { inset: 130px; }
.radar-sweep .sweep-arm {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent-glow), transparent 35%);
  animation: sweep-rotate 4s linear infinite;
}
@keyframes sweep-rotate { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sweep-arm { animation: none; } }

.hero-eyebrow { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.12em; font-size: 11px; color: var(--accent); margin-bottom: 10px; }
.hero h1 { font-size: 30px; margin: 0 0 8px; max-width: 560px; line-height: 1.2; }
.hero p.lede { color: var(--text-dim); max-width: 520px; font-size: 14.5px; margin: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-top: 26px; position: relative; z-index: 1; }
.stat-card {
  background: rgba(6, 10, 8, 0.55);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-label { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); }
.stat-value { font-family: var(--font-mono); font-size: 22px; font-weight: 700; margin-top: 6px; color: var(--text); }
.stat-sub { font-size: 11.5px; color: var(--text-dim); margin-top: 4px; }

.section { margin-bottom: 32px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 17px; margin: 0; }
.section-head .see-all { font-size: 12.5px; color: var(--accent); font-family: var(--font-mono); }

.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ---------------------------------------------------------------------- */
/* Token grid / list rows (used in trending + explorer)                    */
/* ---------------------------------------------------------------------- */

.token-mini-list { display: flex; flex-direction: column; }
.token-mini-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.token-mini-row:last-child { border-bottom: none; }
.token-mini-row:hover { background: var(--surface-hover); }
.token-mini-rank { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); width: 18px; }
.token-icon { width: 26px; height: 26px; border-radius: 50%; background: var(--bg-elevated); object-fit: cover; border: 1px solid var(--border); }
.token-icon.placeholder { display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--text-faint); font-family: var(--font-mono); }
.token-mini-name { flex: 1; min-width: 0; }
.token-mini-name .tn { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.token-mini-name .ts { font-size: 11px; color: var(--text-faint); font-family: var(--font-mono); }
.pct { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; padding: 2px 7px; border-radius: 5px; white-space: nowrap; }
.pct.up { color: var(--up); background: rgba(36, 209, 155, 0.1); }
.pct.down { color: var(--down); background: rgba(239, 106, 95, 0.1); }
.pct.flat { color: var(--text-faint); background: transparent; }

/* ---------------------------------------------------------------------- */
/* Explorer table                                                          */
/* ---------------------------------------------------------------------- */

.explorer-toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.search-box {
  flex: 1; min-width: 200px;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px;
}
.search-box input { background: none; border: none; outline: none; color: var(--text); font-size: 13.5px; width: 100%; font-family: var(--font-display); }
.search-box svg { color: var(--text-faint); flex-shrink: 0; }
select.sort-select {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 9px 10px; font-size: 13px; font-family: var(--font-mono);
}

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.token-table { width: 100%; border-collapse: collapse; min-width: 720px; }
table.token-table th {
  text-align: left; font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-faint); padding: 10px 14px; border-bottom: 1px solid var(--border);
  background: var(--bg-elevated); white-space: nowrap;
}
table.token-table th.sortable { cursor: pointer; user-select: none; }
table.token-table th.sortable:hover { color: var(--text-dim); }
table.token-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
table.token-table tr:last-child td { border-bottom: none; }
table.token-table tbody tr:hover { background: var(--surface-hover); }
.token-link { display: flex; align-items: center; gap: 10px; }
.token-names { display: flex; flex-direction: column; min-width: 0; }
.token-names .token-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.token-names .token-symbol { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.watch-btn { background: none; border: none; color: var(--text-faint); font-size: 16px; cursor: pointer; line-height: 1; }
.watch-btn.active { color: var(--copper); }
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }

/* ---------------------------------------------------------------------- */
/* Token detail                                                            */
/* ---------------------------------------------------------------------- */

.detail-header { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.detail-icon { width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-elevated); object-fit: cover; }
.detail-title { flex: 1; min-width: 200px; }
.detail-title h1 { margin: 0; font-size: 22px; }
.detail-title .sym { font-family: var(--font-mono); color: var(--text-faint); font-size: 13px; }
.detail-price { font-family: var(--font-mono); font-size: 26px; font-weight: 700; text-align: right; }
.detail-actions { display: flex; gap: 8px; }

.token-id-row { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; display: flex; align-items: center; gap: 8px; overflow-wrap: anywhere; margin-bottom: 22px; }
.token-id-row button { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 11px; font-family: var(--font-mono); }

.metric-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.metric-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.metric-card .k { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; color: var(--text-faint); letter-spacing: 0.06em; }
.metric-card .v { font-family: var(--font-mono); font-size: 17px; font-weight: 700; margin-top: 5px; }
.metric-card .metric-sub { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); margin-top: 4px; }

/* Ecosystem navigation strip — put otherwise-empty space under the token
   header to work: Analytics → Explorer/Pools/Activity → Project → Trade. */
.nav-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.nav-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-dim);
  padding: 7px 13px; border-radius: 999px; font-size: 12.5px; transition: border-color 0.15s, color 0.15s;
}
.nav-chip:hover { color: var(--accent); border-color: rgba(10,193,142,0.4); }

.chart-card { padding: 18px; margin-bottom: 24px; }
.chart-range-toggle { display: flex; gap: 6px; margin-bottom: 12px; }
.chart-range-toggle button {
  background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-dim);
  font-family: var(--font-mono); font-size: 11.5px; padding: 5px 11px; border-radius: 5px; cursor: pointer;
}
.chart-range-toggle button.active { color: var(--accent); border-color: rgba(10,193,142,0.4); background: var(--accent-soft); }
.chart-canvas-wrap { position: relative; height: 280px; }

.desc-card { padding: 18px 20px; margin-bottom: 24px; font-size: 13.5px; line-height: 1.6; color: var(--text-dim); }
.desc-card h3 { color: var(--text); font-size: 14px; margin: 0 0 8px; }
.desc-card a { color: var(--accent); }

.pool-list-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
.pool-list-item:last-child { border-bottom: none; }
.pool-list-item .addr { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint); }
.pool-list-item .amt { font-family: var(--font-mono); text-align: right; }

/* ---------------------------------------------------------------------- */
/* Pools view                                                              */
/* ---------------------------------------------------------------------- */

.pool-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.pool-tabs button {
  background: var(--surface); border: 1px solid var(--border); color: var(--text-dim);
  padding: 7px 14px; border-radius: var(--radius-sm); font-size: 13px; cursor: pointer;
}
.pool-tabs button.active { color: var(--accent); border-color: rgba(10,193,142,0.4); background: var(--accent-soft); }

.pool-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.pool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.pool-pair { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.pool-meta { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }
.pool-owner { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); overflow-wrap: anywhere; }

/* ---------------------------------------------------------------------- */
/* Activity feed                                                          */
/* ---------------------------------------------------------------------- */

.activity-note { background: var(--copper-soft); border: 1px solid rgba(201,136,74,0.3); color: var(--copper); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 12.5px; margin-bottom: 18px; }

.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0; }
.activity-item.confirmed .activity-dot { background: var(--accent); }
.activity-item.pending .activity-dot { background: var(--copper); animation: pulse-dot 1.4s ease-in-out infinite; }
.activity-txid { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-time { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }
.activity-link { color: var(--accent); font-family: var(--font-mono); font-size: 11.5px; }

/* ---------------------------------------------------------------------- */
/* Watchlist                                                               */
/* ---------------------------------------------------------------------- */

.empty-watchlist { text-align: center; padding: 60px 20px; color: var(--text-dim); }
.empty-watchlist .glyph { font-size: 34px; margin-bottom: 12px; }

/* ---------------------------------------------------------------------- */
/* Footer / donation                                                       */
/* ---------------------------------------------------------------------- */

.site-footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.7;
}
.site-footer a { color: var(--accent); }
.donate-row {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.donate-label { font-size: 12px; color: var(--copper); white-space: nowrap; }
.donate-address {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 11.5px;
  cursor: pointer;
  overflow-wrap: anywhere;
  text-align: left;
  padding: 0;
  transition: color 0.15s;
}
.donate-address:hover { color: var(--accent); }

/* ---------------------------------------------------------------------- */
/* Utility badges                                                          */
/* ---------------------------------------------------------------------- */

.badge { display: inline-flex; align-items: center; font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 7px; border-radius: 4px; }
.badge.new { color: var(--copper); background: var(--copper-soft); border: 1px solid rgba(201,136,74,0.35); }

/* ---------------------------------------------------------------------- */
/* Responsive                                                              */
/* ---------------------------------------------------------------------- */

@media (max-width: 760px) {
  .main-nav, .topbar-actions .refresh-label { display: none; }
  .mobile-nav-toggle { display: block; }
  .topbar-inner { padding-right: 50px; }
  .two-col { grid-template-columns: 1fr; }
  .radar-sweep { display: none; }
  .hero h1 { font-size: 24px; }
  .detail-price { text-align: left; }
}

/* auto-fit with a minmax floor divides unevenly at phone widths (e.g. a
   lone 3rd card stretching to fill a row by itself) — lock to a clean 2x2
   grid instead so every stat/metric card matches its neighbor's width. */
@media (max-width: 640px) {
  .stat-grid,
  .metric-row {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 380px) {
  .stat-grid,
  .metric-row {
    grid-template-columns: 1fr;
  }
}

/* Visible keyboard focus everywhere */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
