:root {
  --bg: #0b0e11;
  --panel: #12161c;
  --panel2: #1a1f27;
  --border: #2a3140;
  --text: #eaecef;
  --muted: #848e9c;
  --green: #0ecb81;
  --red: #f6465d;
  --accent: #f0b90b;
  --blue: #3b82f6;
  --row-hover: #1c2330;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", "Noto Sans SC", "Segoe UI", system-ui, sans-serif;
  font-size: 13px;
  min-height: 100%;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  background: linear-gradient(180deg, #141a22, #0f1318);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: 0.02em; }
.logo { color: var(--accent); font-size: 18px; }
.badge {
  background: #2b2110; color: var(--accent);
  border: 1px solid #5c4a14; border-radius: 4px;
  padding: 2px 8px; font-size: 11px;
}
.meta { color: var(--muted); font-size: 12px; text-align: right; line-height: 1.45; }
.meta-vol {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end;
  margin-bottom: 6px; align-items: center;
}
.btc-vol-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(240, 185, 11, 0.12);
  color: var(--accent);
  border: 1px solid #5c4a14;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 500;
}
.btc-vol-badge b { color: #ffe08a; font-size: 14px; font-variant-numeric: tabular-nums; }
.btc-vol-range {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
}
.btc-vol-range b { color: var(--text); font-variant-numeric: tabular-nums; }

.live-price-badge {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--muted);
}
.live-price-badge.live {
  color: #8fd19a;
  border-color: #2f5d3a;
  background: rgba(60, 160, 90, 0.12);
}
.live-price-badge.poll {
  color: #e0b35a;
  border-color: #5c4a14;
  background: rgba(240, 185, 11, 0.08);
}
.live-price-badge.connecting,
.live-price-badge.hidden-tab {
  color: var(--muted);
}

/* Live price tick flash */
td.price-cell { transition: background-color 0.05s linear; }
@keyframes priceFlashUp {
  0% { background-color: rgba(14, 203, 129, 0.55); color: #0ecb81; }
  100% { background-color: transparent; }
}
@keyframes priceFlashDown {
  0% { background-color: rgba(246, 70, 93, 0.55); color: #f6465d; }
  100% { background-color: transparent; }
}
td.price-flash-up {
  animation: priceFlashUp 0.85s ease-out;
}
td.price-flash-down {
  animation: priceFlashDown 0.85s ease-out;
}


.tabs {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.tab {
  background: transparent; color: var(--muted);
  border: 1px solid transparent; border-radius: 6px;
  padding: 8px 16px; cursor: pointer; font-size: 13px;
}
.tab:hover { color: var(--text); background: var(--panel2); }
.tab.active {
  color: #111; background: var(--accent);
  border-color: var(--accent); font-weight: 600;
}
.search-wrap { margin-left: auto; }
#search {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 12px; width: 220px; outline: none;
}
#search:focus { border-color: var(--accent); }

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 140px);
  margin: 0;
}

/* Sticky left columns: # / ★ / 交易对 */
thead th.sticky-col {
  position: sticky;
  z-index: 5;
  background: var(--panel2);
  box-shadow: 2px 0 0 var(--border);
}
tbody td.sticky-col {
  position: sticky;
  z-index: 1;
  background: var(--bg);
  box-shadow: 2px 0 0 var(--border);
}
tbody tr:nth-child(even) td.sticky-col {
  background: #0d1117;
}
tbody tr:hover td.sticky-col {
  background: var(--row-hover);
}
thead th.sticky-col.sorted {
  color: var(--accent);
}
td.sticky-col.price-flash-up,
td.sticky-col.price-flash-down {
  z-index: 2;
}

table {
  width: 100%; border-collapse: collapse;
  min-width: 1200px;
}
thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--panel2);
  color: var(--muted);
  font-weight: 500; text-align: right;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; white-space: nowrap; user-select: none;
}
thead th:first-child, thead th:nth-child(2), thead th:nth-child(3), thead th:nth-child(4) { text-align: left; }
thead th:hover { color: var(--accent); }
thead th.sorted { color: var(--accent); }
thead th .arrow { margin-left: 4px; font-size: 10px; }
thead th.th-split {
  white-space: nowrap;
}
thead th.th-split .th-main,
thead th.th-split .th-pct {
  display: inline;
  cursor: pointer;
}
thead th.th-split .th-pct {
  margin-left: 2px;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid transparent;
}
thead th.th-split .th-pct:hover {
  color: var(--accent);
  border-color: var(--border);
  background: rgba(240, 185, 11, 0.08);
}
thead th.th-split .th-main.sorted,
thead th.th-split .th-pct.sorted {
  color: var(--accent);
}

tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid #1a2030;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
tbody td:first-child, tbody td:nth-child(2), tbody td:nth-child(3), tbody td:nth-child(4) { text-align: left; }
tbody tr:hover { background: var(--row-hover); }
tbody tr:nth-child(even) { background: rgba(255,255,255,0.015); }
tbody tr:nth-child(even):hover { background: var(--row-hover); }

.sym { font-weight: 600; color: var(--text); }
.name { color: var(--muted); max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.na { color: var(--muted); }
.loading { text-align: center !important; color: var(--muted); padding: 40px !important; }

.foot {
  padding: 8px 20px;
  color: var(--muted);
  font-size: 11px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

td.sym a {
  color: #f0b90b;
  text-decoration: none;
  font-weight: 600;
}
td.sym a:hover {
  text-decoration: underline;
  color: #ffd54f;
}

.row-count { margin-left: auto; color: #9aa4b2; font-size: 12px; white-space: nowrap; }
.filters {
  padding: 10px 16px 4px;
  border-bottom: 1px solid #1e2329;
  background: #0b0e11;
}
.filter-presets, .filter-checks { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.filter-label { color: #848e9c; font-size: 12px; }
.filter-presets button, .filter-grid .primary, .filter-presets .ghost {
  background: #1e2329; color: #eaecef; border: 1px solid #2b3139; border-radius: 6px;
  padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.filter-presets button:hover, .filter-grid .primary:hover { border-color: #f0b90b; color: #f0b90b; }
.filter-grid .primary { background: #f0b90b; color: #0b0e11; border-color: #f0b90b; font-weight: 600; }
.filter-presets .ghost { opacity: 0.85; }
.filter-checks label { color: #c0c6d0; font-size: 12px; display: flex; gap: 4px; align-items: center; }
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  align-items: end;
}
.filter-grid label { display: flex; flex-direction: column; gap: 4px; color: #848e9c; font-size: 11px; }
.filter-grid input {
  background: #12161c; border: 1px solid #2b3139; color: #eaecef;
  border-radius: 4px; padding: 4px 6px; width: 100%; box-sizing: border-box;
}
.filter-grid label { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px; }
.filter-grid label input { width: 72px; }
.filter-hint { color: #5e6673; font-size: 11px; margin: 8px 0 4px; }

.cols-btn {
  background: #1e2329; color: #eaecef; border: 1px solid #2b3139; border-radius: 6px;
  padding: 4px 12px; font-size: 12px; cursor: pointer; margin-left: 8px; white-space: nowrap;
}
.cols-btn:hover { border-color: #f0b90b; color: #f0b90b; }
.col-editor {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding-top: 72px;
}
.col-editor.hidden { display: none; }
.col-editor-inner {
  background: #12161c; border: 1px solid #2b3139; border-radius: 10px;
  width: min(720px, 92vw); max-height: 70vh; overflow: auto; padding: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
}
.col-editor-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.col-editor-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.col-editor-actions button {
  background: #1e2329; color: #eaecef; border: 1px solid #2b3139; border-radius: 6px;
  padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.col-editor-actions .primary { background: #f0b90b; color: #0b0e11; border-color: #f0b90b; font-weight: 600; }
.col-editor-list {
  display: flex; flex-direction: column; gap: 6px;
}
.col-vis-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  color: #c0c6d0; font-size: 13px;
  background: #0b0e11; border: 1px solid #1e2329; border-radius: 6px; padding: 8px 10px;
  min-height: 40px; user-select: none; transition: border-color 0.12s, opacity 0.12s, background 0.12s;
}
.col-vis-item.movable { cursor: grab; }
.col-vis-item.movable:active { cursor: grabbing; }
.col-vis-item.locked { opacity: 0.7; cursor: default; }
.col-vis-item.dragging {
  opacity: 0.45; background: #151a21; border-style: dashed;
}
.col-vis-item.drag-over {
  border-color: #f0b90b; border-top-width: 2px; box-shadow: inset 0 2px 0 #f0b90b;
}
.col-vis-item.drag-over-below {
  border-color: #f0b90b; border-bottom-width: 2px; box-shadow: inset 0 -2px 0 #f0b90b;
}
.col-vis-label {
  display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; cursor: pointer;
}
.col-vis-moves { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.col-drag-handle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 28px; color: #848e9c; font-size: 12px; letter-spacing: -2px;
  cursor: grab; border-radius: 4px; user-select: none;
}
.col-drag-handle:hover { color: #f0b90b; background: #1e2329; }
.col-vis-item.dragging .col-drag-handle { cursor: grabbing; }
.col-move-btn {
  background: #1e2329; color: #eaecef; border: 1px solid #2b3139; border-radius: 4px;
  min-width: 28px; height: 28px; padding: 0 6px; font-size: 12px; line-height: 1;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.col-move-btn.col-move-edge { font-size: 11px; font-weight: 600; }
.col-move-btn:hover:not(:disabled) { border-color: #f0b90b; color: #f0b90b; }
.col-move-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* generic hide */
.hidden { display: none !important; }
#search.hidden { display: none !important; }
.cols-btn.hidden { display: none !important; }

/* AI recommendations */
.ai-panel {
  padding: 16px 20px 28px;
  max-height: calc(100vh - 120px);
  overflow: auto;
}
.ai-wrap { max-width: 1100px; margin: 0 auto; }
.ai-intro {
  display: flex; flex-wrap: wrap; gap: 10px 24px;
  align-items: baseline;
  color: var(--muted); font-size: 12px;
  margin-bottom: 16px;
}
.ai-note { color: #6b7280; }
.ai-hotspots h2, .ai-list h2 {
  margin: 0 0 10px; font-size: 15px; font-weight: 600; color: var(--text);
}
.ai-hot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}
.ai-hot-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.ai-hot-card h3 {
  margin: 0 0 6px; font-size: 13px; color: var(--accent);
}
.ai-hot-card p {
  margin: 0; color: #b7bfc9; font-size: 12px; line-height: 1.45;
}
.ai-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}
.ai-card {
  background: linear-gradient(180deg, #151b24, #10151c);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.ai-card-head {
  display: flex; justify-content: space-between; gap: 10px; align-items: flex-start;
}
.ai-title { display: flex; flex-direction: column; gap: 2px; }
.ai-sym {
  color: var(--accent); font-weight: 700; font-size: 15px; text-decoration: none;
}
.ai-sym:hover { text-decoration: underline; color: #ffd54f; }
.ai-name { color: var(--muted); font-size: 12px; }
.ai-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.verdict {
  display: inline-block; border-radius: 999px;
  padding: 3px 10px; font-size: 12px; font-weight: 700;
}
.verdict-buy { background: rgba(14,203,129,0.15); color: var(--green); border: 1px solid rgba(14,203,129,0.45); }
.verdict-watch { background: rgba(240,185,11,0.12); color: var(--accent); border: 1px solid rgba(240,185,11,0.4); }
.verdict-no { background: rgba(246,70,93,0.12); color: var(--red); border: 1px solid rgba(246,70,93,0.4); }
.ai-score { color: #9aa4b2; font-size: 11px; }
.ai-meta-row { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-tag {
  background: #1a2030; color: #c0c6d0; border: 1px solid #2a3140;
  border-radius: 6px; padding: 2px 8px; font-size: 11px;
}
.ai-tag.sector { color: #93c5fd; border-color: #1e3a5f; background: #0f1b2d; }
.ai-tag.hot { color: #f0b90b; border-color: #5c4a14; background: #2b2110; }
.ai-line { margin: 0; font-size: 12px; color: #d1d5db; line-height: 1.5; }
.ai-line strong { color: #9aa4b2; font-weight: 600; }
.ai-line.risk { color: #f5a8b2; }
.ai-src {
  margin-left: 6px; color: #60a5fa; font-size: 11px; text-decoration: none;
}
.ai-src:hover { text-decoration: underline; }
.ai-empty {
  text-align: center; color: var(--muted); padding: 48px 16px; font-size: 14px;
}
.ai-empty code {
  background: #1a2030; padding: 2px 6px; border-radius: 4px; color: var(--accent);
}

td.ai-high { color: #f0b90b; font-weight: 700; }
.badge-buy, .badge-hold, .badge-skip, .badge-none {
  display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 600;
}
.badge-buy { background: rgba(14,203,129,0.15); color: #0ecb81; }
.badge-hold { background: rgba(240,185,11,0.15); color: #f0b90b; }
.badge-skip { background: rgba(246,70,93,0.15); color: #f6465d; }
.badge-none { color: #5e6673; }

.ai-score-btn {
  background: transparent; border: none; color: inherit; font: inherit;
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
  padding: 0; font-weight: 700;
}
.ai-score-btn:hover { color: #f0b90b; }
.ai-detail-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 60;
  display: flex; align-items: flex-start; justify-content: center; padding-top: 64px;
}
.ai-detail-modal.hidden { display: none; }
.ai-detail-inner {
  background: #12161c; border: 1px solid #2b3139; border-radius: 10px;
  width: min(640px, 92vw); max-height: 78vh; overflow: auto; padding: 16px 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.ai-detail-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.ai-detail-head h3 { margin: 0; font-size: 16px; color: #eaecef; }
.ai-detail-sub { color: #848e9c; font-size: 12px; margin-top: 4px; }
.ai-detail-head .primary {
  background: #f0b90b; color: #0b0e11; border: none; border-radius: 6px;
  padding: 6px 12px; font-weight: 600; cursor: pointer;
}
.ai-detail-grid { display: grid; gap: 10px; }
.ai-detail-grid p { margin: 0; color: #c0c6d0; font-size: 13px; line-height: 1.5; }
.ai-detail-grid .k {
  display: inline-block; min-width: 72px; color: #848e9c; margin-right: 8px; font-size: 12px;
}
.ai-detail-grid a { color: #f0b90b; word-break: break-all; }
.ai-detail-grid .tv-link { font-weight: 600; }

.badge-accum-hi { background: rgba(14,203,129,0.15); color: #0ecb81; }
.badge-accum-mid { background: rgba(240,185,11,0.15); color: #f0b90b; }
.badge-accum-lo { background: rgba(246,70,93,0.15); color: #f6465d; }
td.accum-high { color: #0ecb81; font-weight: 700; }

/* 递推锚定VWAP 弹窗 */
.ai-detail-inner.itr-wide { width: min(920px, 96vw); }
.itr-head-grid { margin-bottom: 12px; }
.itr-note { color: #848e9c; font-size: 12px; margin: 8px 0 0; line-height: 1.45; }
.itr-chain-wrap { overflow: auto; margin-top: 8px; border: 1px solid #2b3139; border-radius: 8px; }
.itr-chain-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.itr-chain-table th, .itr-chain-table td {
  padding: 6px 8px; border-bottom: 1px solid #2a3140; text-align: left; white-space: nowrap;
}
.itr-chain-table th { color: #848e9c; font-weight: 600; background: #1a1f27; position: sticky; top: 0; }
.itr-chain-table td.muted { color: #5e6673; text-align: center; }
.itr-acc-yes { color: #0ecb81; font-weight: 600; }
.itr-acc-no { color: #f6465d; }

/* BTC perpetual long/short panel */
.btc-panel {
  padding: 16px 20px 28px;
  max-height: calc(100vh - 120px);
  overflow: auto;
}
.btc-wrap { max-width: 1100px; margin: 0 auto; }
.btc-summary {
  background: linear-gradient(90deg, rgba(240,185,11,0.12), rgba(240,185,11,0.02));
  border: 1px solid rgba(240,185,11,0.35);
  border-radius: 10px;
  padding: 12px 14px;
  color: #f0d78c;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 14px;
}
.btc-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.btc-title { font-size: 18px; font-weight: 700; color: var(--text); }
.btc-sub {
  font-size: 11px; font-weight: 600; color: var(--accent);
  border: 1px solid rgba(240,185,11,0.4); border-radius: 4px;
  padding: 1px 6px; margin-left: 6px; vertical-align: middle;
}
.btc-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.btc-tv {
  color: #0b0e11; background: var(--accent); font-weight: 700; font-size: 12px;
  text-decoration: none; border-radius: 6px; padding: 8px 12px; white-space: nowrap;
}
.btc-tv:hover { background: #ffd54f; }
.btc-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.btc-card {
  background: linear-gradient(180deg, #151b24, #10151c);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.btc-card-key {
  border-color: rgba(240,185,11,0.55);
  box-shadow: 0 0 0 1px rgba(240,185,11,0.12);
}
.btc-card h3 {
  margin: 0; font-size: 12px; font-weight: 600; color: #9aa4b2;
}
.btc-ratio {
  font-size: 22px; font-weight: 700; color: var(--accent); letter-spacing: 0.02em;
}
.btc-ls-pct { font-size: 12px; color: #b7bfc9; }
.btc-deltas {
  display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: #848e9c;
}
.btc-deltas b { color: #eaecef; font-weight: 600; }
.btc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.btc-tag {
  background: #1a2030; color: #c0c6d0; border: 1px solid #2a3140;
  border-radius: 6px; padding: 2px 8px; font-size: 11px;
}
.btc-bias-long { color: #0ecb81; border-color: rgba(14,203,129,0.4); background: rgba(14,203,129,0.1); }
.btc-bias-short { color: #f6465d; border-color: rgba(246,70,93,0.4); background: rgba(246,70,93,0.1); }
.btc-bias-neutral { color: #f0b90b; border-color: rgba(240,185,11,0.35); background: rgba(240,185,11,0.08); }
.btc-up { color: #0ecb81 !important; }
.btc-down { color: #f6465d !important; }
.btc-chart-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 10px; color: var(--muted); font-size: 12px;
}
.btc-mode-btn {
  background: #1a2030; color: #c0c6d0; border: 1px solid #2a3140;
  border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.btc-mode-btn.active {
  background: rgba(240,185,11,0.15); color: var(--accent);
  border-color: rgba(240,185,11,0.5); font-weight: 700;
}
.btc-mode-label { color: #6b7280; }
.btc-charts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.btc-chart-card {
  background: #12161c; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px;
}
.btc-chart-card h3 {
  margin: 0 0 8px; font-size: 12px; color: #9aa4b2; font-weight: 600;
}
.btc-spark { display: block; width: 100%; background: #0d1117; border-radius: 6px; }
.btc-footnote {
  margin: 8px 0 0; color: #5e6673; font-size: 11px; line-height: 1.45;
}

/* denser panel: price+% / anchor·reset / open_score */
.cell-main {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.cell-sub {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.cell-sub.signed.pos { color: var(--green); }
.cell-sub.signed.neg { color: var(--red); }
.cell-combo {
  white-space: nowrap;
  line-height: 1.25;
  text-align: inherit;
}
button.cell-combo.ai-score-btn {
  text-decoration: none;
}
button.cell-combo.ai-score-btn:hover .cell-main {
  color: #f0b90b;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.open-score-grid h4.os-sec {
  margin: 14px 0 4px;
  padding-top: 8px;
  border-top: 1px solid #2a3140;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  grid-column: 1 / -1;
}
.open-score-grid h4.os-sec:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.ai-detail-grid .full { grid-column: 1 / -1; }
.ai-detail-grid.open-score-grid {
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 640px) {
  .ai-detail-grid.open-score-grid { grid-template-columns: 1fr; }
}

/* ===== Mobile adaptation ===== */
@media (max-width: 860px) {
  html, body { font-size: 12px; }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    padding-top: max(10px, env(safe-area-inset-top));
  }
  .brand { flex-wrap: wrap; gap: 6px; }
  .brand h1 { font-size: 15px; }
  .badge { font-size: 10px; }
  .meta { text-align: left; width: 100%; font-size: 11px; }
  .meta-vol { justify-content: flex-start; gap: 6px; }
  .btc-vol-badge, .btc-vol-range, .live-price-badge {
    padding: 3px 8px; font-size: 11px;
  }

  .tabs {
    padding: 8px 10px;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    padding: 8px 12px;
    font-size: 12px;
    flex: 0 0 auto;
    min-height: 36px;
  }
  .search-wrap {
    margin-left: 0;
    flex: 1 1 140px;
    min-width: 120px;
    order: 10;
  }
  #search {
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    font-size: 14px; /* avoid iOS zoom */
  }
  .row-count { margin-left: 0; font-size: 11px; }
  .cols-btn, .filters-toggle {
    margin-left: 0;
    padding: 8px 10px;
    min-height: 36px;
    font-size: 12px;
  }

  .filters {
    padding: 8px 10px 6px;
  }
  .filters.collapsed .filter-bar { display: flex; }
  .filters.collapsed .filter-presets,
  .filters.collapsed .filter-checks,
  .filters.collapsed .filter-grid,
  .filters.collapsed .filter-hint {
    display: none;
  }
  .filters.collapsed {
    padding-bottom: 4px;
  }
  .filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
  }
  .filter-bar .filter-label { margin: 0; }
  .filter-presets, .filter-checks {
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }
  .filter-presets button, .filter-checks label {
    flex: 0 0 auto;
    min-height: 32px;
  }
  .filter-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .filter-grid label input { width: 64px; }
  .filter-hint { display: none; }

  .table-wrap {
    max-height: calc(100dvh - var(--mobile-chrome, 200px));
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  table { min-width: 980px; }
  thead th {
    padding: 8px 8px;
    font-size: 11px;
  }
  tbody td {
    padding: 7px 8px;
    font-size: 12px;
  }
  td.fav-cell, th.fav-th {
    width: 32px; min-width: 32px;
  }
  .fav-btn { font-size: 18px; padding: 4px 6px; min-width: 32px; min-height: 32px; }
  .sym-info-btn { width: 18px; height: 18px; font-size: 12px; }
  .name { max-width: 72px; }

  .foot {
    display: none;
  }

  .ai-detail-modal, .col-editor {
    padding: 0;
    align-items: stretch;
    padding-top: env(safe-area-inset-top);
  }
  .ai-detail-inner, .col-editor-inner {
    width: 100%;
    max-width: 100%;
    min-height: 100%;
    max-height: 100dvh;
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding: 14px 12px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
  .ai-detail-inner.itr-wide { width: 100%; }
  .ai-detail-head { flex-wrap: wrap; }
  .ai-detail-head .primary {
    min-height: 40px;
    padding: 10px 14px;
  }

  .btc-panel { padding: 12px 10px 20px; max-height: calc(100dvh - 110px); }
  .btc-charts { grid-template-columns: 1fr; }
  .ai-panel { padding: 10px; }

  .filters-toggle { display: inline-flex; align-items: center; }
}

@media (min-width: 861px) {
  .filters-toggle { display: none; }
  .filter-bar { display: none; }
}

@media (max-width: 480px) {
  .brand .badge { display: none; }
  .filter-grid { grid-template-columns: 1fr; }
  table { min-width: 860px; }
}

/* 支撑强度 badge on 近期成本 cell */
.itr-strength-badge {
  display: inline-block;
  margin-left: 2px;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}
.itr-str-hi { background: rgba(14,203,129,0.18); color: #0ecb81; }
.itr-str-mid { background: rgba(240,185,11,0.16); color: #f0b90b; }
.itr-str-lo { background: rgba(246,70,93,0.14); color: #f6465d; }

/* 特别关注 star */
.fav-btn {
  background: transparent;
  border: none;
  color: #5e6673;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  vertical-align: middle;
}
.fav-btn:hover { color: #f0b90b; background: rgba(240, 185, 11, 0.08); }
.fav-btn.on { color: #f0b90b; }
.fav-btn.on:hover { color: #ffd54f; }

/* Symbol narrative ? button */
.sym-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
}
.sym-wrap > a {
  color: inherit;
}
.sym-info-btn {
  background: transparent;
  border: 1px solid #3a4250;
  color: #848e9c;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  vertical-align: middle;
}
.sym-info-btn:hover {
  color: #f0b90b;
  border-color: #f0b90b;
  background: rgba(240, 185, 11, 0.08);
}

td.fav-cell, th.fav-th {
  text-align: center !important;
  width: 36px;
  min-width: 36px;
  padding-left: 6px !important;
  padding-right: 6px !important;
}
th.fav-th { cursor: default; }
.tab .fav-count {
  display: inline-block;
  margin-left: 4px;
  font-size: 11px;
  color: #f0b90b;
  font-weight: 600;
}

/* 贴/破成本放量 badges */
.badge-cost-vol-near {
  background: rgba(240, 185, 11, 0.18);
  color: #f0b90b;
}
.badge-cost-vol-break {
  background: rgba(14, 203, 129, 0.18);
  color: #0ecb81;
}

/* ===== Mode toggle / homepage / coin detail ===== */
.topbar-right {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.mode-toggle {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.mode-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.home-panel {
  padding: 16px 20px 28px;
  max-height: calc(100vh - 140px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.home-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(240, 185, 11, 0.08), rgba(59, 130, 246, 0.06));
  border: 1px solid var(--border);
  border-radius: 10px;
}
.home-hero-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 4px;
}
.home-hero-sub {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.home-disclaimer {
  color: var(--muted);
  font-size: 11px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 4px 10px;
}
.home-boards { display: flex; flex-direction: column; gap: 20px; }
.home-board {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px 16px;
}
.home-board-head { margin-bottom: 12px; }
.home-board-head h2 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.home-board-head p { margin: 0; color: var(--muted); font-size: 12px; }
.home-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.home-card {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
  text-align: left;
  color: inherit;
  width: 100%;
  font: inherit;
}
.home-card:hover {
  border-color: var(--accent);
  background: var(--row-hover);
  transform: translateY(-1px);
}
.home-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.home-card-sym { font-weight: 700; font-size: 14px; letter-spacing: 0.02em; }
.home-card-name { color: var(--muted); font-size: 11px; margin-top: 2px; }
.home-card-price { text-align: right; font-variant-numeric: tabular-nums; }
.home-card-price .px { display: block; font-weight: 600; }
.home-card-badge {
  display: inline-block;
  margin-top: 2px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(240, 185, 11, 0.14);
  color: var(--accent);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-card-badge.buy { background: rgba(14, 203, 129, 0.16); color: var(--green); }
.home-card-badge.sell { background: rgba(246, 70, 93, 0.16); color: var(--red); }
.home-card-badge.watch { background: rgba(59, 130, 246, 0.14); color: #93c5fd; }
.home-card-metric {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}
.home-card-metric b { color: var(--text); font-weight: 600; }
.home-card.theme-card { cursor: default; }
.home-card.theme-card:hover { transform: none; border-color: var(--border); }
.home-empty { color: var(--muted); font-size: 12px; padding: 8px 0; }

.detail-panel {
  padding: 12px 20px 32px;
  max-height: calc(100vh - 120px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.detail-sticky-bar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 0 12px;
  margin-bottom: 8px;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
}
.detail-back {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.detail-back:hover { border-color: var(--accent); color: var(--accent); }
.detail-title-block { flex: 1 1 auto; min-width: 140px; }
.detail-title-block h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.detail-title-block .detail-name {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}
.detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
  font-size: 13px;
}
.detail-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.detail-tv {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
}
.detail-tv:hover { border-color: var(--accent); color: var(--accent); }
.detail-fav-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 18px;
  width: 40px;
  height: 40px;
  cursor: pointer;
}
.detail-fav-btn.on { color: var(--accent); border-color: #5c4a14; }
.detail-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
  align-items: start;
}
.detail-col { display: flex; flex-direction: column; gap: 14px; }
.detail-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.detail-section h2 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}
.detail-section ul { margin: 0; padding-left: 18px; }
.detail-section li { margin-bottom: 6px; line-height: 1.45; }
.detail-steps { margin: 0; padding-left: 18px; }
.detail-steps li { margin-bottom: 8px; line-height: 1.45; }
.detail-levels {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.detail-levels th,
.detail-levels td {
  text-align: left;
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
}
.detail-levels th { color: var(--muted); font-weight: 500; width: 34%; }
.detail-levels td { font-variant-numeric: tabular-nums; }
.detail-chain {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  padding-left: 16px;
}
.detail-chain li { margin-bottom: 4px; }
.callout-buy, .callout-sell, .callout-watch {
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.45;
}
.callout-buy {
  background: rgba(14, 203, 129, 0.1);
  border-color: rgba(14, 203, 129, 0.35);
  color: #b6f5d4;
}
.callout-sell {
  background: rgba(246, 70, 93, 0.1);
  border-color: rgba(246, 70, 93, 0.35);
  color: #ffc0c8;
}
.callout-watch {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
  color: #bfdbfe;
}
.callout-label {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
  font-size: 12px;
  letter-spacing: 0.04em;
}
.stance-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 6px;
}
.stance-buy { background: rgba(14, 203, 129, 0.18); color: var(--green); }
.stance-sell { background: rgba(246, 70, 93, 0.18); color: var(--red); }
.stance-watch { background: rgba(59, 130, 246, 0.16); color: #93c5fd; }
.sym-detail-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 4px;
  font-size: 10px;
  padding: 1px 5px;
  cursor: pointer;
  margin-left: 4px;
  line-height: 1.3;
}
.sym-detail-btn:hover { color: var(--accent); border-color: var(--accent); }
.sym-link-detail {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
}
.sym-link-detail:hover { color: var(--accent); }

body.mode-phone .home-card-grid { grid-template-columns: 1fr; }
body.mode-phone .detail-layout { grid-template-columns: 1fr; }
body.mode-phone .filter-hint { display: none; }
body.mode-phone .home-panel,
body.mode-phone .detail-panel {
  padding: 10px 12px 24px;
  max-height: calc(100dvh - var(--mobile-chrome, 160px));
}
body.mode-phone .detail-sticky-bar { padding-top: 4px; }
body.mode-phone .home-board { padding: 12px; }
body.mode-phone .home-card { padding: 10px; }
body.mode-phone .foot { display: none; }
body.mode-phone table { min-width: 900px; }

body.mode-desktop .home-card-grid {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
body.mode-desktop .detail-layout { grid-template-columns: 1.15fr 0.85fr; }
body.mode-desktop .home-panel,
body.mode-desktop .detail-panel {
  max-height: calc(100vh - 140px);
  padding: 16px 20px 28px;
}
body.mode-desktop .filter-hint { display: block; }

@media (max-width: 860px) {
  .home-card-grid { grid-template-columns: 1fr; }
  .detail-layout { grid-template-columns: 1fr; }
  .home-panel, .detail-panel {
    padding: 10px 12px 24px;
    max-height: calc(100dvh - var(--mobile-chrome, 160px));
  }
  .topbar-right {
    width: 100%;
    justify-content: space-between;
    align-items: center;
  }
  .mode-toggle { font-size: 11px; padding: 5px 8px; }
}

/* ===== Phone detail optimizations ===== */
.detail-quick {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}
.detail-quick .dq {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  min-width: 0;
}
.detail-quick .dq-k {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}
.detail-quick .dq-v {
  display: block;
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-quick .dq-alert {
  border-color: rgba(240, 185, 11, 0.45);
  background: rgba(240, 185, 11, 0.08);
}
.detail-jump {
  display: none;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 0 0 12px;
  padding-bottom: 2px;
}
.detail-jump::-webkit-scrollbar { display: none; }
.detail-jump a {
  flex: 0 0 auto;
  text-decoration: none;
  color: var(--muted);
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
}
.detail-jump a:active { color: var(--accent); border-color: var(--accent); }

.level-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.level-card {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.level-card .level-k { font-size: 11px; color: var(--muted); }
.level-card .level-v {
  font-size: 14px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.level-card .level-d {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.detail-collapse {
  padding-top: 4px;
  padding-bottom: 4px;
}
.detail-collapse > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.detail-collapse > summary::-webkit-details-marker { display: none; }
.detail-collapse > summary h2 { margin: 0; }
.detail-collapse > summary::after {
  content: "展开";
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.detail-collapse[open] > summary::after { content: "收起"; }
.detail-collapse[open] { padding-bottom: 14px; }

.detail-live-price b {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}
.detail-sticky-phone {
  background: rgba(11, 14, 17, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  margin-left: -12px;
  margin-right: -12px;
  padding-left: 12px;
  padding-right: 12px;
  padding-top: max(6px, env(safe-area-inset-top));
  top: 0;
}
.detail-sticky-phone .detail-back {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 10px;
  font-size: 18px;
}
.detail-sticky-phone .detail-title-block h1 {
  font-size: 17px;
  gap: 6px;
}
.detail-sticky-phone .detail-actions .detail-tv {
  min-height: 44px;
  padding: 0 12px;
}
.detail-sticky-phone .detail-fav-btn {
  width: 44px;
  height: 44px;
}

body.detail-phone .topbar .meta { display: none; }
body.detail-phone .topbar {
  padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top));
}
body.detail-phone .brand h1 { font-size: 14px; }
body.detail-phone .brand .badge { display: none; }
body.detail-phone .mode-toggle { font-size: 11px; padding: 6px 8px; }
body.detail-phone .detail-panel {
  max-height: calc(100dvh - var(--mobile-chrome, 72px));
  padding: 0 12px 28px;
  padding-bottom: max(28px, env(safe-area-inset-bottom));
}
body.detail-phone .detail-jump { display: flex; }
body.detail-phone .detail-section {
  padding: 12px;
  border-radius: 12px;
}
body.detail-phone .detail-section h2 { font-size: 13px; margin-bottom: 8px; }
body.detail-phone .detail-section li { font-size: 13px; }
body.detail-phone .callout-buy,
body.detail-phone .callout-sell,
body.detail-phone .callout-watch {
  font-size: 13px;
  padding: 12px;
}
body.detail-phone .detail-layout-phone { gap: 10px; }
body.detail-phone .detail-col { gap: 10px; }
body.detail-phone .foot { display: none; }

body.mode-phone .detail-jump { display: flex; }
body.mode-phone.detail-open .detail-jump { display: flex; }

@media (max-width: 860px) {
  .detail-jump { display: flex; }
  .detail-sticky-bar.detail-sticky-phone { /* applied via JS class */ }
}

/* Detail K-line chart */
.detail-chart-section {
  margin-bottom: 14px;
}
.detail-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.detail-chart-section h2 {
  margin: 0;
}
.detail-chart-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.detail-chart-toolbar button {
  background: var(--panel2);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  line-height: 1.2;
}
.detail-chart-toolbar button:hover {
  color: var(--text);
  border-color: var(--accent);
}
.detail-chart-toolbar button.active {
  color: #111;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
}
.detail-chart-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0 0 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(14, 18, 24, 0.9);
  border: 1px solid rgba(42, 49, 64, 0.85);
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted);
}
.dleg-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  max-width: 100%;
}
.dleg-item.dleg-emph {
  color: var(--text);
  font-weight: 600;
}
.dleg-swatch {
  display: inline-block;
  width: 12px;
  height: 3px;
  border-radius: 2px;
  background: var(--sw, #848e9c);
  flex: 0 0 auto;
}
.dleg-swatch.dleg-candle {
  width: 8px;
  height: 10px;
  border-radius: 1px;
}
.dleg-swatch.dleg-vol {
  width: 8px;
  height: 8px;
  border-radius: 1px;
  opacity: 0.85;
}
.dleg-swatch.dleg-ma {
  height: 2px;
}
.dleg-swatch.dleg-line {
  height: 2px;
  width: 14px;
}
.dleg-px {
  font-style: normal;
  font-variant-numeric: tabular-nums;
  color: #c8cdd5;
  margin-left: 2px;
  font-weight: 500;
}
.detail-chart-box,
#detailChart {
  position: relative;
  width: 100%;
  height: 400px;
  overflow: hidden;
  border-radius: 8px;
  background: #0b0e11;
  border: 1px solid var(--border);
}
.detail-chart-tooltip {
  position: absolute;
  z-index: 5;
  min-width: 160px;
  max-width: min(92%, 280px);
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(11, 14, 17, 0.94);
  border: 1px solid rgba(240, 185, 11, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  color: #eaecef;
  font-size: 11px;
  line-height: 1.45;
  pointer-events: none;
}
.detail-chart-tooltip[hidden] {
  display: none !important;
}
.detail-chart-tooltip .dct-time {
  color: #f0b90b;
  font-weight: 600;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}
.detail-chart-tooltip .dct-ohlc {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.detail-chart-tooltip .dct-ohlc span b {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.detail-chart-tooltip .dct-ohlc .up b,
.detail-chart-tooltip .dct-ohlc .up {
  color: #0ecb81;
}
.detail-chart-tooltip .dct-ohlc .down b,
.detail-chart-tooltip .dct-ohlc .down {
  color: #f6465d;
}
.detail-chart-hint {
  margin: 8px 0 0;
  font-size: 11px;
}
.detail-chart-msg {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 160px;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.detail-chart-msg.is-error {
  color: #ffc0c8;
}
.detail-chart-overlay {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 3;
  height: auto;
  min-height: 0;
  background: rgba(11, 14, 17, 0.88);
  border: 1px solid rgba(246, 70, 93, 0.35);
  border-radius: 8px;
  padding: 8px 10px;
  pointer-events: none;
}

body.mode-phone .detail-chart-box,
body.mode-phone #detailChart,
body.detail-phone .detail-chart-box,
body.detail-phone #detailChart {
  height: 280px;
}
body.mode-phone .detail-chart-section,
body.detail-phone .detail-chart-section {
  margin-bottom: 10px;
  padding: 12px;
}
body.mode-phone .detail-chart-toolbar button,
body.detail-phone .detail-chart-toolbar button {
  padding: 6px 10px;
  font-size: 12px;
}
body.mode-phone .detail-chart-legend,
body.detail-phone .detail-chart-legend {
  gap: 5px 8px;
  padding: 5px 6px;
  font-size: 10px;
}
body.mode-phone .dleg-px,
body.detail-phone .dleg-px {
  display: none;
}
@media (max-width: 860px) {
  .detail-chart-box,
  #detailChart {
    height: 280px;
  }
  .detail-chart-legend {
    font-size: 10px;
  }
  .dleg-px {
    display: none;
  }
}



/* ===== 项目信息（币种详情） ===== */
.detail-project {
  margin-top: 4px;
  margin-bottom: 4px;
}
.detail-project .proj-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.detail-project .proj-k {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  margin-right: 4px;
}
.proj-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
}
.proj-badge.curated {
  background: rgba(14, 203, 129, 0.14);
  color: #0ecb81;
  border-color: rgba(14, 203, 129, 0.35);
}
.proj-badge.sector-only {
  background: rgba(240, 185, 11, 0.12);
  color: #f0b90b;
  border-color: rgba(240, 185, 11, 0.35);
}
.proj-badge.none {
  background: rgba(94, 102, 115, 0.15);
  color: #9aa4b2;
  border-color: #2a3140;
}
.proj-block {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.proj-block:first-of-type { border-top: none; padding-top: 0; }
.proj-h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: #c0c6d0;
}
.proj-blurb {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.55;
  color: #eaecef;
}
.proj-sector {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #9aa4b2;
}
.proj-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.proj-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #1a2030;
  color: #f0b90b;
  border: 1px solid #5c4a14;
}
.proj-note {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.4;
}
.proj-catalyst {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.proj-cat-text {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: #d1d5db;
}
.proj-src {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: #60a5fa;
  text-decoration: none;
}
.proj-src:hover { text-decoration: underline; }
.proj-twitter {
  margin-top: 4px;
}
.proj-x-official {
  margin: 0 0 8px;
  font-size: 13px;
}
.proj-x-official a {
  color: #60a5fa;
  text-decoration: none;
  font-weight: 600;
}
.proj-x-official a:hover { text-decoration: underline; }
.proj-x-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0;
}
.proj-x-btn {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  background: rgba(29, 155, 240, 0.16);
  color: #1d9bf0;
  border: 1px solid rgba(29, 155, 240, 0.35);
}
.proj-x-btn.secondary {
  background: #1a2030;
  color: #c0c6d0;
  border-color: #2a3140;
}
.proj-x-btn:active { opacity: 0.85; }
.proj-cg-desc {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #12161c;
  border: 1px dashed #2a3140;
}
.proj-cg-desc.hidden { display: none; }
.proj-cg-text {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: #9aa4b2;
}
body.mode-phone .detail-project,
body.detail-phone .detail-project {
  padding: 12px;
}
body.mode-phone .proj-x-btn,
body.detail-phone .proj-x-btn {
  padding: 8px 12px;
  font-size: 13px;
}


/* ===== Detail scores / project features / tags ===== */
.detail-scores {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 12px;
}
.dscore {
  background: var(--panel2, #12161c);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dscore-k {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.dscore-v {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  color: var(--text);
}
.dscore-sub {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.35;
  margin-top: 2px;
}
.dscore.score-hi .dscore-v,
.dq-v.score-hi { color: #0ecb81; }
.dscore.score-mid .dscore-v,
.dq-v.score-mid { color: #f0b90b; }
.dscore.score-lo .dscore-v,
.dq-v.score-lo { color: #f6465d; }
.dq.dq-score .dq-v {
  font-weight: 700;
  font-size: 15px;
}
.proj-feat-list {
  margin: 0;
  padding-left: 18px;
}
.proj-feat-list li {
  margin-bottom: 6px;
  line-height: 1.45;
  color: #c0c6d0;
  font-size: 13px;
}
.proj-chip.tag {
  background: rgba(240, 185, 11, 0.12);
  border-color: rgba(240, 185, 11, 0.35);
  color: #f0b90b;
}
.detail-layout-focus {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}
body.mode-desktop .detail-layout-focus {
  grid-template-columns: 1.15fr 0.85fr;
}
body.mode-phone .detail-scores,
body.detail-phone .detail-scores {
  gap: 8px;
  margin-bottom: 10px;
}
body.mode-phone .dscore-v,
body.detail-phone .dscore-v {
  font-size: 20px;
}
body.mode-phone .dscore-sub,
body.detail-phone .dscore-sub {
  display: none;
}
@media (max-width: 720px) {
  .detail-scores { grid-template-columns: 1fr 1fr; }
  .detail-layout-focus { grid-template-columns: 1fr; }
}

/* Ensure chart container keeps height even while loading message */
.detail-chart-box .tv-lightweight-charts {
  width: 100% !important;
  height: 100% !important;
}


/* Panel version stamp */
.badge.version {
  background: rgba(240, 185, 11, 0.12);
  color: #f0b90b;
  border: 1px solid rgba(240, 185, 11, 0.35);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.foot-version {
  display: block;
  margin-bottom: 0.35rem;
  color: #848e9c;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}


/* ===== Sector / tag filter bar ===== */
.tag-filter-bar {
  padding: 8px 14px 10px;
  border-bottom: 1px solid #1e2329;
  background: #0e1218;
}
.tag-filter-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.tag-mode {
  display: inline-flex;
  border: 1px solid #2b3139;
  border-radius: 6px;
  overflow: hidden;
}
.tag-mode-btn {
  background: transparent;
  border: 0;
  color: #848e9c;
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
}
.tag-mode-btn + .tag-mode-btn { border-left: 1px solid #2b3139; }
.tag-mode-btn.active {
  background: rgba(240, 185, 11, 0.15);
  color: #f0b90b;
}
.tag-clear {
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid #2b3139;
  border-radius: 6px;
  background: transparent;
  color: #848e9c;
  cursor: pointer;
}
.tag-clear:hover { border-color: #f0b90b; color: #f0b90b; }
.tag-filter-hint {
  color: #848e9c;
  font-size: 11px;
  margin-left: auto;
}
.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag-chip {
  border: 1px solid #2b3139;
  background: #151a21;
  color: #c0c6d0;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  line-height: 1.4;
}
.tag-chip:hover { border-color: #f0b90b; color: #f0b90b; }
.tag-chip.active {
  background: rgba(240, 185, 11, 0.18);
  border-color: #f0b90b;
  color: #f0b90b;
}
.tag-chip .tag-count {
  opacity: 0.65;
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}
.tag-filter-bar.hidden { display: none; }
@media (max-width: 720px) {
  .tag-filter-bar { padding: 8px 10px; }
  .tag-filter-hint { width: 100%; margin-left: 0; }
}


/* ===== Detail enrich: scores / chain / empty / chart meta ===== */
.detail-scores-rich {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.detail-empty {
  font-size: 12.5px;
  line-height: 1.5;
  padding: 6px 0;
}
.chain-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.chain-stat {
  background: var(--panel2, #12161c);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chain-k { font-size: 11px; color: var(--muted); }
.chain-v { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chain-note { font-size: 11.5px; line-height: 1.45; margin: 0 0 8px; }
.chain-subh {
  font-size: 12px;
  color: var(--muted);
  margin: 10px 0 6px;
  font-weight: 600;
}
.detail-chart-meta {
  font-size: 11px;
  margin: 6px 0 0;
  font-variant-numeric: tabular-nums;
}
@media (min-width: 720px) {
  .chain-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
body.mode-phone .chain-summary,
body.detail-phone .chain-summary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
