/* JJ选股2.0APP · 手机竖屏深色主题 */

:root{
  --bg:#0f1114; --bg2:#161a1f; --bg3:#1d2229; --bg4:#252c35;
  --tx:#e6e9ee; --tx2:#9aa4b2; --tx3:#6b7684;
  --acc:#f0a020; --acc2:#3ea6ff;
  --up:#ff5c5c; --dn:#2ecc71;      /* A股习惯：红涨绿跌 */
  --bd:#262d36;
  --r:12px;
}

*{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html,body{ margin:0; padding:0; height:100%; }
body{
  background:var(--bg); color:var(--tx);
  font:14px/1.5 -apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;
  display:flex; flex-direction:column; height:100dvh; overflow:hidden;
}
button,input,select{ font-family:inherit; font-size:14px; }

/* ---------- 顶栏 ---------- */
.topbar{
  flex:0 0 auto; padding:calc(8px + env(safe-area-inset-top)) 12px 8px;
  background:var(--bg2); border-bottom:1px solid var(--bd);
  display:flex; align-items:center; justify-content:space-between; gap:8px;
}
.brand{ display:flex; align-items:center; gap:8px; min-width:0; }
.logo{
  display:inline-flex; align-items:center; justify-content:center;
  width:30px; height:30px; border-radius:9px; background:var(--acc);
  color:#1a1200; font-weight:800; font-size:13px; flex:0 0 auto;
}
.sub{ font-weight:700; font-size:15px; letter-spacing:.5px; }
.topinfo{ display:flex; gap:6px; flex-wrap:wrap; justify-content:flex-end; }
.pill{
  background:var(--bg3); border:1px solid var(--bd); color:var(--tx2);
  padding:2px 8px; border-radius:999px; font-size:11px; white-space:nowrap;
}

/* ---------- 标签 ---------- */
.tabs{ flex:0 0 auto; display:flex; background:var(--bg2); border-bottom:1px solid var(--bd); }
.tab{
  flex:1; padding:10px 4px; background:none; border:0; color:var(--tx2);
  font-size:14px; border-bottom:2px solid transparent; cursor:pointer;
}
.tab.active{ color:var(--acc); border-bottom-color:var(--acc); font-weight:600; }

/* ---------- 视图 ---------- */
main{ flex:1 1 auto; position:relative; overflow:hidden; }
.view{
  position:absolute; inset:0; overflow-y:auto; -webkit-overflow-scrolling:touch;
  padding:10px 12px calc(20px + env(safe-area-inset-bottom)); display:none;
}
.view.active{ display:block; }
.pad{ height:20px; }

/* ---------- 按钮 ---------- */
.primary{
  background:var(--acc); color:#1a1200; border:0; border-radius:var(--r);
  padding:10px 14px; font-weight:700; cursor:pointer;
}
.primary:disabled{ opacity:.5; }
.big{ width:100%; padding:14px; font-size:16px; }
.ghost{
  background:var(--bg3); color:var(--tx); border:1px solid var(--bd);
  border-radius:var(--r); padding:10px 14px; cursor:pointer; white-space:nowrap;
}
.ghost:disabled{ opacity:.5; }
.actionbar{ display:flex; gap:8px; align-items:stretch; }
.actionbar .big{ flex:1; }
.actionbar .ghost{ flex:0 0 auto; }

/* ---------- 进度 ---------- */
.prog{ margin-top:10px; }
.prog.hide{ display:none; }
.progbar{ height:6px; background:var(--bg3); border-radius:999px; overflow:hidden; }
.progbar i{ display:block; height:100%; width:0; background:var(--acc); transition:width .2s; }
.progtext{ font-size:12px; color:var(--tx2); margin-top:6px; }

/* ---------- 筛选 ---------- */
.filters{ display:flex; gap:6px; margin:12px 0 8px; align-items:center; flex-wrap:wrap; }
.chip{
  background:var(--bg3); border:1px solid var(--bd); color:var(--tx2);
  padding:6px 12px; border-radius:999px; font-size:13px; cursor:pointer;
}
.chip.active{ background:var(--acc); border-color:var(--acc); color:#1a1200; font-weight:600; }
.chip.warn{ color:var(--up); }
.search{
  flex:1 1 110px; min-width:100px; background:var(--bg3); border:1px solid var(--bd);
  color:var(--tx); border-radius:999px; padding:6px 12px; outline:none;
}
.meta{ font-size:12px; color:var(--tx3); margin-bottom:6px; }

/* ---------- 结果卡片 ---------- */
.results{ display:flex; flex-direction:column; gap:8px; }
.rcard{
  background:var(--bg2); border:1px solid var(--bd); border-radius:var(--r);
  padding:10px 12px; cursor:pointer;
}
.rcard:active{ background:var(--bg3); }
.rhead{ display:flex; align-items:baseline; gap:8px; }
.rname{ font-weight:700; font-size:15px; }
.rcode{ color:var(--tx3); font-size:12px; }
.rprice{ margin-left:auto; font-weight:700; }
.up{ color:var(--up); }
.dn{ color:var(--dn); }
.flat{ color:var(--tx2); }
.rtags{ display:flex; gap:6px; margin-top:6px; flex-wrap:wrap; }
.tag{
  font-size:11px; padding:2px 8px; border-radius:999px;
  background:var(--bg3); color:var(--tx2); border:1px solid var(--bd);
}
.tag.s1{ color:#ffd479; border-color:#4a3a12; }
.tag.s2{ color:#8fd3ff; border-color:#123c4a; }
.tag.s3{ color:#a5e8a5; border-color:#17401b; }
.rtext{ font-size:12px; color:var(--tx3); margin-top:6px; line-height:1.45; }
.rempty{ text-align:center; color:var(--tx3); padding:40px 10px; font-size:13px; }

/* ---------- 参数面板 ---------- */
.presetrow{ display:flex; gap:6px; align-items:center; margin-bottom:10px; flex-wrap:wrap; }
.rl{ font-size:12px; color:var(--tx3); }
.group{ background:var(--bg2); border:1px solid var(--bd); border-radius:var(--r); margin-bottom:10px; overflow:hidden; }
.gh{ display:flex; justify-content:space-between; align-items:center; padding:11px 12px; font-weight:600; cursor:pointer; }
.gh .arrow{ color:var(--tx3); font-size:11px; transition:transform .15s; }
.group.collapsed .arrow{ transform:rotate(-90deg); }
.gb{ padding:0 12px 12px; }
.group.collapsed .gb{ display:none; }
.gdesc{ font-size:12px; color:var(--tx3); line-height:1.5; margin-bottom:10px; }
.field{ margin-bottom:12px; }
.field label{ display:flex; justify-content:space-between; gap:8px; font-size:12.5px; color:var(--tx2); margin-bottom:6px; }
.field .val{ color:var(--acc); font-weight:700; flex:0 0 auto; }
.field input[type=range]{ width:100%; accent-color:var(--acc2); height:26px; }
.field.bool{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.field.bool label{ margin:0; flex:1; font-size:13px; color:var(--tx); }
.field.bool input{ width:20px; height:20px; accent-color:var(--acc2); flex:0 0 auto; }

/* ---------- 回测 / 设置卡片 ---------- */
.card{ background:var(--bg2); border:1px solid var(--bd); border-radius:var(--r); padding:12px; margin-bottom:10px; }
.cardtitle{ font-weight:700; margin-bottom:8px; }
.row{ display:flex; align-items:center; gap:8px; margin-bottom:10px; flex-wrap:wrap; }
.row label{ font-size:13px; color:var(--tx2); }
.row input[type=date],.row select{
  background:var(--bg3); border:1px solid var(--bd); color:var(--tx);
  border-radius:8px; padding:7px 10px;
}
.row input[type=date]{ flex:1 1 130px; min-width:120px; }
.cb{ display:flex; align-items:center; gap:6px; }
.cb input{ width:18px; height:18px; accent-color:var(--acc2); }
.hint{ font-size:12px; color:var(--tx3); line-height:1.55; margin-top:8px; }

/* 回测结果表 */
.btsec{ background:var(--bg2); border:1px solid var(--bd); border-radius:var(--r); padding:12px; margin-bottom:10px; }
.bttot{ display:flex; gap:10px; flex-wrap:wrap; margin-bottom:10px; }
.bttot .kv{ background:var(--bg3); border:1px solid var(--bd); border-radius:8px; padding:8px 10px; flex:1 1 40%; }
.bttot .kv b{ display:block; font-size:17px; color:var(--acc); }
.bttot .kv span{ font-size:11px; color:var(--tx3); }
table.tb{ width:100%; border-collapse:collapse; font-size:12.5px; }
table.tb th,table.tb td{ padding:7px 6px; border-bottom:1px solid var(--bd); text-align:right; }
table.tb th:first-child,table.tb td:first-child{ text-align:left; }
table.tb th{ color:var(--tx3); font-weight:500; }

/* ---------- 弹窗 ---------- */
.modal{
  position:fixed; inset:0; background:rgba(0,0,0,.6); z-index:80;
  display:none; align-items:flex-end; justify-content:center;
}
.modal.show{ display:flex; }
.sheet{
  width:100%; max-height:92dvh; overflow-y:auto;
  background:var(--bg2); border-radius:16px 16px 0 0; padding:12px 12px calc(16px + env(safe-area-inset-bottom));
  border-top:1px solid var(--bd);
}
.sheethead{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.mtitle{ font-weight:700; font-size:16px; }
.x{ background:var(--bg3); border:1px solid var(--bd); color:var(--tx2); width:32px; height:32px; border-radius:9px; }
.msub{ font-size:12px; color:var(--tx2); margin:4px 0 10px; }
.mcanvas{ width:100%; height:300px; display:block; background:var(--bg); border-radius:10px; }
.mlegend{ display:flex; gap:10px; font-size:11px; color:var(--tx3); margin-top:8px; flex-wrap:wrap; }
.mlegend .dot{ display:inline-block; width:9px; height:9px; border-radius:2px; margin-right:5px; }
.minfo{ font-size:12px; color:var(--tx2); line-height:1.6; margin-top:8px; }

/* ---------- toast ---------- */
.toast{
  position:fixed; left:50%; bottom:calc(24px + env(safe-area-inset-bottom));
  transform:translateX(-50%); background:var(--bg4); color:var(--tx);
  border:1px solid var(--bd); padding:9px 16px; border-radius:999px;
  font-size:13px; z-index:99; max-width:88vw; text-align:center;
}
.toast.hide{ display:none; }
