:root {
  --bg: #f7f8fa; --panel: #ffffff; --text: #0f172a; --muted: #64748b; --line: #e5e7eb;
  --up: #16a34a; --down: #dc2626; --accent: #ea580c; --hover: #fff7ed; --star: #f59e0b;
}
:root[data-theme="dark"] {
  --bg: #0b0f17; --panel: #121826; --text: #e5e7eb; --muted: #8b95a7; --line: #1f2937;
  --up: #22c55e; --down: #ef4444; --accent: #fb923c; --hover: #1f1a17;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
button, select, input { font: inherit; color: inherit; }

.topbar { position: sticky; top: 0; z-index: 5; display: flex; gap: 16px; align-items: center;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.brand em { font-style: normal; background: linear-gradient(90deg, #f59e0b, #ea580c);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.global { flex: 1; color: var(--muted); font-size: 12.5px; display: flex; gap: 14px; flex-wrap: wrap; min-width: 0; }
.global b { color: var(--text); font-weight: 600; }
.controls { display: flex; gap: 8px; align-items: center; }
select, input[type=search] { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.icon-btn { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; cursor: pointer; }
.install { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 6px 12px; cursor: pointer; font-weight: 600; }

main { max-width: 1280px; margin: 0 auto; padding: 16px; }
.trending h2 { font-size: 15px; margin: 0 0 8px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.chip { display: flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 12px 5px 6px; white-space: nowrap; cursor: pointer; }
.chip img { width: 20px; height: 20px; border-radius: 50%; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 16px 0 10px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; }
.tab { background: none; border: 0; padding: 6px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tab.active { background: var(--panel); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
#search { width: 240px; max-width: 100%; }

.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-align: right; cursor: pointer; user-select: none;
  position: sticky; top: 0; background: var(--panel); }
th.left, td.left { text-align: left; }
th.star { cursor: default; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--hover); }
.coin { display: flex; align-items: center; gap: 10px; }
.coin img { width: 24px; height: 24px; border-radius: 50%; }
.coin .sym { color: var(--muted); text-transform: uppercase; font-size: 12px; }
.up { color: var(--up); } .down { color: var(--down); }
.starbtn { background: none; border: 0; cursor: pointer; font-size: 16px; color: var(--muted); padding: 0; }
.starbtn.on { color: var(--star); }
.status { text-align: center; color: var(--muted); padding: 20px; margin: 0; }
.status:empty { display: none; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 14px 0; }
.pager button { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.pager button:disabled { opacity: .4; cursor: default; }

dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border: 1px solid var(--line);
  border-radius: 14px; background: var(--panel); color: var(--text); padding: 18px; }
dialog::backdrop { background: rgba(0,0,0,.5); }
.detail-head { display: flex; justify-content: space-between; align-items: center; }
.d-title { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; }
.d-title img { width: 32px; height: 32px; }
.d-title .rank { font-size: 12px; background: var(--hover); padding: 2px 8px; border-radius: 6px; color: var(--muted); }
.d-price { font-size: 28px; font-weight: 700; margin: 8px 0; font-variant-numeric: tabular-nums; }
.d-price span { font-size: 15px; margin-left: 8px; }
.ranges { display: flex; gap: 4px; margin-bottom: 8px; }
.ranges button { background: none; border: 1px solid var(--line); border-radius: 6px; padding: 3px 10px; cursor: pointer; color: var(--muted); }
.ranges button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chart-box { position: relative; height: 280px; }
#chart { width: 100%; height: 100%; display: block; }
.tip { position: absolute; pointer-events: none; background: var(--text); color: var(--panel); font-size: 12px;
  padding: 4px 8px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -120%); }
.d-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 14px 0; }
.d-stats div { background: var(--hover); border-radius: 8px; padding: 8px 10px; }
.d-stats small { display: block; color: var(--muted); font-size: 11.5px; }
.d-desc { color: var(--muted); font-size: 13px; max-height: 140px; overflow: auto; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; }

@media (max-width: 900px) { .hide-md { display: none; } }
@media (max-width: 600px) {
  .hide-sm { display: none; }
  .global { order: 3; flex-basis: 100%; }
  #search { width: 100%; }
  th, td { padding: 10px 6px; }
}

/* ---------- polish (Oct 2026) ---------- */
/* Themed scrollbars: no bright white bars in dark mode */
:root { --scroll: #cbd5e1; }
:root[data-theme="dark"] { color-scheme: dark; --scroll: #334155; }
.chips, .table-wrap { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
.chips::-webkit-scrollbar, .table-wrap::-webkit-scrollbar { height: 8px; }
.chips::-webkit-scrollbar-track, .table-wrap::-webkit-scrollbar-track { background: transparent; }
.chips::-webkit-scrollbar-thumb, .table-wrap::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 999px; }

/* Long coin names truncate (full name on hover) so the table fits tablet widths */
.coin { min-width: 0; }
.coin img, .coin .sym { flex-shrink: 0; }
.coin b { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 601px) and (max-width: 1100px) {
  th, td { padding-left: 8px; padding-right: 8px; }
  .coin b { max-width: 140px; }
}
@media (min-width: 601px) and (max-width: 900px) { .coin b { max-width: 130px; } }

/* ---------- SEO content (Oct 2026) ---------- */
.intro { margin: 2px 0 14px; }
.intro h1 { font-size: 20px; margin: 0 0 4px; letter-spacing: -.01em; }
.intro p { margin: 0; color: var(--muted); font-size: 13.5px; max-width: 760px; }
.about { margin: 28px 0 8px; padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.about h2 { font-size: 16px; margin: 0 0 8px; }
.about h2 + p { margin: 0 0 18px; color: var(--muted); }
.about details { border-top: 1px solid var(--line); padding: 10px 0; }
.about summary { cursor: pointer; font-weight: 600; }
.about details p { margin: 8px 0 2px; color: var(--muted); }
footer small { opacity: .8; }

/* ---------- coin pages (Oct 2026) ---------- */
a.brand { color: inherit; text-decoration: none; }
.coin .coin-name { color: inherit; text-decoration: none; font-weight: 700; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coin .coin-name:hover { color: var(--accent); }
@media (min-width: 601px) and (max-width: 1100px) { .coin .coin-name { max-width: 140px; } }
@media (min-width: 601px) and (max-width: 900px) { .coin .coin-name { max-width: 130px; } }
.d-page { display: inline-block; margin-top: 12px; font-weight: 600; text-decoration: none; }
.crumbs { flex: 1; color: var(--muted); font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.cp { max-width: 960px; }
.cp-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.cp-head img { border-radius: 50%; }
.cp-head h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; }
.cp-head h1 .sym { color: var(--muted); font-size: 16px; font-weight: 600; }
.cp-rank { background: var(--hover); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 12px; color: var(--muted); }
.cp-price { font-size: 34px; font-weight: 800; margin: 12px 0 2px; font-variant-numeric: tabular-nums; }
.cp-price span { font-size: 16px; font-weight: 600; vertical-align: middle; }
.cp-price small { font-size: 13px; color: var(--muted); font-weight: 500; }
.cp-sub { color: var(--muted); margin: 0 0 16px; font-size: 13px; }
.cp-chart { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.cp-chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.cp-chart-head h2 { font-size: 15px; margin: 0; }
.cp-range { color: var(--muted); font-size: 12.5px; }
.cp-svg { display: block; width: 100%; height: 240px; }
.cp-svg .line { fill: none; stroke-width: 2; stroke-linejoin: round; }
.cp-svg .area { opacity: .12; }
.cp-svg.up .line { stroke: var(--up); } .cp-svg.up .area { fill: var(--up); }
.cp-svg.down .line { stroke: var(--down); } .cp-svg.down .area { fill: var(--down); }
.cp-live { display: inline-block; margin-top: 10px; font-weight: 600; text-decoration: none; }
.cp .about p { color: var(--muted); }
.cp-more { margin: 24px 0 8px; }
.cp-more h2 { font-size: 16px; margin: 0 0 10px; }
.cp-more .chips { flex-wrap: wrap; overflow: visible; }
a.chip { color: var(--text); text-decoration: none; }
a.chip .sym { color: var(--muted); font-size: 11px; }
a.chip:hover { border-color: var(--accent); }
@media (max-width: 600px) { .cp-head h1 { font-size: 21px; } .cp-price { font-size: 28px; } .cp-svg { height: 180px; } .crumbs { display: none; } }

.cp .d-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 600px) { .cp .d-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- info pages (Oct 2026) ---------- */
.legal { max-width: 760px; line-height: 1.6; }
.legal h1 { font-size: 26px; margin: 8px 0 2px; letter-spacing: -.02em; }
.legal h2 { font-size: 16px; margin: 24px 0 6px; }
.legal p, .legal li { color: var(--text); }
.legal ul { padding-left: 20px; }
.legal li { margin: 4px 0; }
footer a { color: var(--muted); }
footer a:hover { color: var(--accent); }

/* ---------- converter, movers, quick nav (Oct 2026) ---------- */
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 2px; }
.quick a { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; text-decoration: none; color: var(--text); font-weight: 600; font-size: 13px; }
.quick a:hover, .quick a.on { border-color: var(--accent); color: var(--accent); }
.cp-wide { max-width: 1100px; }
.cp-wide .table-wrap { margin-top: 12px; }
.conv { display: grid; gap: 8px; }
.conv-row { display: flex; align-items: stretch; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.conv-row:focus-within { border-color: var(--accent); }
.conv-lab, .conv-row select { display: flex; align-items: center; gap: 8px; padding: 0 12px; min-width: 120px; font-weight: 700; background: var(--hover); border: 0; border-right: 1px solid var(--line); border-radius: 0; }
.conv-lab img { border-radius: 50%; }
.conv-row input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 12px; font-size: 20px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; outline: none; }
.conv-swap { text-align: center; color: var(--muted); font-size: 18px; line-height: 1; }
.cp-conv { margin-top: 16px; }
.cp-conv .chips { flex-wrap: wrap; overflow: visible; margin-top: 12px; }
.conv-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.conv-tables td, .conv-tables th { padding: 9px 12px; }
.table-wrap td a { color: inherit; text-decoration: none; }
.table-wrap td a:hover { color: var(--accent); }
@media (max-width: 600px) { .conv-tables { grid-template-columns: 1fr; } .conv-lab, .conv-row select { min-width: 96px; } .conv-row input { font-size: 18px; } }
