/* ══════════════════════════════════════════════════════════════════════
   exchange-futures.css  —  CryptoRank Exchange futures Page
   ══════════════════════════════════════════════════════════════════════ */

/* ── Reset & Root ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:       #0a0c12;
  --surface:  #111420;
  --border:   #1e2235;
  --border2:  #252840;
  --text:     #e8eaf6;
  --muted:    #6b7280;
  --accent:   #5b6ef5;
  --accent2:  #00d4aa;
  --red:      #ff4d6d;
  --green:    #00d4aa;
  --yellow:   #f5c842;
  --radius:   12px;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-sans: 'IBM Plex Sans', sans-serif;
}
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: clip;
}
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(91,110,245,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91,110,245,.04) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}
.wrapper {
  position: relative; z-index: 1;
  max-width: 100%; margin: 0 auto;
  padding: 0 32px 60px;
}

/* ── Market Ticker Bar ────────────────────────────────────────────────── */
.market-ticker-bar {
  background: rgba(17,20,32,0.97);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  height: 38px;
  display: flex; align-items: center;
  padding: 0;
  overflow: hidden;
}

/* 内容滚动区 — 桌面不滚动，移动端可横划 */
.ticker-scroll {
  display: flex; align-items: center;
  flex: 1; min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  white-space: nowrap;
  padding: 0 32px;
}
.ticker-scroll::-webkit-scrollbar { display: none; }

.ticker-item {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 20px 0 0;
  margin-right: 20px;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  height: 38px;
}
.ticker-item:last-child { border-right: none; margin-right: 0; padding-right: 0; }

.ticker-label { color: var(--muted); font-size: 12px; }
.ticker-sym   { color: var(--text);  font-weight: 700; font-size: 12px; }
.ticker-pct   { font-size: 11px; font-weight: 700; }
.ticker-pct.up   { color: var(--green); }
.ticker-pct.down { color: var(--red); }

/* Loading state */
.ticker-loading {
  display: flex; align-items: center; gap: 8px;
  color: var(--muted); padding: 0 32px;
}
.ticker-dot {
  width: 7px; height: 7px;
  background: var(--accent); border-radius: 50%;
  display: inline-block; animation: pulse 1.6s infinite;
}

/* 左右箭头 — 桌面隐藏，移动端按需显示 */
.ticker-arrow {
  display: none; /* 桌面不显示 */
  align-items: center; justify-content: center;
  width: 28px; height: 38px; flex-shrink: 0;
  border: none; background: rgba(17,20,32,0.97);
  color: var(--text); font-size: 20px; line-height: 1;
  cursor: pointer; padding: 0;
  transition: opacity .2s;
  position: relative; z-index: 2;
}
.ticker-arrow-left  { border-right: 1px solid var(--border); }
.ticker-arrow-right { border-left:  1px solid var(--border); }
.ticker-arrow:hover { color: var(--accent); }

@media (max-width: 768px) {
  .ticker-arrow { display: flex; }
  .ticker-scroll { padding: 0 12px; }
}

/* ── Header ───────────────────────────────────────────────────────────── */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 28px 0 32px;
  border-bottom: 1px solid var(--border);
  gap: 16px; flex-wrap: wrap;
}
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 18px;
      color: #fff;
}
.logo-text { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; color: var(--text); }
.logo-text span { color: var(--accent); }
.header-right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.header-nav {
  display: flex; align-items: center; gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 3px;
}
.nav-item {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 7px;
  font-size: 13px; font-weight: 600;
  color: var(--muted); text-decoration: none;
  transition: all .2s; white-space: nowrap;
}
.nav-item:hover { color: var(--text); background: var(--border); }
.nav-item.active { background: var(--accent); color: #fff; }
.header-meta {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; color: var(--muted); font-family: var(--font-mono);
}
.live-dot {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--green); font-weight: 700; font-size: 11px; letter-spacing: .06em;
}
.live-dot::before {
  content: ''; width: 7px; height: 7px;
  background: var(--green); border-radius: 50%;
  animation: pulse 2s infinite; flex-shrink: 0;
}
@keyframes pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:.5; transform:scale(1.4); }
}
.lang-switcher {
  display: flex; align-items: center;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 8px; overflow: hidden;
  font-size: 12px; font-family: var(--font-mono);
}
.lang-current { padding: 6px 12px; background: var(--accent); color: #fff; font-weight: 700; }
.lang-option {
  padding: 6px 12px; color: var(--muted);
  text-decoration: none; transition: color .2s, background .2s;
}
.lang-option:hover { color: var(--text); background: var(--border); }

/* ── Breadcrumb ───────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  padding: 20px 0 4px;
  font-size: 13px; color: var(--muted);
  font-family: var(--font-mono); flex-wrap: wrap;
}
.breadcrumb a { color: var(--muted); text-decoration: none; transition: color .2s; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--border2); }
.breadcrumb .current { color: var(--text); font-weight: 700; }

/* ── Exchange Hero ────────────────────────────────────────────────────── */
.exchange-hero {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  padding: 28px 0 20px;
}
.hero-left {
  display: flex; align-items: center; gap: 20px;
  flex: 1; min-width: 0;
}
.hero-logo {
  width: 72px; height: 72px; border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border2);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: var(--accent);
  overflow: hidden; flex-shrink: 0;
}
.hero-logo img {
  width: 100%; height: 100%;
  object-fit: contain; border-radius: 16px;
}
.hero-name {
  font-size: 28px; font-weight: 800; letter-spacing: -0.5px;
  color: var(--text); line-height: 1.1; margin-bottom: 6px;
}
.hero-type {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(91,110,245,.12);
  border: 1px solid rgba(91,110,245,.3);
  border-radius: 20px; padding: 3px 12px;
  font-size: 12px; font-weight: 700;
  color: var(--accent); letter-spacing: .04em;
  font-family: var(--font-mono);
}
.hero-right {
  display: flex; flex-direction: column;
  align-items: flex-end; gap: 14px;
  flex-shrink: 0;
}
.market-type-tabs {
  display: flex; align-items: center; gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 4px;
}
.mtype-btn {
  padding: 7px 18px; border-radius: 7px;
  border: none; background: none;
  color: var(--muted);
  font-size: 13px; font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer; transition: all .2s;
  white-space: nowrap;
}
.mtype-btn:hover  { color: var(--text); background: var(--border); }
.mtype-btn.active { background: var(--accent); color: #fff; }
a.mtype-btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn-trading {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--accent), #7c8fff);
  color: #fff; font-size: 14px; font-weight: 700;
  padding: 11px 24px; border-radius: 10px;
  text-decoration: none; transition: all .2s;
  letter-spacing: .02em;
}
.btn-trading:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(91,110,245,.4);
}
.btn-trading svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ── Stats Grid — 3 flat cards ────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  transition: border-color .2s;
}
.stat-card:hover { border-color: var(--border2); }
.stat-vol-value {
  font-size: 26px; font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text); letter-spacing: -0.5px;
  margin-bottom: 8px;
}
.stat-vol-sub {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-family: var(--font-mono);
  flex-wrap: wrap;
}
.stat-trust-value {
  font-size: 32px; font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -1px; margin-bottom: 6px;
}
.stat-trust-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted);
  font-family: var(--font-mono);
}
.stat-card-value {
  font-size: 22px; font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text); margin-top: 6px;
}

/* ── Info Cards (New Listings / Top Gainers) ──────────────────────────── */
.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.info-card-title {
  font-size: 13px; font-weight: 700;
  color: var(--text); letter-spacing: .04em;
  margin-bottom: 16px;
  font-family: var(--font-mono);
}
.info-row {
  display: flex; align-items: center;
  justify-content: space-between;
  gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; padding-bottom: 0; }
.info-row:first-of-type { padding-top: 0; }
.info-row-coin {
  display: flex; align-items: center; gap: 10px;
  min-width: 0; flex: 1;
}
.info-coin-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.info-row-right {
  flex-shrink: 0; text-align: right;
}
.info-price {
  font-size: 13px; font-weight: 700;
  font-family: var(--font-mono); color: var(--text);
}
.info-pct-up {
  font-size: 11px; font-weight: 700;
  color: var(--green); background: rgba(0,212,170,.1);
  border-radius: 4px; padding: 2px 6px;
}
.info-pct-down {
  font-size: 11px; font-weight: 700;
  color: var(--red); background: rgba(255,77,109,.1);
  border-radius: 4px; padding: 2px 6px;
}

/* ── Detail Tabs ──────────────────────────────────────────────────────── */
.detail-tabs {
  display: flex; align-items: center; gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 12px;
}
.dtab {
  padding: 12px 24px; border: none; background: none;
  color: var(--muted); font-size: 14px; font-weight: 600;
  font-family: var(--font-sans); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all .2s; white-space: nowrap;
}
.dtab:hover { color: var(--text); }
.dtab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* External link tabs */
.dtab-ext {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--muted);
}
.dtab-ext:hover { color: var(--text); }

/* Tab content sections */
.markets-section,
.about-section,
.stats-section {
  display: none;
}
.markets-section.active,
.about-section.active,
.stats-section.active {
  display: block;
}

/* ── Markets Tab ──────────────────────────────────────────────────────── */
.markets-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 10px; flex-wrap: wrap;
  width: 100%;
}
.markets-title {
  font-size: 16px; font-weight: 800;
  color: var(--text); letter-spacing: -0.2px;
  flex: 1;
}
.pairs-filter {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 8px; padding: 0 4px 0 12px;
  height: 36px;
}
.pairs-filter select {
  border: none; background: transparent;
  color: var(--text); font-size: 13px;
  font-family: var(--font-sans); font-weight: 600;
  padding: 0 8px; height: 100%; outline: none; cursor: pointer;
}

/* ── Top Scrollbar Mirror ────────────────────────────────────────────── */
.table-scroll-top {
  overflow-x: auto;
  overflow-y: hidden;
  height: 14px;
  background: var(--border);
  border: 1px solid var(--border2);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  scrollbar-width: auto;
  scrollbar-color: var(--accent) var(--border);
  -webkit-overflow-scrolling: touch;
}
.table-scroll-top::-webkit-scrollbar {
  height: 14px;
  display: block;
}
.table-scroll-top::-webkit-scrollbar-track {
  background: var(--border);
  border-radius: 999px;
}
.table-scroll-top::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 999px;
  border: 3px solid var(--border);
  min-width: 60px;
}
.table-scroll-top::-webkit-scrollbar-thumb:hover {
  background: #7c8fff;
}
.table-scroll-top-inner { height: 1px; }

/* Remove top border-radius from table-wrap when top scrollbar is present */
.table-scroll-top + .table-wrap {
  border-radius: 0 0 var(--radius) var(--radius);
  border-top: none;
}

/* ── Table ────────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; }
thead {
  background: rgba(91,110,245,.06);
  border-bottom: 1px solid var(--border);
}
th {
  padding: 12px 16px;
  font-size: 12px; font-weight: 600;
  text-transform: none; letter-spacing: 0;
  color: #ffffff; text-align: left;
  white-space: nowrap; cursor: pointer;
  user-select: none; transition: color .2s;
}
th:hover { color: #ffffff; }
th.sorted { color: #ffffff; }

/* Sort arrow — hidden by default, show on hover or active */
th[data-sort] { position: relative; padding-right: 26px; }
th[data-sort]::after {
  content: '';
  position: absolute; right: 8px; top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 5px solid rgba(255,255,255,0.2);
  opacity: 0;
  transition: opacity .15s, border-color .15s;
}
th[data-sort]:hover::after {
  opacity: 1;
  border-bottom-color: rgba(255,255,255,0.5);
}
th.sort-asc::after {
  opacity: 1 !important;
  border-bottom: 5px solid #ffffff;
  border-top: none;
  margin-top: -2px;
}
th.sort-desc::after {
  opacity: 1 !important;
  border-top: 5px solid #ffffff;
  border-bottom: none;
  margin-top: 2px;
}
th.right, td.right { text-align: right; }
th.center, td.center { text-align: center; }
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s; cursor: pointer;
  animation: rowIn .4s ease both;
}
@keyframes rowIn {
  from { opacity:0; transform:translateY(6px); }
  to   { opacity:1; transform:none; }
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(91,110,245,.05); }
td {
  padding: 14px 16px; font-size: 13px;
  vertical-align: middle; white-space: nowrap;
}
.rank-cell {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--muted); width: 40px; text-align: center;
}
.coin-cell {
  display: flex; align-items: center; gap: 12px;
}
.coin-name {
  font-size: 13px; font-weight: 700; color: var(--text);
  margin-bottom: 2px;
}
.coin-sym {
  font-size: 11px; color: var(--muted);
  font-family: var(--font-mono); text-transform: uppercase;
}
.pair-link {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--accent); text-decoration: none;
  font-weight: 600; font-size: 13px;
  font-family: var(--font-mono);
  transition: color .2s;
}
.pair-link:hover { color: #fff; }
.pair-ext { font-size: 11px; opacity: .6; }
.num {
  font-family: var(--font-mono);
  font-weight: 600; color: var(--text);
}
.positive { color: var(--green); font-weight: 700; }
.negative { color: var(--red); font-weight: 700; }
.vol-wrap {
  display: flex; flex-direction: column;
  align-items: flex-end; gap: 4px;
}
.vol-bar-bg {
  width: 80px; height: 3px;
  background: var(--border2); border-radius: 2px;
  overflow: hidden;
}
.vol-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 2px;
  transition: width .4s ease;
}

/* ── Pagination ───────────────────────────────────────────────────────── */
.pagination-wrap {
  display: flex; align-items: center;
  justify-content: space-between;
  gap: 12px; margin-top: 28px;
  flex-wrap: wrap; padding: 0 4px;
}
.pagination-info {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--muted); white-space: nowrap;
}
.pagination { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.page-btn {
  min-width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--surface); color: var(--text);
  font-size: 13px; font-family: var(--font-mono);
  cursor: pointer; transition: all .2s;
  display: grid; place-items: center; padding: 0 10px;
}
.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.page-btn:disabled { opacity: .35; cursor: not-allowed; }
.page-ellipsis {
  padding: 0 4px; color: var(--muted);
  font-family: var(--font-mono); font-size: 14px; line-height: 36px;
}
.pagination-right { display: flex; align-items: center; gap: 12px; }
.pagination-jump {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted); font-family: var(--font-mono);
}
.pagination-jump input {
  width: 60px; height: 36px; border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--surface); color: var(--text);
  font-size: 12px; font-family: var(--font-mono);
  text-align: center; outline: none; transition: border-color .2s;
  -moz-appearance: textfield;
}
.pagination-jump input::-webkit-outer-spin-button,
.pagination-jump input::-webkit-inner-spin-button { -webkit-appearance: none; }
.pagination-jump input:focus { border-color: var(--accent); }
.rows-select-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 8px; padding: 0 4px 0 12px;
  height: 36px; flex-shrink: 0;
}
.rows-label { font-size: 13px; color: var(--muted); white-space: nowrap; }
.rows-select-wrap select {
  border: none; background: transparent;
  color: var(--text); font-size: 13px;
  font-family: var(--font-sans); font-weight: 600;
  padding: 0 8px; height: 100%; outline: none; cursor: pointer;
}


/* ── About Tab ── enhanced layout ────────────────────────────────────────── */
.about-heading {
  font-size: 20px; font-weight: 800; color: var(--text);
  letter-spacing: -0.3px; margin-bottom: 20px;
}
.about-content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.about-what-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
}
.about-what-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  margin-bottom: 14px;
}
.about-what-body {
  font-size: 13px; line-height: 1.8;
  color: var(--muted); margin-bottom: 20px;
}
.about-info-list {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--border);
}
.about-info-row {
  display: flex; align-items: center;
  justify-content: space-between;
  gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.about-info-row:last-child { border-bottom: none; }
.about-info-label { color: var(--muted); flex-shrink: 0; }
.about-info-value { color: var(--text); text-align: right; }
.about-info-link {
  color: var(--accent) !important; text-decoration: none;
  transition: opacity .2s;
}
.about-info-link:hover { opacity: .8; }
.about-info-code {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--border); border-radius: 6px;
  padding: 3px 10px; font-family: var(--font-mono); font-size: 12px;
}
.about-copy-btn {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 14px; padding: 0; line-height: 1;
  transition: color .2s;
}
.about-copy-btn:hover { color: var(--text); }
@media (max-width: 768px) {
  .about-content-grid { grid-template-columns: 1fr; }
}

/* ── About Tab ────────────────────────────────────────────────────────── */
.about-grid {
  display: flex; flex-wrap: wrap; gap: 16px;
  margin-bottom: 24px;
}
.about-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 24px;
  min-width: 180px; flex: 1;
}
.about-card-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-family: var(--font-mono);
  margin-bottom: 8px;
}
.about-card-value {
  font-size: 16px; font-weight: 700;
  color: var(--text);
}
.about-desc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  font-size: 14px; line-height: 1.8;
  color: var(--muted); font-family: var(--font-sans);
}
.about-desc p { margin: 0; }


/* ── Statistics Tab Charts ───────────────────────────────────────────────── */
.stats-heading {
  font-size: 20px; font-weight: 800; color: var(--text);
  letter-spacing: -0.3px; margin-bottom: 20px;
}
.stats-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.stats-chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
}
.stats-chart-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  margin-bottom: 24px;
}
.stats-chart-inner {
  display: flex;
  align-items: center;
  gap: 28px;
}
.stats-chart-inner canvas {
  flex-shrink: 0;
  width: 180px !important;
  height: 180px !important;
}
.stats-chart-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.stats-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.stats-legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.stats-legend-label {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.stats-legend-pct {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-left: auto;
  padding-left: 8px;
}
@media (max-width: 768px) {
  .stats-charts-grid { grid-template-columns: 1fr; }
  .stats-chart-inner { flex-direction: column; align-items: flex-start; }
  .stats-chart-inner canvas { width: 160px !important; height: 160px !important; }
}

/* ── Statistics Tab ───────────────────────────────────────────────────── */
.stats-detailed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

/* ── Error Banner ─────────────────────────────────────────────────────── */
.error-banner {
  background: rgba(255,77,109,.1);
  border: 1px solid rgba(255,77,109,.3);
  border-radius: var(--radius); padding: 18px 24px;
  margin: 20px 0; display: flex; align-items: flex-start; gap: 12px;
}
.error-title { font-weight: 700; color: var(--red); margin-bottom: 4px; }
.error-msg { font-size: 13px; color: var(--muted); font-family: var(--font-mono); }

/* ── Footer ───────────────────────────────────────────────────────────── */
.site-footer {
  margin-top: 48px; padding: 28px 0 40px;
  border-top: 1px solid var(--border);
}
.footer-copyright {
  font-size: 13px; color: var(--text);
  font-family: var(--font-mono); margin-bottom: 20px;
}
.footer-disclaimer {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px;
}
.disclaimer-title {
  font-size: 12px; font-weight: 700; color: var(--text);
  font-family: var(--font-mono); letter-spacing: .06em; margin-bottom: 10px;
}
.footer-disclaimer p {
  font-size: 12px; line-height: 1.75;
  color: var(--muted); font-family: var(--font-mono);
}

/* ── Back to Top ──────────────────────────────────────────────────────── */
#backToTop {
  text-decoration: none;
  position: fixed; right: 24px; bottom: 32px; z-index: 999;
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border2); color: var(--text);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; transition: border-color .2s, background .2s;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
#backToTop:hover { background: var(--accent); border-color: var(--accent); }
#backToTop .btt-line {
  width: 14px; height: 2px;
  background: currentColor; border-radius: 2px; margin-bottom: 2px;
}
#backToTop svg {
  width: 14px; height: 14px; fill: none;
  stroke: currentColor; stroke-width: 2.2;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .wrapper { padding: 0 12px 40px; }
  .market-ticker-bar { padding: 0 12px; }
  header { flex-wrap: wrap; padding: 14px 0 16px; gap: 10px; }
  .logo { flex: 1; }
  .header-right { order: 2; margin-left: auto; }
  .header-nav { order: 3; width: 100%; justify-content: center; }
  .header-nav .nav-item { flex: 1; justify-content: center; }

  /* Hero: stack vertically, compact spacing */
  .exchange-hero { flex-direction: column; gap: 12px; padding: 16px 0 12px; }
  .hero-left { gap: 12px; }
  .hero-logo { width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0; }
  .hero-name { font-size: 20px; margin-bottom: 4px; }

  /* hero-right: row layout on mobile — tabs left, button right */
  .hero-right {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
    gap: 10px;
  }
  .market-type-tabs { flex: 1; min-width: 0; }
  .mtype-btn { padding: 6px 10px; font-size: 12px; }
  .btn-trading {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 13px;
    white-space: nowrap;
  }

  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-vol-value { font-size: 18px; }
  .stat-vol-sub { font-size: 11px; }

  .about-grid { flex-direction: column; }
  .detail-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .dtab { padding: 10px 16px; font-size: 13px; }
  .markets-header { flex-direction: column; align-items: flex-start; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 900px; }
  .pagination-wrap { flex-direction: column; align-items: center; }
  .pagination-right { flex-wrap: wrap; justify-content: center; }
}
@media (max-width: 480px) {
  /* On very small screens, stack tabs and button vertically */
  .hero-right { flex-direction: column; align-items: flex-start; }
  .market-type-tabs { width: 100%; }
  .mtype-btn { flex: 1; text-align: center; }
  .btn-trading { width: 100%; justify-content: center; }
  .stats-grid { grid-template-columns: 1fr; }
}