/* ============================================================
 * mobile.css —— A股行情 手机版
 * 设计语言沿用桌面版深色金融终端配色，针对触屏重排。
 * ============================================================ */

/* ---------------- 设计变量 ---------------- */
:root {
  --bg: #0B0E11;
  --bg-soft: #10141A;
  --card: #161B23;
  --card-2: #1C222B;
  --elev: #232A35;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.13);
  --text: #E9ECF0;
  --dim: #9BA4B0;
  --mute: #6B7280;
  --up: #F6465D;
  --down: #2EBD85;
  --gold: #F0B90B;
  --blue: #4A9EFF;
  --purple: #C77DFF;
  --up-soft: rgba(246, 70, 93, 0.13);
  --down-soft: rgba(46, 189, 133, 0.13);
  --blue-soft: rgba(74, 158, 255, 0.13);
  --gold-soft: rgba(240, 185, 11, 0.13);
  --radius: 16px;
  --radius-sm: 11px;
  --tabbar-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --num: ui-monospace, "SF Mono", "DIN Alternate", "Roboto Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #F2F4F7;
  --bg-soft: #E9EDF2;
  --card: #FFFFFF;
  --card-2: #F7F9FB;
  --elev: #FFFFFF;
  --line: rgba(16, 24, 40, 0.08);
  --line-2: rgba(16, 24, 40, 0.14);
  --text: #101828;
  --dim: #5B6470;
  --mute: #8A929E;
  --up: #E0354C;
  --down: #0A9A6C;
  --gold: #C08A00;
  --blue: #1E6FE8;
  --purple: #8B5CF6;
  --up-soft: rgba(224, 53, 76, 0.10);
  --down-soft: rgba(10, 154, 108, 0.10);
  --blue-soft: rgba(30, 111, 232, 0.10);
  --gold-soft: rgba(192, 138, 0, 0.12);
  --shadow: 0 12px 32px rgba(16, 24, 40, 0.12);
  --shadow-sm: 0 1px 0 rgba(16, 24, 40, 0.02) inset;
  color-scheme: light;
}

/* ---------------- 基础 ---------------- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background:
    radial-gradient(560px 260px at 12% -8%, rgba(74, 158, 255, 0.13), transparent 62%),
    radial-gradient(520px 240px at 92% -4%, rgba(240, 185, 11, 0.08), transparent 60%),
    var(--bg);
  overscroll-behavior: none;
}

html[data-theme="light"] body {
  background:
    radial-gradient(520px 240px at 10% -6%, rgba(74, 158, 255, 0.10), transparent 62%),
    radial-gradient(460px 220px at 95% -4%, rgba(240, 185, 11, 0.10), transparent 60%),
    var(--bg);
}

button, input { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; -webkit-user-select: none; user-select: none; }
input { -webkit-user-select: text; user-select: text; }
input::-webkit-search-cancel-button { display: none; }
a { color: var(--blue); text-decoration: none; }
svg { display: block; }
[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* 涨跌语义 */
.up { color: var(--up) !important; }
.down { color: var(--down) !important; }
.flat { color: var(--dim) !important; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; letter-spacing: -0.2px; }

/* ---------------- 应用骨架 ---------------- */
#app { position: fixed; inset: 0; z-index: 1; }
#main { position: absolute; inset: 0; }

.view {
  position: absolute;
  inset: 0;
  display: none;
  overflow-x: hidden;
  overflow-y: auto;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}
.view.is-active { display: block; }
.view.page-in { animation: viewIn 0.22s ease both; }
@keyframes viewIn { from { opacity: 0.4; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page { padding: 0 14px; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: calc(var(--safe-t) + 10px) 14px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid var(--line);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .topbar { background: rgba(11, 14, 17, 0.86); }
  html[data-theme="light"] .topbar { background: rgba(242, 244, 247, 0.88); }
}

.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 36px; height: 36px; flex: 0 0 36px;
  border-radius: 12px;
  display: grid; place-items: center;
  color: #1A1205;
  background: linear-gradient(145deg, #FFD75E, var(--gold) 62%, #C98F00);
  box-shadow: 0 6px 16px rgba(240, 185, 11, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-text h1 { font-size: 17px; font-weight: 700; letter-spacing: 0.2px; line-height: 1.2; }
.brand-text p { font-size: 11px; color: var(--mute); letter-spacing: 0.3px; }

.icon-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  color: var(--dim);
  background: var(--card);
  border: 1px solid var(--line);
  transition: transform 0.12s ease, color 0.15s ease, background 0.15s ease;
}
.icon-btn:active { transform: scale(0.92); color: var(--text); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 10px; }
.icon-btn.sm .ico { width: 18px; height: 18px; }

.title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-height: 30px; }
.title-row h1 { font-size: 20px; font-weight: 700; letter-spacing: 0.2px; }
.title-row .sub { font-size: 11px; color: var(--mute); }
.hint { font-size: 11.5px; color: var(--mute); margin-top: 2px; }

/* ---------------- 搜索 ---------------- */
.search-box { position: relative; margin-top: 10px; }
.search-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--mute); pointer-events: none; }
.search-box input {
  width: 100%; height: 42px;
  padding: 0 40px 0 38px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 14.5px;
  outline: none;
  transition: border-color 0.16s ease, background 0.16s ease;
  appearance: none;
}
.search-box input::placeholder { color: var(--mute); }
.search-box input:focus { border-color: rgba(240, 185, 11, 0.42); background: var(--card-2); }
.search-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; color: var(--mute);
}
.search-clear .ico { width: 15px; height: 15px; }

.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  z-index: 40;
  max-height: min(58vh, 440px);
  overflow-y: auto;
  border-radius: 16px;
  background: var(--elev);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow);
  padding: 6px;
  animation: dropIn 0.16s ease both;
}
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px) scale(0.99); } to { opacity: 1; transform: none; } }

.sr-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 10px;
  border-radius: 11px;
  text-align: left;
}
.sr-row:active { background: var(--card-2); }
.sr-main { flex: 1; min-width: 0; }
.sr-name { font-size: 14.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-name em { font-style: normal; color: var(--gold); }
.sr-meta { font-size: 11px; color: var(--mute); font-family: var(--num); }
.sr-add {
  width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 9px; display: grid; place-items: center;
  color: var(--gold); background: var(--gold-soft);
}
.sr-add .ico { width: 16px; height: 16px; }
.sr-add.is-on { color: var(--mute); background: var(--card-2); }
.sr-empty { padding: 18px 12px; text-align: center; color: var(--mute); font-size: 13px; }
.sr-hint { padding: 8px 12px 10px; font-size: 11px; color: var(--mute); border-top: 1px solid var(--line); }

body.search-open .page { opacity: 0.35; filter: saturate(0.6); pointer-events: none; transition: opacity 0.16s ease; }
.page { transition: opacity 0.16s ease; }

/* ---------------- 指数条 ---------------- */
.index-strip {
  display: flex; gap: 8px;
  margin: 14px 0 0;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.index-strip::-webkit-scrollbar { display: none; }
.index-card {
  flex: 1 0 calc((100% - 16px) / 3);
  min-width: 100px;
  scroll-snap-align: start;
  padding: 10px 11px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.index-card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(160deg, var(--tint, transparent), transparent 68%);
  pointer-events: none;
}
.index-card.is-up { --tint: rgba(246, 70, 93, 0.16); }
.index-card.is-down { --tint: rgba(46, 189, 133, 0.16); }
.ix-name { font-size: 11px; color: var(--dim); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ix-price { font-size: 16px; font-weight: 600; line-height: 1.25; }
.ix-chg { font-size: 11px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- 区块 ---------------- */
.block { margin-top: 20px; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.block-head h2 {
  font-size: 15.5px; font-weight: 600; letter-spacing: 0.2px;
  display: flex; align-items: center; gap: 8px;
}
.block-head h2::before {
  content: ""; width: 3px; height: 13px; border-radius: 2px;
  background: linear-gradient(180deg, var(--gold), rgba(240, 185, 11, 0.25));
}
.block-head .sub { font-size: 11px; color: var(--mute); font-weight: 400; }
.block-head .count { font-size: 11px; color: var(--mute); font-family: var(--num); font-weight: 400; }
.block-actions { display: flex; align-items: center; gap: 8px; }
.text-btn {
  font-size: 12.5px; color: var(--blue);
  padding: 5px 10px; border-radius: 8px;
  background: var(--blue-soft);
}
.text-btn:active { opacity: 0.7; }
.text-btn.warn { color: var(--up); background: var(--up-soft); }

/* ---------------- 行情列表 ---------------- */
.stock-list {
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  overflow: hidden;
}
.stock-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 11px 13px;
  min-height: 62px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  transition: background 0.14s ease;
  position: relative;
}
.stock-row:last-child { border-bottom: 0; }
.stock-row:active { background: var(--card-2); }
.row-main { flex: 1; min-width: 0; }
.row-name {
  font-size: 15px; font-weight: 500; letter-spacing: 0.1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row-meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; min-height: 15px; }
.row-code { font-size: 11px; color: var(--mute); font-family: var(--num); letter-spacing: 0.2px; }
.tag {
  font-size: 9.5px; line-height: 1;
  padding: 2.5px 5px;
  border-radius: 4px;
  color: var(--dim);
  background: var(--elev);
  letter-spacing: 0.2px;
}
.tag.sh { color: #FF9AA8; background: rgba(246, 70, 93, 0.12); }
.tag.sz { color: #7FC8FF; background: rgba(74, 158, 255, 0.12); }
.tag.bj { color: var(--gold); background: var(--gold-soft); }
.tag.gold { color: var(--gold); background: var(--gold-soft); }
.row-price { font-size: 16px; font-weight: 600; text-align: right; min-width: 72px; }
.row-chg { min-width: 74px; text-align: right; }
.chg {
  display: inline-block;
  min-width: 68px;
  padding: 4px 7px;
  border-radius: 8px;
  font-size: 12.5px; font-weight: 600;
  font-family: var(--num);
  text-align: center;
  background: var(--card-2);
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.chg.up { background: var(--up-soft); color: var(--up); }
.chg.down { background: var(--down-soft); color: var(--down); }
.chg.flat { color: var(--mute); }
.row-del {
  width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 50%; display: none; place-items: center;
  color: var(--up); background: var(--up-soft);
  margin-left: 2px;
}
.row-del .ico { width: 14px; height: 14px; }
.stock-list.editing .row-del { display: grid; }
.stock-list.editing .row-chg { display: none; }

.stock-list.compact .stock-row { min-height: 54px; padding: 9px 13px; }
.stock-list.compact .row-name { font-size: 14.5px; }
.stock-list.compact .row-price { font-size: 15px; }
.stock-list.compact .chg { min-width: 62px; font-size: 12px; padding: 3px 6px; }

.list-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--mute);
  font-size: 13px;
  line-height: 1.8;
}
.list-empty b { color: var(--text); font-weight: 500; }
.list-msg { padding: 14px; text-align: center; color: var(--mute); font-size: 12.5px; }

/* ---------------- 板块领涨 ---------------- */
.gainer-strip {
  display: flex; gap: 8px;
  overflow-x: auto; scrollbar-width: none;
  scroll-snap-type: x proximity;
  margin: 0 -14px; padding: 0 14px 2px;
}
.gainer-strip::-webkit-scrollbar { display: none; }
.gainer-card {
  flex: 0 0 124px;
  scroll-snap-align: start;
  padding: 10px 11px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  text-align: left;
}
.gainer-card:active { background: var(--card-2); }
.g-label { font-size: 10px; color: var(--mute); letter-spacing: 0.3px; }
.g-name { font-size: 13px; font-weight: 500; margin: 3px 0 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-price { font-size: 14.5px; font-weight: 600; }
.gainer-card .chg { min-width: 0; width: 100%; margin-top: 5px; font-size: 11.5px; padding: 3px 0; }

/* ---------------- 页脚 ---------------- */
.foot-note { margin: 22px 4px 4px; text-align: center; }
.foot-line { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; color: var(--mute); }
.foot-line .sep { opacity: 0.5; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--mute); flex: 0 0 6px; }
.dot.live { background: var(--down); box-shadow: 0 0 0 0 rgba(46, 189, 133, 0.55); animation: pulse 2.2s infinite; }
.dot.paused { background: var(--mute); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(46, 189, 133, 0.5); }
  70% { box-shadow: 0 0 0 7px rgba(46, 189, 133, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 189, 133, 0); }
}
.disclaimer { font-size: 10.5px; line-height: 1.7; color: var(--mute); opacity: 0.85; margin-top: 8px; }

/* ---------------- 芯片 / 分段 ---------------- */
.chip-row {
  display: flex; gap: 7px;
  overflow-x: auto; scrollbar-width: none;
  margin: 9px -14px 0; padding: 0 14px;
  scroll-snap-type: x proximity;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip-row.grow { margin: 0; padding: 0; flex: 1; }
.chip {
  flex: 0 0 auto;
  height: 31px; padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--dim);
  font-size: 12.5px;
  display: inline-flex; align-items: center; gap: 5px;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.chip:active { transform: scale(0.97); }
.chip.is-on { color: var(--gold); background: var(--gold-soft); border-color: rgba(240, 185, 11, 0.35); font-weight: 500; }
.chip .mini-chg { font-family: var(--num); font-size: 11px; opacity: 0.9; }
.chip .mini-chg.up { color: var(--up); }
.chip .mini-chg.down { color: var(--down); }

.filter-row { display: flex; align-items: center; gap: 7px; margin-top: 9px; }
.dir-btn {
  flex: 0 0 34px; height: 31px;
  border-radius: 9px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--gold); font-size: 15px; font-weight: 700;
  font-family: var(--num);
}
.filter-btn {
  flex: 0 0 auto; height: 31px; padding: 0 11px;
  border-radius: 9px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--dim); font-size: 12.5px;
  display: inline-flex; align-items: center; gap: 5px;
}
.filter-btn .ico { width: 14px; height: 14px; }
.filter-btn.is-on { color: var(--gold); border-color: rgba(240, 185, 11, 0.35); background: var(--gold-soft); }

.seg {
  display: flex; gap: 4px;
  padding: 3px;
  margin-top: 9px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
}
.seg button {
  flex: 1; height: 33px; border-radius: 9px;
  font-size: 13px; color: var(--dim);
  transition: background 0.15s, color 0.15s;
}
.seg button.is-on { background: var(--elev); color: var(--text); font-weight: 500; box-shadow: var(--shadow-sm); }

.mini-seg { display: flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--card-2); border: 1px solid var(--line); }
.mini-seg button {
  padding: 4px 8px; border-radius: 7px;
  font-size: 11px; color: var(--dim); letter-spacing: 0.2px;
}
.mini-seg button.is-on { background: var(--elev); color: var(--gold); font-weight: 500; }

/* ---------------- 加载 ---------------- */
.spinner {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  border-top-color: var(--gold);
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.chart-mask {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  border-radius: inherit;
  z-index: 3;
}
.chart-mask[hidden] { display: none !important; }
.chart-fail {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 18px; text-align: center;
}
.chart-fail p { font-size: 12px; line-height: 1.7; color: var(--mute); max-width: 240px; }
.chart-fail .text-btn { font-size: 12px; }
.load-more-wrap { padding: 16px 0 4px; text-align: center; }
.load-more {
  height: 38px; min-width: 140px; padding: 0 20px;
  border-radius: 12px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--dim); font-size: 13px;
}
.load-more:active { background: var(--card-2); }
.list-end { font-size: 11.5px; color: var(--mute); padding: 8px 0; }

.skeleton { position: relative; overflow: hidden; background: var(--card); border-radius: 10px; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.sk-row { height: 62px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 13px; }
.sk-line { height: 11px; border-radius: 6px; background: var(--card-2); }
.sk-line.w40 { width: 40%; }
.sk-line.w20 { width: 20%; }

/* ---------------- 行业页 ---------------- */
.ind-group { margin-top: 18px; }
.ind-group:first-child { margin-top: 16px; }
.ind-group-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ind-group-head h3 { font-size: 13.5px; font-weight: 600; color: var(--dim); letter-spacing: 0.3px; }
.ind-group-head .ind-stats { font-size: 11px; color: var(--mute); font-family: var(--num); }
.ind-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.ind-card {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  text-align: left;
  min-height: 54px;
}
.ind-card:active { background: var(--card-2); }
.ind-name { font-size: 13px; line-height: 1.3; }
.ind-chg { font-size: 12.5px; font-weight: 600; font-family: var(--num); flex: 0 0 auto; }
.ind-chg.up { color: var(--up); }
.ind-chg.down { color: var(--down); }
.ind-chg.flat { color: var(--mute); }

/* ---------------- 产业链 ---------------- */
.h-scroll {
  display: flex; gap: 9px;
  margin: 14px -14px 0; padding: 0 14px 2px;
  overflow-x: auto; scrollbar-width: none;
  scroll-snap-type: x mandatory;
}
.h-scroll::-webkit-scrollbar { display: none; }
.leader-card {
  flex: 0 0 172px;
  scroll-snap-align: start;
  padding: 11px 12px;
  border-radius: 15px;
  background: var(--card);
  border: 1px solid var(--line);
  text-align: left;
  position: relative;
}
.leader-card.is-on { border-color: rgba(240, 185, 11, 0.5); background: linear-gradient(160deg, var(--gold-soft), var(--card) 72%); }
.leader-card.is-on::before {
  content: ""; position: absolute; left: 12px; top: 0; width: 26px; height: 2px;
  background: var(--gold); border-radius: 0 0 2px 2px;
}
.ld-top { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.ld-name { max-width: 100%; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld-role { max-width: 100%; font-size: 9.5px; color: var(--gold); background: var(--gold-soft); padding: 2px 5px; border-radius: 4px; flex: 0 0 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld-code { font-size: 10.5px; color: var(--mute); font-family: var(--num); margin-top: 2px; }
.ld-price { font-size: 18px; font-weight: 600; margin-top: 7px; }
.ld-chg { font-size: 12px; font-weight: 600; font-family: var(--num); margin-top: 1px; }

.chart-box {
  position: relative;
  height: 200px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  overflow: hidden;
  padding: 4px 0;
}
.chart-box .chart { width: 100%; height: 100%; }

.mat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mat-card {
  padding: 10px 11px;
  border-radius: 13px;
  background: var(--card);
  border: 1px solid var(--line);
  min-height: 92px;
}
.mat-name { font-size: 12.5px; font-weight: 500; display: flex; align-items: baseline; gap: 4px; }
.mat-unit { font-size: 9.5px; color: var(--mute); font-weight: 400; }
.mat-row { display: flex; align-items: baseline; gap: 5px; margin-top: 5px; font-size: 11px; }
.mat-tag { font-size: 9px; color: var(--mute); background: var(--card-2); padding: 1.5px 4px; border-radius: 3px; flex: 0 0 auto; }
.mat-price { font-family: var(--num); font-size: 12.5px; font-weight: 600; }
.mat-chg { font-family: var(--num); font-size: 10.5px; margin-left: auto; }
.mat-chg.up, .mat-price.up { color: var(--up); }
.mat-chg.down, .mat-price.down { color: var(--down); }
.mat-spark { height: 26px; margin-top: 4px; }
.mat-empty { font-size: 10.5px; color: var(--mute); margin-top: 6px; }

/* ---------------- 学堂 ---------------- */
.term-group { margin-top: 18px; }
.term-group:first-child { margin-top: 16px; }
.term-group h3 { font-size: 13px; color: var(--dim); font-weight: 600; letter-spacing: 0.3px; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.term-group h3::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.term-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.term-card {
  text-align: left;
  padding: 10px 11px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  min-height: 60px;
}
.term-card:active { background: var(--card-2); }
.term-name { font-size: 13px; font-weight: 500; }
.term-abbr { font-size: 10px; color: var(--gold); font-family: var(--num); margin-left: 4px; }
.term-desc { font-size: 11px; color: var(--mute); line-height: 1.5; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.knowledge-section {
  margin-top: 14px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  overflow: hidden;
}
.knowledge-section:first-child { margin-top: 16px; }
.knowledge-head { display: flex; align-items: center; gap: 11px; padding: 13px 14px; border-bottom: 1px solid var(--line); }
.knowledge-icon { font-size: 20px; }
.knowledge-head h3 { font-size: 14.5px; font-weight: 600; }
.knowledge-head p { font-size: 11px; color: var(--mute); margin-top: 1px; }
.knowledge-list { padding: 2px 0; }
.knowledge-item { border-bottom: 1px solid var(--line); }
.knowledge-item:last-child { border-bottom: 0; }
.knowledge-q {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 14px; text-align: left; font-size: 13.5px; color: var(--text);
}
.knowledge-q .q-arrow { color: var(--mute); transition: transform 0.2s ease; font-size: 11px; }
.knowledge-q.active { color: var(--gold); }
.knowledge-q.active .q-arrow { transform: rotate(180deg); }
.knowledge-a {
  display: none;
  padding: 0 14px 14px;
  font-size: 12.5px; line-height: 1.75; color: var(--dim);
}
.knowledge-a.open { display: block; animation: dropIn 0.18s ease both; }

/* ---------------- 详情页 ---------------- */
.detail {
  position: fixed; inset: 0; z-index: 70;
  display: flex; flex-direction: column;
  background: var(--bg);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.3s;
  will-change: transform;
}
.detail.is-open { transform: none; visibility: visible; }
.detail-hd {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: calc(var(--safe-t) + 8px) 12px 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  z-index: 12;
}
.detail-hd .icon-btn { background: transparent; border-color: transparent; width: 34px; height: 34px; }
.dt-title { flex: 1; min-width: 0; text-align: center; }
.dt-title h1 { font-size: 16.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dt-title p { font-size: 10.5px; color: var(--mute); font-family: var(--num); letter-spacing: 0.3px; }
.star-btn .ico { fill: transparent; transition: fill 0.18s, color 0.18s; }
.star-btn.is-on { color: var(--gold); }
.star-btn.is-on .ico { fill: var(--gold); }
.star-btn[hidden] { display: none; }

.detail-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding-bottom: calc(var(--safe-b) + 22px);
}

.quote-hero { padding: 14px 16px 12px; }
.hero-main { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.hero-price { font-size: 34px; font-weight: 700; line-height: 1; letter-spacing: -0.8px; }
.hero-chg { font-size: 13px; font-weight: 600; display: flex; gap: 8px; padding-bottom: 3px; }
.hero-chg span { font-family: var(--num); }
.hero-stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 6px;
  margin-top: 14px;
  padding: 11px 12px;
  border-radius: 13px;
  background: var(--card);
  border: 1px solid var(--line);
}
.hero-stats .hs { min-width: 0; }
.hero-stats .hs span { display: block; font-size: 10px; color: var(--mute); }
.hero-stats .hs b { display: block; font-size: 12.5px; font-weight: 600; font-family: var(--num); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.detail-tabs {
  position: sticky; top: 0; z-index: 10;
  display: flex; gap: 3px;
  margin: 0 14px 10px;
  padding: 3px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
}
.detail-tabs button {
  flex: 1; height: 34px; border-radius: 9px;
  font-size: 13px; color: var(--dim);
  transition: background 0.15s, color 0.15s;
}
.detail-tabs button.is-on { background: var(--elev); color: var(--gold); font-weight: 600; box-shadow: var(--shadow-sm); }

.kline-box { height: clamp(260px, 44vh, 360px); margin: 0 14px; }
.ma-row { display: flex; justify-content: center; gap: 6px; margin: 9px 14px 0; flex-wrap: wrap; }
.ma-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 8px;
  font-size: 11px; font-family: var(--num);
  color: var(--dim); background: var(--card); border: 1px solid var(--line);
  transition: opacity 0.15s;
}
.ma-chip i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.ma-chip.is-off { opacity: 0.34; }
.ma-chip.is-off i { background: var(--mute) !important; }

.ind-wrap { margin: 18px 14px 0; }
.block-head.inner { margin: 0 2px 8px; }
.ind-box { height: 168px; }

/* 成交分析 */
.trade-block { margin: 18px 14px 0; }

/* 详情页「所属板块」 */
.sector-chips { margin-bottom: 9px; align-items: center; }
.chip.is-ghost {
  color: var(--dim);
  background: transparent;
  border-style: dashed;
  border-color: var(--line);
  pointer-events: none;
}
.sector-peers { margin-top: 2px; }
.sector-peers .row-meta .tag { opacity: 0.9; }
.trade-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.trade-title h2 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.trade-title h2::before { content: ""; width: 3px; height: 13px; border-radius: 2px; background: linear-gradient(180deg, var(--gold), rgba(240, 185, 11, 0.25)); }
.trade-sub { font-size: 10.5px; color: var(--mute); text-align: right; }
.stat-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}
.stat-cell {
  padding: 8px 9px;
  border-radius: 11px;
  background: var(--card);
  border: 1px solid var(--line);
  min-width: 0;
}
.stat-cell span { display: block; font-size: 10px; color: var(--mute); }
.stat-cell b { display: block; font-size: 13px; font-weight: 600; font-family: var(--num); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.split-card {
  margin-top: 10px;
  padding: 12px;
  border-radius: 13px;
  background: var(--card);
  border: 1px solid var(--line);
}
.split-row { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.split-row:last-child { margin-bottom: 0; }
.split-tag { font-size: 10.5px; color: var(--dim); flex: 0 0 54px; }
.split-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--card-2); overflow: hidden; }
.split-bar div { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.split-bar .buy { background: linear-gradient(90deg, rgba(246, 70, 93, 0.6), var(--up)); }
.split-bar .sell { background: linear-gradient(90deg, rgba(46, 189, 133, 0.6), var(--down)); }
.split-val { font-size: 11px; font-family: var(--num); flex: 0 0 auto; min-width: 88px; text-align: right; }

.depth { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.depth-col { padding: 9px 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.depth-title { font-size: 10px; color: var(--mute); margin-bottom: 5px; }
.depth-row { display: flex; align-items: center; gap: 4px; font-size: 11px; line-height: 1.85; font-family: var(--num); }
.depth-row .lv { flex: 0 0 24px; color: var(--mute); font-size: 10px; font-family: var(--font); }
.depth-row .p { flex: 1; text-align: right; }
.depth-row .v { flex: 0 0 46px; text-align: right; color: var(--dim); font-size: 10.5px; }
.depth-total { display: flex; justify-content: space-between; font-size: 10px; color: var(--mute); border-top: 1px solid var(--line); margin-top: 5px; padding-top: 5px; }

.ticks-card {
  border-radius: 13px;
  background: var(--card);
  border: 1px solid var(--line);
  overflow: hidden;
}
.ticks-scroll { max-height: 268px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.tick-head, .tick-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr 0.8fr;
  gap: 6px; padding: 6px 11px;
  font-size: 11px; font-family: var(--num);
  align-items: center;
}
.tick-head { position: sticky; top: 0; background: var(--card-2); color: var(--mute); font-family: var(--font); font-size: 10px; border-bottom: 1px solid var(--line); }
.tick-row { border-bottom: 1px solid var(--line); line-height: 1.25; }
.tick-row:last-child { border-bottom: 0; }
.tick-row .dir { font-size: 10px; font-family: var(--font); text-align: right; }
.tick-row .dir.buy { color: var(--up); }
.tick-row .dir.sell { color: var(--down); }
.tick-row .dir.mid { color: var(--mute); }

.chart-box.flow-box { height: 190px; margin-top: 9px; }

/* 板块成分股 */
.board-members { border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); overflow: hidden; }
.board-members .stock-row { min-height: 52px; }

/* ---------------- 底部导航 ---------------- */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0;
  z-index: 40;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  border-top: 1px solid var(--line);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .tabbar { background: rgba(11, 14, 17, 0.9); }
  html[data-theme="light"] .tabbar { background: rgba(255, 255, 255, 0.92); }
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--mute);
  font-size: 10px;
  position: relative;
  transition: color 0.16s ease;
}
.tab .ico { width: 21px; height: 21px; stroke-width: 1.7; }
.tab.is-on { color: var(--gold); }
.tab.is-on::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 22px; height: 2px; border-radius: 0 0 2px 2px;
  background: var(--gold);
}
.tab:active { color: var(--dim); }

/* ---------------- 弹层 ---------------- */
.sheet-mask {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  animation: fadeIn 0.18s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 91;
  max-height: 82vh;
  display: flex; flex-direction: column;
  background: var(--bg-soft);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--line-2);
  box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.4);
  padding-bottom: calc(var(--safe-b) + 10px);
  animation: sheetUp 0.28s cubic-bezier(0.32, 0.72, 0, 1) both;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet-handle { width: 36px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 8px auto 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px 10px; }
.sheet-head h3 { font-size: 16px; font-weight: 600; }
.sheet-body { overflow-y: auto; padding: 0 16px 6px; -webkit-overflow-scrolling: touch; }
.sheet-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; padding: 14px 2px;
  border-bottom: 1px solid var(--line);
  text-align: left; font-size: 14px;
}
.sheet-item:last-child { border-bottom: 0; }
.sheet-item .si-value { font-size: 12.5px; color: var(--mute); }
.sheet-label { font-size: 12px; color: var(--mute); margin: 14px 0 8px; }
.sheet-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sheet-chips .chip { height: 34px; }
.sheet-actions { padding: 12px 0 4px; display: flex; gap: 8px; }
.btn {
  flex: 1; height: 42px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--text); font-size: 14px;
}
.btn.primary { background: var(--gold); color: #221A02; border-color: transparent; font-weight: 600; }
.btn.danger { color: var(--up); background: var(--up-soft); border-color: transparent; }
.btn:active { opacity: 0.85; }
.sheet p.sheet-desc { font-size: 12.5px; line-height: 1.75; color: var(--dim); padding: 4px 0 8px; }
.sheet .term-head { padding: 2px 0 6px; }
.sheet .term-head h4 { font-size: 17px; font-weight: 600; }
.sheet .term-head p { font-size: 11px; color: var(--gold); font-family: var(--num); }

.switch {
  width: 46px; height: 27px; border-radius: 14px;
  background: var(--card-2); border: 1px solid var(--line);
  position: relative; transition: background 0.2s, border-color 0.2s;
  flex: 0 0 46px;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 21px; height: 21px; border-radius: 50%;
  background: var(--dim);
  transition: transform 0.2s ease, background 0.2s;
}
.switch.is-on { background: var(--gold-soft); border-color: rgba(240, 185, 11, 0.45); }
.switch.is-on::after { transform: translateX(19px); background: var(--gold); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 22px);
  transform: translate(-50%, 12px);
  z-index: 120;
  max-width: 82vw;
  padding: 9px 16px;
  border-radius: 12px;
  background: rgba(30, 36, 44, 0.96);
  color: #F3F5F7;
  font-size: 13px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
html[data-theme="light"] .toast { background: rgba(16, 24, 40, 0.92); }

/* ---------------- 下拉刷新 ---------------- */
.ptr {
  height: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 11.5px; color: var(--mute);
  transition: height 0.2s ease;
}
.ptr.pulling { transition: none; }
.ptr .spinner { width: 14px; height: 14px; border-width: 1.5px; }

/* ---------------- 小屏适配 ---------------- */
@media (max-width: 359px) {
  .hero-price { font-size: 30px; }
  .row-price { min-width: 62px; font-size: 15px; }
  .chg { min-width: 62px; font-size: 12px; }
  .index-card { min-width: 94px; padding: 9px; }
  .ix-price { font-size: 15px; }
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .term-grid, .mat-grid, .ind-grid { gap: 6px; }
}

/* 横屏 / 矮屏：压缩纵向留白 */
@media (max-height: 560px) {
  .quote-hero { padding-top: 10px; }
  .hero-stats { margin-top: 10px; }
  .kline-box { height: 220px; }
  .topbar { padding-top: calc(var(--safe-t) + 8px); padding-bottom: 8px; }
  .brand-text p { display: none; }
}

/* 平板 / 桌面预览：居中手机宽度 */
@media (min-width: 620px) {
  #app, .detail { width: 480px; left: 50%; right: auto; margin-left: -240px; }
  .detail { transform: translateX(100%); }
  .detail.is-open { transform: none; }
  .tabbar { width: 480px; left: 50%; margin-left: -240px; right: auto; border-radius: 0; }
  .sheet { width: 480px; left: 50%; margin-left: -240px; right: auto; }
  #app::before {
    content: ""; position: fixed; inset: 0; z-index: -1;
    background: radial-gradient(700px 500px at 50% 0%, rgba(74, 158, 255, 0.08), transparent 70%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
