/* ── 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 Stats Bar ─────────────────────────────────────────────────── */
.market-stats-bar {
  background: rgba(17, 20, 32, 0.95);
  border-bottom: 1px solid var(--border);
  padding: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.market-stats-inner {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  white-space: nowrap;
  padding: 0 32px;
}
.market-stats-inner::-webkit-scrollbar { display: none; }
.market-stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px 10px 0;
  color: var(--muted);
  border-right: 1px solid var(--border);
  margin-right: 20px;
  flex-shrink: 0;
}
.market-stat-item:last-child { border-right: none; margin-right: 0; }
.market-stat-label { color: var(--muted); }
.market-stat-value { color: var(--text); font-weight: 600; }
.market-stat-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
}
.market-stat-change.up { color: var(--green); }
.market-stat-change.down { color: var(--red); }
.market-stat-change .arrow { font-size: 9px; }
.market-dominance { display: flex; align-items: center; gap: 8px; }
.dominance-label { color: var(--muted); }
.dominance-item { display: flex; align-items: center; gap: 4px; }
.dominance-coin { color: var(--text); font-weight: 700; }
.dominance-pct { color: var(--muted); }


/* ── 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-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; }
.live-time { color: var(--muted); font-size: 11px; font-family: var(--font-mono); }
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(1.4)} }
.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; }
.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; }

/* ── Page Header ──────────────────────────────────────────────────────── */
.page-header { padding: 8px 0 20px; }
.page-title { font-size: 22px; font-weight: 800; letter-spacing: -0.3px; margin-bottom: 10px; color: var(--text); }
.page-subtitle { font-size: 13px; color: var(--muted); line-height: 1.7; max-width: 860px; font-family: var(--font-mono); }
.page-subtitle strong { color: var(--text); font-weight: 700; }

/* ── Controls ─────────────────────────────────────────────────────────── */
.controls { display: flex; align-items: center; gap: 10px; padding: 0 0 20px; flex-wrap: wrap; }
.tab-strip { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 4px; gap: 2px; }
.tab-btn { display: flex; align-items: center; gap: 7px; padding: 8px 16px; border-radius: 7px; border: none; background: none; color: var(--muted); font-size: 13px; font-weight: 600; font-family: var(--font-sans); cursor: pointer; white-space: nowrap; transition: all .2s; }
.tab-btn.active { background: var(--accent); color: #fff; }
.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: 38px; 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; }

/* ── 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: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); text-align: left; white-space: nowrap; cursor: pointer; user-select: none; transition: color .2s; }
th:hover { color: var(--text); }
th.sorted { color: var(--text); }
th[data-sort] { position: relative; padding-right: 22px; }
th[data-sort]::after { content: ''; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 4px solid transparent; opacity: .2; }
th.sort-asc::after  { border-bottom-color: var(--text); margin-top: -2px; opacity: .8; }
th.sort-desc::after { border-top-color: var(--text); margin-top: 2px; opacity: .8; }
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; }
.exchange-cell { display: flex; align-items: center; gap: 12px; }
.exchange-logo { width: 32px; height: 32px; border-radius: 8px; object-fit: contain; background: var(--border); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--accent); overflow: hidden; }
.exchange-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
.exchange-name { font-weight: 700; font-size: 14px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.exchange-name:hover { color: var(--accent); }
.exchange-country { font-size: 11px; color: var(--muted); font-family: var(--font-mono); margin-top: 2px; }
.verified-badge { display: inline-flex; align-items: center; background: rgba(0,212,170,.12); border: 1px solid rgba(0,212,170,.3); border-radius: 4px; padding: 1px 6px; font-size: 10px; font-weight: 700; color: var(--green); letter-spacing: .04em; }
.trust-score { display: inline-flex; align-items: center; justify-content: center; min-width: 52px; padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; font-family: var(--font-mono); }
.trust-high   { background: rgba(0,212,170,.15);  color: #00d4aa; border: 1px solid rgba(0,212,170,.3); }
.trust-medium { background: rgba(245,200,66,.12);  color: #f5c842; border: 1px solid rgba(245,200,66,.3); }
.trust-low    { background: rgba(255,77,109,.12);  color: #ff4d6d; border: 1px solid rgba(255,77,109,.3); }
.trust-none   { background: rgba(107,114,128,.1);  color: var(--muted); border: 1px solid var(--border2); }
.volume-cell { font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--text); }
.spark-cell { width: 160px; padding-left: 12px; }
.spark-wrap { display: flex; align-items: center; height: 44px; }
.spark-wrap svg { display: block; overflow: visible; }
.visit-btn { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border2); border-radius: 6px; padding: 5px 12px; font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; transition: all .2s; font-family: var(--font-sans); }
.visit-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(91,110,245,.08); }

/* ── Country dropdown ─────────────────────────────────────────────────── */
.country-select { position: relative; flex-shrink: 0; }
.country-btn { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border2); border-radius: 8px; padding: 0 12px; height: 38px; font-size: 13px; font-weight: 600; color: var(--text); font-family: var(--font-sans); cursor: pointer; white-space: nowrap; transition: border-color .2s; }
.country-btn:hover { border-color: var(--accent); }
.country-chevron { width: 14px; height: 14px; color: var(--muted); flex-shrink: 0; transition: transform .2s; }
.country-dropdown { position: absolute; top: calc(100% + 6px); right: 0; z-index: 200; background: var(--surface); border: 1px solid var(--border2); border-radius: 12px; box-shadow: 0 16px 48px rgba(0,0,0,.6); width: 220px; max-height: 320px; overflow: hidden; display: none; flex-direction: column; }
.country-dropdown.open { display: flex; }
.country-search-wrap { padding: 10px 10px 6px; border-bottom: 1px solid var(--border); }
.country-search-input { width: 100%; background: var(--bg); border: 1px solid var(--border2); border-radius: 6px; color: var(--text); font-size: 12px; font-family: var(--font-mono); padding: 6px 10px; outline: none; }
.country-search-input:focus { border-color: var(--accent); }
.country-list { overflow-y: auto; padding: 4px 0; }
.country-list::-webkit-scrollbar { width: 4px; }
.country-list::-webkit-scrollbar-track { background: transparent; }
.country-list::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
.country-option { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; transition: background .15s; font-family: var(--font-sans); }
.country-option:hover { background: rgba(91,110,245,.08); }
.country-option.active { color: var(--green); }
.country-option .check { color: var(--green); font-size: 14px; }

/* ── Empty state ──────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); font-family: var(--font-mono); font-size: 14px; }
.empty-icon { font-size: 40px; margin-bottom: 16px; }

/* ── Pagination ───────────────────────────────────────────────────────── */
.pagination-right { display: flex; align-items: center; gap: 12px; }
.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-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); }

/* ── 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-icon { font-size: 20px; flex-shrink: 0; }
.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: 768px) {
  .wrapper { padding: 0 12px 40px; }
  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; }
  .page-title { font-size: 18px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { width: 700px; }
  .pagination-wrap { flex-direction: column; align-items: center; }
  td.col-visit { display: none; }
  .market-stats-inner { padding: 0 12px; }
  .market-stat-item { padding: 8px 14px 8px 0; margin-right: 14px; }
}

/* ── Stats bar scroll arrows (mobile only) ────────────────────────────── */
.market-stats-bar  { position: relative; }
.stats-arrow {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border2);
  background: rgba(17,20,32,.95);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background .2s, opacity .2s, border-color .2s;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.stats-arrow:hover { background: var(--accent); border-color: var(--accent); }
.stats-arrow-left  { left: 4px; }
.stats-arrow-right { right: 4px; }
.stats-arrow.hidden { opacity: 0; pointer-events: none; }

@media (max-width: 768px) {
  .stats-arrow { display: flex; }
  .market-stats-inner { padding: 0 36px; }
}
