/* ═══════ 道系 · 观象台 ═══════ */
:root {
  --ink:      #101210;   /* 玄墨 */
  --ink-2:    #1a1c19;   /* 黛 */
  --paper:    #f5efe0;   /* 宣纸 */
  --paper-2:  #ece4cf;   /* 旧宣 */
  --cinnabar: #c03f2b;   /* 朱砂 */
  --gold:     #b08d3e;   /* 泥金 */
  --jade:     #4f7a63;   /* 青玉 */
  --ash:      #8a8578;   /* 灰墨 */
  --hairline: rgba(176, 141, 62, .35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  background: var(--ink);
  color: var(--paper);
  background-image:
    radial-gradient(circle at 15% 0%, rgba(192, 63, 43, .07), transparent 45%),
    radial-gradient(circle at 85% 100%, rgba(79, 122, 99, .08), transparent 45%);
  min-height: 100vh;
}

/* 八卦底纹 */
.bagua-bg {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(200px, 40vw, 460px);
  letter-spacing: .2em;
  color: rgba(245, 239, 224, .025);
  pointer-events: none; user-select: none;
  z-index: 0;
  white-space: nowrap;
}

/* ── 山门（顶栏）── */
.topbar {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between; align-items: center;
  gap: 18px; padding: 26px 32px;
  border-bottom: 1px solid var(--hairline);
  background: linear-gradient(180deg, rgba(26,28,25,.9), rgba(16,18,16,.6));
  backdrop-filter: blur(4px);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 18px; }
.taiji { width: 64px; height: 64px; animation: spin 40s linear infinite; filter: drop-shadow(0 0 12px rgba(192,63,43,.35)); }
@keyframes spin { to { transform: rotate(360deg); } }
h1 {
  margin: 0; font-size: 34px; font-weight: 700;
  letter-spacing: .35em; text-indent: .35em;
  color: var(--paper);
  text-shadow: 0 0 24px rgba(176, 141, 62, .3);
}
.motto { margin: 6px 0 0; color: var(--gold); font-size: 13px; letter-spacing: .2em; }
.backend-box { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── 控件 ── */
input, select, button {
  font-family: inherit;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 9px 12px;
  font-size: 14px;
  background: rgba(245, 239, 224, .06);
  color: var(--paper);
  transition: border-color .25s, box-shadow .25s;
}
input::placeholder { color: var(--ash); }
input:focus, select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px rgba(176,141,62,.15); }
select option { background: var(--ink-2); color: var(--paper); }

button {
  background: linear-gradient(180deg, #b03a27, var(--cinnabar));
  color: var(--paper); border: none; cursor: pointer;
  letter-spacing: .15em; text-indent: .15em;
  box-shadow: 0 2px 10px rgba(192, 63, 43, .3);
}
button:hover { filter: brightness(1.12); }
button:active { transform: translateY(1px); }
button.secondary { background: var(--ink-2); border: 1px solid var(--hairline); box-shadow: none; }

/* ── 布局 ── */
.layout { position: relative; z-index: 1; padding: 28px 32px; display: grid; gap: 20px; max-width: 1200px; margin: 0 auto; }

/* ── 卷轴卡片 ── */
.card {
  position: relative;
  background: linear-gradient(180deg, var(--paper), var(--paper-2));
  color: #26241d;
  border-radius: 6px;
  padding: 20px 22px;
  border: 1px solid rgba(0,0,0,.15);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45), inset 0 0 60px rgba(176, 141, 62, .06);
}
.card::before {
  content: ""; position: absolute; inset: 6px;
  border: 1px solid var(--hairline); border-radius: 3px;
  pointer-events: none;
}
.card input, .card select { background: rgba(16,18,16,.06); color: #26241d; border-color: rgba(0,0,0,.2); }
.card input::placeholder { color: #9a927e; }
.card select option { background: var(--paper); color: #26241d; }

/* 卦印 */
h2 {
  margin: 0; font-size: 19px; letter-spacing: .12em;
  display: flex; align-items: center; gap: 10px;
  color: #26241d;
}
.seal {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex: none;
  background: var(--cinnabar); color: var(--paper);
  border-radius: 4px; font-size: 16px;
  box-shadow: 0 2px 6px rgba(192,63,43,.4);
  transform: rotate(-3deg);
}
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; padding-right: 64px; }
.filters { display: flex; gap: 8px; align-items: center; }

/* ── 表格 ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; border-bottom: 1px solid rgba(0,0,0,.12); text-align: left; vertical-align: top; }
th {
  background: rgba(192, 63, 43, .07);
  letter-spacing: .15em; font-weight: 600; color: #6b3d2a;
}
tbody tr:hover { background: rgba(176, 141, 62, .08); }

/* ── 列表 ── */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.list li {
  padding: 10px 12px;
  background: rgba(176, 141, 62, .08);
  border-left: 3px solid var(--gold);
  border-radius: 2px;
  line-height: 1.5;
}
.list li button { padding: 4px 14px; font-size: 13px; margin-top: 6px; }
.list small { color: #6f6753; }

.form-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; margin-bottom: 12px; }

pre {
  white-space: pre-wrap; word-break: break-word;
  background: rgba(16, 18, 16, .05);
  border: 1px dashed rgba(0,0,0,.18);
  padding: 12px 14px; border-radius: 3px;
  max-height: 320px; overflow: auto;
  font-family: "SF Mono", "Menlo", monospace; font-size: 12.5px;
  color: #3a372c;
}

/* ── 涨跌（中式：红涨绿跌）── */
.buy  { color: var(--cinnabar); font-weight: 700; }
.sell { color: var(--jade); font-weight: 700; }

/* ── 符箓 ── */
.fu {
  position: absolute; top: -26px; right: -16px; z-index: 2;
  height: 168px; width: auto;
  transform: rotate(3.5deg);
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .5));
  user-select: none; pointer-events: none;
}
.card:nth-child(odd) .fu { transform: rotate(-2.5deg); }

/* ── 演武 · 模拟池 ── */
.sim-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.pf { background: rgba(176,141,62,.07); border: 1px solid var(--hairline); border-radius: 4px; padding: 14px 16px; }
.pf h3 { margin: 0 0 10px; font-size: 15px; letter-spacing: .1em; color: #4a3b1e; }
.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.stat-row div { display: flex; flex-direction: column; align-items: center; min-width: 62px; }
.stat-row b { font-size: 17px; }
.stat-row small { color: #6f6753; }
.spark { display: block; margin: 4px 0 10px; background: rgba(16,18,16,.04); border-radius: 3px; }
.dim2 { color: #8a8578; font-size: 12.5px; }
.ops { margin: 8px 0 0; }
.pool-line { margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--hairline); font-size: 13px; color: #4a4436; }
.pf table { font-size: 13px; }
.pf th, .pf td { padding: 6px 8px; }

/* ── 页脚 ── */
.foot {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 10px 4px 4px;
  color: var(--gold); font-size: 13px; letter-spacing: .25em;
}
.foot .dim { color: var(--ash); letter-spacing: .1em; }

@media (max-width: 760px) {
  .form-row { grid-template-columns: 1fr; }
  .topbar { align-items: stretch; padding: 20px; }
  .layout { padding: 20px; }
  .backend-box { width: 100%; }
  .backend-box input { flex: 1; }
  h1 { font-size: 26px; }
}

/* ── 个股链接与详情页 ── */
.code-link {
  color: var(--cinnabar); font-weight: 700; letter-spacing: .04em;
  text-decoration: none; border-bottom: 1px dotted rgba(192,63,43,.45);
}
.code-link:hover { border-bottom-style: solid; }

.score-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 8px; }
.score-cell { background: rgba(176,141,62,.07); border: 1px solid var(--hairline); border-radius: 4px; padding: 10px 12px; }
.score-cell h4 { margin: 0 0 6px; font-size: 13px; color: #6f6753; letter-spacing: .08em; }
.score-cell .sc-val { font-size: 20px; font-weight: 700; color: var(--cinnabar); }
.bar { height: 6px; background: rgba(16,18,16,.08); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--cinnabar)); }

.badge {
  display: inline-block; padding: 3px 10px; margin: 3px 6px 0 0;
  border: 1px solid var(--hairline); border-radius: 3px;
  font-size: 12.5px; color: #4a3b1e; background: rgba(176,141,62,.09);
  letter-spacing: .06em;
}
.back-link { display: inline-block; margin: 0 0 14px; color: var(--gold); text-decoration: none; font-size: 14px; letter-spacing: .15em; }
.back-link:hover { color: var(--cinnabar); }
.stock-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.stock-code { font-size: 15px; color: #6f6753; letter-spacing: .1em; }
.axis { display: flex; justify-content: space-between; margin: 6px 2px 0; font-size: 12.5px; color: #8a8578; }
.spark.big { display: block; margin: 6px 0; background: rgba(16,18,16,.04); border-radius: 3px; }

/* ── 手机适配（≤760px 自动生效）── */
@media (max-width: 760px) {
  .form-row { grid-template-columns: 1fr; }
  .topbar { align-items: stretch; padding: 20px; }
  .layout { padding: 20px; }
  .backend-box { width: 100%; }
  .backend-box input { flex: 1; }
  h1 { font-size: 26px; }

  /* 卡片留白收紧，符箓缩小防遮字 */
  .card { padding: 20px 18px; margin-bottom: 26px; }
  .fu { height: 108px; top: -18px; right: -10px; opacity: .85; }

  /* 模拟池单列 */
  .sim-grid { grid-template-columns: 1fr; }
  .stat-row { gap: 10px; }
  .stat-row div { min-width: 56px; }
  .stat-row b { font-size: 15px; }

  /* 表格→卡片：表头隐藏，每行变卡，每格左标签右值 */
  table.resp, .pf table, #signalsBody { font-size: 13.5px; }
  .pf table thead, table.resp thead { display: none; }
  .pf table tr, table.resp tr {
    display: block; margin-bottom: 10px; padding: 8px 10px;
    border: 1px solid var(--hairline); border-radius: 4px;
    background: rgba(255,255,255,.35);
  }
  .pf table td, table.resp td {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    padding: 4px 2px; border: none; text-align: right;
  }
  .pf table td::before, table.resp td::before {
    content: attr(data-label);
    color: #8a8578; font-size: 12px; letter-spacing: .08em;
    flex-shrink: 0; text-align: left;
  }
  .pf table td[colspan], table.resp td[colspan] { justify-content: center; }
  .pf table td[colspan]::before, table.resp td[colspan]::before { content: none; }

  /* 列表项与按钮可点区域加大 */
  .list li { padding: 10px 0; }
  button { min-height: 40px; }
  pre { max-height: 220px; }

  /* 个股详情页 */
  .score-row { grid-template-columns: 1fr 1fr; }
  .stock-head h2 { font-size: 22px; }
}

@media (max-width: 380px) {
  .score-row { grid-template-columns: 1fr; }
}

/* ── 点将 · 三军选股 ── */
.army-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.army { background: rgba(176,141,62,.07); border: 1px solid var(--hairline); border-radius: 4px; padding: 14px 16px; }
.army h3 { margin: 0 0 4px; font-size: 15px; letter-spacing: .08em; color: #4a3b1e; }
.army h3 small { font-weight: 400; letter-spacing: 0; }
.army h4 { margin: 12px 0 4px; font-size: 13px; color: #6f6753; letter-spacing: .1em; border-top: 1px dashed var(--hairline); padding-top: 10px; }
.pick-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 7px 2px; border-bottom: 1px dashed rgba(0,0,0,.08);
}
.pick-row:last-child { border-bottom: none; }
.pick-main small { color: #6f6753; margin-left: 6px; }
.pick-right { font-size: 12.5px; color: #8a8578; white-space: nowrap; }
.tag { display: inline-block; padding: 1px 8px; margin-left: 6px; border-radius: 3px; font-size: 12px; letter-spacing: .05em; }
.tag-buy  { color: var(--cinnabar); border: 1px solid rgba(192,63,43,.4); background: rgba(192,63,43,.07); }
.tag-sell { color: var(--jade); border: 1px solid rgba(79,122,99,.4); background: rgba(79,122,99,.07); }
.tag-skip { color: #8a8578; border: 1px solid rgba(0,0,0,.18); background: rgba(0,0,0,.04); }
.tag-wait { color: #4a3b1e; border: 1px solid rgba(176,141,62,.45); background: rgba(176,141,62,.1); }
.tag-hold { color: #4a3b1e; border: 1px dashed rgba(176,141,62,.45); }
.army-foot { margin: 10px 0 0; border-top: 1px dashed var(--hairline); padding-top: 8px; }
.gate-line { margin: 2px 0 8px; }

@media (max-width: 760px) {
  .army-grid { grid-template-columns: 1fr; }
}

/* ── 演武 · 实时刷新（8/4） ── */
.rt-now { color: var(--cinnabar); }
.rt-badge { color: var(--cinnabar); border: 1px solid rgba(192,63,43,.4); background: rgba(192,63,43,.07); border-radius: 3px; padding: 0 5px; font-size: 11px; margin-left: 6px; }
.rt-line { margin: 8px 0 2px; padding: 6px 8px; border: 1px dashed var(--hairline); border-radius: 6px; background: rgba(192,63,43,.04); }
button:disabled { opacity: .55; cursor: wait; }

/* ── 问道 · 日课一卦（8/4 v2：墨条卦画+白话释义） ── */
.gua-wrap { display: flex; gap: 16px; align-items: flex-start; }
.gua-svg { background: rgba(43,36,25,.05); border-radius: 8px; border: 1px solid var(--hairline); }
.gua-name { font-size: 20px; color: var(--gold); letter-spacing: .15em; }
.gua-ci { margin: 6px 0 2px; font-size: 14px; line-height: 1.6; font-weight: 600; }
.gua-yi { margin: 2px 0 6px; font-size: 13px; line-height: 1.7; color: #6b5a36; }

/* 问道v3: 动爻爻辞(朱砂左边线)+之卦 */
.gua-dong{margin:8px 0 0;font-size:13.5px;font-weight:600;color:#8a2c1d;border-left:3px solid #c03f2b;padding-left:8px;line-height:1.65}
.gua-dong span{font-weight:400;color:#6b5a36;font-size:12.5px}
.gua-bian{margin:6px 0 0;font-size:12.5px;color:#8a6d2f}
.gua-bian span{color:#a89468;font-size:11px}


/* ── 8/9 前端优化: 观象饼图汇总 / 星宿·阵法摘要 / 跳转链接 ── */
.donut-wrap { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.donut-wrap > svg { flex: none; }
.donut-side { flex: 1; min-width: 180px; }
.donut-side p { margin: 6px 0; font-size: 14px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 7px; }
.dot-buy { background: var(--cinnabar); }
.dot-sell { background: var(--jade); }
.sig-links { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px !important; }
.jump-link { color: var(--cinnabar); text-decoration: none; font-size: 14px; letter-spacing: .06em; border-bottom: 1px dashed rgba(192,63,43,.5); padding-bottom: 1px; }
.jump-link:hover { border-bottom-style: solid; }
.sum-line { margin: 4px 0 6px; font-size: 14px; }
.sum-line b { color: var(--cinnabar); font-size: 17px; }
.sum-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 10px; }
.sum-chips .tag { margin-left: 0; }

/* 明细页通用 */
.detail-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.detail-head h2 { margin: 0; }
.detail-head .dim2 { font-size: 12.5px; }
.judge-cell small { display: block; color: #6f6753; line-height: 1.5; }
.grp-title { margin: 18px 0 6px; font-size: 15px; letter-spacing: .1em; color: #4a3b1e; border-top: 1px dashed var(--hairline); padding-top: 12px; }
@media (max-width: 760px) {
  .donut-wrap { justify-content: center; }
  .donut-side { min-width: 100%; }
}
