/* ============ Design tokens ============ */
:root {
  --bg: #ffffff;
  --bg-alt: #f8fafd;
  --surface: #ffffff;
  --row-hover: #f7f9fc;
  --border: #eff2f5;
  --text: #0d1421;
  --text-dim: #616e85;
  --text-faint: #a1a7bb;
  --brand: #3861fb;
  --brand-soft: #eaf0ff;
  --up: #16c784;
  --down: #ea3943;
  --star: #f6b900;
  --shadow: 0 2px 10px rgba(13, 20, 33, .06);
  --radius: 12px;
  --header-h: 64px;
  --page-max: 1680px;   /* max content width; raise for wider, lower for tighter */
  font-synthesis: none;
}

:root[data-theme="dark"] {
  --bg: #0d1421;
  --bg-alt: #0b111d;
  --surface: #111827;
  --row-hover: #17203100;
  --row-hover: #172031;
  --border: #222a3d;
  --text: #eaecef;
  --text-dim: #a7b1c2;
  --text-faint: #6b7488;
  --brand: #6a8bff;
  --brand-soft: #1a2440;
  --shadow: 0 2px 14px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; overflow-x: clip; }  /* clip = no sideways scroll, keeps sticky working */

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: -0.1px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background .25s ease, color .25s ease;
}

a { color: inherit; text-decoration: none; }

/* ============ Header ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(6px);
}
.topbar__inner {
  max-width: var(--page-max);
  margin: 0 auto;
  height: var(--header-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 22px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 18px; letter-spacing: -.5px; }
.brand__logo { display: inline-flex; }
.brand__logo svg { display: block; border-radius: 8px; box-shadow: 0 2px 8px rgba(56, 97, 251, .35); }
.brand__name span { color: var(--brand); }

.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav__link {
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
  color: var(--text-dim);
  transition: background .15s, color .15s;
}
.nav__link:hover { background: var(--bg-alt); color: var(--text); }
.nav__link.is-active { color: var(--text); }

.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.search {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 10px;
  width: 300px;
  max-width: 42vw;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search__icon { width: 18px; height: 18px; color: var(--text-faint); flex: none; }
.search input {
  border: 0;
  background: transparent;
  outline: none;
  color: var(--text);
  padding: 10px 8px;
  width: 100%;
  font-size: 14px;
}
.search input::placeholder { color: var(--text-faint); }
.search__kbd {
  font: inherit;
  font-size: 12px;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 7px;
  background: var(--surface);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-alt);
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.icon-btn:hover { border-color: var(--brand); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }

/* Hamburger — hidden on desktop, shown on mobile */
.hamburger { display: none; }

/* ============ Mobile slide-down menu ============ */
.mobile-menu {
  display: none;
  flex-direction: column;
  padding: 8px 20px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.mobile-menu.is-open { display: flex; }
.mobile-menu__link {
  padding: 13px 6px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.mobile-menu__link.is-active { color: var(--brand); }
.mobile-menu__actions { display: flex; gap: 10px; margin-top: 14px; }
.mobile-menu__actions .btn { flex: 1; padding: 11px; font-size: 14px; }

.btn--ghost { background: var(--bg-alt); color: var(--text); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand); }

/* ============ Utility bar ============ */
.utilbar {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.utilbar__inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 7px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.ticker {
  display: flex;
  align-items: center;
  color: var(--text-dim);
  overflow: hidden;
  flex: 1 1 auto;
  min-width: 0;
}
.ticker__track { display: flex; }
.ticker__group { display: flex; align-items: center; gap: 20px; padding-right: 20px; flex: none; white-space: nowrap; }
.ticker__dup { display: none; }        /* second copy only shown for the mobile marquee */
.ticker__item { white-space: nowrap; }
@keyframes tickerMove { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.ticker__item b { color: var(--text); font-weight: 700; }
.ticker__item .fg { color: #f6b900; }

.utilbar__account { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.selectish { color: var(--text-dim); font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 3px; }
.selectish span { font-size: 9px; }
.ghost-link { color: var(--text); font-weight: 600; }
.ghost-link:hover { color: var(--brand); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; border-radius: 8px; cursor: pointer; border: 1px solid transparent;
  transition: filter .15s, background .15s, border-color .15s;
}
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { filter: brightness(1.08); }
.btn--sm { padding: 6px 14px; font-size: 12.5px; }

/* ============ Market metrics strip (gauges + news) ============ */
.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.6fr;
  gap: 16px;
  margin: 22px 0 16px;
}
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.metric-card__head { display: flex; align-items: center; justify-content: space-between; }
.metric-card__head h3 { font-size: 13.5px; margin: 0; color: var(--text); font-weight: 600; }
.metric-card__more {
  color: var(--text-faint); font-weight: 700; font: inherit; font-weight: 700;
  background: none; border: 0; cursor: pointer; line-height: 1;
  padding: 2px 6px; border-radius: 6px; transition: color .15s, background .15s;
}
.metric-card__more:hover { color: var(--brand); background: var(--bg-alt); }

/* "What is this?" explainer body inside the modal */
.md-info { color: var(--text-dim); line-height: 1.65; font-size: 14.5px; }
.md-info p { margin: 0 0 12px; }
.md-info b { color: var(--text); }
.md-info ul { margin: 0 0 12px; padding-left: 20px; }
.md-info li { margin-bottom: 5px; }
.md-info .md-note { font-size: 13px; color: var(--text-faint); border-left: 3px solid var(--border); padding-left: 12px; margin-top: 14px; }
.metric-card__value { font-size: 26px; font-weight: 800; letter-spacing: -.5px; margin: 6px 0 14px; }
.metric-card__value small { font-size: 15px; color: var(--text-faint); font-weight: 600; margin-left: 2px; }

.gauge { position: relative; height: 8px; margin-bottom: 8px; }
.gauge__track { position: absolute; inset: 0; border-radius: 999px; }
.gauge__track--alt { background: linear-gradient(90deg, #f7931a 0%, #f5c76e 32%, #9db0ff 62%, #3861fb 100%); }
.gauge__track--rsi { background: linear-gradient(90deg, #16c784 0%, #c9a94b 50%, #ea3943 100%); }
.gauge__dot {
  position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 3px solid var(--brand);
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
  transition: left .6s cubic-bezier(.4,1.2,.5,1);
}
.gauge__labels { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-dim); font-weight: 500; }
.gauge__labels span:nth-child(2) { color: var(--text); font-weight: 700; }

/* News card */
.metric-card--news { display: flex; flex-direction: column; }
.news__head { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.news__avatar { width: 22px; height: 22px; flex: none; display: inline-flex; }
.news__avatar svg { display: block; border-radius: 7px; }
.news__source { font-weight: 700; font-size: 13px; }
.news__badge { width: 15px; height: 15px; flex: none; }
.news__time { color: var(--text-faint); font-size: 12px; }
.news__text {
  margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text);
  transition: opacity .3s ease;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  height: 4.5em;   /* FIXED (3 lines) → container never resizes when the slide changes */
}
.news__text.is-fading { opacity: 0; }
.news__dots { display: flex; gap: 5px; margin-top: auto; padding-top: 10px; }
.news__dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--border); transition: background .2s, width .2s; }
.news__dots i.on { background: var(--brand); width: 16px; border-radius: 3px; }

/* ============ Highlights cards ============ */
.highlights {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 24px 0 28px;
}
.hl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.hl-card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.hl-card__head h2 { font-size: 15px; margin: 0; letter-spacing: -.2px; display: flex; align-items: center; gap: 7px; }
.hl-ico { width: 18px; height: 18px; flex: none; }
.hl-card__head a { font-size: 12.5px; color: var(--brand); font-weight: 600; }
.hl-list { list-style: none; margin: 0; padding: 0; }
.hl-row {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 0; border-top: 1px solid var(--border); cursor: pointer;
}
.hl-row:first-child { border-top: 0; }
.hl-row:hover .hl-row__name { color: var(--brand); }
.hl-row__logo { width: 28px; height: 28px; border-radius: 50%; flex: none; background: var(--bg-alt); }
/* left: name over symbol — gets all the remaining width so names aren't crushed */
.hl-row__id { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.hl-row__name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hl-row__sym { color: var(--text-faint); font-weight: 600; font-size: 11px; text-transform: uppercase; }
/* right: price over % change, compact */
.hl-row__vals { flex: none; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; white-space: nowrap; }
.hl-row__price { font-weight: 700; font-variant-numeric: tabular-nums; }
.hl-row__vals .pct { font-size: 12px; }

/* ============ Layout ============ */
.wrap { max-width: var(--page-max); margin: 0 auto; padding: 24px 20px 28px; }
.page-head { margin-bottom: 16px; }
.page-head h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.5px; }
.page-head__meta { margin: 0; color: var(--text-dim); }

.table-scroll { overflow-x: auto; padding-bottom: 2px; }

/* ============ Table ============ */
.coins {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}
.coins thead th {
  position: sticky;
  top: 0; /* sticky relative to the overflow-x scroll container, not the viewport */
  background: var(--surface);
  z-index: 5;
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.coins thead th.col-star,
.coins thead th.col-rank { text-align: center; cursor: default; }
.coins thead th.col-name,
.coins thead th.col-spark { text-align: left; }
.coins thead th[data-sort]:hover { color: var(--text); }
.coins thead th.sorted::after { content: " ↓"; color: var(--brand); }
.coins thead th.sorted.asc::after { content: " ↑"; }

/* Header info (i) icon */
.hdr-i {
  display: inline-flex;
  width: 13px; height: 13px;
  vertical-align: -2px;
  margin-left: 2px;
  color: var(--text-faint);
  cursor: help;
  transition: color .15s;
}
.hdr-i::before {
  content: "";
  width: 100%; height: 100%;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='7' fill='none' stroke='%23000' stroke-width='1.3'/%3E%3Ccircle cx='8' cy='5.1' r='1' fill='%23000'/%3E%3Cpath d='M8 7.2v4.1' stroke='%23000' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='7' fill='none' stroke='%23000' stroke-width='1.3'/%3E%3Ccircle cx='8' cy='5.1' r='1' fill='%23000'/%3E%3Cpath d='M8 7.2v4.1' stroke='%23000' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat;
}
.hdr-i:hover { color: var(--brand); }

/* Portal tooltip (appended to body so it never gets clipped) */
.tip {
  position: fixed;
  z-index: 200;
  max-width: 230px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 11px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: normal;
  text-transform: none;
  text-align: left;
  white-space: normal;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .22);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .14s, transform .14s;
}
.tip.show { opacity: 1; transform: translateY(0); }
.tip[hidden] { display: none; }

.coins tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.coins tbody tr:hover { background: var(--row-hover); }
.coins td {
  padding: 16px 12px;
  text-align: right;
  white-space: nowrap;
  vertical-align: middle;
}
.col-star, .col-rank { text-align: center !important; }
.col-name { text-align: left !important; }
.col-spark { text-align: left !important; }

.star {
  border: 0; background: none; cursor: pointer;
  color: var(--text-faint); font-size: 16px; line-height: 1;
  transition: color .15s, transform .15s;
}
.star:hover { transform: scale(1.2); }
.star.is-on { color: var(--star); }

.rank { color: var(--text-dim); font-variant-numeric: tabular-nums; }

.coin { display: flex; align-items: center; gap: 12px; }
.coin__logo {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--bg-alt); flex: none; object-fit: cover;
}
.coin__meta { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.coin__name { font-weight: 700; letter-spacing: -.2px; }
.coin__sym { color: var(--text-faint); font-weight: 600; font-size: 12px; text-transform: uppercase; }

.num { font-variant-numeric: tabular-nums; font-weight: 600; }

/* Live price flash on refresh */
@keyframes flashUp {
  0% { background: rgba(22, 199, 132, .22); color: var(--up); }
  100% { background: transparent; }
}
@keyframes flashDown {
  0% { background: rgba(234, 57, 67, .22); color: var(--down); }
  100% { background: transparent; }
}
.flash-up { animation: flashUp 1.1s ease-out; border-radius: 6px; }
.flash-down { animation: flashDown 1.1s ease-out; border-radius: 6px; }
.pct { font-variant-numeric: tabular-nums; font-weight: 600; }
.pct.up { color: var(--up); }
.pct.down { color: var(--down); }
.pct .arrow { font-size: 9px; }

.spark { width: 140px; height: 40px; display: block; }

/* ============ States ============ */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}
.empty__emoji { font-size: 34px; display: block; margin-bottom: 8px; }

.skeleton .sk {
  display: inline-block;
  height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, var(--border) 25%, var(--bg-alt) 37%, var(--border) 63%);
  background-size: 400% 100%;
  animation: sk 1.2s ease-in-out infinite;
}
.skeleton .sk--logo { width: 30px; height: 30px; border-radius: 50%; }
.skeleton .sk--wide { width: 90px; }
.skeleton .sk--mid { width: 60px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.banner {
  margin: 12px 0 16px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.banner__retry {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: filter .15s;
}
.banner__retry:hover { filter: brightness(1.08); }

/* ============ Clickable row ============ */
.coins tbody tr { cursor: pointer; }

/* ============ Modal ============ */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(13, 20, 33, .55);
  backdrop-filter: blur(3px);
  animation: fade .18s ease;
}
.modal__panel {
  position: relative;
  width: min(680px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
  padding: 26px;
  animation: pop .2s cubic-bezier(.2, .8, .3, 1);
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.modal__close {
  position: absolute; top: 16px; right: 16px;
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--bg-alt);
  color: var(--text-dim); cursor: pointer; font-size: 15px;
  transition: color .15s, border-color .15s;
}
.modal__close:hover { color: var(--text); border-color: var(--brand); }

.md-head { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; padding-right: 40px; }
.md-head img { width: 46px; height: 46px; border-radius: 50%; background: var(--bg-alt); }
.md-head__name { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.md-head__sym { color: var(--text-faint); font-weight: 700; font-size: 13px; text-transform: uppercase; }
.md-rank { margin-left: auto; align-self: flex-start; flex: none; white-space: nowrap; font-size: 12px; font-weight: 700; color: var(--text-dim); background: var(--bg-alt); border: 1px solid var(--border); padding: 4px 10px; border-radius: 999px; }

.md-price { display: flex; align-items: baseline; gap: 12px; margin: 14px 0 20px; }
.md-price__val { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }

.md-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.md-cell { background: var(--bg-alt); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.md-cell__label { color: var(--text-dim); font-size: 12px; font-weight: 600; margin-bottom: 3px; }
.md-cell__val { font-weight: 700; font-variant-numeric: tabular-nums; }

.md-section { margin-bottom: 20px; }
.md-section h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-dim); margin: 0 0 10px; }

.addr {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
}
.addr__chain { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--brand); background: var(--brand-soft); padding: 3px 8px; border-radius: 6px; flex: none; }
.addr__val { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.addr__copy { border: 0; background: var(--surface); border: 1px solid var(--border); color: var(--text-dim); border-radius: 7px; padding: 5px 9px; cursor: pointer; font-size: 12px; flex: none; transition: color .15s, border-color .15s; }
.addr__copy:hover { color: var(--text); border-color: var(--brand); }
.addr__copy.copied { color: var(--up); border-color: var(--up); }

.md-desc { color: var(--text-dim); line-height: 1.6; font-size: 13.5px; }
.md-desc a { color: var(--brand); }

.md-links { display: flex; flex-wrap: wrap; gap: 8px; }
.md-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px; color: var(--text); background: var(--bg-alt); border: 1px solid var(--border); padding: 7px 12px; border-radius: 999px; transition: border-color .15s, color .15s; }
.md-link:hover { border-color: var(--brand); color: var(--brand); }

.md-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.md-tag { font-size: 11.5px; font-weight: 600; color: var(--text-dim); background: var(--bg-alt); border: 1px solid var(--border); padding: 4px 10px; border-radius: 999px; }

.md-loading { text-align: center; padding: 40px 0; color: var(--text-dim); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--brand); border-radius: 50%; margin: 0 auto 12px; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Auth modal ============ */
.auth { width: min(420px, 100%); padding: 30px; }
.auth__title { font-size: 22px; margin: 0 0 4px; letter-spacing: -.4px; }
.auth__sub { color: var(--text-dim); margin: 0 0 22px; font-size: 14px; }
.auth form label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin: 14px 0 6px; }
.auth form input {
  width: 100%; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); padding: 12px 14px; font-size: 15px; font-family: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.auth form input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.auth__submit { width: 100%; padding: 12px; font-size: 15px; margin-top: 20px; }
.auth__msg { min-height: 18px; margin: 12px 0 0; font-size: 13px; font-weight: 600; color: var(--down); }
.auth__msg.ok { color: var(--up); }
.auth__switch { text-align: center; color: var(--text-dim); font-size: 13.5px; margin: 18px 0 0; }
.auth__switch a { color: var(--brand); font-weight: 600; }

/* ============ Logged-in account chip ============ */
.account-chip { display: flex; align-items: center; gap: 8px; }
.account-chip__badge {
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px;
  color: #fff; background: linear-gradient(135deg, #f7931a, #e8590c); padding: 2px 7px; border-radius: 5px;
}
.account-chip__email { font-weight: 600; color: var(--text); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-chip__logout { color: var(--text-dim); font-weight: 600; cursor: pointer; }
.account-chip__logout:hover { color: var(--down); }

/* ============ In-modal admin address editor ============ */
.admin-edit {
  margin: 10px 0 4px; border: 1px dashed var(--brand); border-radius: 12px;
  padding: 14px; background: var(--brand-soft);
}
.admin-edit__head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 12.5px; color: var(--brand); margin-bottom: 10px; }
.admin-edit__head::before { content: "🛡"; }
.admin-edit__row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; }
.admin-edit input {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text);
  padding: 9px 11px; font-size: 13px; font-family: inherit; outline: none; min-width: 0;
}
.admin-edit input:focus { border-color: var(--brand); }
.admin-edit__save { background: var(--brand); color: #fff; border: 0; border-radius: 8px; font-weight: 700; padding: 0 14px; cursor: pointer; }
.admin-edit__save:hover { filter: brightness(1.08); }
.admin-edit__msg { font-size: 12px; font-weight: 600; margin: 8px 0 0; min-height: 15px; }
.admin-edit__del { margin-left: 6px; color: var(--down); font-size: 11px; font-weight: 700; cursor: pointer; text-transform: uppercase; }
@media (max-width: 520px) { .admin-edit__row { grid-template-columns: 1fr; } }

@media (max-width: 520px) {
  .modal__panel { padding: 20px; }
  /* keep two columns on phones so the modal stays short */
  .md-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .md-cell { padding: 10px 12px; }
  .md-cell__val { font-size: 13.5px; }

  /* show the FULL contract address: badge + copy on top, address wraps below */
  .addr { flex-wrap: wrap; row-gap: 8px; }
  .addr__copy { margin-left: auto; }
  .addr__val {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-all;
    flex: 1 1 100%;
    order: 3;
    font-size: 13px;
    line-height: 1.5;
  }
}

/* ============ Currency switcher ============ */
.utilbar__right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.curr { position: relative; }
.curr .selectish { background: none; border: 0; font: inherit; padding: 0; }
.curr__menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); padding: 6px; min-width: 130px;
}
.curr__menu[hidden] { display: none; }
.curr__opt {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: none; border: 0; color: var(--text); font: inherit; font-weight: 600;
  padding: 8px 10px; border-radius: 7px; cursor: pointer;
}
.curr__opt b { color: var(--text-dim); width: 14px; }
.curr__opt:hover { background: var(--bg-alt); }
.curr__opt.is-on { color: var(--brand); }
.curr__opt.is-on b { color: var(--brand); }

/* ============ Native selects — one professional, consistent look ============ */
select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8f9a' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
  border: 1px solid var(--border); border-radius: 9px;
  color: var(--text); font: inherit; font-weight: 600; font-size: 13.5px;
  padding: 8px 32px 8px 12px; cursor: pointer; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
select:hover { border-color: var(--text-faint); }
select:focus-visible { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(56,97,251,.18); }
select option { color: var(--text); background: var(--surface); }

/* ============ Filter chips ============ */
.filters {
  display: flex; gap: 8px; margin: 0 0 14px; overflow-x: auto;
  -webkit-overflow-scrolling: touch; padding-bottom: 6px;
}
/* CMC-style: keep a slim, always-visible horizontal scrollbar so it's clear
   these controls scroll sideways (rather than hiding it entirely). */
.thin-x, .filters, .table-scroll { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.thin-x::-webkit-scrollbar, .filters::-webkit-scrollbar, .table-scroll::-webkit-scrollbar { height: 8px; }
.thin-x::-webkit-scrollbar-track, .filters::-webkit-scrollbar-track, .table-scroll::-webkit-scrollbar-track { background: transparent; }
.thin-x::-webkit-scrollbar-thumb, .filters::-webkit-scrollbar-thumb, .table-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
.thin-x::-webkit-scrollbar-thumb:hover, .filters::-webkit-scrollbar-thumb:hover, .table-scroll::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit; font-weight: 700; font-size: 13.5px; color: var(--text-dim);
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 16px; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { color: var(--text); border-color: var(--text-faint); }
.chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip__ico { font-size: 12px; }

/* ============ Pagination ============ */
.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  flex-wrap: wrap; margin: 18px 2px 0;
}
.pager[hidden] { display: none; }
.pager__pages { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pg {
  min-width: 36px; height: 36px; padding: 0 8px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 700; font-size: 13.5px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.pg:hover:not(:disabled):not(.is-active) { border-color: var(--brand); }
.pg.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pg:disabled { opacity: .4; cursor: not-allowed; }
.pg--dots { border: 0; background: none; color: var(--text-faint); cursor: default; }
.pager__per { display: flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 13px; font-weight: 600; }

/* ============ Modal 7-day chart + watchlist star ============ */
.md-chart { position: relative; margin: 0 0 20px; }
.md-chart__svg { width: 100%; height: 88px; display: block; }
.md-chart__tag {
  position: absolute; top: 0; left: 0; font-size: 11px; font-weight: 700;
  color: var(--text-faint); background: var(--bg-alt); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 6px;
}
.md-fav {
  border: 0; background: none; cursor: pointer; color: var(--star); font-size: 22px; line-height: 1;
  align-self: flex-start; margin-left: auto; transition: transform .15s;
}
.md-fav:not(.is-on) { color: var(--text-faint); }
.md-fav:hover { transform: scale(1.15); }
.md-head .md-rank { margin-left: 10px; }

@media (max-width: 560px) {
  .pager { justify-content: center; }
  .pager__per { width: 100%; justify-content: center; }
  .pg { min-width: 34px; height: 34px; }
}

/* ============ SPA views ============ */
.view[hidden] { display: none !important; }
.view-loading { display: grid; place-items: center; padding: 50px 0; color: var(--text-dim); }

/* ---- Coin modal chart with range tabs ---- */
.md-ranges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.md-range {
  flex: none; font: inherit; font-weight: 700; font-size: 12.5px; color: var(--text-dim);
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; cursor: pointer;
}
.md-range:hover { color: var(--text); }
.md-range.is-on { background: var(--brand); border-color: var(--brand); color: #fff; }
.md-chart__area { position: relative; min-height: 120px; }
.md-chart__change { font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.md-chart__change.up { color: var(--up); }
.md-chart__change.down { color: var(--down); }
.md-chart__wrap { position: relative; height: 240px; }
.md-chart__svg2 { width: 100%; height: 100%; display: block; }
.md-chart__ylabels { position: absolute; inset: 0; pointer-events: none; }
.md-chart__y { position: absolute; left: 0; transform: translateY(-50%); font-size: 11px; color: var(--text-faint); background: var(--surface); padding: 0 5px; }
.md-chart__xlabels { position: relative; height: 16px; margin-top: 6px; }
.md-chart__x { position: absolute; font-size: 11px; color: var(--text-faint); white-space: nowrap; }
.md-chart__loading, .md-chart__empty { height: 200px; display: grid; place-items: center; color: var(--text-dim); }
.md-chart__wrap { cursor: crosshair; touch-action: pan-y; }
.md-cross-line { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--text-faint); opacity: .5; display: none; pointer-events: none; }
.md-cross-dot { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); border: 2px solid var(--surface); transform: translate(-50%, -50%); box-shadow: 0 0 0 1px var(--brand); display: none; pointer-events: none; }
.md-cross-tip {
  position: absolute; top: 0; z-index: 5; display: none; pointer-events: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 9px; font-size: 12.5px; font-weight: 700; white-space: nowrap; box-shadow: var(--shadow);
}
.md-cross-tip span { display: block; color: var(--text-dim); font-weight: 500; font-size: 11px; }

/* ---- Exchanges ---- */
.trust { font-weight: 700; font-variant-numeric: tabular-nums; }
.trust.up { color: var(--up); }
.trust.down { color: var(--down); }
.ex-visit { color: var(--brand); font-weight: 600; white-space: nowrap; }

/* ---- NFT grid ---- */
.nft-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.nft-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.nft-card__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.nft-card__img { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; background: var(--bg-alt); flex: none; }
.nft-card__name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nft-card__rows { display: grid; gap: 9px; }
.nft-card__rows > div { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.nft-card__rows span { color: var(--text-dim); }
.nft-card__rows b { font-variant-numeric: tabular-nums; }

/* ---- Portfolio ---- */
.pf-summary { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; box-shadow: var(--shadow); }
.pf-summary__label { color: var(--text-dim); font-size: 13px; font-weight: 600; }
.pf-summary__val { font-size: 30px; font-weight: 800; letter-spacing: -.6px; margin: 4px 0 6px; font-variant-numeric: tabular-nums; }
.pf-summary__pl { font-weight: 700; color: var(--text-dim); }
.pf-summary__pl.up { color: var(--up); }
.pf-summary__pl.down { color: var(--down); }
.pf-add { display: grid; grid-template-columns: 1.5fr 1fr 1fr auto; gap: 10px; }
.pf-add input { background: var(--bg-alt); border: 1px solid var(--border); border-radius: 9px; color: var(--text); padding: 11px 12px; font: inherit; font-size: 14px; outline: none; min-width: 0; }
.pf-add input:focus { border-color: var(--brand); }
.pf-add .btn { padding: 0 18px; }
.pf-add .pick { align-self: stretch; }
.pf-add .pick__btn { height: 100%; background: var(--bg-alt); }
.pf-msg { min-height: 16px; font-size: 13px; font-weight: 600; margin: 6px 0 14px; }
.pf-del { border: 1px solid var(--border); background: var(--bg-alt); color: var(--text-dim); border-radius: 7px; width: 28px; height: 28px; cursor: pointer; }
.pf-del:hover { color: var(--down); border-color: var(--down); }
.pf-gate, .pf-hint { text-align: center; color: var(--text-dim); padding: 44px 20px; }
.pf-gate .empty__emoji { font-size: 34px; display: block; margin-bottom: 10px; }

/* ---- Products ---- */
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.product-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); display: block; transition: border-color .15s, transform .15s; }
.product-card:hover { border-color: var(--brand); transform: translateY(-3px); }
.product-card__ico { font-size: 28px; }
.product-card h3 { margin: 12px 0 6px; font-size: 16px; }
.product-card p { margin: 0; color: var(--text-dim); font-size: 13.5px; line-height: 1.5; }

/* ---- Filters (CMC-style) ---- */
.filterbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.filterbar .filters { margin-bottom: 0; flex: 1 1 auto; }
.filter-btn {
  flex: none; display: inline-flex; align-items: center; gap: 7px; font: inherit; font-weight: 700; font-size: 13.5px;
  color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.filter-btn svg { width: 16px; height: 16px; }
.filter-btn:hover, .filter-btn.is-on { border-color: var(--brand); color: var(--brand); }
.filter-badge { background: var(--brand); color: #fff; font-size: 11px; font-weight: 800; border-radius: 999px; padding: 1px 7px; }
.filter-badge[hidden] { display: none; }

.filter-active { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filter-active:empty { display: none; }
.fa-chip {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 600; font-size: 12.5px; color: var(--brand);
  background: var(--brand-soft); border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; cursor: pointer;
}
.fa-chip--reset { color: var(--text-dim); background: var(--bg-alt); }
.fa-chip:hover { border-color: var(--brand); }

.filter-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.filter-panel[hidden] { display: none; }
.filter-panel__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.fp-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--text-dim); }
.fp-field--wide { grid-column: span 2; }
.fp-field input { background: var(--bg-alt); border: 1px solid var(--border); border-radius: 9px; color: var(--text); padding: 9px 11px; font: inherit; font-size: 14px; outline: none; }
.fp-field input:focus { border-color: var(--brand); }
.fp-field select { width: 100%; background-color: var(--bg-alt); padding: 9px 32px 9px 11px; font-size: 14px; }
.filter-panel__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.filter-panel__actions .btn { padding: 9px 18px; }

.nav__link { white-space: nowrap; }   /* multi-word items must never wrap in the header */

/* ---- Stocks & Bonds (RWA) ---- */
.rwa-top { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; margin-bottom: 22px; }
.rwa-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.rwa-card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--text-dim); margin: 0 0 12px; }
.rwa-total { font-size: 34px; font-weight: 800; letter-spacing: -.8px; }
.rwa-sub { color: var(--text-dim); font-size: 13.5px; margin-top: 4px; }
.rwa-bars { display: flex; gap: 3px; margin-top: 16px; height: 10px; }
.rwa-bar { min-width: 2px; }
.rwa-bar span { display: block; height: 100%; border-radius: 3px; }
.rwa-donut { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut { flex: none; }
.rwa-legend { list-style: none; margin: 0; padding: 0; flex: 1 1 160px; min-width: 0; }
.rwa-legend li { display: flex; align-items: center; gap: 9px; padding: 5px 0; font-size: 13.5px; }
.rwa-legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.rwa-legend__l { flex: 1 1 auto; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rwa-legend b { font-weight: 700; }

.page-head--tight { margin-top: 26px; }
.page-head--tight h2 { font-size: 19px; margin: 0 0 2px; }
.yield-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.yield-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.yield-card__label { font-size: 12.5px; color: var(--text-dim); font-weight: 600; }
.yield-card__val { font-size: 27px; font-weight: 800; letter-spacing: -.5px; margin: 6px 0 2px; }
.yield-card__val span { font-size: 16px; color: var(--text-faint); margin-left: 1px; }
.yield-card__chg { font-size: 12.5px; font-weight: 700; }
.yield-card__chg.up { color: var(--up); }
.yield-card__chg.down { color: var(--down); }

/* ---- Prediction markets ---- */
.pm-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.pm-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.pm-stat__n { display: block; font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.pm-stat__l { font-size: 12.5px; color: var(--text-dim); font-weight: 600; }
/* min(320px, 100%) keeps the track from forcing the grid wider than the screen */
.pm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 16px; }
.pm-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 0; }
.pm-card__head { display: flex; gap: 11px; align-items: flex-start; min-width: 0; }
.pm-card__ico { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; flex: none; background: var(--bg-alt); }
.pm-card__q { font-size: 14.5px; margin: 0; line-height: 1.4; font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.pm-tag { align-self: flex-start; margin-top: 9px; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; color: var(--brand); background: var(--brand-soft); padding: 3px 9px; border-radius: 6px; }
.pm-outcomes { list-style: none; margin: 13px 0 0; padding: 0; flex: 1 1 auto; }
.pm-outcomes li { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; min-width: 0; }
/* min-width:0 is what lets the ellipsis engage — without it a nowrap flex item
   keeps its full min-content width and pushes the whole card off-screen. */
.pm-o__l { flex: 1 1 40%; min-width: 0; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-o__bar { flex: 1 1 30%; min-width: 24px; height: 7px; background: var(--bg-alt); border-radius: 999px; overflow: hidden; }
.pm-o__bar i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.pm-o__p { flex: none; font-weight: 800; min-width: 38px; text-align: right; }
.pm-card__foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-faint); font-weight: 600; }
.pm-card__foot a { margin-left: auto; color: var(--brand); font-weight: 700; }

@media (max-width: 900px) {
  .rwa-top { grid-template-columns: 1fr; }
  .yield-grid, .pm-stats { grid-template-columns: repeat(2, 1fr); }
  .rwa-total { font-size: 27px; }
  .pm-grid { grid-template-columns: minmax(0, 1fr); }   /* minmax(0,…) so the track may shrink */
  .pm-card { padding: 14px; }
  .pm-card__foot { gap: 8px; font-size: 12px; }
}

/* ---- Dedicated coin page ---- */
.coinpage__back { display: inline-block; color: var(--text-dim); font-weight: 600; font-size: 13.5px; margin: 0 0 14px; }
.coinpage__back:hover { color: var(--brand); }
#view-coin .md-head__name { font-size: 30px; }
#view-coin .md-price__val { font-size: 38px; }
#view-coin .md-chart__svg { height: 320px; }
#view-coin .md-grid { grid-template-columns: repeat(4, 1fr); }
/* link from the popup through to the full page */
.md-full {
  display: block; margin: 2px 0 16px; font-weight: 700; font-size: 13.5px; color: var(--brand);
  background: var(--brand-soft); border: 1px solid var(--border); border-radius: 9px;
  padding: 10px 14px; text-align: center; transition: border-color .15s;
}
.md-full:hover { border-color: var(--brand); }

.cp-section { margin-top: 26px; }
.cp-section h2 { font-size: 19px; margin: 0 0 12px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.cp-count { font-size: 13px; font-weight: 600; color: var(--text-faint); }
.cp-markets th, .cp-markets td { white-space: nowrap; }
.cp-ex { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.cp-ex a { color: var(--text); }
.cp-ex a:hover { color: var(--brand); }
.cp-pair { color: var(--text-dim); font-weight: 600; }
.trust { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.trust.is-green { background: var(--up); }
.trust.is-yellow { background: #f5a623; }
.trust.is-red { background: var(--down); }
.trust.is-none { background: var(--border); }

@media (max-width: 900px) {
  #view-coin .md-grid { grid-template-columns: repeat(2, 1fr); }
  #view-coin .md-head__name { font-size: 22px; }
  #view-coin .md-price__val { font-size: 30px; }
  #view-coin .md-chart__svg { height: 220px; }
}

/* ---- Categories ---- */
.cat-row { cursor: pointer; }
.cat-coins { display: flex; gap: 4px; }
.cat-coin { width: 22px; height: 22px; border-radius: 50%; background: var(--bg-alt); flex: none; }
.gauge__track--fng { background: linear-gradient(90deg, #ea3943 0%, #f6b900 50%, #16c784 100%); }

/* ---- Converter ---- */
/* ============ Searchable picker (logo + name + symbol) ============ */
.pick { position: relative; }
.pick__btn {
  width: 100%; display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font: inherit; font-weight: 600; font-size: 14.5px;
  padding: 11px 12px; cursor: pointer; text-align: left; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
.pick__btn:hover { border-color: var(--text-faint); }
.pick__btn[aria-expanded="true"] { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(56,97,251,.18); }
.pick__cur { display: flex; align-items: center; gap: 9px; flex: 1 1 auto; min-width: 0; }
.pick__cur img { width: 22px; height: 22px; border-radius: 50%; flex: none; background: var(--bg-alt); }
.pick__cur-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick__cur-l--ph { color: var(--text-faint); font-weight: 500; }
.pick__cur-s { color: var(--text-faint); font-size: 12.5px; font-weight: 700; text-transform: uppercase; flex: none; }
.pick__chev { width: 14px; height: 14px; flex: none; color: var(--text-faint); }
.pick__panel {
  position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 34px rgba(0,0,0,.22); padding: 8px; min-width: 240px;
}
.pick__panel[hidden] { display: none; }
.pick__search {
  width: 100%; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font: inherit; font-size: 14px; padding: 9px 11px; outline: none; margin-bottom: 6px;
}
.pick__search:focus { border-color: var(--brand); }
.pick__list { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow-y: auto; scrollbar-width: thin; }
.pick__opt {
  display: flex; align-items: center; gap: 9px; padding: 8px 9px; border-radius: 8px;
  cursor: pointer; font-size: 14px; min-width: 0;
}
.pick__opt:hover { background: var(--bg-alt); }
.pick__opt.is-on { background: var(--brand-soft); color: var(--brand); }
.pick__opt img { width: 22px; height: 22px; border-radius: 50%; flex: none; background: var(--bg-alt); }
.pick__badge {
  width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--bg-alt); color: var(--text-dim); font-size: 9px; font-weight: 800; text-transform: uppercase;
}
.pick__opt-l { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pick__opt-s { color: var(--text-faint); font-size: 12px; font-weight: 700; text-transform: uppercase; flex: none; }
.pick__none { padding: 14px 10px; color: var(--text-faint); font-size: 13.5px; text-align: center; }

/* ============ Converter (CoinGecko-style row of labelled fields) ============ */
.conv2 { display: grid; grid-template-columns: 1fr 1fr auto 1fr; gap: 14px; align-items: end; }
.conv2__field { min-width: 0; }
.conv2__label { display: block; font-size: 12.5px; font-weight: 700; color: var(--text-dim); margin-bottom: 6px; }
.conv2__amount {
  width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font: inherit; font-weight: 700; font-size: 15px; padding: 11px 12px; outline: none;
}
.conv2__amount:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(56,97,251,.18); }
.conv2__swap {
  width: 42px; height: 42px; border-radius: 50%; flex: none; margin-bottom: 1px;
  border: 1px solid var(--border); background: var(--bg-alt); color: var(--brand);
  font-size: 17px; cursor: pointer; transition: border-color .15s, transform .15s;
}
.conv2__swap:hover { border-color: var(--brand); transform: rotate(180deg); }
.conv2__out { font-size: 24px; font-weight: 800; letter-spacing: -.4px; margin: 22px 0 0; }
.conv2__out b { font-weight: 800; }
@media (max-width: 760px) {
  .conv2 { grid-template-columns: 1fr; }
  .conv2__swap { justify-self: center; transform: rotate(90deg); }
  .conv2__swap:hover { transform: rotate(270deg); }
  .conv2__out { font-size: 19px; }
}

.converter { max-width: 820px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
/* (old .conv-row / .conv-coin / #convTo select styles removed — the converter
   now uses .conv2 fields with the searchable .pick component) */
.conv-rate { color: var(--text-dim); font-size: 13px; margin: 6px 0 0; }

@media (max-width: 620px) {
  .filter-panel__grid { grid-template-columns: 1fr 1fr; }
  .filterbar { flex-wrap: wrap; }
  .filterbar .filters { order: 2; flex-basis: 100%; }
}

@media (max-width: 620px) {
  .pf-add { grid-template-columns: 1fr; }
  .pf-add .btn { padding: 12px; }
  .md-chart__wrap { height: 200px; }
  .ex-hide { display: none; }
}

/* ============ Footer ============ */
.site-foot {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  margin-top: 0;
}
.site-foot__top {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 44px 20px 32px;
  display: grid;
  grid-template-columns: 1.4fr 3fr;
  gap: 40px;
}
.foot-brand .brand { font-size: 18px; }
.foot-brand__tag { color: var(--text-dim); line-height: 1.6; margin: 14px 0 18px; max-width: 320px; }
.foot-social { display: flex; gap: 10px; }
.foot-social a {
  width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: 15px;
  transition: border-color .15s, color .15s, transform .15s;
}
.foot-social a:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-2px); }

.foot-cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.foot-col h4 { font-size: 13px; margin: 0 0 14px; letter-spacing: .2px; }
.foot-col a { display: block; color: var(--text-dim); padding: 6px 0; font-size: 13.5px; transition: color .15s; }
.foot-col a:hover { color: var(--brand); }

.site-foot__bottom {
  border-top: 1px solid var(--border);
}
.site-foot__bottom {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 20px;
}
.copyright { font-weight: 700; margin: 0 0 6px; }
.disclaimer { color: var(--text-dim); font-size: 12.5px; line-height: 1.6; margin: 0; max-width: 900px; }

@media (max-width: 860px) {
  .site-foot__top { grid-template-columns: 1fr; gap: 30px; }
  .foot-cols { grid-template-columns: repeat(2, 1fr); }
}

/* ============ Responsive ============ */

/* Tablet: highlights turn into a horizontal snap carousel (like CMC) */
/* Tablet: metrics + highlights become horizontal snap carousels */
@media (max-width: 1040px) {
  .metrics, .highlights {
    grid-template-columns: none;
    grid-auto-flow: column;
    align-items: start;          /* cards size to content, no stretched empty space */
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }
  .metrics::-webkit-scrollbar, .highlights::-webkit-scrollbar { height: 8px; }
  .metrics::-webkit-scrollbar-track, .highlights::-webkit-scrollbar-track { background: transparent; }
  .metrics::-webkit-scrollbar-thumb, .highlights::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
  .metric-card, .hl-card { scroll-snap-align: start; }
  .metrics { grid-auto-columns: minmax(270px, 60%); margin: 20px 0 14px; padding: 0 0 6px; }
  .highlights { grid-auto-columns: minmax(300px, 86%); margin: 8px 0 24px; padding: 0 0 8px; }
}

/* ≤900px (mobile-first): fit gauges two-up, put the coin LIST right under them,
   push the Trending/Gainers/Losers cards below the table */
@media (max-width: 900px) {
  #view-crypto:not([hidden]) { display: flex; flex-direction: column; }
  #view-crypto > * { min-width: 0; }   /* let flex children shrink, never overflow */
  #view-crypto .metrics      { order: 1; }
  #view-crypto .page-head    { order: 2; }
  #view-crypto .filterbar,
  #view-crypto .filter-active,
  #view-crypto .filter-panel { order: 3; }
  #view-crypto .table-scroll { order: 4; }
  #view-crypto .pager        { order: 5; }
  #view-crypto .highlights   { order: 6; }

  /* gauges side-by-side (fit, no cut-off), news spans the full width */
  .metrics {
    grid-template-columns: 1fr 1fr;
    grid-auto-flow: row;
    align-items: stretch;   /* both cards in a row share the taller one's height */
    overflow: visible;
    gap: 12px;
    margin: 14px 0 18px;
    padding: 0;
  }
  /* 2×2 grid: [Altcoin Season | RSI] then [Fear & Greed | News] — saves vertical space */
  .metric-card { scroll-snap-align: none; padding: 13px; }
  .metric-card__value { font-size: 21px; margin: 4px 0 12px; }
  .gauge__labels { font-size: 9.5px; }
  .metric-card--news .news__head { flex-wrap: nowrap; gap: 6px; min-width: 0; }
  .metric-card--news .news__source { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .metric-card--news .news__time { display: none; }   /* drop "· live" so the head stays on one line */
  /* 2 lines (not 3) so the news card is no taller than the Fear & Greed card beside it */
  .metric-card--news .news__text { font-size: 12px; -webkit-line-clamp: 2; height: 3em; flex: none; }
  .metric-card--news .news__dots { padding-top: 8px; }

  /* highlights carousel, now sitting below the table */
  .highlights { grid-auto-columns: minmax(280px, 88%); margin: 28px 0 8px; }
}

/* Below 900px: collapse nav into a hamburger, let the search flex-fill */
@media (max-width: 900px) {
  .nav { display: none; }
  .hamburger { display: grid; }
  .topbar__actions { flex: 1; justify-content: flex-end; }
  .search { flex: 1 1 auto; width: auto; max-width: none; }
  .search__kbd { display: none; }
  .utilbar__account { display: none; }
  /* ticker becomes a smooth auto-scrolling marquee so every stat is revealed */
  .ticker__dup { display: flex; }
  .ticker__track { animation: tickerMove 22s linear infinite; will-change: transform; }
  .ticker:hover .ticker__track, .ticker:active .ticker__track { animation-play-state: paused; }
}

/* ≤900px: rebuild the COIN/WATCHLIST rows as flex lines so Name/Price/24h
   CANNOT overflow. Scoped to .coins--rows so the exchanges/portfolio tables
   keep normal (horizontally-scrollable) table layout. */
@media (max-width: 900px) {
  .coins--rows { display: block; width: 100%; min-width: 0; }
  .coins--rows thead { display: none; }
  .coins--rows tbody { display: block; }

  .coins--rows tbody tr {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 0 2px;
  }
  .coins--rows td { display: block; padding: 14px 0; border: 0; white-space: nowrap; }

  /* hide everything except rank, name, price, 24h% */
  .coins--rows td:nth-child(1),   /* star      */
  .coins--rows td:nth-child(5),   /* 1h %      */
  .coins--rows td:nth-child(7),   /* 7d %      */
  .coins--rows td:nth-child(8),   /* market cap*/
  .coins--rows td:nth-child(9),   /* volume    */
  .coins--rows td:nth-child(10)   /* sparkline */
  { display: none; }

  .coins--rows td:nth-child(2) { flex: none; width: 20px; color: var(--text-dim); font-size: 13px; }
  .coins--rows td:nth-child(3) { flex: 1 1 auto; min-width: 0; }
  .coins--rows td:nth-child(4) { flex: none; margin-left: auto; text-align: right; }
  .coins--rows td:nth-child(6) { flex: none; width: 74px; text-align: right; }

  .coins--rows .coin { min-width: 0; }
  .coins--rows .coin__name { overflow: hidden; text-overflow: ellipsis; }
}

/* Phone fine-tuning */
@media (max-width: 560px) {
  .topbar__inner { gap: 12px; padding: 0 14px; }
  .utilbar__inner { padding: 7px 14px; }
  .wrap { padding: 16px 14px 24px; }
  .page-head { margin-bottom: 12px; }
  .page-head h1 { font-size: 19px; }
  .brand__name { display: none; }          /* keep just the gradient mark */
  .search input { font-size: 16px; }        /* stops iOS zoom-on-focus */
  .coin__logo { width: 26px; height: 26px; }
}

/* When a search is active, hide the widgets so results are front-and-center */
.wrap.is-searching .metrics,
.wrap.is-searching .highlights { display: none; }
