/* ============================================================
   黄金宏观雷达 · 手机版
   涨=红 跌=绿（中国市场习惯）；利多=红 利空=绿
   ============================================================ */
:root {
  --bg:      #0e1116;
  --bg2:     #141922;
  --panel:   #171d27;
  --panel2:  #1c2330;
  --line:    #262e3d;
  --txt:     #e6e9ef;
  --txt2:    #9aa4b6;
  --txt3:    #6b7688;
  --up:      #f0565c;          /* 涨 / 利多 */
  --down:    #2fbf71;          /* 跌 / 利空 */
  --gold:    #f5c451;
  --up-bg:   rgba(240, 86, 92, .13);
  --down-bg: rgba(47, 191, 113, .13);
  --gold-bg: rgba(245, 196, 81, .12);
  --shadow:  0 8px 24px rgba(0, 0, 0, .28);
  --r:       18px;
}

html[data-theme="light"] {
  --bg:      #f2f4f8;
  --bg2:     #e9edf4;
  --panel:   #ffffff;
  --panel2:  #f6f8fc;
  --line:    #dee3ed;
  --txt:     #1a2130;
  --txt2:    #5b6678;
  --txt3:    #8b95a6;
  --up:      #d9313c;
  --down:    #12945c;
  --gold:    #b8860b;
  --up-bg:   rgba(217, 49, 60, .10);
  --down-bg: rgba(18, 148, 92, .10);
  --gold-bg: rgba(184, 134, 11, .10);
  --shadow:  0 6px 20px rgba(24, 36, 60, .07);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: "HarmonyOS Sans SC", system-ui, -apple-system, "PingFang SC",
               "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}
body {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
button { font-family: inherit; border: 0; background: none; color: inherit; cursor: pointer; }

/* ---------------- 顶部 ---------------- */
.hdr {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: calc(6px + env(safe-area-inset-top)) 14px 6px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.hdr-l { display: flex; align-items: center; gap: 9px; min-width: 0; }
.logo {
  width: 30px; height: 30px; flex: 0 0 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(145deg, #f7d27a, #d99b1c);
  color: #241a05; font-weight: 800; font-size: 15px;
  box-shadow: 0 2px 8px rgba(217, 155, 28, .35);
}
.hdr-t { font-size: 14.5px; font-weight: 700; letter-spacing: .3px; }
.hdr-s { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--txt3); margin-top: 1px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--txt3); }
.dot.ok { background: var(--down); box-shadow: 0 0 6px var(--down); }
.dot.bad { background: var(--up); }
.dot.wait { background: var(--gold); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: .35 } 50% { opacity: 1 } }
.hdr-r { display: flex; align-items: center; gap: 8px; }
.clock { font-size: 11.5px; color: var(--txt3); font-variant-numeric: tabular-nums; }
.ibtn {
  width: 30px; height: 30px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel);
  font-size: 13px; display: grid; place-items: center;
}

/* ---------------- 交易时段条 ---------------- */
.sess {
  margin: 10px 12px 0;
  padding: 9px 12px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: linear-gradient(100deg, var(--panel2), var(--panel));
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--txt2);
  overflow: hidden;
}
.sess .pill {
  flex: 0 0 auto;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
  background: var(--gold-bg); color: var(--gold);
}
.sess .pill.closed { background: var(--panel2); color: var(--txt3); }
.sess-t { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sess .bar {
  flex: 0 0 54px; height: 3px; border-radius: 3px;
  background: var(--line); overflow: hidden;
}
.sess .bar i { display: block; height: 100%; background: var(--gold); border-radius: 3px; }

/* ---------------- 主体 ---------------- */
main { padding: 10px 12px 8px; }
.page[hidden] { display: none; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.card.flush { padding: 12px 0 0; overflow: hidden; }
.card-h {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; margin-bottom: 10px;
  font-size: 12.5px; font-weight: 700; color: var(--txt);
}
.card-h .hint { font-size: 10.5px; font-weight: 400; color: var(--txt3); }
.card.flush .card-h { padding: 0 14px; }

/* ---------------- 金价 ---------------- */
.hero { padding: 15px 15px 11px; }
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.lbl { font-size: 11px; color: var(--txt3); letter-spacing: .4px; }
.px {
  font-size: 34px; font-weight: 800; line-height: 1.15;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.8px; margin-top: 2px;
}
.chgbox { text-align: right; padding-top: 16px; }
.chg { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chg2 { font-size: 10.5px; color: var(--txt3); margin-top: 3px; font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }
.spark { width: 100%; height: 42px; display: block; margin: 8px 0 2px; }
.hero-foot { font-size: 10.5px; color: var(--txt3); font-variant-numeric: tabular-nums; }

/* ---------------- 多空指数 ---------------- */
.score-main { display: flex; align-items: baseline; gap: 10px; }
.score-num {
  font-size: 38px; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -1.2px;
}
.score-v {
  font-size: 12px; font-weight: 700;
  padding: 3px 9px; border-radius: 20px;
}
.score-v.bull   { background: var(--up-bg);   color: var(--up); }
.score-v.bear   { background: var(--down-bg); color: var(--down); }
.score-v.neutral{ background: var(--panel2);  color: var(--txt2); }

.gauge {
  position: relative; height: 7px; border-radius: 4px; margin: 14px 0 5px;
  background: linear-gradient(90deg,
    var(--down) 0%, rgba(47,191,113,.35) 26%,
    var(--line) 50%,
    rgba(240,86,92,.35) 74%, var(--up) 100%);
  opacity: .95;
}
.gauge-knob {
  position: absolute; top: 50%; left: 50%;
  width: 15px; height: 15px; margin: -7.5px 0 0 -7.5px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--gold);
  box-shadow: 0 1px 6px rgba(0,0,0,.45);
  transition: left .45s cubic-bezier(.34,1.3,.5,1);
}
.gauge-s {
  display: flex; justify-content: space-between;
  font-size: 9.5px; color: var(--txt3); margin-bottom: 10px;
}
.advice {
  font-size: 11.5px; line-height: 1.68; color: var(--txt2);
  background: var(--panel2); border-radius: 11px; padding: 9px 11px;
}

/* ---------------- 预测 ---------------- */
.fc2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fc {
  border: 1px solid var(--line); border-radius: 13px;
  padding: 10px 11px; background: var(--panel2);
}
.fc-t { font-size: 10.5px; color: var(--txt3); display: flex; justify-content: space-between; }
.fc-d { font-size: 16px; font-weight: 800; margin: 5px 0 3px; }
.fc-p { font-size: 10.5px; color: var(--txt2); font-variant-numeric: tabular-nums; }
.fc-r { font-size: 10px; color: var(--txt3); margin-top: 5px; font-variant-numeric: tabular-nums; }
.fc-m { font-size: 9.5px; color: var(--txt3); margin-top: 2px; }
.prob { height: 3px; border-radius: 3px; background: var(--line); margin-top: 7px; overflow: hidden; }
.prob i { display: block; height: 100%; border-radius: 3px; }

/* ---------------- 驱动 / 价位 ---------------- */
.drv { display: flex; flex-direction: column; gap: 7px; }
.drv-row {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 11.5px; line-height: 1.5;
}
.drv-k { flex: 1 1 auto; color: var(--txt2); }
.drv-k b { color: var(--txt); font-weight: 600; }
.drv-v { flex: 0 0 auto; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 11px; }

.lvls { display: flex; flex-direction: column; gap: 6px; }
.lv {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-variant-numeric: tabular-nums;
}
.lv-t { flex: 0 0 44px; font-size: 10.5px; color: var(--txt3); }
.lv-b { flex: 1 1 auto; height: 26px; display: flex; align-items: center; }
.lv-b i { display: block; height: 100%; border-radius: 5px; }
.lv-n { flex: 0 0 auto; font-weight: 700; }

/* ---------------- 行情 ---------------- */
.seg {
  display: flex; gap: 4px; margin: 0 12px 10px;
  background: var(--panel2); border-radius: 11px; padding: 3px;
}
.seg-b {
  flex: 1; padding: 7px 0; border-radius: 9px;
  font-size: 12px; color: var(--txt2); font-weight: 600;
  transition: .18s;
}
.seg-b.on { background: var(--panel); color: var(--gold); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.ivs {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 5px; padding: 0 12px 10px;
}
.iv {
  padding: 5px 0; border-radius: 8px; text-align: center;
  font-size: 11px; color: var(--txt3);
  border: 1px solid transparent; background: var(--panel2);
}
.iv.on { color: var(--gold); border-color: rgba(245,196,81,.4); background: var(--gold-bg); }
.chartbox { position: relative; padding: 0 4px; }
canvas { display: block; width: 100%; touch-action: pan-y; }
#kc { height: 300px; }
#yc { height: 190px; }
.chart-empty {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 11.5px; color: var(--txt3);
}
.tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: rgba(12,16,22,.94); color: #e6e9ef;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 9px; padding: 7px 9px;
  font-size: 10.5px; line-height: 1.55; white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transform: translate(-50%, -100%);
  box-shadow: 0 6px 18px rgba(0,0,0,.5);
}
.chart-foot {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 6px 14px 8px; font-size: 9.5px; color: var(--txt3);
}
.chart-foot span:last-child { font-variant-numeric: tabular-nums; }
.ohlc {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 9px 14px; border-top: 1px solid var(--line);
  font-size: 10.5px; color: var(--txt2); font-variant-numeric: tabular-nums;
}
.ohlc b { color: var(--txt); font-weight: 600; }
.legend {
  display: flex; gap: 12px; padding: 8px 14px 12px; flex-wrap: wrap;
  font-size: 10px; color: var(--txt3);
}
.legend i { display: inline-block; width: 8px; height: 3px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.segsm { display: flex; gap: 6px; margin-bottom: 8px; }
.seg-s {
  flex: 1; padding: 5px 0; border-radius: 8px;
  font-size: 11px; color: var(--txt3); background: var(--panel2);
}
.seg-s.on { color: var(--gold); background: var(--gold-bg); }

/* ---------------- 指标手风琴 ---------------- */
.groups { display: flex; flex-direction: column; gap: 8px; }
.grp { border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.grp-h {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 12px; background: var(--panel2);
  font-size: 12px; font-weight: 600;
}
.grp-h .n {
  margin-left: auto; font-size: 10px; color: var(--txt3); font-weight: 400;
}
.grp-h .arw { font-size: 9px; color: var(--txt3); transition: transform .2s; }
.grp.open .arw { transform: rotate(180deg); }
.grp-b { display: none; }
.grp.open .grp-b { display: block; }

.it { border-top: 1px solid var(--line); }
.it-h {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px;
}
.it-n { flex: 1 1 auto; min-width: 0; }
.it-n .t { font-size: 12px; font-weight: 600; line-height: 1.4; }
.it-n .s { font-size: 9.5px; color: var(--txt3); margin-top: 2px; }
.it-v { flex: 0 0 auto; text-align: right; }
.it-v .v { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.it-v .w { font-size: 9px; color: var(--txt3); margin-top: 2px; }
.tag {
  display: inline-block; padding: 1px 6px; border-radius: 5px;
  font-size: 9px; font-weight: 700; margin-left: 4px;
}
.tag.bull { background: var(--up-bg); color: var(--up); }
.tag.bear { background: var(--down-bg); color: var(--down); }
.tag.neu  { background: var(--panel2); color: var(--txt3); }
.it-d {
  display: none; padding: 0 12px 11px;
  font-size: 11px; line-height: 1.7; color: var(--txt2);
}
.it.open .it-d { display: block; }
.it-d .sub { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.it-d .sub span {
  font-size: 9.5px; padding: 2px 6px; border-radius: 5px;
  background: var(--panel2); color: var(--txt2);
}

/* ---------------- 列表 ---------------- */
.list { display: flex; flex-direction: column; }
.li {
  padding: 10px 0; border-top: 1px solid var(--line);
  font-size: 11.5px; line-height: 1.6;
}
.li:first-child { border-top: 0; padding-top: 2px; }
.li-h { display: flex; gap: 8px; align-items: baseline; }
.li-t { flex: 1 1 auto; }
.li-d { font-size: 9.5px; color: var(--txt3); flex: 0 0 auto; }
.li-s { font-size: 10.5px; color: var(--txt2); margin-top: 4px; }
.li-src { font-size: 9.5px; color: var(--txt3); margin-top: 3px; }
.empty { font-size: 11px; color: var(--txt3); padding: 6px 0; }

.about { font-size: 11px; line-height: 1.75; color: var(--txt2); }
.about-more { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.about-more div {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 10.5px; padding: 3px 0; color: var(--txt3);
}
.about-more b { font-weight: 500; }
.about-more span { font-variant-numeric: tabular-nums; }

/* ---------------- 底部导航 ---------------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 7px; color: var(--txt3); font-size: 9.5px;
  transition: color .15s;
}
.tab svg { width: 20px; height: 20px; fill: currentColor; opacity: .75; }
.tab.on { color: var(--gold); }
.tab.on svg { opacity: 1; }

/* ---------------- 下拉刷新 ---------------- */
.ptr {
  position: fixed; top: 0; left: 0; right: 0; height: 0; z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
  overflow: hidden; pointer-events: none;
  background: linear-gradient(var(--bg), transparent);
  transition: height .22s ease;
}
.ptr-t { font-size: 10.5px; color: var(--txt3); padding-bottom: 6px; }
.ptr.on { height: 54px; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: calc(78px + env(safe-area-inset-bottom));
  transform: translate(-50%, 14px);
  background: rgba(20,25,34,.95); color: #e6e9ef;
  border: 1px solid rgba(255,255,255,.12);
  padding: 8px 15px; border-radius: 20px;
  font-size: 11.5px; opacity: 0; pointer-events: none;
  transition: .24s; z-index: 60;
  box-shadow: 0 8px 22px rgba(0,0,0,.45);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 骨架 ---------------- */
@keyframes sk { 0% { opacity: .35 } 50% { opacity: .7 } 100% { opacity: .35 } }
.skel { animation: sk 1.3s infinite; color: transparent !important;
        background: var(--panel2); border-radius: 5px; }
