/* Codex markets — shared stylesheet for /coins/ pages */
:root {
  --bg: #0b0e11; --panel: #161a1e; --panel-2: #1b2127; --line: #2a3138;
  --muted: #9aa5b1; --text: #f3f7fb; --accent: #f7931a; --accent-2: #ffb347;
  --up: #2ebd85; --down: #f6465d;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); color: var(--text); color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
body { margin: 0; padding: 16px; display: flex; justify-content: center; background: var(--bg); color: var(--text); line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.up { color: var(--up); }
.down { color: var(--down); }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.wrap { width: 100%; max-width: 1200px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }

/* header, same look as the app */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px 12px; flex-wrap: wrap; }
.brand { font-size: 26px; font-weight: 800; letter-spacing: .5px; width: fit-content;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; order: 3; flex: 1 1 100%; }
.navbtn { padding: 9px 16px; font-weight: 700; font-size: 13px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.navbtn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.navbtn.active { background: var(--accent); color: #11161a; border-color: transparent; }
.tools { display: flex; gap: 8px; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; font-size: 12px; font-weight: 800; letter-spacing: .3px;
  color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; }
.iconbtn:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
@media (min-width: 900px) { .nav { order: 0; flex: 0 1 auto; margin-right: auto; margin-left: 18px; } }

.crumbs { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 6px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs span { color: var(--text); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; }
.card h1 { margin: 0 0 6px; font-size: 24px; line-height: 1.2; }
.card h2 { margin: 0 0 12px; font-size: 16.5px; line-height: 1.25; }
.card h3 { margin: 14px 0 4px; font-size: 14px; }
.lead { margin: 0 0 12px; color: #cdd6df; font-size: 14.5px; line-height: 1.6; }
.chead { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.chead h2 { margin: 0; }

.btn, .mini { display: inline-block; padding: 9px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font: inherit; font-weight: 700; font-size: 13px; line-height: 1.2; cursor: pointer; text-align: center; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.mini { padding: 6px 10px; font-size: 12px; }
.btn:hover, .mini:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn.big[aria-pressed="true"], .star.on { color: var(--accent); border-color: var(--accent); }
a.mini.scan { color: #11161a; border-color: transparent; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
a.mini.scan:hover { color: #11161a; filter: brightness(1.08); }

/* hero */
.hrow { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who > div { min-width: 0; }
.logo { width: 48px; height: 48px; border-radius: 50%; background: var(--panel-2); flex: none; object-fit: cover; }
.logo.ph, .lg.ph { display: inline-block; }
.sym { color: var(--muted); font-weight: 600; font-size: .75em; }
.sub { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.rankchip, .chip { display: inline-block; padding: 3px 9px; border: 1px solid var(--line); background: var(--panel-2); border-radius: 999px; font-size: 12px; color: var(--muted); }
.rankchip b { color: var(--text); }
.chip.dex { color: #8bb8ff; } .chip.cex { color: var(--accent-2); }
.acts { display: flex; gap: 8px; flex-wrap: wrap; }
.prow { display: flex; align-items: baseline; gap: 6px 14px; flex-wrap: wrap; margin-top: 14px; }
.price { font-size: 36px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.chg { font-size: 18px; font-weight: 800; }
.chg small { color: var(--muted); font-weight: 600; font-size: 12px; }
.status { font-size: 12px; color: var(--muted); }
.status.live { color: var(--up); }
.status.stale { color: var(--accent); }
.range { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.range b { color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.range span { min-width: 0; }
.bar { position: relative; flex: 1 1 60px; min-width: 40px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--down), var(--accent), var(--up)); }
.bar i { position: absolute; top: 50%; left: var(--p, 50%); width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--text); border: 2px solid var(--bg); }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.tile { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.tile > span { display: block; color: var(--muted); font-size: 12px; }
.tile b { display: block; font-size: 16px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.notice { margin: 0; padding: 12px 14px; border: 1px solid var(--accent); border-radius: 10px; background: rgba(247,147,26,.08); font-size: 14px; }

/* chart */
.chartbox { height: 440px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--bg); }
.chartbox iframe { display: block; width: 100%; height: 100%; border: 0; }
.bigspark { height: 180px; }
.bigspark svg { width: 100%; height: 100%; display: block; }
svg.spark path { fill: none; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
svg.spark.up path { stroke: var(--up); } svg.spark.down path { stroke: var(--down); }

/* two-column body on desktop, ordered single column on phones */
.cols { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 12px; align-items: start; margin-top: 12px; }
.colA, .colB { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
@media (max-width: 979px) {
  .cols { display: flex; flex-direction: column; align-items: stretch; }
  .colA, .colB { display: contents; }
  .o1 { order: 1; } .o2 { order: 2; } .o3 { order: 3; } .o4 { order: 4; } .o5 { order: 5; } .o6 { order: 6; } .o7 { order: 7; }
}
main#cx-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
main#cx-main > .cols { margin-top: 0; }

/* tables */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th.num { text-align: right; }
.tbl td { padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:first-child td { border-top: 0; }
.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
.kv th, .kv td { padding: 9px 0; border-top: 1px solid var(--line); vertical-align: top; }
.kv tr:first-child th, .kv tr:first-child td { border-top: 0; }
.kv th { text-align: left; font-weight: 600; color: var(--muted); width: 46%; padding-right: 10px; }
.kv td { text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.acol { text-align: right; white-space: nowrap; }
.acol .mini { margin-left: 4px; }
td.netname { white-space: nowrap; font-weight: 700; }
code.addr { display: block; font-size: 12.5px; word-break: break-all; background: var(--panel-2); padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); min-width: 130px; }
table.nets td { vertical-align: top; }
@media (max-width: 600px) {
  table.nets, table.nets tbody, table.nets tr, table.nets td { display: block; }
  table.nets thead { display: none; }
  table.nets tr { padding: 10px 0; border-top: 1px solid var(--line); }
  table.nets tbody tr:first-child { border-top: 0; }
  table.nets td { border: 0; padding: 3px 0; text-align: left; }
  table.nets td.acol { text-align: left; padding-top: 6px; }
  table.nets td.acol .mini { margin: 0 6px 6px 0; }
}
@media (max-width: 600px) {
  table.ex, table.ex tbody, table.ex tr, table.ex td { display: block; }
  table.ex thead { display: none; }
  table.ex tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "n n a" "p v a"; gap: 2px 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
  table.ex tbody tr:first-child { border-top: 0; }
  table.ex td { border: 0; padding: 0; }
  table.ex td:nth-child(1) { grid-area: n; min-width: 0; overflow-wrap: anywhere; }
  table.ex td:nth-child(2) { grid-area: p; color: var(--muted); font-size: 13px; }
  table.ex td:nth-child(3) { grid-area: v; text-align: left; font-size: 13px; }
  table.ex td:nth-child(4) { grid-area: a; }
}
i.ts { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 2px; vertical-align: middle; background: var(--muted); }
i.ts.green { background: var(--up); } i.ts.yellow { background: var(--accent); } i.ts.red { background: var(--down); }

.perf { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.perf div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.perf span:first-child { display: block; color: var(--muted); font-size: 12px; }
.perf .pv { font-weight: 800; font-size: 15px; }

.desc p { margin: 0 0 10px; line-height: 1.7; font-size: 14.5px; color: #dfe6ee; overflow-wrap: anywhere; }
.desc p:last-child { margin-bottom: 0; }
.faq h3:first-child { margin-top: 0; }
.faq p { margin: 0; color: #cdd6df; font-size: 14px; line-height: 1.6; }
.linkrow { display: flex; flex-wrap: wrap; gap: 8px; }

/* related */
.rel { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.relcard { display: grid; grid-template-columns: 28px minmax(0, 1fr); grid-template-areas: "i n" "i p"; column-gap: 10px; row-gap: 2px; align-items: center;
  padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; color: var(--text); min-width: 0; }
.relcard:hover { border-color: var(--accent); text-decoration: none; }
.relcard .lg { grid-area: i; }
.relcard .nm { grid-area: n; }
.relcard .rp { grid-area: p; display: flex; gap: 8px; font-size: 13px; font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.lg { width: 26px; height: 26px; border-radius: 50%; background: var(--panel); flex: none; }
.nm { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.nm b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nm small { color: var(--muted); font-size: 11.5px; }

/* list page */
.gbar { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.gbar b { color: var(--text); }
.gbar b.up { color: var(--up); } .gbar b.down { color: var(--down); }
.movers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 700px) { .movers { grid-template-columns: minmax(0, 1fr); } }
.mv { list-style: none; margin: 0; padding: 0; counter-reset: mv; }
.mv li { counter-increment: mv; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: baseline; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.mv li:first-child { border-top: 0; }
.mv li a { color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv li a small { color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.search, .sel { height: 40px; padding: 0 12px; font: inherit; font-size: 14px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; outline: none; }
.search { flex: 1 1 180px; min-width: 0; }
.search:focus, .sel:focus { border-color: var(--accent); }
.sel { max-width: 100%; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.tab { padding: 9px 12px; font: inherit; font-weight: 700; font-size: 13px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; touch-action: manipulation; }
.tab:hover { border-color: var(--accent); color: var(--accent); }
.tab.active { background: var(--accent); color: #11161a; border-color: transparent; }
.tab .n { opacity: .75; }
table.mk th button { all: unset; cursor: pointer; color: inherit; font: inherit; padding: 2px 0; }
table.mk th button:hover { color: var(--accent); }
table.mk th[aria-sort="ascending"] button::after { content: " ▲"; font-size: 9px; }
table.mk th[aria-sort="descending"] button::after { content: " ▼"; font-size: 9px; }
table.mk td { padding: 8px 8px; }
table.mk td.c-name a { display: flex; align-items: center; gap: 10px; color: var(--text); min-width: 0; }
table.mk td.c-name a:hover { text-decoration: none; }
table.mk td.c-name a:hover b { color: var(--accent); }
table.mk td.c-name .nm { min-width: 0; }
table.mk td.c-name .nm small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-rank { color: var(--muted); }
.c-star { padding-left: 0 !important; padding-right: 0 !important; }
.star { all: unset; cursor: pointer; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; color: var(--muted); border-radius: 8px; }
.star:hover { color: var(--accent); }
.star:focus-visible, .tab:focus-visible, .btn:focus-visible, .mini:focus-visible, a:focus-visible, table.mk th button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.c-spark { padding-right: 0 !important; }
.c-spark svg { display: block; width: 100px; height: 32px; }

/* fixed column grid: nothing jumps when live prices change width, the name column takes the rest and truncates */
table.mk { table-layout: fixed; }
table.mk th.c-star { width: 40px; }
table.mk th[data-col="rank"] { width: 48px; }
table.mk th[data-col="price"] { width: 118px; }
table.mk th[data-col="c1h"], table.mk th[data-col="c7d"], table.mk th[data-col="c24h"] { width: 84px; }
table.mk th[data-col="mcap"], table.mk th[data-col="vol"] { width: 126px; }
table.mk th.c-spark { width: 124px; }
@media (max-width: 899px) {
  .hide-md { display: none; }
  table.mk th.c-star { width: 36px; }
  table.mk th[data-col="rank"] { width: 44px; }
  table.mk th[data-col="price"] { width: 108px; }
  table.mk th[data-col="c1h"], table.mk th[data-col="c7d"], table.mk th[data-col="c24h"] { width: 72px; }
  table.mk th[data-col="mcap"] { width: 112px; }
}
@media (max-width: 700px) {
  .hide-sm { display: none; }
  table.mk th.c-star { width: 34px; }
  table.mk th[data-col="rank"] { width: 40px; }
  table.mk th[data-col="price"] { width: 104px; }
  table.mk th[data-col="c24h"] { width: 76px; }
  table.mk th[data-col="mcap"] { width: 108px; }
}
@media (max-width: 560px) {
  .hide-xs { display: none; }
  table.mk th, table.mk td { padding-left: 4px; padding-right: 4px; }
  table.mk th.c-star, table.mk td.c-star { width: 28px; padding-left: 0 !important; padding-right: 0 !important; }
  table.mk th[data-col="rank"] { width: 28px; padding-left: 0; padding-right: 2px; }
  table.mk td.c-rank { padding-left: 0; padding-right: 2px; font-size: 12px; }
  table.mk th[data-col="price"] { width: 90px; }
  table.mk th[data-col="c24h"] { width: 68px; }
  table.mk td.c-name a { gap: 7px; }
  table.mk td.c-name .lg { width: 22px; height: 22px; }
  table.mk td.c-name .nm b { font-size: 13.5px; }
  table.mk td.c-price, table.mk td.num { font-size: 13px; }
  .star { width: 28px; }
}
@media (max-width: 360px) {
  table.mk th.c-star, table.mk td.c-star { width: 26px; }
  table.mk th[data-col="rank"] { width: 24px; }
  table.mk th[data-col="price"] { width: 84px; }
  table.mk th[data-col="c24h"] { width: 60px; }
  table.mk td.c-name a { gap: 6px; }
  table.mk td.c-name .lg { width: 20px; height: 20px; }
  table.mk td.c-price, table.mk td.num { font-size: 12.5px; }
}
@media (max-width: 340px) { table.mk td.c-name .lg { display: none; } }

.foot { border-top: 1px solid var(--line); padding: 14px 0 6px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.foot p { margin: 0; }
.foot a { color: var(--muted); text-decoration: underline; }
.foot a:hover { color: var(--accent); }

@keyframes cxup { from { background: rgba(46,189,133,.4); } to { background: transparent; } }
@keyframes cxdown { from { background: rgba(246,70,93,.4); } to { background: transparent; } }
.flash-up { animation: cxup 1.2s ease-out; border-radius: 4px; }
.flash-down { animation: cxdown 1.2s ease-out; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { .flash-up, .flash-down { animation: none; } }

@media (max-width: 600px) {
  body { padding: 10px 10px calc(14px + env(safe-area-inset-bottom)); }
  .wrap { gap: 8px; }
  .brand { font-size: 22px; }
  .nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .navbtn { padding: 8px 4px; font-size: 12px; text-align: center; white-space: nowrap; }
  .navbtn:last-child { grid-column: 1 / -1; white-space: normal; }
  .wrap > .movers { order: 10; } .wrap > .faqcard { order: 11; } .wrap > .foot { order: 12; }
  .card { padding: 12px; }
  .card h1 { font-size: 20px; }
  .price { font-size: 28px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .perf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chartbox { height: 340px; }
  .acts { width: 100%; }
  .acts .btn { flex: 1 1 auto; }
  .kv th { width: 50%; }
  .range .bar { order: 3; flex: 1 1 100%; }
}
@media (max-width: 360px) { .price { font-size: 25px; } .range { gap: 6px; font-size: 11px; } }
