/* ===== A 股实时决策台 · 移动端样式 ===== */
:root {
  --bg: #0a0e13;
  --panel: #111823;
  --panel2: #151f2c;
  --border: #1e2a38;
  --border-soft: #18222e;
  --text: #e7eef8;
  --muted: #8496ab;
  --dim: #5f7186;
  --up: #ff4d4f;
  --down: #12c48b;
  --accent: #4c8dff;
  --gold: #f0a92d;
  --radius: 14px;
  --tabbar: 62px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body { padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px)); }

button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }

/* ---- 顶栏 ---- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 10px;
  background: rgba(10, 14, 19, 0.86);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 15px; letter-spacing: .3px; }
.logo {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, #ff4d4f, #ff8a3d);
  font-size: 14px; font-weight: 800; color: #fff;
  box-shadow: 0 4px 14px rgba(255, 77, 79, .32);
}
.chip {
  font-size: 11px; padding: 4px 9px; border-radius: 20px;
  background: var(--panel2); border: 1px solid var(--border); color: var(--muted);
}
.chip.live { color: #ffd9d9; border-color: rgba(255,77,79,.45); background: rgba(255,77,79,.12); }
.chip.live::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--up); margin-right: 6px; vertical-align: middle;
  animation: pulse 1.4s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .25 } }

/* ---- 布局 ---- */
main { max-width: 620px; margin: 0 auto; padding: 12px 14px 24px; }
.view { display: none; }
.view.active { display: block; animation: rise .18s ease; }
@keyframes rise { from { transform: translateY(4px) } to { transform: none } }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--muted); }

/* ---- 指数条 ---- */
.index-strip {
  display: flex; gap: 9px; overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: none; -ms-overflow-style: none;
}
.index-strip::-webkit-scrollbar { display: none; }
.idx {
  flex: 0 0 auto; min-width: 118px; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--border-soft);
  border-radius: 12px;
}
.idx .nm { font-size: 11.5px; color: var(--muted); }
.idx .val { font-size: 16px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.idx .pc { font-size: 11.5px; margin-top: 1px; font-variant-numeric: tabular-nums; }

/* ---- 搜索 ---- */
.search-row { position: relative; margin: 12px 0 4px; }
.search-row input {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--border);
  outline: none; transition: border-color .15s;
}
.search-row input:focus { border-color: rgba(76,141,255,.55); }
.search-row input::placeholder { color: var(--dim); }
.search-results {
  position: absolute; left: 0; right: 0; top: 46px; z-index: 30;
  background: #141c27; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0,0,0,.55); overflow: hidden;
}
.search-results div {
  padding: 11px 14px; border-bottom: 1px solid var(--border-soft);
  display: flex; justify-content: space-between; align-items: center;
}
.search-results div:last-child { border-bottom: none; }
.search-results div:active { background: rgba(76,141,255,.12); }

/* ---- 区块标题 ---- */
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin: 18px 2px 8px; font-size: 12.5px; font-weight: 600; color: #b9c8da;
}
.seg { display: flex; gap: 2px; background: var(--panel); border: 1px solid var(--border); border-radius: 9px; padding: 2px; }
.seg button { font-size: 11px; padding: 3px 9px; border-radius: 7px; color: var(--muted); }
.seg button.on { background: var(--panel2); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.04) inset; }

/* ---- 股票列表 ---- */
.stock-list { display: flex; flex-direction: column; gap: 7px; }
.stock-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--border-soft);
  transition: transform .12s, background .12s;
}
.stock-row:active { transform: scale(.988); background: var(--panel2); }
.sr-main { flex: 1; min-width: 0; }
.sr-name { font-weight: 620; font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.sr-code { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.sr-price { text-align: right; font-variant-numeric: tabular-nums; }
.sr-price .p { font-size: 14.5px; font-weight: 650; }
.sr-price .c { font-size: 11.5px; }
.score-chip {
  flex: 0 0 auto; min-width: 52px; text-align: center;
  padding: 5px 8px; border-radius: 9px;
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.tag {
  font-size: 10px; padding: 1px 5px; border-radius: 4px;
  background: rgba(255,255,255,.06); color: var(--muted);
}

/* ---- 今日风口 ---- */
.theme-strip {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: none; -ms-overflow-style: none;
}
.theme-strip::-webkit-scrollbar { display: none; }
.theme-pill {
  flex: 0 0 auto; min-width: 110px; max-width: 138px; padding: 9px 11px;
  border-radius: 12px; background: var(--panel); border: 1px solid var(--border-soft);
}
.theme-pill .tn {
  font-size: 12.5px; font-weight: 640; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.theme-pill .tp { font-size: 13.5px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.theme-pill .tl {
  font-size: 10px; color: var(--dim); margin-top: 1px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.theme-tag {
  font-size: 10px; padding: 1px 6px; border-radius: 5px; margin-left: 6px;
  background: rgba(255, 122, 61, .14); color: #ffa46b; white-space: nowrap;
}
.list-note { font-size: 10.5px; color: var(--dim); margin: 6px 2px 0; line-height: 1.55; }

/* ---- 卖出提醒行 ---- */
.stock-row.alert { border-color: rgba(18, 196, 139, .22); background: linear-gradient(180deg, rgba(18,196,139,.06), var(--panel)); }
.alert-chip {
  flex: 0 0 auto; min-width: 52px; text-align: center;
  padding: 5px 8px; border-radius: 9px; font-size: 12px; font-weight: 700;
}
.alert-chip.high { color: #12c48b; background: rgba(18,196,139,.16); }
.alert-chip.mid { color: #f0a92d; background: rgba(240,169,45,.14); }
.alert-chip.low { color: #8496ab; background: rgba(132,150,171,.14); }
.sr-reason { font-size: 11px; margin-top: 2px; line-height: 1.4; }

/* ---- 卡片 ---- */
.card {
  margin-top: 12px; padding: 14px;
  background: var(--panel); border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}
.card-title { font-size: 12.5px; font-weight: 600; color: #b9c8da; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }

/* ---- 详情头部 ---- */
.detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--panel); border: 1px solid var(--border); color: var(--text); font-size: 18px;
}
.icon-btn:active { background: var(--panel2); }
.dh-main { flex: 1; }
.dh-title { display: flex; align-items: baseline; gap: 7px; }
.dh-title #dName { font-size: 17px; font-weight: 680; }
.dh-price { display: flex; align-items: baseline; gap: 9px; margin-top: 1px; }
.dh-price #dPrice { font-size: 24px; font-weight: 720; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.dh-price .chg { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.period-tabs { display: flex; gap: 6px; margin: 10px 0 6px; }
.period-tabs button {
  padding: 4px 11px; border-radius: 8px; font-size: 11.5px;
  background: var(--panel); border: 1px solid var(--border); color: var(--muted);
}
.period-tabs button.on { background: rgba(76,141,255,.14); border-color: rgba(76,141,255,.45); color: #a9c9ff; }

#chart { width: 100%; height: 268px; display: block; border-radius: 12px; background: var(--panel); border: 1px solid var(--border-soft); touch-action: none; cursor: crosshair; }
.chart-hint { font-size: 10.5px; color: var(--dim); text-align: center; margin-top: 5px; letter-spacing: .2px; }

/* ---- 信号卡 ---- */
.signal-card { position: relative; overflow: hidden; }
.signal-head { display: flex; align-items: center; justify-content: space-between; }
.sig-label { font-size: 20px; font-weight: 750; letter-spacing: .5px; }
.sig-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.ring-wrap { display: flex; align-items: center; gap: 14px; }
.score-big { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.score-cap { font-size: 10.5px; color: var(--dim); margin-top: 3px; }
.meter { height: 6px; border-radius: 6px; background: linear-gradient(90deg,#0aa06e,#12c48b,#3a4a5e,#ff8a3d,#ff3b3b); position: relative; margin-top: 12px; }
.meter-dot {
  position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%;
  background: #fff; transform: translate(-50%,-50%); box-shadow: 0 0 0 3px rgba(255,255,255,.14);
  transition: left .4s cubic-bezier(.2,.8,.2,1);
}
.meter-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--dim); margin-top: 5px; }

/* ---- 计划网格 ---- */
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.plan-item { background: var(--panel2); border-radius: 10px; padding: 9px 11px; }
.plan-item .k { font-size: 10.5px; color: var(--muted); }
.plan-item .v { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 1px; }
.plan-item .s { font-size: 10px; color: var(--dim); }

/* ---- 因子条 ---- */
.factor-row { margin-bottom: 9px; }
.factor-row:last-child { margin-bottom: 0; }
.factor-top { display: flex; justify-content: space-between; font-size: 11.5px; margin-bottom: 3px; }
.factor-bar { height: 5px; border-radius: 4px; background: #1b2635; position: relative; overflow: hidden; }
.factor-fill { position: absolute; top: 0; bottom: 0; left: 50%; border-radius: 4px; }
.factor-note { font-size: 10.5px; color: var(--dim); margin-top: 3px; }

/* ---- 回测 ---- */
.bt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bt-item { text-align: center; background: var(--panel2); border-radius: 10px; padding: 9px 4px; }
.bt-item .v { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bt-item .k { font-size: 10px; color: var(--muted); margin-top: 1px; }
#btCurve { width: 100%; height: 78px; display: block; margin-top: 10px; }

/* ---- 列表/日志 ---- */
.log-list { display: flex; flex-direction: column; gap: 6px; }
.log-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 11px; border-radius: 10px; background: var(--panel);
  border: 1px solid var(--border-soft); font-size: 12px;
}
.log-time { color: var(--dim); font-size: 10.5px; flex: 0 0 auto; padding-top: 1px; font-variant-numeric: tabular-nums; }
.log-text { flex: 1; color: #c8d5e5; }

/* ---- 按钮 ---- */
.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.btn {
  padding: 13px; border-radius: 12px; font-weight: 650; font-size: 14px;
  border: 1px solid var(--border); background: var(--panel);
}
.btn:active { transform: scale(.985); }
.btn.buy { background: linear-gradient(135deg, #ff4d4f, #e8342f); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(255,77,79,.26); }
.btn.sell { background: linear-gradient(135deg, #12c48b, #0aa06e); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(18,196,139,.22); }
.btn.ghost { background: var(--panel); color: var(--text); }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 12px; font-size: 12px; border-radius: 9px; }

/* ---- 表单 ---- */
.field { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.field:last-child { border-bottom: none; }
.field .lab { font-size: 13px; }
.field .hint { font-size: 10.5px; color: var(--dim); margin-top: 2px; }
.field input[type="number"], .field input[type="text"], .field select {
  width: 96px; padding: 7px 9px; text-align: right;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; outline: none;
  font-variant-numeric: tabular-nums;
}
.switch { position: relative; width: 46px; height: 27px; border-radius: 20px; background: #24313f; transition: background .2s; }
.switch.on { background: linear-gradient(135deg,#ff4d4f,#ff8a3d); }
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px;
  border-radius: 50%; background: #fff; transition: transform .2s;
}
.switch.on::after { transform: translateX(19px); }

/* ---- 底部导航 ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: space-around; align-items: center;
  height: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(13, 18, 25, .93);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border-soft);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--dim); font-size: 10.5px; flex: 1; padding: 8px 0; }
.tab svg { width: 21px; height: 21px; stroke-width: 1.7; }
.tab.on { color: #ff6b6b; }
.tab.on svg { stroke: #ff6b6b; }

/* ---- 提示 ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar) + 26px); transform: translate(-50%, 14px);
  background: #1d2836; border: 1px solid var(--border); color: var(--text);
  padding: 10px 16px; border-radius: 11px; font-size: 12.5px; z-index: 100;
  opacity: 0; pointer-events: none; transition: all .22s; max-width: 82vw; text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- 骨架屏 ---- */
.skeleton { height: 60px; border-radius: 12px; background: linear-gradient(100deg,#131b25 30%,#1a2532 50%,#131b25 70%); background-size: 220% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { from { background-position: 120% 0 } to { background-position: -120% 0 } }

.equity { background: linear-gradient(150deg, #16212e, #111823 62%); }
.eq-main { display: flex; align-items: flex-end; justify-content: space-between; }
.eq-total { font-size: 27px; font-weight: 780; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.eq-sub { display: flex; gap: 18px; margin-top: 12px; }
.eq-sub div { font-size: 11px; color: var(--muted); }
.eq-sub b { display: block; font-size: 13.5px; color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; }

.empty { text-align: center; padding: 26px 10px; color: var(--dim); font-size: 12.5px; }

.disclaim { font-size: 11.5px; color: var(--muted); line-height: 1.7; }
.disclaim b { color: #ff9b9b; }

/* ---- 安装提示条 ---- */
.install-bar {
  position: fixed; left: 12px; right: 12px; z-index: 90;
  bottom: calc(var(--tabbar) + 12px + env(safe-area-inset-bottom, 0px));
  max-width: 596px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 14px;
  background: rgba(26, 36, 49, .97); border: 1px solid rgba(255, 120, 80, .32);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .55);
  animation: slideUp .26s cubic-bezier(.2, .9, .25, 1);
}
.install-bar .ib-main { flex: 1; min-width: 0; }
.install-bar .ib-t { font-size: 12.5px; font-weight: 650; }
.install-bar .ib-d { font-size: 10.5px; color: var(--muted); margin-top: 2px; line-height: 1.45; }
.install-bar .ib-btn {
  flex: 0 0 auto; padding: 7px 13px; border-radius: 9px; font-size: 12px; font-weight: 650;
  background: linear-gradient(135deg, #ff4d4f, #ff8a3d); color: #fff;
}
.install-bar .ib-x { flex: 0 0 auto; color: var(--dim); font-size: 15px; padding: 0 2px; }

/* ---- 连不上服务 ---- */
.offline-mask {
  position: fixed; inset: 0; z-index: 200; background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.offline-box { width: 100%; max-width: 360px; text-align: center; }
.offline-icon { font-size: 34px; }
.offline-title { font-size: 17px; font-weight: 700; margin-top: 10px; }
.offline-desc { font-size: 12.5px; color: var(--muted); line-height: 1.65; margin-top: 8px; }
.offline-url {
  font-size: 11px; color: var(--dim); margin-top: 10px; word-break: break-all;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.offline-help {
  text-align: left; font-size: 11.5px; color: var(--muted); line-height: 1.9;
  margin-top: 14px; background: var(--panel); border-radius: 12px; padding: 12px 14px;
}
.offline-help b { color: #ffd9a0; }

/* ---- 安装卡片 ---- */
.app-row { display: flex; align-items: center; gap: 12px; }
.app-icon { width: 46px; height: 46px; border-radius: 12px; }
.app-meta { flex: 1; min-width: 0; }
.app-meta .n { font-size: 14px; font-weight: 650; }
.app-meta .s { font-size: 11px; color: var(--muted); margin-top: 1px; }

/* ---- 底部下单面板 ---- */
.sheet-mask {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(0, 0, 0, .62);
  display: flex; align-items: flex-end; justify-content: center;
  animation: rise .16s ease;
}
.sheet {
  width: 100%; max-width: 620px;
  background: #111823;
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--border);
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  animation: slideUp .22s cubic-bezier(.2, .9, .25, 1);
}
@keyframes slideUp { from { transform: translateY(100%) } to { transform: none } }
