:root {
  --bg: #ffffff;
  --panel: #f6f7f8;
  --line: #e6e8eb;
  --text: #1f2328;
  --muted: #6b7280;
  --faint: #9aa1ab;
  --up: #2f8f5b;
  --down: #c4473a;
  --up-bg: #eaf4ee;
  --down-bg: #f8ecea;
  --accent: #46607e;
  --accent-bg: #edf1f5;
  --warn: #a8761f;
  --warn-bg: #f7f0e2;
  --nav-h: 58px;
  --r: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100dvh; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.num { font-variant-numeric: tabular-nums lining-nums; }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--muted); }

/* 顶栏 */
.top { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: calc(env(safe-area-inset-top) + 10px) 16px 0; }
.top-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.top h1 { font-size: 20px; font-weight: 650; margin: 0; letter-spacing: .5px; }
.meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.status-bar { margin-top: 8px; font-size: 12px; padding: 6px 10px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); }

main { padding: 0 16px 24px; max-width: 760px; margin: 0 auto; }
.loading, .empty { color: var(--muted); font-size: 14px; padding: 40px 0; text-align: center; }

/* 市场标签与分段 */
.tabs { position: sticky; top: calc(env(safe-area-inset-top) + 40px); z-index: 15; background: var(--bg); display: flex; gap: 4px; padding: 10px 0 8px; border-bottom: 1px solid var(--line); margin: 0 -16px 12px; padding-left: 16px; padding-right: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; font-size: 14px; padding: 6px 12px; border-radius: 999px; color: var(--muted); }
.tab[aria-selected="true"] { background: var(--text); color: #fff; font-weight: 600; }
.seg { display: flex; background: var(--panel); border-radius: 9px; padding: 3px; margin: 4px 0 12px; }
.seg button { flex: 1; font-size: 13px; padding: 7px 4px; border-radius: 7px; color: var(--muted); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg .c { font-size: 11px; color: var(--faint); margin-left: 3px; }

/* 标题 */
.h2 { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 0 8px; }
.h2 h2 { font-size: 15px; font-weight: 650; margin: 0; }
.h2 .sub { font-size: 12px; color: var(--muted); }
.note { font-size: 12px; color: var(--muted); line-height: 1.55; margin: 4px 0 10px; }

/* 新闻 */
.news { border: 1px solid var(--line); border-radius: var(--r); padding: 4px 14px; margin-top: 4px; }
.news-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.news-item:last-of-type { border-bottom: 0; }
.news-head { display: flex; gap: 8px; align-items: flex-start; }
.tag { flex: 0 0 auto; font-size: 11px; line-height: 18px; padding: 0 6px; border-radius: 4px; background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.up { background: var(--up-bg); color: var(--up); }
.tag.down { background: var(--down-bg); color: var(--down); }
.tag.grey { background: var(--panel); color: var(--muted); font-weight: 500; }
.news-title { font-size: 15px; font-weight: 650; line-height: 1.4; }
.news-fact { font-size: 13.5px; line-height: 1.6; margin: 6px 0 4px; }
.news-impact { font-size: 13px; color: var(--muted); line-height: 1.55; }
.news-foot { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--faint); }
.chip { font-size: 12px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--text); }
.chip.up { border-color: #cfe5d8; background: var(--up-bg); color: var(--up); }
.chip.down { border-color: #efd3cf; background: var(--down-bg); color: var(--down); }
.news-src { text-decoration: underline; text-underline-offset: 2px; }
.watch { font-size: 13px; padding: 10px 0 12px; border-top: 1px solid var(--line); }
.watch b { font-weight: 600; margin-right: 6px; }

/* 信息卡片 */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card { display: block; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 11px 8px; background: #fff; min-width: 0; content-visibility: auto; contain-intrinsic-size: 0 120px; }
.card .nm { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .tk { font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .row1 { display: flex; justify-content: space-between; align-items: baseline; margin-top: 4px; gap: 6px; }
.card .px { font-size: 13px; color: var(--muted); }
.card .big { font-size: 17px; font-weight: 650; }
.card .row2 { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 2px; gap: 6px; }
.card .row2 span { white-space: nowrap; }
.card svg.spark { display: block; width: 100%; height: 32px; margin-top: 4px; }
.card .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; min-height: 18px; }

/* 5 日最佳/最差 */
.movers { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.mv { display: grid; grid-template-columns: 52px minmax(0,1fr) minmax(0,1fr); gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; align-items: center; }
.mv:last-child { border-bottom: 0; }
.mv .sec { color: var(--muted); }
.mv .a { display: flex; justify-content: space-between; gap: 6px; min-width: 0; }
.mv .a span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 紧凑列表 */
.list { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); min-height: 52px; }
.li:last-child { border-bottom: 0; }
.li .main { flex: 1; min-width: 0; }
.li .t1 { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .t2 { font-size: 11.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .side { text-align: right; flex: 0 0 auto; }
.li .v { font-size: 15px; font-weight: 650; }
.li .v2 { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.rsi-bar { width: 44px; height: 4px; border-radius: 2px; background: var(--panel); position: relative; margin: 4px 0 0 auto; }
.rsi-bar i { position: absolute; top: -2px; width: 2px; height: 8px; border-radius: 1px; }
.group-h { font-size: 12px; color: var(--muted); padding: 7px 12px; background: var(--panel); border-bottom: 1px solid var(--line); font-weight: 600; }

/* 配对 */
.pair-names { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; min-width: 0; }
.pair-names > a, .pair-names > span:not(.x) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pair-names + .pair-names { margin-top: 1px; }
.pair-names .x { color: var(--faint); font-weight: 400; flex: 0 0 auto; }
.corr { width: 54px; height: 4px; background: var(--panel); border-radius: 2px; position: relative; margin: 5px 0 0 auto; }
.corr i { position: absolute; top: 0; height: 4px; border-radius: 2px; }
.corr::after { content: ""; position: absolute; left: 50%; top: -2px; width: 1px; height: 8px; background: var(--faint); }

/* 个股 */
.search { display: flex; gap: 8px; margin: 4px 0 12px; }
.search input { flex: 1; font: inherit; font-size: 15px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; outline: none; background: #fff; }
.search input:focus { border-color: var(--accent); }
.search button { padding: 0 14px; border-radius: 9px; background: var(--text); color: #fff; font-size: 14px; }
.stock-head .nm { font-size: 20px; font-weight: 650; }
.stock-head .tk { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stock-head .pxrow { display: flex; align-items: baseline; gap: 10px; margin-top: 8px; }
.stock-head .px { font-size: 24px; font-weight: 650; }
.verdict { border-radius: var(--r); padding: 11px 13px; margin: 12px 0; background: var(--accent-bg); }
.verdict .v { font-size: 15px; font-weight: 650; color: var(--accent); }
.verdict .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chart { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 10px 6px; margin-bottom: 10px; }
.chart .ttl { font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.chart .lg { font-size: 11px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 4px 0 2px; font-weight: 400; }
.chart .lg i { display: inline-block; width: 12px; height: 2px; vertical-align: middle; margin-right: 4px; }
.chart .lg i.dash { background: none !important; border-top: 2px dashed; height: 0; }
.chart svg { display: block; width: 100%; }
.kv { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.kv > div { padding: 9px 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.kv > div:nth-child(3n) { border-right: 0; }
.kv > div:nth-last-child(-n+3) { border-bottom: 0; }
.kv .k { font-size: 11px; color: var(--muted); }
.kv .vv { font-size: 14px; font-weight: 600; margin-top: 2px; }
table.t { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl { border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; overscroll-behavior: contain; }
table.t th, table.t td { padding: 7px 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.t th:first-child, table.t td:first-child { text-align: left; position: sticky; left: 0; background: #fff; }
table.t th { font-weight: 500; color: var(--muted); font-size: 11.5px; }
table.t tr:last-child td { border-bottom: 0; }
.narr { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.narr p { font-size: 13.5px; line-height: 1.65; margin: 6px 0; }
.narr ul { margin: 4px 0 8px; padding-left: 18px; font-size: 13.5px; line-height: 1.6; }
.narr h3 { font-size: 13px; color: var(--muted); font-weight: 600; margin: 12px 0 4px; }
.narr li { margin-bottom: 6px; }
.narr li b { font-weight: 600; }
.narr .side-l { margin-top: 3px; color: var(--ink, inherit); }
.narr .lb { display: inline-block; font-size: 11px; line-height: 18px; padding: 0 6px; margin-right: 6px; border-radius: 4px; background: #eef0f2; color: var(--muted); vertical-align: 1px; }
.narr .lb.up { background: #e6f2eb; color: #2f8f5b; }
.narr .lb.down { background: #f6e7e5; color: #c4473a; }
.nowrap { white-space: nowrap; }
.narr a { text-decoration: underline; text-underline-offset: 2px; color: var(--accent); }
.back { font-size: 13px; color: var(--accent); display: inline-block; padding: 8px 0 4px; }
.foot { font-size: 11.5px; color: var(--faint); line-height: 1.6; margin-top: 18px; }

/* 底部导航 */
nav.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
nav.bottom a { flex: 1; height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--faint); }
nav.bottom svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
nav.bottom a.on { color: var(--text); font-weight: 600; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
