/* 界面改版 v3：苹果毛玻璃（折射）风格，默认浅色，右上角可切深色。
 * 叠在 style.css 后面加载，只改外观和排列顺序，不动页面结构和脚本依赖的类名、id。
 * 颜色全部走变量：:root[data-theme] 的优先级高于 style.css 里的 :root 和系统深色媒体查询。
 *
 * 玻璃的做法：页面最底下铺一层固定的彩色柔光（body::before），
 * 卡片、顶栏、弹窗都是半透明 + 背景模糊（backdrop-filter），所以能透出模糊的彩光；
 * 卡片顶部一层淡淡的高光（--glass-sheen），四周一圈渐变细边（::after）模拟玻璃边缘的折射。 */

:root[data-theme="light"] {
  --bg: #e9eef6;
  --panel: rgba(255, 255, 255, .58);
  --panel-2: rgba(255, 255, 255, .52);
  --panel-3: rgba(255, 255, 255, .94);
  --glass-strong: rgba(255, 255, 255, .82);
  --glass-sheen: rgba(255, 255, 255, .55);
  --glass-edge: rgba(255, 255, 255, .95);
  --glass-edge-2: rgba(255, 255, 255, .35);
  --seg-track: rgba(118, 118, 128, .12);
  --text: #0b1220;
  --muted: #5b6579;
  --line: rgba(15, 23, 42, .08);
  --line-strong: rgba(15, 23, 42, .15);
  --grid: rgba(15, 23, 42, .06);
  --accent: #007aff;
  --accent-strong: #0062d6;
  --accent-bg: rgba(0, 122, 255, .12);
  --up: #0f9d58;
  --up-bg: rgba(15, 157, 88, .11);
  --down: #e5484d;
  --down-bg: rgba(229, 72, 77, .11);
  --flat: #5b6579;
  --flat-bg: rgba(91, 101, 121, .11);
  --caution: #a86400;
  --caution-bg: rgba(255, 170, 0, .15);
  --danger: #d92d20;
  --danger-bg: rgba(229, 72, 77, .12);
  --shadow: 0 12px 32px -10px rgba(30, 41, 80, .20), 0 2px 6px rgba(30, 41, 80, .05);
  --shadow-pop: 0 26px 60px -14px rgba(30, 41, 80, .32);
  --topbar-bg: rgba(255, 255, 255, .55);
  --primary-glow: rgba(0, 122, 255, .32);
  --chart-bg: rgba(255, 255, 255, 0);
  --blob-1: rgba(96, 165, 250, .55);
  --blob-2: rgba(244, 114, 182, .36);
  --blob-3: rgba(52, 211, 153, .34);
  --blob-4: rgba(251, 191, 36, .28);
  --blob-base-1: #eef3fb;
  --blob-base-2: #e6ebf5;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #090c13;
  --panel: rgba(30, 35, 48, .52);
  --panel-2: rgba(255, 255, 255, .05);
  --panel-3: rgba(255, 255, 255, .16);
  --glass-strong: rgba(34, 39, 54, .86);
  --glass-sheen: rgba(255, 255, 255, .06);
  --glass-edge: rgba(255, 255, 255, .24);
  --glass-edge-2: rgba(255, 255, 255, .04);
  --seg-track: rgba(118, 118, 128, .24);
  --text: #eef1f6;
  --muted: #9aa4b5;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .16);
  --grid: rgba(255, 255, 255, .05);
  --accent: #0a84ff;
  --accent-strong: #006be0;
  --accent-bg: rgba(10, 132, 255, .18);
  --up: #30d27c;
  --up-bg: rgba(48, 210, 124, .14);
  --down: #ff5c62;
  --down-bg: rgba(255, 92, 98, .14);
  --flat: #9aa4b5;
  --flat-bg: rgba(154, 164, 181, .13);
  --caution: #ffc24a;
  --caution-bg: rgba(255, 194, 74, .14);
  --danger: #ff6b62;
  --danger-bg: rgba(255, 107, 98, .14);
  --shadow: 0 14px 36px -12px rgba(0, 0, 0, .65), 0 2px 6px rgba(0, 0, 0, .25);
  --shadow-pop: 0 26px 60px -12px rgba(0, 0, 0, .75);
  --topbar-bg: rgba(22, 26, 36, .58);
  --primary-glow: rgba(10, 132, 255, .38);
  --chart-bg: rgba(0, 0, 0, 0);
  --blob-1: rgba(59, 130, 246, .30);
  --blob-2: rgba(168, 85, 247, .24);
  --blob-3: rgba(16, 185, 129, .18);
  --blob-4: rgba(245, 158, 11, .12);
  --blob-base-1: #0b0f18;
  --blob-base-2: #080a10;
  color-scheme: dark;
}

:root {
  --radius: 20px;
  --radius-sm: 12px;
  --glass-blur: blur(24px) saturate(180%);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --coin: var(--accent);
}

/* 每个币一个专属色：卡片左上角的圆点、详情页的币种按钮 */
[data-sym="BTC"] { --coin: #f7931a; }
[data-sym="ETH"] { --coin: #627eea; }
[data-sym="SOL"] { --coin: #9945ff; }
[data-sym="BNB"] { --coin: #f0b90b; }
[data-sym="ZEC"] { --coin: #e7a33e; }
[data-sym="BTW"] { --coin: #14b8c4; }

/* ---------- 全局与底层彩光 ---------- */
body {
  font-family: var(--font);
  font-size: 14.5px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  scrollbar-color: var(--line-strong) transparent;
}
body::before {
  content: "";
  position: fixed;
  inset: -10vmax;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(40vmax 32vmax at 12% 10%, var(--blob-1), transparent 70%),
    radial-gradient(36vmax 30vmax at 88% 6%, var(--blob-2), transparent 70%),
    radial-gradient(42vmax 34vmax at 80% 80%, var(--blob-3), transparent 70%),
    radial-gradient(38vmax 30vmax at 16% 92%, var(--blob-4), transparent 70%),
    linear-gradient(180deg, var(--blob-base-1), var(--blob-base-2));
}
::selection { background: var(--accent-bg); }
a { color: var(--accent); }
h2, h3, h4 { letter-spacing: .005em; }

/* ---------- 玻璃面：卡片、提示条、指南折叠块、短线决策卡 ---------- */
.card, .notice, .guide details, .sl-decision {
  position: relative;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, var(--glass-sheen), transparent 45%), var(--panel);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-edge), inset 0 -1px 0 var(--glass-edge-2);
}
.card { border-radius: var(--radius); }
/* 玻璃边缘的折射高光：一圈从左上到右下渐隐的细边，不盖住内容 */
.card::after, .notice::after, .sl-decision::after, .topbar::after {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, var(--glass-edge), transparent 32%, transparent 68%, var(--glass-edge-2));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}
/* 计算器结果栏原本是跟随滚动的，不能被上面的 relative 覆盖；顶栏悬浮后停靠位置往下挪 */
.calc-out { position: sticky; top: 92px; }

/* ---------- 去掉框内左侧的粗色条 ----------
 * 原来用左边粗线表示偏多 / 偏空 / 激进 / 保守，改成整块淡色底，信息不丢 */
.gate-overview, .sl-decision, .sl-horizon-setup,
.sl-news-item.positive, .sl-news-item.negative, .sl-news-item.unclear,
.sl-kline-scan-row.long, .sl-kline-scan-row.short,
.sl-signal.long, .sl-signal.short, .sl-signal.wait,
.sl-scenario.aggressive, .sl-scenario.conservative {
  border-left: 1px solid var(--line);
}
.news-impact, .sl-horizon-plain { border-left: 0; }
.news-impact { border-radius: 10px; }
.sl-horizon-plain { background: var(--accent-bg); }
.sl-decision.long { background: linear-gradient(160deg, var(--glass-sheen), transparent 45%), linear-gradient(var(--up-bg), var(--up-bg)), var(--panel); }
.sl-decision.short { background: linear-gradient(160deg, var(--glass-sheen), transparent 45%), linear-gradient(var(--down-bg), var(--down-bg)), var(--panel); }
.sl-news-item.positive, .sl-kline-scan-row.long, .sl-signal.long, .sl-scenario.conservative { background: var(--up-bg); }
.sl-news-item.negative, .sl-kline-scan-row.short, .sl-signal.short { background: var(--down-bg); }
.sl-scenario.aggressive { background: var(--caution-bg); }

/* ---------- 悬浮玻璃顶栏 ---------- */
.topbar {
  position: sticky;
  top: 10px;
  z-index: 20;
  width: calc(100% - 32px);
  max-width: 1320px;
  margin: 10px auto 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--topbar-bg);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  backdrop-filter: blur(28px) saturate(190%);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-edge);
}
.topbar-inner { max-width: none; min-height: 52px; padding: 7px 10px 7px 14px; gap: 10px 12px; }
.brand { align-items: center; gap: 10px; font-size: 16px; font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.brand::before {
  content: "";
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: conic-gradient(from 210deg, #34c759, #007aff, #af52de, #ff9f0a, #34c759);
  box-shadow: inset 0 0 0 5px var(--panel-3), 0 2px 6px rgba(0, 0, 0, .12);
}
.brand .src { font-size: 12px; }

/* 顶部页签：选中项是一颗玻璃胶囊 */
.tabs { gap: 2px; }
.tabs a {
  flex-shrink: 0;
  padding: 7px 13px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  transition: background .2s, color .2s, box-shadow .2s;
}
.tabs a:hover { background: var(--panel-2); color: var(--text); }
.tabs a.active {
  background: var(--panel-3);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08), inset 0 0 0 1px var(--line);
}

.status {
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  font-size: 12.5px;
}
.status.live .dot { animation: live-pulse 2s infinite; }
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 199, 89, .5); }
  70% { box-shadow: 0 0 0 6px rgba(52, 199, 89, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0); }
}

.theme-toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
  transition: color .2s, background .2s;
}
.theme-toggle:hover { color: var(--text); background: var(--panel-3); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .sun { display: none; }
.theme-toggle[data-mode="light"] .sun { display: block; }
.theme-toggle[data-mode="light"] .moon { display: none; }

/* ---------- iOS 风格分段选择器（时区、周期、币种、方向） ---------- */
.seg { gap: 2px; padding: 2px; border: 0; border-radius: 11px; background: var(--seg-track); }
.seg button { padding: 6px 12px; border-radius: 9px; color: var(--muted); font-weight: 600; transition: background .2s, color .2s, box-shadow .2s; }
.seg button:hover { color: var(--text); }
.seg button.active {
  background: var(--panel-3);
  color: var(--text);
  outline: none;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 1px 1px rgba(0, 0, 0, .04);
}
.tz button { padding: 4px 10px; font-size: 12.5px; }
.side button.active[data-side="long"] { color: var(--up); box-shadow: 0 3px 8px rgba(0, 0, 0, .1), inset 0 0 0 1px var(--up); }
.side button.active[data-side="short"] { color: var(--down); box-shadow: 0 3px 8px rgba(0, 0, 0, .1), inset 0 0 0 1px var(--down); }

/* ---------- 页面框架 ---------- */
.wrap { max-width: 1320px; padding: 16px 16px 56px; }
.notice {
  padding: 10px 16px 10px 40px;
  border-radius: 16px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}
.notice::before {
  content: "!";
  position: absolute;
  left: 13px;
  top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--caution-bg);
  color: var(--caution);
  font-size: 12px;
  font-weight: 800;
}
.alert { border-radius: 14px; }
.section-title { margin: 6px 2px 12px; font-size: 16px; font-weight: 700; }
.page-head h2 { font-size: 22px; }

/* ---------- 总览：币种卡片 ----------
 * 电脑上每行 3 张（6 个币正好 3+3），平板 2 张，手机 1 张 */
.coin-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.coin { gap: 8px; padding: 18px 18px 16px; transition: transform .2s, box-shadow .2s; }
.coin:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop), inset 0 1px 0 var(--glass-edge); }
.coin-head { align-items: center; }
.coin-head .sym, .ls-head .sym { display: inline-flex; align-items: center; margin-right: 8px; font-size: 17px; font-weight: 700; }
.coin-head .sym::before,
.ls-head .sym::before {
  content: "";
  width: 10px;
  height: 10px;
  margin-right: 9px;
  border-radius: 50%;
  background: var(--coin);
  box-shadow: 0 0 0 4px rgba(127, 127, 127, .12), 0 0 12px var(--coin);
}
.coin .chg { padding: 3px 10px; border-radius: 999px; background: var(--flat-bg); font-size: 13px; font-weight: 700; }
.coin .chg.up { background: var(--up-bg); }
.coin .chg.down { background: var(--down-bg); }
.big-price { margin-left: 0; padding: 0; font-size: 32px; font-weight: 700; letter-spacing: -.02em; }
.chg-lines { gap: 2px 16px; font-size: 13px; }
.chg-lines b { font-weight: 650; }

/* 价格跳动：只让数字颜色闪一下，不再整块底色闪 */
@keyframes glass-flash-up { from { color: var(--up); } to { color: var(--text); } }
@keyframes glass-flash-down { from { color: var(--down); } to { color: var(--text); } }
.flash-up { animation: glass-flash-up .9s ease-out; background: none; }
.flash-down { animation: glass-flash-down .9s ease-out; background: none; }

/* 周期表：周期 | 走势 | 这根 K 线涨跌（涨跌额 + 涨跌幅）| 热度，一行排齐 */
.tf-rows { gap: 0; margin-top: 6px; padding-top: 2px; border-top: 1px solid var(--line); }
.tf-rows li { grid-template-columns: 50px 72px minmax(0, 1fr) 30px; gap: 8px; align-items: center; min-height: 31px; padding: 4px 0; }
.tf-rows li.tf-head { min-height: 0; padding: 8px 0 4px; color: var(--muted); font-size: 11.5px; }
.tf-rows li.tf-head span:nth-child(n+3) { text-align: right; }
.tf-rows li.group-start { margin-top: 3px; padding-top: 8px; border-top: 1px dashed var(--line-strong); }
.tf-rows .tf-name { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.tf-rows .pill { justify-self: start; }
.tf-chg { display: contents; }
/* 放不下时让涨跌幅换行，绝不裁掉数字（裁掉负号会把跌看成涨） */
.tf-chg b {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0 8px;
  min-width: 0;
  white-space: nowrap;
  text-align: right;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.tf-chg b .pts { font-weight: 500; opacity: .72; }
.tf-chg b .pct { min-width: 56px; font-weight: 700; }
.tf-chg [data-f="rsi"] { text-align: right; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.pill { padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 650; }
.agree { padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); color: var(--muted); font-size: 12.5px; font-weight: 600; }
.ls-mini { gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.split { height: 6px; background: var(--seg-track); }
.more { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-size: 13.5px; font-weight: 650; }
.more:hover { text-decoration: underline; }

/* ---------- 详情 ----------
 * 排列顺序：币种 → 价格 → K 线图 → 合约市场数据（交易时最常看，紧跟图表）→ 各周期解读 → 1 小时细看 / 一周波动 */
#view-detail:not([hidden]) { display: flex; flex-direction: column; }
#view-detail > .coin-tabs { order: 1; align-self: flex-start; margin-bottom: 14px; }
#view-detail > .detail-head { order: 2; }
#view-detail > .chart-card { order: 3; }
#view-detail > h3.section-title:nth-of-type(2) { order: 4; }
#view-detail > .deriv-grid { order: 5; margin-bottom: 24px; }
#view-detail > h3.section-title:nth-of-type(1) { order: 6; }
#view-detail > .tf-grid { order: 7; }
#view-detail > .two-col { order: 8; }

.coin-tabs button::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--coin);
  vertical-align: 1px;
}
.detail-head { padding: 18px 22px; }
.d-price-row .big-price { font-size: 38px; }
.chart-card { padding: 14px 14px 10px; }
.chart { height: 470px; }
.ohlc { font-size: 12.5px; }
.tfcard { padding: 15px 16px; }
.tfcard.active { border-color: var(--accent); box-shadow: var(--shadow), inset 0 0 0 1px var(--accent), inset 0 1px 0 var(--glass-edge); }
.tfcard dt { font-size: 11.5px; letter-spacing: .02em; }
.deriv { padding: 16px 18px; }
.deriv-big { font-size: 22px; }
/* 年线卡片：每年一行，年份在左、涨跌在右 */
.year-list { grid-template-columns: minmax(0, 1fr); gap: 3px; font-size: 13px; }
.year-list li { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.year-list li:last-child { border-bottom: 0; }

/* ---------- 新手指南：居中，阅读宽度 ---------- */
.guide { max-width: 860px; margin: 0 auto; }

/* ---------- 表单、按钮、表格、弹窗 ---------- */
.field input, .field select, .sl-main select, .sl-main input, .sl-side input, .sl-side select, textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-bg); }
.ghost { border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); color: var(--text); }
.ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--panel-3); }
.sl-primary {
  border-radius: 14px;
  background: linear-gradient(180deg, #3d9bff, var(--accent) 55%, var(--accent-strong));
  box-shadow: 0 8px 22px var(--primary-glow), inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: transform .1s, box-shadow .2s;
}
.sl-primary:hover:not(:disabled) { box-shadow: 0 10px 26px var(--primary-glow), inset 0 1px 0 rgba(255, 255, 255, .35); }
.sl-primary:active:not(:disabled) { transform: translateY(1px) scale(.995); }
.tbl { border-radius: 12px; overflow: hidden; }
.tbl th, .tbl td { border-color: var(--line); }
.tbl th { background: var(--panel-2); color: var(--muted); font-size: 12.5px; font-weight: 650; }
.guide details { border-radius: 16px; }
.pop {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  backdrop-filter: blur(28px) saturate(190%);
  box-shadow: var(--shadow-pop), inset 0 1px 0 var(--glass-edge);
}
.q { border-color: var(--line-strong); background: var(--panel-2); }
.warn { border-radius: 12px; }

/* ---------- 短线开单分析 ---------- */
.sl-decision { border-radius: var(--radius); }
.sl-signal, .sl-scenario, .sl-news-item, .sl-kline-scan-row { border-radius: 14px; }
.sl-mobile-bar {
  border-top: 1px solid var(--line);
  background: var(--topbar-bg);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  backdrop-filter: blur(28px) saturate(190%);
  box-shadow: 0 -10px 30px -10px rgba(0, 0, 0, .25), inset 0 1px 0 var(--glass-edge);
}

/* ---------- 宽度适配 ---------- */
/* 顶栏一行放不下时，先收起副标题，再把状态文字收成一个绿点（断线等异常时仍显示文字） */
@media (max-width: 1500px) {
  .brand .src { display: none; }
}
@media (max-width: 1400px) {
  .status.live .txt { display: none; }
  .status.live { padding: 9px; }
}
@media (max-width: 1100px) {
  .coin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .calc-out { position: static; }
}
@media (max-width: 680px) {
  .coin-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  :root { --glass-blur: blur(18px) saturate(170%); --radius: 18px; }
  .topbar { top: 8px; width: calc(100% - 16px); margin-top: 8px; border-radius: 18px; }
  .topbar-inner { gap: 6px 8px; min-height: 0; padding: 7px 10px 0; }
  .brand { flex: 1; font-size: 15px; }
  .brand::before { width: 22px; height: 22px; box-shadow: inset 0 0 0 4px var(--panel-3); }
  .status { order: 2; padding: 4px 8px; }
  .status .txt { font-size: 11.5px; }
  .tz { order: 3; }
  .theme-toggle { order: 4; width: 30px; height: 30px; }
  .tabs { order: 5; flex-basis: 100%; margin: 0 -10px; padding: 2px 8px 7px; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { padding: 6px 11px; }
  .wrap { padding: 12px 10px 48px; }
  .notice { padding-left: 36px; font-size: 12px; }
  .notice::before { left: 11px; }
  .coin { padding: 15px; }
  .coin:hover { transform: none; }
  .big-price { font-size: 28px; }
  .tf-rows li { grid-template-columns: 42px 64px minmax(0, 1fr) 24px; gap: 6px; }
  .tf-chg b { gap: 0 6px; font-size: 12px; }
  .tf-chg b .pct { min-width: 50px; }
  #view-detail > .coin-tabs { align-self: stretch; }
  .detail-head { padding: 14px; }
  .d-price-row .big-price { font-size: 30px; }
  .chart { height: 340px; }
}

/* 不支持背景模糊的老浏览器：退回更不透明的底色，保证字看得清 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root[data-theme="light"] { --panel: rgba(255, 255, 255, .92); --topbar-bg: rgba(255, 255, 255, .95); }
  :root[data-theme="dark"] { --panel: rgba(24, 28, 39, .95); --topbar-bg: rgba(20, 24, 34, .96); }
}

/* =====================================================================
 * v3.1：顶栏防透字、行情条、回到顶部、详情币种栏吸顶、短线页重新排版
 * ===================================================================== */

/* 顶栏更不透明，下面滑过去的字不会透出来干扰 */
:root[data-theme="light"] { --topbar-bg: rgba(250, 252, 255, .84); --fade-bg: rgba(236, 241, 249, .92); }
:root[data-theme="dark"] { --topbar-bg: rgba(20, 24, 34, .86); --fade-bg: rgba(9, 12, 19, .92); }
.topbar { -webkit-backdrop-filter: blur(32px) saturate(200%); backdrop-filter: blur(32px) saturate(200%); }

/* 屏幕顶部的渐隐遮罩：往下滑时出现，滑到顶部的内容先变模糊、淡出，不和顶栏的字叠在一起，
 * 也挡住悬浮顶栏上方那一小段空隙 */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 15;
  height: calc(var(--topbar-top, 10px) + var(--topbar-h, 54px) + 16px);
  pointer-events: none;
  background: linear-gradient(180deg, var(--fade-bg) 0%, var(--fade-bg) 58%, transparent 100%);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  -webkit-mask-image: linear-gradient(180deg, #000 68%, transparent);
  mask-image: linear-gradient(180deg, #000 68%, transparent);
  opacity: 0;
  transition: opacity .2s;
}
.scrolled body::after { opacity: 1; }

/* ---------- 顶部行情条 ---------- */
.ticker { display: flex; gap: 10px; margin: 0 0 12px; padding: 2px 2px 4px; overflow-x: auto; scrollbar-width: none; }
.ticker::-webkit-scrollbar { display: none; }
.tick {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas: "sym chg" "price price";
  align-items: center;
  gap: 1px 12px;
  min-width: 132px;
  padding: 9px 14px 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(160deg, var(--glass-sheen), transparent 50%), var(--panel);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-edge);
  color: var(--text);
  text-decoration: none;
  transition: transform .15s, box-shadow .2s;
}
.tick:hover { transform: translateY(-1px); text-decoration: none; }
.tick.active { box-shadow: var(--shadow), inset 0 0 0 1.5px var(--coin), inset 0 1px 0 var(--glass-edge); }
.tick-sym { grid-area: sym; display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; font-weight: 700; }
.tick-sym::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--coin); box-shadow: 0 0 8px var(--coin); }
.tick-chg { grid-area: chg; justify-self: end; color: var(--muted); font-size: 12px; font-weight: 700; }
.tick-chg.up { color: var(--up); }
.tick-chg.down { color: var(--down); }
.tick-price { grid-area: price; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }

/* 总览里整张币卡都能点进详情 */
.coin:not(.gate-overview) { cursor: pointer; }

/* ---------- 回到顶部 ---------- */
.to-top {
  position: fixed;
  right: 18px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 25;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--topbar-bg);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-edge);
  color: var(--text);
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px) scale(.9);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top svg { width: 20px; height: 20px; }

/* ---------- 详情：往下滑时币种栏停在顶栏下面，随时能换币 ---------- */
#view-detail > .coin-tabs {
  position: sticky;
  top: calc(var(--topbar-top, 10px) + var(--topbar-h, 54px) + 8px);
  z-index: 16;
  background: var(--topbar-bg);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow);
}

/* ---------- 短线开单分析：重新排版 ----------
 * 电脑：左边操作区（①选行情 → ②设仓位 → ③核对账户 → 分析按钮），右边结果区（结论 → 方案 → 依据 → 材料），
 *       「未来走势」是另一个工具，放到最下面单独一块。
 * 手机：同样的顺序从上往下排。只改显示顺序，元素和 id 都没动。 */
#sl-main { counter-reset: sl-step; }
#sl-main > h3 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 16px; counter-increment: sl-step; }
#sl-main > h3::before {
  content: counter(sl-step);
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(180deg, #3d9bff, var(--accent));
  box-shadow: 0 4px 10px var(--primary-glow);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.sl-divider { height: 1px; margin: 4px 0; background: var(--line); }
.sl-tf-options button { border-radius: 14px; }

#view-shortline .sl-side { display: flex; flex-direction: column; gap: 12px; }
#sl-analysis { order: 1; }
#sl-kline-story { order: 2; }
#sl-charts { order: 3; }
#sl-news { order: 4; }
#view-shortline .sl-side > h3 { order: 5; margin: 6px 0 0; }
#sl-preview { order: 6; }
#sl-material-card { order: 7; }
#sl-context { order: 8; }
#sl-next { order: 9; }
#sl-history { order: 10; }
#view-shortline .sl-raw { order: 11; }
#view-shortline .sl-kline-guide { order: 12; }

#sl-main, #sl-decision, #sl-kline-story, #sl-news, #sl-analysis, #sl-horizon-setup, #sl-horizon-results, #sl-horizon {
  scroll-margin-top: calc(var(--topbar-top, 10px) + var(--topbar-h, 54px) + 16px);
}

@media (min-width: 861px) {
  #view-shortline:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(340px, 400px) minmax(0, 1fr);
    grid-template-areas:
      "head head"
      "main decision"
      "main side"
      "hsetup hsetup"
      "hres hres";
    grid-template-rows: auto auto 1fr auto auto;
    column-gap: 16px;
    align-items: start;
  }
  #view-shortline .sl-layout { display: contents; }
  #view-shortline .page-head { grid-area: head; }
  #sl-main { grid-area: main; align-self: start; margin: 0; }
  #sl-decision { grid-area: decision; margin: 0 0 16px; }
  #view-shortline .sl-side { grid-area: side; }
  #sl-horizon-setup { grid-area: hsetup; margin: 28px 0 14px; }
  #sl-horizon-results { grid-area: hres; }
}

@media (max-width: 860px) {
  #view-shortline:not([hidden]) { display: flex; flex-direction: column; gap: 12px; }
  #view-shortline .sl-layout { display: contents; }
  #view-shortline .page-head { order: 0; margin: 0; }
  #view-shortline .sl-mobile-jumps { order: 1; margin: 0; }
  #sl-main { order: 2; }
  #sl-decision { order: 3; margin: 0; }
  #view-shortline .sl-side { order: 4; }
  #sl-horizon-setup { order: 5; margin: 12px 0 0; }
  #sl-horizon-results { order: 6; margin: 0; }
}

@media (max-width: 700px) {
  /* 短线页手机底部有操作栏，回到顶部按钮往上让一让 */
  [data-view="shortline"] .to-top { bottom: calc(128px + env(safe-area-inset-bottom)); }
}

@media (max-width: 560px) {
  .ticker { gap: 8px; margin: 0 -10px 10px; padding: 2px 10px 4px; }
  .tick { min-width: 118px; padding: 8px 12px 9px; border-radius: 14px; }
  .tick-price { font-size: 15.5px; }
  #view-detail > .coin-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  #view-detail > .coin-tabs::-webkit-scrollbar { display: none; }
  #view-detail > .coin-tabs button { flex: none; }
  .to-top { right: 12px; width: 40px; height: 40px; }
}

/* =====================================================================
 * v3.2：顶栏贴顶（不再悬浮），正文永远不会从顶栏上方或后面透出来；手机顶栏固定两行
 * ===================================================================== */
:root[data-theme="light"] { --topbar-bg: rgba(248, 250, 253, .94); }
:root[data-theme="dark"] { --topbar-bg: rgba(16, 19, 27, .95); }
.topbar {
  top: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: 0 1px 0 var(--glass-edge) inset;
  transition: box-shadow .2s;
}
.topbar::after { display: none; }
.scrolled .topbar { box-shadow: 0 10px 28px -14px rgba(20, 30, 60, .28); }
.topbar-inner { max-width: 1320px; margin: 0 auto; padding: 8px 16px; }
/* 顶栏贴顶以后，不再需要顶部渐隐遮罩 */
body::after { display: none; }

/* 状态：只要有空间就显示文字；放不下时只留一个圆点（绿=实时，黄=备用通道，红=断开） */
.status .dot { flex: none; }
.status.polling .dot { background: var(--caution); box-shadow: 0 0 0 3px var(--caution-bg); }
.status.down .dot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
@media (max-width: 1400px) {
  .status .txt { display: none; }
  .status { padding: 9px; }
}

@media (max-width: 560px) {
  .topbar { top: 0; width: 100%; margin: 0; border-radius: 0; }
  .topbar-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 8px; padding: 8px 12px 0; }
  .brand { order: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 16px; }
  .status { order: 1; padding: 8px; }
  .status .txt { display: none; }
  .tz { order: 2; }
  .theme-toggle { order: 3; width: 32px; height: 32px; }
  .tabs { order: 4; grid-column: 1 / -1; margin: 0 -12px; padding: 4px 8px 8px; }
}

/* 顶部长提示：手机上收成一行，点一下展开 */
@media (max-width: 700px) {
  .notice { cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 36px; }
  .notice.open { white-space: normal; }
}
.notice-more { display: none; }
@media (max-width: 700px) {
  .notice-more {
    display: block;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--panel-3);
    color: var(--accent);
    font-size: 11.5px;
    font-weight: 700;
  }
  .notice.open { padding-right: 16px; padding-bottom: 30px; }
  .notice.open .notice-more { top: auto; bottom: 8px; transform: none; }
}

/* =====================================================================
 * v3.3：逐页手机排版
 * ===================================================================== */
/* 长说明：手机上默认两行 */
.clamp-more { display: none; }
@media (max-width: 700px) {
  .clamp:not(.open) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .clamp-more {
    display: inline-flex;
    align-self: flex-start;
    justify-self: start;
    width: auto;
    margin: -4px 0 4px;
    padding: 2px 0;
    border: 0;
    background: none;
    color: var(--accent);
    font-size: 12.5px;
    font-weight: 650;
    cursor: pointer;
  }
}

/* 新闻和大事件：分段切换（只在单栏时出现） */
.news-switch { display: none; }
@media (max-width: 960px) {
  .news-switch { display: flex; width: 100%; margin: 0 0 12px; }
  .news-switch button { flex: 1; padding: 8px 12px; }
  .news-layout[data-tab="news"] > .events-col,
  .news-layout[data-tab="events"] > .news-col { display: none; }
}

@media (max-width: 560px) {
  /* 详情：周期按钮一行左右滑 */
  #tf-tabs { flex-wrap: nowrap; width: 100%; overflow-x: auto; scrollbar-width: none; }
  #tf-tabs::-webkit-scrollbar { display: none; }
  #tf-tabs button { flex: none; }
  .detail-head { gap: 12px; }
  /* 图例、开高低收更紧凑 */
  .legend { gap: 4px 12px; padding-bottom: 6px; font-size: 12px; }
  .ohlc { gap: 0 10px; padding-bottom: 4px; font-size: 11.5px; }
  .chart-card { padding: 10px 8px 6px; }

  /* 「合约市场的情况」「每个周期」改成左右滑动的卡片，省掉大半屏 */
  #view-detail > .tf-grid,
  #view-detail > .deriv-grid {
    display: flex;
    gap: 10px;
    margin: 0 -10px 22px;
    padding: 2px 10px 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  #view-detail > .tf-grid::-webkit-scrollbar,
  #view-detail > .deriv-grid::-webkit-scrollbar { display: none; }
  #view-detail > .tf-grid > *,
  #view-detail > .deriv-grid > * { flex: 0 0 86%; scroll-snap-align: start; }
  #view-detail > h3.section-title { display: flex; justify-content: space-between; align-items: baseline; }
  #view-detail > h3.section-title::after { content: "左右滑动 →"; color: var(--muted); font-size: 12px; font-weight: 600; }
  .deriv { padding: 14px 16px; }

  /* 多空比卡片、两栏块内边距收一收 */
  .ls-card { gap: 12px; padding: 14px; }
  .two-col > .card { padding: 14px; }
}
@media (max-width: 560px) {
  /* 快讯分类按钮一行左右滑 */
  .news-filter { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .news-filter::-webkit-scrollbar { display: none; }
  .news-filter button { flex: none; }
}

/* =====================================================================
 * v3.4：走势小图、24 小时区间条、多空对比总表、计算器结果卡片、按压反馈
 * ===================================================================== */
/* 总览：价格 + 24 小时走势小图 */
.price-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.price-row .big-price { min-width: 0; }
.coin-spark { flex: 0 0 116px; height: 40px; }
.pspark { display: block; width: 100%; height: 100%; overflow: visible; }
.pspark polyline { fill: none; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.pspark polygon { stroke: none; opacity: .14; }
.pspark.up polyline { stroke: var(--up); }
.pspark.up polygon { fill: var(--up); }
.pspark.down polyline { stroke: var(--down); }
.pspark.down polygon { fill: var(--down); }

/* 24 小时区间条：左低右高，圆点是现价的位置 */
.range24 { display: grid; gap: 6px; margin-top: 2px; }
.range-labels { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; }
.range-labels b { color: var(--text); font-weight: 600; }
.range-bar {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--down-bg), var(--seg-track) 50%, var(--up-bg));
}
.range-bar i {
  position: absolute;
  top: 50%;
  left: var(--pos, 50%);
  width: 12px;
  height: 12px;
  border: 2px solid var(--panel-3);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
  transform: translate(-50%, -50%);
  transition: left .4s ease;
}
#d-range-bar { max-width: 360px; margin-top: 8px; }

/* 多空比页：五币对比总表 */
.ls-table-card { margin-bottom: 16px; padding: 6px; }
.ls-table { width: 100%; border: 0; border-collapse: separate; border-spacing: 0; }
.ls-table th, .ls-table td { padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
.ls-table thead th { background: transparent; color: var(--muted); font-size: 12px; font-weight: 650; }
.ls-table tbody tr:last-child th, .ls-table tbody tr:last-child td { border-bottom: 0; }
.ls-table tbody th { font-weight: 700; }
.ls-table tbody th .sym { display: inline-flex; align-items: center; font-size: 15px; }
.ls-table tbody th .sym::before { content: ""; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--coin); box-shadow: 0 0 8px var(--coin); }
.ls-table tr[data-sym] { --coin: var(--accent); }
.ls-table tr[data-sym="BTC"] { --coin: #f7931a; }
.ls-table tr[data-sym="ETH"] { --coin: #627eea; }
.ls-table tr[data-sym="SOL"] { --coin: #9945ff; }
.ls-table tr[data-sym="BNB"] { --coin: #f0b90b; }
.ls-table tr[data-sym="ZEC"] { --coin: #e7a33e; }
.ls-table td { font-size: 13.5px; }
.ls-table td b { margin-right: 6px; font-size: 15px; }
.ls-table td .up { color: var(--up); font-weight: 600; margin-right: 10px; }
.ls-table td .down { color: var(--down); font-weight: 600; }
.ls-table td b.up, .ls-table td b.down { margin-right: 6px; }
.mini-split { display: block; width: 110px; height: 4px; margin-top: 6px; border-radius: 999px; background: var(--down); opacity: .9; overflow: hidden; }
.mini-split i { display: block; height: 100%; background: var(--up); }
@media (max-width: 700px) {
  /* 手机上表格左右滑，第一列（币种）固定不动 */
  .ls-table th:first-child, .ls-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--panel-3); }
  .ls-table th, .ls-table td { padding: 9px 10px; }
}

/* 开单计算器：结果从一行行列表改成一格格卡片，关键数字更醒目 */
.calc-out .res { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.calc-out .res-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
}
.calc-out .res-row:first-child { border-top: 1px solid var(--line); }
.calc-out .res-key { font-size: 12px; }
.calc-out .res-val { font-size: 18px; font-weight: 700; line-height: 1.3; word-break: break-word; }
.calc-out .res-note { font-size: 12px; line-height: 1.45; }
.calc-out .res-val.loss { color: var(--down); }
.calc-out .res-val.gain { color: var(--up); }
@media (max-width: 360px) {
  .calc-out .res { grid-template-columns: minmax(0, 1fr); }
}

/* 按压反馈：手机上点下去轻轻一缩，手感更像 App */
.seg button, .tabs a, .tick, .ghost, .sl-primary, .theme-toggle, .to-top, .news-switch button, .sl-tf-options button, .sl-mobile-bar button {
  -webkit-tap-highlight-color: transparent;
}
.seg button:active, .tabs a:active, .tick:active, .ghost:active, .theme-toggle:active, .to-top:active,
.sl-tf-options button:active, .sl-mobile-bar button:active { transform: scale(.96); }
.coin:not(.gate-overview):active { transform: scale(.99); }

@media (max-width: 560px) {
  .coin-spark { flex-basis: 104px; height: 36px; }
  .price-row { min-height: 40px; }
}
@media (max-width: 560px) {
  /* 分类按钮条要限定宽度，多出来的在条内左右滑，不能把整页撑宽 */
  .news-filter { display: flex; width: 100%; max-width: 100%; }
}

/* =====================================================================
 * v4：手机 App 模式——底部 Tab 栏、底部弹出面板、可折叠卡片（电脑版不受影响）
 * ===================================================================== */
.tabbar { display: none; }

/* 底部弹出面板 */
.sheet-wrap { position: fixed; inset: 0; z-index: 70; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(10, 14, 25, .32); opacity: 0; transition: opacity .25s; }
.sheet {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  max-height: 80vh;
  overflow: auto;
  padding: 8px 16px 18px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(30px) saturate(190%);
  backdrop-filter: blur(30px) saturate(190%);
  box-shadow: var(--shadow-pop), inset 0 1px 0 var(--glass-edge);
  transform: translateY(110%);
  transition: transform .26s cubic-bezier(.2, .8, .2, 1);
}
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-grabber { width: 38px; height: 5px; margin: 2px auto 10px; border-radius: 3px; background: var(--line-strong); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sheet-head h3 { font-size: 17px; }
.sheet-close { padding: 4px 2px; border: 0; background: none; color: var(--accent); font-size: 15px; font-weight: 650; cursor: pointer; }
.sheet-list { display: grid; gap: 8px; }
.sheet-link {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
}
.sheet-link:active { transform: scale(.98); }
.sheet-icon { display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 13px; background: var(--accent-bg); color: var(--accent); }
.sheet-icon svg { width: 22px; height: 22px; }
.sheet-text b { display: block; font-size: 15px; }
.sheet-text small { display: block; margin-top: 1px; color: var(--muted); font-size: 12.5px; }
.sheet-chev { color: var(--muted); }
.sheet-chev svg { width: 18px; height: 18px; }
.sheet-open body { overflow: hidden; }

/* 电脑上没有折叠、摘要和 Tab 栏 */
@media (min-width: 701px) {
  .sl-step-summary, .cz-toggle, .cz-chev { display: none !important; }
}

@media (max-width: 700px) {
  :root { --tabbar-h: 62px; }
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }

  /* 顶部那一行页面标签交给底部 Tab 栏，顶栏只剩一行 */
  .topbar .tabs { display: none; }

  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--topbar-bg);
    -webkit-backdrop-filter: blur(28px) saturate(190%);
    backdrop-filter: blur(28px) saturate(190%);
    box-shadow: 0 -8px 24px -14px rgba(20, 30, 60, .28);
  }
  .tabbar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 48px;
    padding: 4px 2px;
    border: 0;
    border-radius: 12px;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color .15s, transform .1s;
  }
  .tabbar-item svg { width: 24px; height: 24px; }
  .tabbar-item.active { color: var(--accent); }
  .tabbar-item.active svg { filter: drop-shadow(0 3px 6px var(--primary-glow)); }
  .tabbar-item:active { transform: scale(.92); }

  /* 短线页自己的底部操作栏放到 Tab 栏上方，只留一排按钮 */
  .sl-mobile-bar { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)) !important; padding: 6px 10px !important; box-shadow: none !important; }
  .sl-mobile-bar-status { display: none !important; }
  .sl-mobile-bar button { min-height: 38px !important; border-radius: 12px !important; }
  #view-shortline:not([hidden]) { padding-bottom: 64px !important; }
  .to-top { bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom)); }
  [data-view="shortline"] .to-top { bottom: calc(var(--tabbar-h) + 70px + env(safe-area-inset-bottom)); }

  /* 通用折叠 */
  .cz.collapsed > :not(.cz-head):not(.cz-keep) { display: none !important; }
  .cz-head { cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .cz-chev { display: inline-flex; flex: none; margin-left: auto; color: var(--muted); transition: transform .2s; }
  .cz-chev svg { width: 18px; height: 18px; }
  .cz:not(.collapsed) > .cz-head .cz-chev { transform: rotate(90deg); }
  .card-title.cz-head, .sl-kline-guide > h3.cz-head { display: flex; align-items: center; gap: 6px; margin: 0; }
  .cz:not(.collapsed) > .card-title.cz-head, .cz:not(.collapsed) > .sl-kline-guide > h3.cz-head { margin-bottom: 10px; }
  .ls-card.cz.collapsed { gap: 0; }
  .ls-head.cz-head .cz-chev { margin-left: 8px; }

  /* 总览币卡：收起时只留价格、走势、涨跌、区间条 */
  .cz-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 2px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-2);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
  }
  .cz-toggle svg { width: 16px; height: 16px; color: var(--muted); transition: transform .2s; }
  .coin:not(.collapsed) .cz-toggle svg { transform: rotate(90deg); }
  .coin.collapsed .more { margin-top: 0; }

  /* 短线 ② 设仓位：收成一行摘要 */
  .sl-step-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-2);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
  }
  .sl-step-summary b { flex: none; color: var(--accent); }
  .step2-collapsed .sl-step2-body,
  .step2-collapsed .sl-step2-body + .clamp-more { display: none !important; }

  /* 新闻快讯：只露标签，依据点开看 */
  .news-impact { cursor: pointer; }
  .news-impact:not(.open) > :not(:first-child) { display: none; }
  .news-impact:not(.open) > b::after { content: " · 看依据"; color: var(--muted); font-weight: 500; }

  /* 「?」解释：改成从底部弹出的小面板 */
  .pop {
    position: fixed !important;
    top: auto !important;
    left: 10px !important;
    right: 10px !important;
    bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom)) !important;
    z-index: 60;
    width: auto !important;
    max-height: 55vh;
    overflow: auto;
    padding: 18px 18px 20px;
    border-radius: 22px;
  }
}
@media (max-width: 700px) {
  .coin.cz { scroll-margin-top: calc(var(--topbar-h, 60px) + 8px); }
  .coin.collapsed .cz-opened, .coin:not(.collapsed) .cz-closed { display: none; }
  .coin:not(.collapsed) .cz-toggle { justify-content: center; gap: 6px; color: var(--muted); }
  .coin:not(.collapsed) .cz-toggle svg { transform: rotate(-90deg); }
}

/* ---------- v4.1 详情币种栏：贴紧顶栏、不透字 ---------- */
:root { --gutter: 16px; }
:root[data-theme="light"] { --band-bg: rgb(248, 250, 253); }
:root[data-theme="dark"] { --band-bg: rgb(16, 19, 27); }
@media (max-width: 560px) { :root { --gutter: 10px; } }
#view-detail > .coin-tabs { top: calc(var(--topbar-top, 0px) + var(--topbar-h, 54px)); }
/* 电脑：平时是一颗胶囊；停住后左右用同色铺满整行（不改尺寸，不会抖） */
@media (min-width: 701px) {
  #view-detail > .coin-tabs.stuck {
    border-radius: 0;
    border-color: transparent;
    background: var(--band-bg);
    box-shadow: 0 0 0 100vmax var(--band-bg);
    clip-path: inset(0 -100vmax);
  }
}
/* 手机：一直是贴边的整条，像 App 的二级导航 */
@media (max-width: 700px) {
  #view-detail > .coin-tabs {
    align-self: stretch;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 calc(-1 * var(--gutter)) 12px;
    padding: 6px var(--gutter);
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: var(--band-bg);
    box-shadow: none;
  }
  #view-detail > .coin-tabs::-webkit-scrollbar { display: none; }
  #view-detail > .coin-tabs button { flex: none; }
}
@media (max-width: 700px) {
  .sl-mobile-jumps { scrollbar-width: none; }
  .sl-mobile-jumps::-webkit-scrollbar { display: none; }
}
/* 新闻：每条下面那句长说明在手机上缩成一行短标签，意思不变 */
@media (max-width: 700px) {
  .news-rx { flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 0; }
  .news-rx::before { content: "之后涨跌（不一定因新闻）"; color: var(--muted); font-size: 12px; }
  .news-rx > * { font-size: 12.5px; }
}

/* 计算器底部结果条（只在手机的计算器页出现） */
.calc-bar { display: none; }
@media (max-width: 700px) {
  [data-view="calc"] .calc-bar {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(var(--tabbar-h) + 8px + env(safe-area-inset-bottom));
    z-index: 35;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 46px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--band-bg);
    box-shadow: var(--shadow-pop);
    color: var(--text);
    font: inherit;
    font-size: 13.5px;
    font-weight: 650;
    text-align: left;
    cursor: pointer;
    transition: opacity .2s, transform .2s;
  }
  [data-view="calc"] .calc-bar.hide { opacity: 0; transform: translateY(12px); pointer-events: none; }
  .calc-bar-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .calc-bar.empty .calc-bar-text { color: var(--muted); }
  .calc-bar.ok::before, .calc-bar.warn::before { content: ""; flex: none; width: 8px; height: 8px; margin-right: -2px; border-radius: 50%; background: var(--up); }
  .calc-bar.warn::before { background: var(--caution); }
  .calc-bar-text { flex: 1; }
  .calc-bar b { flex: none; color: var(--accent); }
  [data-view="calc"] .to-top { bottom: calc(var(--tabbar-h) + 64px + env(safe-area-inset-bottom)); }
  [data-view="calc"] #view-calc { padding-bottom: 60px; }
}

/* 新手指南：iOS 列表式的右侧箭头代替三角 */
.guide details > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; list-style: none; }
.guide details > summary::-webkit-details-marker { display: none; }
.guide details > summary::after {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform .2s;
}
.guide details[open] > summary::after { transform: rotate(45deg); }
/* 计算结果：手机上状态和价格这两条长的占整行，其余两两并排 */
@media (max-width: 700px) {
  .calc-out .res { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 8px; }
  .calc-out .res > .res-row:nth-child(1), .calc-out .res > .res-row:nth-child(3) { grid-column: 1 / -1; }
  .calc-out .res-row { padding: 11px 12px; }
  .calc-out .res-val { font-size: 15.5px; }
  .calc-out .res-note { font-size: 11.5px; }
}
@media (max-width: 360px) {
  .calc-out .res { grid-template-columns: minmax(0, 1fr); }
}

/* =====================================================================
 * v4.2 防抖：顶栏改 fixed（iPhone 回弹时不跟着跑，也不和毛玻璃一起抖）；
 * 去掉滚动起手时整卡缩放、顶栏里一直闪的呼吸灯
 * ===================================================================== */
:root { --topbar-h: 54px; }
@media (max-width: 700px) { :root { --topbar-h: 44px; } }
.topbar { position: fixed !important; top: 0 !important; left: 0; right: 0; width: auto !important; }
body { padding-top: var(--topbar-h); }
html { scroll-padding-top: calc(var(--topbar-h) + 10px); }
.coin.cz { scroll-margin-top: 0; }
.coin:not(.gate-overview):active, .tick:active { transform: none; }
.coin, .tick, .cz-head, .news-impact { -webkit-tap-highlight-color: transparent; }
.status.live .dot { animation: none; box-shadow: 0 0 0 3px rgba(52, 199, 89, .2); }
@media (max-width: 560px) {
  .topbar-inner { padding: 6px 12px; }
}

/* =====================================================================
 * v4.3 短线页手机版：五段分段控件（设置/结果/依据/新闻/走势），一次只看一段
 * ===================================================================== */
.sl-seg, .sl-seg-cta, .sl-seg-empty, .sl-dec-more { display: none; }
@media (max-width: 700px) {
  /* 原来的跳转条、底部四个按钮由分段控件代替 */
  #view-shortline .sl-mobile-jumps, .sl-mobile-bar { display: none !important; }
  #view-shortline:not([hidden]) { padding-bottom: 0 !important; }
  [data-view="shortline"] .to-top { bottom: calc(var(--tabbar-h) + 76px + env(safe-area-inset-bottom)); }
  #view-shortline > .page-head { margin: 0 0 10px; }
  #view-shortline > .page-head h2 { font-size: 22px; }
  #view-shortline > .page-head > p, #view-shortline > .page-head > .clamp-more { display: none !important; }

  /* 分段控件：贴在顶栏下面，iOS 那种灰底白块 */
  #view-shortline > .sl-seg {
    position: sticky;
    top: var(--topbar-h);
    z-index: 15;
    order: 0;
    display: block;
    margin: 0 calc(-1 * var(--gutter)) 12px;
    padding: 7px var(--gutter);
    border-bottom: 1px solid var(--line);
    background: var(--band-bg);
  }
  .sl-seg-track { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; padding: 2px; border-radius: 11px; background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line); }
  .sl-seg button {
    position: relative;
    min-height: 34px;
    padding: 0 2px;
    border: 0;
    border-radius: 9px;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .15s, color .15s;
  }
  .sl-seg button.active { background: var(--band-bg); color: var(--text); box-shadow: 0 1px 4px rgba(20, 30, 60, .14), 0 0 0 .5px var(--line); }
  .sl-seg button i { display: none; }
  .sl-seg button.fresh i { position: absolute; top: 6px; right: 10%; display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

  /* 只显示当前这一段 */
  #view-shortline[data-seg="setup"] [data-sl-seg]:not([data-sl-seg="setup"]),
  #view-shortline[data-seg="result"] [data-sl-seg]:not([data-sl-seg="result"]),
  #view-shortline[data-seg="basis"] [data-sl-seg]:not([data-sl-seg="basis"]),
  #view-shortline[data-seg="news"] [data-sl-seg]:not([data-sl-seg="news"]),
  #view-shortline[data-seg="trend"] [data-sl-seg]:not([data-sl-seg="trend"]),
  #view-shortline[data-seg="setup"] .sl-side,
  #view-shortline[data-seg="trend"] .sl-side,
  #view-shortline[data-seg="result"][data-sl-has-analysis="0"] .sl-side,
  #view-shortline[data-seg="news"][data-sl-has-news="0"] .sl-side,
  #view-shortline[data-seg="news"][data-sl-has-news="1"] .sl-seg-empty { display: none !important; }

  /* 设置段：分析按钮停在屏幕底部，随时能点 */
  #view-shortline[data-seg="setup"] #sl-copy {
    position: sticky;
    bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom));
    z-index: 6;
    box-shadow: 0 12px 26px -10px var(--primary-glow), 0 0 0 4px var(--band-bg);
  }

  /* 结果段 */
  .sl-seg-cta { order: 3; display: block; margin: -2px 0 12px; }
  .sl-seg-cta .sl-primary { width: 100%; }
  .sl-seg-empty { order: 4; display: block; padding: 18px; text-align: center; }
  .sl-seg-empty b { display: block; margin-bottom: 6px; font-size: 16px; }
  .sl-seg-empty p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
  .sl-dec-more {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-2);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 650;
    text-align: left;
    cursor: pointer;
  }
  .sl-dec-more[hidden] { display: none; }
  .sl-dec-more svg { width: 16px; height: 16px; color: var(--muted); transition: transform .2s; }
  .sl-dec-more.open svg { transform: rotate(90deg); }
  .sl-dec-more.open .cz-closed, .sl-dec-more:not(.open) .cz-opened { display: none; }
  .sl-dec-more:not(.open) ~ #sl-decision-structure,
  .sl-dec-more:not(.open) ~ #sl-decision-news,
  .sl-dec-more:not(.open) ~ #sl-decision-activity,
  .sl-dec-more:not(.open) ~ #sl-decision-level,
  .sl-dec-more:not(.open) ~ #sl-decision-time { display: none !important; }

  /* 两套方案：结构条件先露两行，点方案卡展开 */
  #sl-analysis .sl-scenario { cursor: pointer; -webkit-tap-highlight-color: transparent; }
  #sl-analysis .sl-scenario:not(.open) > p.muted.small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  #sl-analysis .sl-scenario:not(.open) > span::after { content: " · 点开看完整条件"; color: var(--accent); }

  /* K 线依据：每一步先只露「第几步 + 结论」，点开看数字 */
  #sl-kline-story .sl-kline-step {
    position: relative;
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 4px 10px;
    padding: 12px 34px 12px 12px;
    border-top-width: 1px;
    border-top-color: var(--line);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  #sl-kline-story .sl-kline-step-number { grid-row: span 2; align-self: start; }
  #sl-kline-story .sl-kline-step > h4 { font-size: 12.5px; }
  #sl-kline-story .sl-kline-step-lead { font-size: 15.5px; }
  #sl-kline-story .sl-kline-step > p { grid-column: 1 / -1; margin: 4px 0 0; }
  #sl-kline-story .sl-kline-step:not(.open) > p { display: none; }
  #sl-kline-story .sl-kline-step::after {
    content: "";
    position: absolute;
    top: 20px;
    right: 15px;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(-45deg);
    transition: transform .2s;
  }
  #sl-kline-story .sl-kline-step.open::after { transform: rotate(45deg); }
  #sl-kline-story .sl-kline-step.long .sl-kline-step-number { background: var(--up-bg); color: var(--up); }
  #sl-kline-story .sl-kline-step.short .sl-kline-step-number { background: var(--down-bg); color: var(--down); }
}
.sl-ai-card { margin: 20px 0; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel-2); }
.sl-ai-card h3 { margin: 0 0 8px; }
.sl-ai-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.sl-ai-actions select { min-width: 150px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--text); }
.sl-ai-result { margin-top: 12px; padding: 14px; border-left: 4px solid var(--accent); border-radius: 8px; background: var(--panel); line-height: 1.65; overflow-wrap: anywhere; }
.sl-ai-result p { margin: 10px 0; }
@media (max-width: 640px) { .sl-ai-actions { display: grid; grid-template-columns: 1fr; } .sl-ai-actions select, .sl-ai-actions button { width: 100%; } }

/* v4.3.1 AI 深度复核卡：排在两套方案后面（原来没有顺序会跑到右栏最上面）；结果框不要左侧粗条 */
#view-shortline .sl-ai-card { order: 0; }
.sl-ai-result { border-left: 1px solid var(--line); background: var(--panel); }
.sl-ai-conversation, .market-ai-conversation { display: flex; flex-direction: column; gap: 10px; min-width: 0; margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.sl-ai-conversation .sl-ai-result { margin: 0; }
.sl-ai-conversation .sl-ai-chat-head { margin-top: 0; }
.sl-ai-conversation .sl-ai-chat-log, .market-ai-conversation .sl-ai-chat-log { margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
.sl-ai-conversation .sl-ai-chat-form, .market-ai-conversation .sl-ai-chat-form { margin: 0; }
.sl-ai-conversation .sl-ai-suggestions, .market-ai-conversation .market-ai-prompts { margin: 0; }
.sl-ai-chat-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px; }
.sl-ai-chat-head .ghost { padding: 6px 10px; font-size: 12px; }
.sl-ai-chat-log { display: flex; flex-direction: column; gap: 10px; min-height: 84px; max-height: 360px; overflow: auto; margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); scroll-behavior: smooth; }
.sl-ai-chat-log > p { margin: 0; }
.sl-ai-message { max-width: 92%; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); color: var(--text); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.sl-ai-message.user { align-self: flex-end; background: var(--accent); color: #fff; }
.sl-ai-message.assistant, .sl-ai-message.system { align-self: flex-start; }
.sl-ai-message strong { display: block; margin-bottom: 4px; }
.sl-ai-message p { margin: 0 0 8px; }
.sl-ai-message p:last-child { margin-bottom: 0; }
.sl-ai-message details { margin-top: 8px; font-size: 12px; }
.sl-ai-message summary { cursor: pointer; }
.sl-ai-suggestions { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0; }
.sl-ai-suggestions button { padding: 7px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text); font: inherit; font-size: 12px; cursor: pointer; }
.sl-ai-suggestions button:disabled { opacity: .55; cursor: not-allowed; }
.sl-ai-chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.sl-ai-chat-form label { grid-column: 1 / -1; font-size: 13px; font-weight: 650; }
.sl-ai-chat-form textarea { min-height: 56px; max-height: 150px; width: 100%; resize: vertical; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); font: inherit; box-sizing: border-box; }
.sl-ai-chat-form button { min-width: 96px; min-height: 44px; }
#sl-ai-chat-status { margin: 8px 0 0; }
.sl-ai-help { margin-top: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.sl-ai-help summary { cursor: pointer; font-weight: 650; }
.sl-ai-config-form { display: grid; grid-template-columns: 1fr; gap: 6px; margin-top: 12px; }
.sl-ai-config-form label { margin-top: 6px; font-size: 13px; font-weight: 650; }
.sl-ai-config-form input, .sl-ai-config-form select { width: 100%; min-width: 0; box-sizing: border-box; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--text); font: inherit; }
.sl-ai-config-form #sl-ai-custom-fields:not([hidden]) { display: grid; gap: 6px; }
.sl-ai-config-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.sl-ai-config-buttons button { min-height: 42px; }
.market-ai-card { margin-bottom: 18px; padding: 18px; }
.market-ai-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.market-ai-head h2 { margin: 0 0 5px; font-size: 21px; }
.market-ai-head p { margin: 0; }
.market-ai-badge { flex: none; padding: 5px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); font-size: 12px; }
.market-ai-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 15px 0 8px; }
.market-ai-toolbar label { display: grid; gap: 4px; min-width: 130px; font-size: 12px; color: var(--muted); }
.market-ai-toolbar select { min-height: 42px; border: 1px solid var(--line); border-radius: 9px; padding: 8px; background: var(--panel); color: var(--text); font: inherit; font-size: 14px; }
.market-ai-toolbar button { min-height: 42px; }
.market-ai-facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.market-ai-fact { flex: 1 1 180px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); font-size: 13px; line-height: 1.5; }
.market-ai-fact b { display: block; margin-bottom: 3px; }
.market-ai-fact details { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 7px; }
.market-ai-fact details summary { cursor: pointer; font-weight: 650; }
.market-ai-fact details p { margin: 7px 0 0; overflow-wrap: anywhere; }
.market-ai-log { min-height: 120px; max-height: 400px; }
.market-ai-card .sl-ai-chat-form { margin-top: 10px; }
.market-ai-card .sl-ai-chat-form label { display: grid; gap: 4px; }
.market-ai-card .sl-ai-chat-form textarea { width: 100%; min-height: 70px; resize: vertical; box-sizing: border-box; padding: 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--text); font: inherit; }
.market-ai-material { margin: 8px 0; line-height: 1.5; }
.market-ai-evidence, .sl-material-card { min-width: 0; margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); }
.market-ai-evidence-head, .sl-material-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.market-ai-evidence-head h3, .sl-material-head h3 { margin: 0 0 4px; font-size: 16px; }
.market-ai-evidence-head p, .sl-material-head p { margin: 0; }
.market-ai-evidence-head button, .sl-material-head button { flex: none; min-height: 42px; }
.market-ai-kline, #sl-candle-data { display: grid; gap: 10px; margin-top: 12px; }
.market-ai-coin-material { min-width: 0; }
.market-ai-coin-material h4 { margin: 6px 0; font-size: 14px; overflow-wrap: anywhere; }
.market-ai-kline details, #sl-candle-data details { min-width: 0; margin: 6px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.market-ai-kline summary, #sl-candle-data summary { cursor: pointer; font-weight: 650; overflow-wrap: anywhere; }
.market-ai-kline details p, #sl-candle-data details p { margin: 8px 0; }
.ai-kline-scroll { overflow-x: auto; max-width: 100%; }
.ai-kline-table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 12px; font-variant-numeric: tabular-nums; }
.ai-kline-table th, .ai-kline-table td { padding: 7px 9px; border-bottom: 1px solid var(--line); text-align: right; }
.ai-kline-table th:first-child, .ai-kline-table td:first-child { text-align: left; }
.ai-kline-table th { color: var(--muted); font-weight: 650; }
.market-ai-facts[hidden], #sl-material-card[hidden] { display: none; }
.market-ai-prompts { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0; }
.market-ai-prompts button { border: 1px solid var(--line); border-radius: 999px; padding: 8px 11px; color: var(--text); background: var(--panel-2); cursor: pointer; font: inherit; font-size: 12px; }
.market-ai-prompts button:hover { border-color: var(--accent); }
@media (max-width: 700px) { .market-ai-card { padding: 14px; } .market-ai-head { display: block; } .market-ai-badge { display: inline-block; margin-top: 8px; } .market-ai-toolbar { display: grid; grid-template-columns: 1fr; } .market-ai-toolbar label, .market-ai-toolbar select, .market-ai-toolbar button { width: 100%; } .market-ai-prompts button { flex: 1 1 calc(50% - 7px); } .market-ai-evidence-head, .sl-material-head { flex-direction: column; } .market-ai-evidence-head button, .sl-material-head button { width: 100%; } .market-ai-conversation, .sl-ai-conversation { padding: 10px; } }
/* 顶栏改 fixed 后 html 已有 scroll-padding，这些块原来的大 scroll-margin 会让跳转多留出一截空 */
#sl-main, #sl-decision, #sl-kline-story, #sl-news, #sl-analysis, #sl-ai-title, #sl-horizon-setup, #sl-horizon-results, #sl-horizon { scroll-margin-top: 6px; }
@media (max-width: 700px) {
  #view-shortline .sl-ai-card { margin: 8px 0 0; padding: 14px; }
  .sl-ai-chat-log { max-height: 300px; }
  .sl-ai-chat-form { grid-template-columns: 1fr; }
  .sl-ai-chat-form button { width: 100%; }
}
