/* TokenPick — dense market-data portal layout */
:root {
  color-scheme: light;
  --page: #eef2f7;
  --paper: #ffffff;
  --ink: #1a2433;
  --ink-2: #4a5568;
  --muted: #8592a6;
  --line: #d3dce8;
  --line-soft: #e6ecf3;
  --zebra: #f6f9fc;
  --hover: #fff7e0;
  --navy: #173a6a;
  --navy-2: #0f2b52;
  --nav-top: #2f74c8;
  --nav-bot: #12509f;
  --thead: #dfeaf7;
  --thead-ink: #23406b;
  --accent: #1f6fd1;
  --orange: #f08a00;
  --up: #d0262d;     /* price increase (red, CN market convention) */
  --down: #13894a;   /* price cut (green) */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--page); }
body { margin: 0; background: var(--page); color: var(--ink); font: 13px/1.45 var(--font); }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1240px; margin: 0 auto; padding-inline: 16px; }
.num, .tabnum { font-variant-numeric: tabular-nums; }

/* ---------- header ---------- */
.strip { background: var(--navy-2); color: #b9c8dd; font-size: 12px; }
.strip .wrap { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 30px; }
.strip a { color: #dbe6f5; }
.strip .sep { color: #4d6487; margin-inline: 6px; }
.switch { display: inline-flex; border: 1px solid #3c5579; border-radius: 3px; overflow: hidden; }
.switch button { border: 0; background: transparent; color: #b9c8dd; padding: 1px 9px; cursor: pointer; font-size: 12px; }
.switch button + button { border-left: 1px solid #3c5579; }
.switch button.on { background: var(--orange); color: #fff; font-weight: 600; }
.strip-right { display: flex; gap: 8px; align-items: center; }

.masthead { background: var(--paper); border-bottom: 1px solid var(--line); }
.masthead .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-block: 14px; }
.logo { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.logo:hover { text-decoration: none; }
.logo-mark { width: 40px; height: 40px; border-radius: 8px; background: linear-gradient(135deg, var(--nav-top), var(--navy)); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 17px; letter-spacing: -0.04em; }
.logo-text b { display: block; font-size: 24px; line-height: 1.05; letter-spacing: -0.02em; color: var(--navy); }
.logo-text b em { font-style: normal; color: var(--orange); }
.logo-text span { font-size: 12px; color: var(--ink-2); }
.ticker { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: var(--zebra); }
.ticker > div { padding: 6px 14px; border-left: 1px solid var(--line); }
.ticker > div:first-child { border-left: 0; }
.ticker .k { font-size: 11px; color: var(--muted); }
.ticker .v { font-size: 15px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }

.navbar { background: linear-gradient(var(--nav-top), var(--nav-bot)); border-bottom: 3px solid var(--orange); position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 6px rgba(15, 43, 82, 0.25); }
.navbar .wrap { display: flex; overflow-x: auto; }
.navbar button { flex: 1 0 auto; min-width: 100px; background: none; border: 0; border-right: 1px solid rgba(255,255,255,0.18); color: #fff; font-weight: 600; font-size: 14px; padding: 11px 14px; cursor: pointer; white-space: nowrap; }
.navbar button:first-child { border-left: 1px solid rgba(255,255,255,0.18); }
.navbar button:hover { background: rgba(255,255,255,0.12); }
.navbar button.on { background: var(--navy-2); box-shadow: inset 0 -3px 0 var(--orange); }

/* ---------- layout ---------- */
main.wrap { padding-block: 14px 24px; }
.portal { display: grid; grid-template-columns: 228px minmax(0, 1fr) 236px; gap: 12px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
@media (max-width: 1100px) {
  .portal { grid-template-columns: minmax(0, 1fr) 236px; }
  .portal > .col-left { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
}
@media (max-width: 760px) {
  .portal { grid-template-columns: minmax(0, 1fr); }
  .ticker { width: 100%; }
  .ticker > div { flex: 1; padding: 5px 8px; }
}

/* ---------- boxes (sidebar + panels) ---------- */
.box { background: var(--paper); border: 1px solid var(--line); }
.box-h { background: var(--navy); color: #fff; font-weight: 700; font-size: 13px; padding: 6px 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.box-h small { font-weight: 400; color: #c3d2e8; font-size: 11px; }
.box-b { padding: 8px 10px; }
.box.dark { background: var(--navy); color: #dfe8f5; border-color: var(--navy); }
.box.dark .box-h { background: var(--navy-2); color: #7fc0ff; font-size: 15px; letter-spacing: 0.02em; }
.newslist { list-style: none; margin: 0; padding: 4px 10px 8px; }
.newslist li { padding: 6px 0 6px 12px; position: relative; border-bottom: 1px dotted rgba(255,255,255,0.18); font-size: 12px; line-height: 1.5; }
.newslist li:last-child { border-bottom: 0; }
.newslist li::before { content: "›"; position: absolute; left: 0; color: var(--orange); font-weight: 700; }
.newslist .d { color: #8fb3e0; font-size: 11px; display: block; }
.newslist b { color: #fff; }
.kv { width: 100%; border-collapse: collapse; font-size: 12px; }
.kv td { padding: 4px 0; border-bottom: 1px dotted var(--line); }
.kv tr:last-child td { border-bottom: 0; }
.kv td:first-child { white-space: nowrap; padding-right: 10px; color: var(--ink-2); }
.kv td:last-child { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.rank-list { list-style: none; margin: 0; padding: 0; counter-reset: r; }
.rank-list li { display: grid; grid-template-columns: 18px 1fr auto; gap: 6px; padding: 5px 0; border-bottom: 1px dotted var(--line); font-size: 12px; align-items: baseline; counter-increment: r; }
.rank-list li:last-child { border-bottom: 0; }
.rank-list li::before { content: counter(r); color: #fff; background: var(--accent); border-radius: 2px; font-size: 10px; text-align: center; line-height: 16px; height: 16px; }
.rank-list li:nth-child(-n+3)::before { background: var(--orange); }
.rank-list .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.focus-name { font-size: 15px; font-weight: 700; color: var(--navy); margin-bottom: 2px; }
.focus-sub { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.more-link { display: block; text-align: right; font-size: 12px; padding-top: 6px; }
.note { color: var(--muted); font-size: 11px; margin: 6px 0 0; }

/* ---------- category strip ---------- */
.cats { display: flex; gap: 3px; flex-wrap: wrap; margin-bottom: 8px; }
.cats button { flex: 1 1 auto; border: 0; border-radius: 3px 3px 0 0; padding: 5px 12px; color: #fff; font-weight: 600; font-size: 12px; cursor: pointer; background: linear-gradient(#4f97e6, #2470c6); }
.cats button:hover { filter: brightness(1.08); }
.cats button.on { background: linear-gradient(#ff5a4f, #d0262d); }

/* ---------- price blocks ---------- */
.block { background: var(--paper); border: 1px solid var(--line); margin-bottom: 10px; }
.block-h { background: var(--navy); color: #fff; display: flex; align-items: center; gap: 8px; padding: 5px 8px; flex-wrap: wrap; }
.block-h .t { font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.block-h .more { background: var(--orange); color: #fff; font-size: 10px; font-weight: 700; padding: 0 6px; border-radius: 2px; line-height: 16px; cursor: pointer; border: 0; text-transform: uppercase; }
.block-h .upd { margin-left: auto; font-size: 11px; color: #c3d2e8; }
.block-h .upd b { color: #ffd27a; font-weight: 600; }
.region-flag { font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 2px; line-height: 16px; }
.region-flag.global { background: var(--series-1); }
.region-flag.china { background: var(--series-2); }
.notice { background: #fff4d6; color: #8a5a00; font-size: 12px; padding: 4px 8px; border-bottom: 1px solid #f1dca4; }

table.pt { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.pt th { background: var(--thead); color: var(--thead-ink); font-weight: 600; font-size: 11px; line-height: 1.25; padding: 4px 6px; border-left: 1px solid #fff; text-align: center; vertical-align: middle; }
.pt th:first-child { border-left: 0; text-align: left; }
.pt th.grp { background: #cbdcf0; border-bottom: 1px solid #fff; }
.pt th[data-sort] { cursor: pointer; user-select: none; }
.pt th[data-sort]:hover { color: var(--accent); }
.pt th.sorted::after { content: " ▼"; font-size: 9px; color: var(--accent); }
.pt th.sorted.asc::after { content: " ▲"; }
.pt td { padding: 5px 6px; border-top: 1px solid var(--line-soft); text-align: right; white-space: nowrap; }
.pt td.l { text-align: left; white-space: normal; }
.pt td.c { text-align: center; }
.pt tbody tr:nth-child(even) td { background: var(--zebra); }
.pt tbody tr:hover td { background: var(--hover); }
.pt .mname { display: flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 500; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.pt button.mname:hover { color: var(--accent); text-decoration: underline; }
.pt .mname::before { content: ""; width: 9px; height: 9px; flex: none; border-radius: 2px; background: var(--chip, var(--accent)); }
.pt .mid { display: block; color: var(--muted); font-size: 11px; padding-left: 15px; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.pt .tp { color: var(--ink-2); }
.pt .dim, .dim { color: var(--muted); }
.chg-up { color: var(--up); font-weight: 600; }
.chg-down { color: var(--down); font-weight: 600; }
.chg-flat { color: var(--muted); }
.chg-cell { line-height: 1.1; }
.chg-cell i { font-style: normal; display: block; font-size: 10px; }
.badge { display: inline-block; font-size: 10px; line-height: 15px; padding: 0 5px; border-radius: 2px; border: 1px solid var(--line); color: var(--ink-2); background: #fff; margin: 1px 2px 1px 0; white-space: nowrap; }
.badge.off { border-color: #9cc3ee; color: var(--accent); background: #eef5fd; }
.badge.tp3 { border-color: #e7c88f; color: #9a6400; background: #fff8ea; }
.badge.warn { border-color: #f2a7aa; color: var(--up); background: #fff1f1; }
.badge.free { border-color: #9ad5b3; color: var(--down); background: #eefaf3; }
.tier { color: var(--orange); cursor: help; font-size: 10px; margin-left: 1px; vertical-align: super; }
.block-f { display: flex; justify-content: space-between; font-size: 11px; padding: 4px 8px; background: var(--zebra); border-top: 1px solid var(--line-soft); color: var(--muted); }
.table-scroll { overflow-x: auto; }

/* ---------- toolbar (full table / calc) ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px; background: var(--zebra); border-bottom: 1px solid var(--line); }
.toolbar input[type=search], .toolbar select, .calc-grid input {
  background: #fff; border: 1px solid var(--line); border-radius: 3px; padding: 4px 8px; font-size: 12px;
}
.toolbar input[type=search] { flex: 1 1 200px; max-width: 280px; min-width: 0; }
.toolbar label { display: inline-flex; gap: 4px; align-items: center; color: var(--ink-2); font-size: 12px; cursor: pointer; }
.toolbar .count { margin-left: auto; color: var(--muted); font-size: 12px; }

/* ---------- calculator ---------- */
.calc-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 10px; border-bottom: 1px solid var(--line); }
.calc-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--ink-2); font-weight: 600; }
.calc-grid input { font-size: 14px; padding: 5px 8px; width: 100%; }
@media (max-width: 760px) { .calc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bar-cell { width: 40%; }
.bar { height: 10px; border-radius: 0 3px 3px 0; min-width: 2px; }
.bar.global { background: var(--series-1); }
.bar.china { background: var(--series-2); }
.summary { padding: 8px 10px; font-size: 12px; color: var(--ink-2); border-bottom: 1px solid var(--line-soft); }
.summary b { color: var(--ink); }

/* ---------- charts ---------- */
.chart-box { padding: 6px 10px 10px; overflow-x: auto; }
.chart-box svg { display: block; width: 100%; height: auto; }
.chart-box.big svg { min-width: 560px; }
.gridline { stroke: var(--line-soft); stroke-width: 1; }
.axis-label { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.axis-title { fill: var(--ink-2); font-size: 12px; }
.dotm { stroke: #fff; stroke-width: 2; }
.dotm.global { fill: var(--series-1); }
.dotm.china { fill: var(--series-2); }
.dotm.hot { stroke: var(--ink); }
.trend-line { fill: none; stroke: var(--series-1); stroke-width: 2; }
.trend-dot { fill: var(--series-1); stroke: #fff; stroke-width: 2; }
.crosshair { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 2 2; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); padding: 8px 10px 0; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.sw { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.sw.global { background: var(--series-1); }
.sw.china { background: var(--series-2); }

/* ---------- vendors ---------- */
.vendor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; padding: 10px; }
.vendor { border: 1px solid var(--line); cursor: pointer; background: #fff; }
.vendor:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(31, 111, 209, 0.15); }
.vendor .vh { background: var(--thead); color: var(--thead-ink); font-weight: 700; padding: 5px 8px; display: flex; justify-content: space-between; align-items: center; }
.vendor .vb { padding: 6px 8px; }

/* ---------- changes / about ---------- */
.empty { padding: 28px; text-align: center; color: var(--ink-2); }
.about { padding: 4px 16px 12px; max-width: 860px; font-size: 13px; }
.about h3 { font-size: 14px; color: var(--navy); border-left: 3px solid var(--orange); padding-left: 8px; margin: 16px 0 6px; }
.about li { margin-bottom: 3px; }

/* ---------- tooltip & footer ---------- */
.tip { position: fixed; z-index: 70; pointer-events: none; background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--navy); padding: 6px 9px; box-shadow: 0 4px 14px rgba(15, 43, 82, 0.18); font-size: 12px; max-width: 280px; }
.tip .t { font-weight: 700; margin-bottom: 3px; color: var(--navy); }
.tip .r { display: flex; justify-content: space-between; gap: 16px; color: var(--ink-2); }
.tip .r b { color: var(--ink); font-variant-numeric: tabular-nums; }
footer { background: var(--navy-2); color: #93a6c2; font-size: 12px; }
footer .wrap { padding-block: 16px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
footer a { color: #cfe0f6; }
footer .foot-links, footer .foot-legal { padding-block: 0 12px; display: block; line-height: 1.8; }
footer .foot-legal { color: #7d91ae; font-size: 11px; }

/* official pricing links + domestic CNY markers */
.block-h .pp-link { color: #ffd27a; font-size: 11px; border: 1px solid rgba(255, 210, 122, 0.5); border-radius: 2px; padding: 0 5px; line-height: 16px; }
.block-h .pp-link:hover { background: rgba(255, 210, 122, 0.15); text-decoration: none; }
.badge.cny { border-color: #f3b0a0; color: #c2410c; background: #fff3ee; }
.cnymark { font-size: 9px; color: #c2410c; vertical-align: super; margin-left: 1px; }
.badge.gone { border-color: #b8b8b8; color: #fff; background: #8a8f98; }
.pt tr:has(.badge.gone) td { color: var(--muted); }

/* ---------- price history modal ---------- */
body.modal-open { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(10, 25, 48, 0.55); display: flex; align-items: flex-start; justify-content: center; padding: max(24px, env(safe-area-inset-top, 0px)) 16px 24px; overflow-y: auto; }
.modal-card { background: var(--paper); width: min(760px, 100%); border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(10, 25, 48, 0.35); }
.modal-card .block-h { padding: 8px 10px; }
.modal-x { margin-left: auto; background: none; border: 0; color: #fff; font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; }
.hist-sub { font-size: 12px; color: var(--muted); padding: 6px 10px 0; }
#hist-body { padding: 0 10px 12px; }
#hist-body .note { font-size: 12px; }
.hist-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 8px; }
.hist-bar .legend { padding: 0; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.seg button { background: #fff; border: 0; padding: 3px 12px; cursor: pointer; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--navy); color: #fff; font-weight: 600; }
.ln { width: 18px; height: 0; border-top: 2px solid var(--series-1); display: inline-block; }
.ln.dashed { border-top-style: dashed; }
.hist-line { fill: none; stroke: var(--series-1); stroke-width: 2; }
.hist-line.dashed { stroke-dasharray: 5 4; }
.hist-dot { fill: var(--series-1); stroke: #fff; stroke-width: 2; }
.hist-dot.hollow { fill: #fff; stroke: var(--series-1); }
.hist-dot.hot { fill: var(--orange); }
.hist-tbl { max-height: 220px; overflow-y: auto; margin-top: 8px; border: 1px solid var(--line-soft); }
.hist-tbl .pt td:first-child { position: static; box-shadow: none; }

/* phones: stat cards in a 3-column grid, slimmer chrome, readable tables */
@media (max-width: 560px) {
  .strip .wrap > div:first-child { display: none; }
  .strip .wrap { justify-content: flex-end; }
  .masthead .wrap { padding-block: 10px; gap: 10px; }
  .logo-mark { width: 34px; height: 34px; font-size: 15px; }
  .logo-text b { font-size: 21px; }
  .ticker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ticker > div { border-left: 1px solid var(--line); border-top: 1px solid var(--line); min-width: 0; }
  .ticker > div:nth-child(-n+3) { border-top: 0; }
  .ticker > div:nth-child(3n+1) { border-left: 0; }
  .ticker > div:nth-child(5) { grid-column: span 2; }
  .ticker .k { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ticker .v { font-size: 14px; white-space: nowrap; }
  .navbar button { min-width: 0; font-size: 13px; padding: 10px 12px; }
  .pt { font-size: 12px; }
  .pt .mname { min-width: 8.5em; }
  .pt .mid { display: none; }
  /* keep the model name visible while price columns scroll sideways */
  .pt thead tr:first-child th:first-child, .pt tbody td:first-child { position: sticky; left: 0; z-index: 1; }
  .pt tbody td:first-child { background: var(--paper); box-shadow: 1px 0 0 var(--line); }
  .pt thead tr:first-child th:first-child { box-shadow: 1px 0 0 #fff; }
  .block-h .upd { margin-left: 0; width: 100%; }
  #chart svg { min-width: 820px !important; }  /* scroll the scatter sideways instead of shrinking its labels */
  #changes td:first-child { position: static; box-shadow: none; white-space: normal; width: 5.5em; }
  #changes td:last-child { white-space: nowrap; }
  #changes th:nth-child(3), #changes td:nth-child(3) { display: none; }
  #changes .table-scroll { overflow-x: visible; }
}
