/* ==========================================================
   股鉴 StockLens · 专业金融终端风格
   黑底 + 红涨绿跌 + 青色数据高亮，与 DevBox / GameRank 完全独立
   ========================================================== */
:root {
  --bg: #0a0c10;
  --bg-2: #0e1117;
  --panel: #12161d;
  --panel-2: #171c25;
  --line: #222935;
  --text: #d5dce6;
  --text-2: #6f7d90;
  --cy: #00c8b4;
  --cy-dim: rgba(0,200,180,.12);
  --up: #e8494a;      /* 中国市场惯例：红涨 */
  --up-bg: rgba(232,73,74,.12);
  --down: #1fa97c;    /* 绿跌 */
  --down-bg: rgba(31,169,124,.12);
  --amber: #e6a23c;
  --mono: ui-monospace, "SF Mono", Consolas, "Courier New", monospace;
  --sans: "PingFang SC", "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 13.5px; line-height: 1.6; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
::selection { background: var(--cy); color: #0a0c10; }

/* ---------- 终端顶栏 ---------- */
.terminal-bar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 22px;
  height: 48px; padding: 0 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.tb-left { display: flex; align-items: center; gap: 10px; }
.tb-logo { font-size: 17px; font-weight: 800; letter-spacing: 3px; color: var(--text); white-space: nowrap; }
.tb-logo i { font-style: normal; font-size: 10px; font-weight: 400; letter-spacing: 2px; color: var(--cy); margin-left: 6px; }
.tb-badge {
  font-size: 9px; letter-spacing: 1px; padding: 1px 6px;
  color: var(--amber); border: 1px solid var(--amber); border-radius: 2px; white-space: nowrap;
}
.tb-nav { display: flex; gap: 2px; overflow-x: auto; }
.tb-link {
  padding: 6px 14px; font-size: 13px; color: var(--text-2);
  background: none; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; white-space: nowrap; font-family: var(--sans); transition: color .15s;
}
.tb-link:hover { color: var(--text); }
.tb-link.active { color: var(--cy); border-bottom-color: var(--cy); }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.tb-clock { font-family: var(--mono); font-size: 12px; color: var(--cy); letter-spacing: 1px; }
.tb-user { font-size: 11.5px; color: var(--text-2); white-space: nowrap; }

/* ---------- 滚动行情条 ---------- */
.ticker-strip {
  overflow: hidden; white-space: nowrap;
  background: var(--panel); border-bottom: 1px solid var(--line);
  height: 30px; display: flex; align-items: center;
}
.ticker-track { display: inline-flex; gap: 34px; padding-left: 100%; animation: marquee 45s linear infinite; }
.ticker-strip:hover .ticker-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-100%); } }
.tk-item { font-family: var(--mono); font-size: 12px; }
.tk-item b { color: var(--text-2); font-weight: 400; margin-right: 6px; }
.tk-up { color: var(--up); }
.tk-down { color: var(--down); }

/* ---------- 面板布局 ---------- */
.panels { max-width: 1360px; margin: 0 auto; padding: 14px 14px 50px; }
.panel { display: none; }
.panel.active { display: block; animation: rise .3s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.panel-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px; }
.card {
  grid-column: span 12;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 14px 16px; min-width: 0;
}
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-8 { grid-column: span 8; }
.span-9 { grid-column: span 9; }
.card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.card-head h2 { font-size: 14px; font-weight: 700; letter-spacing: 1px; display: flex; align-items: center; gap: 8px; }
.card-head h2 small { font-family: var(--mono); font-size: 11px; color: var(--text-2); font-weight: 400; }
.card-note { font-size: 11px; color: var(--text-2); }
.result-count { font-family: var(--mono); font-size: 12px; color: var(--cy); }

/* ---------- 指数卡片 ---------- */
.index-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.idx-card {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px;
  padding: 12px 14px; cursor: pointer; transition: border-color .15s;
}
.idx-card:hover, .idx-card.on { border-color: var(--cy); }
.idx-name { font-size: 12.5px; color: var(--text-2); margin-bottom: 4px; display: flex; justify-content: space-between; }
.idx-name code { font-family: var(--mono); font-size: 10.5px; }
.idx-price { font-family: var(--mono); font-size: 24px; font-weight: 700; line-height: 1.2; }
.idx-chg { font-family: var(--mono); font-size: 12.5px; margin-top: 2px; }
.idx-up .idx-price, .idx-up .idx-chg { color: var(--up); }
.idx-down .idx-price, .idx-down .idx-chg { color: var(--down); }
.idx-spark { display: block; width: 100%; height: 34px; margin-top: 8px; }

/* ---------- 温度计 ---------- */
.gauge-box { display: flex; flex-direction: column; gap: 14px; }
.gauge-value { font-family: var(--mono); font-size: 34px; font-weight: 700; color: var(--cy); text-align: center; }
.gauge-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-2); padding: 0 2px; }
.gs-cold { color: var(--down); font-style: normal; }
.gs-hot { color: var(--up); font-style: normal; }
.gauge-bar { height: 10px; background: linear-gradient(90deg, var(--down), #6f7d90 50%, var(--up)); border-radius: 2px; position: relative; }
.gauge-bar i {
  position: absolute; top: -4px; bottom: -4px; width: 4px;
  background: #fff; border-radius: 2px; left: 50%; transition: left .6s ease;
}
.gauge-stats { list-style: none; font-size: 12px; }
.gauge-stats li { display: flex; justify-content: space-between; padding: 5px 2px; border-bottom: 1px dashed var(--line); color: var(--text-2); }
.gauge-stats li:last-child { border: none; }
.gauge-stats b { font-family: var(--mono); color: var(--text); font-weight: 600; }

/* ---------- 数据表格 ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th {
  text-align: left; font-weight: 600; color: var(--text-2); font-size: 11px;
  padding: 7px 8px; border-bottom: 1px solid var(--line); letter-spacing: .5px; white-space: nowrap;
}
.data-table td { padding: 8px; border-bottom: 1px solid rgba(34,41,53,.5); font-family: var(--mono); white-space: nowrap; }
.data-table th.r, .data-table td.r { text-align: right; }
.data-table tbody tr { cursor: pointer; transition: background .1s; }
.data-table tbody tr:hover { background: var(--cy-dim); }
.data-table .name-cell { font-family: var(--sans); }
.name-cell b { display: block; font-weight: 600; font-size: 13px; }
.name-cell code { font-size: 10.5px; color: var(--text-2); }
.data-table.small td, .data-table.small th { padding: 5px 6px; font-size: 11.5px; }
.t-up { color: var(--up); }
.t-down { color: var(--down); }
.badge-rank { font-family: var(--mono); color: var(--text-2); }
.tab-group { display: inline-flex; gap: 2px; }
.rt {
  padding: 4px 12px; font-size: 11.5px; cursor: pointer;
  background: var(--panel-2); color: var(--text-2);
  border: 1px solid var(--line); font-family: var(--sans); transition: all .12s;
}
.rt:first-child { border-radius: 3px 0 0 3px; }
.rt:last-child { border-radius: 0 3px 3px 0; }
.rt:hover { color: var(--text); }
.rt.on { background: var(--cy-dim); color: var(--cy); border-color: var(--cy); }

/* ---------- K线面板 ---------- */
.chart-controls { display: flex; gap: 10px; flex-wrap: wrap; }
.chart-quote { display: flex; flex-wrap: wrap; gap: 22px; padding: 8px 0 12px; font-family: var(--mono); font-size: 12px; }
.cq-item { display: flex; flex-direction: column; }
.cq-item span { font-size: 10px; color: var(--text-2); font-family: var(--sans); }
.cq-item strong { font-size: 15px; font-weight: 600; }
.kchart-wrap { position: relative; width: 100%; height: 440px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg-2); }
.kchart-wrap canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }

/* 指标面板 */
.indicator-list { display: flex; flex-direction: column; gap: 6px; }
.ind-row {
  display: grid; grid-template-columns: 64px 1fr 56px; gap: 8px; align-items: center;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 3px;
  padding: 7px 10px; font-size: 12px;
}
.ind-row .ind-name { color: var(--text-2); }
.ind-row .ind-val { font-family: var(--mono); text-align: right; font-weight: 600; }
.ind-row .ind-state { font-size: 11px; text-align: center; border-radius: 2px; padding: 1px 0; }
.ind-state.buy { background: var(--up-bg); color: var(--up); }
.ind-state.sell { background: var(--down-bg); color: var(--down); }
.ind-state.neutral { background: rgba(111,125,144,.15); color: var(--text-2); }
.signal-list { list-style: none; font-size: 12px; display: flex; flex-direction: column; gap: 6px; }
.signal-list li {
  padding: 8px 10px; border-radius: 3px; border-left: 2px solid var(--text-2);
  background: var(--panel-2); color: var(--text-2);
}
.signal-list li.bull { border-left-color: var(--up); color: var(--text); }
.signal-list li.bear { border-left-color: var(--down); color: var(--text); }

/* ---------- 筛选/回测表单 ---------- */
.filter-form { display: flex; flex-direction: column; gap: 10px; }
.filter-form label { font-size: 12px; color: var(--text-2); display: flex; flex-direction: column; gap: 4px; }
.filter-form input, .filter-form select {
  height: 34px; padding: 0 10px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 3px;
  color: var(--text); font-size: 13px; outline: none; font-family: var(--mono);
}
.filter-form input:focus, .filter-form select:focus { border-color: var(--cy); }
.filter-actions { display: flex; gap: 8px; margin-top: 6px; }
.btn-cy, .btn-dim {
  flex: 1; height: 36px; font-size: 13px; cursor: pointer; border-radius: 3px;
  font-family: var(--sans); letter-spacing: 1px; transition: all .15s;
}
.btn-cy { background: var(--cy); border: 1px solid var(--cy); color: #04110e; font-weight: 700; }
.btn-cy:hover { filter: brightness(1.15); }
.btn-dim { background: none; border: 1px solid var(--line); color: var(--text-2); }
.btn-dim:hover { border-color: var(--text-2); color: var(--text); }

.wl-results { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.wl-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 10px; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 3px; cursor: pointer; font-size: 12.5px; transition: border-color .12s;
}
.wl-item:hover { border-color: var(--cy); }
.wl-item code { font-family: var(--mono); font-size: 11px; color: var(--text-2); }
.wl-add { color: var(--cy); font-size: 16px; line-height: 1; }

/* 删除按钮 */
.del-btn {
  background: none; border: 1px solid var(--line); color: var(--text-2);
  width: 26px; height: 26px; border-radius: 3px; cursor: pointer; font-size: 13px;
}
.del-btn:hover { border-color: var(--up); color: var(--up); }

/* ---------- 回测 ---------- */
.bt-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 12px; }
.bm-item { background: var(--panel-2); border: 1px solid var(--line); border-radius: 3px; padding: 9px 12px; }
.bm-item span { display: block; font-size: 10.5px; color: var(--text-2); }
.bm-item strong { font-family: var(--mono); font-size: 16px; font-weight: 700; }
.bt-chart-wrap { position: relative; height: 240px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg-2); margin-bottom: 12px; }
.bt-chart-wrap canvas { display: block; width: 100%; height: 100%; }
.bt-trades-box { max-height: 260px; overflow-y: auto; }
.trade-buy td { color: var(--up); }
.trade-sell td { color: var(--down); }

/* ---------- 免责声明 & Toast ---------- */
.disclaimer {
  margin-top: 16px; padding: 12px 16px; font-size: 11.5px; color: var(--text-2);
  border: 1px dashed var(--line); border-radius: 4px; text-align: center;
}
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(14px);
  background: var(--cy); color: #04110e; font-weight: 600;
  padding: 9px 22px; border-radius: 3px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: all .3s; z-index: 300;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .span-9, .span-8 { grid-column: span 12; }
  .span-3, .span-4 { grid-column: span 6; }
}
@media (max-width: 760px) {
  .span-3, .span-4 { grid-column: span 12; }
  .tb-right .tb-user { display: none; }
  .tb-nav { gap: 0; }
  .terminal-bar { gap: 12px; padding: 0 10px; }
  .kchart-wrap { height: 340px; }
  .bt-chart-wrap { height: 200px; }
  .data-table .hide-m { display: none; }
}
@media (max-width: 520px) {
  .tb-logo i { display: none; }
  .tb-clock { display: none; }
  .index-grid { grid-template-columns: 1fr 1fr; }
  .kchart-wrap { height: 280px; }
  .chart-quote { gap: 14px; }
}
