/* =========================================================
   四维周期地图 · 沉浸式全屏
   ========================================================= */
:root {
  --bg: #000000;
  --ink: #dfe9f5;
  --ink-2: #93a3b8;
  --ink-3: #6a7889;
  --ink-4: #8892b0;
  --hair: rgba(140, 180, 225, .10);
  --hair-2: rgba(140, 180, 225, .22);
  --glass: rgba(15, 20, 30, .70);
  --cyan: #8fd8ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #000;
  overflow: hidden;
  color: var(--ink);
  font-family: "Roboto Light", Roboto, "Helvetica Neue", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "DengXian", 等线, sans-serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ===== 舞台：铺满视口，3D 永远居中 ===== */
.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #000;
}

.chart {
  position: absolute;
  inset: 0;
}

.chart canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ===== 标签层 ===== */
.labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  /* 明确低于标题层（.hero 是 9）：球顶的阶段名不该盖住标题与摘要 */
  z-index: 4;
}

.lbl {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  will-change: transform, opacity;
  transform: translate(-50%, -50%);
  transition: opacity .12s linear;
}

/* 轴上的阶段刻度：与轴线同色、低透明度，只作参考不抢主体 */
.lbl-stage {
  padding: 1px 4px;
  font-size: 10px;
  line-height: 1.3;
  letter-spacing: .3px;
  color: #8fa2b6;
  font-weight: 300;
  border-radius: 2px;
  text-shadow: 0 0 4px #000, 0 0 9px rgba(0, 0, 0, .85);
  transition: opacity .2s ease, color .25s ease;
}

/* 当前组合在轴上的落点阶段名：亮起来，告诉你连线指向哪一阶 */
.lbl-stage.is-hit {
  font-weight: 400;
  background: rgba(4, 8, 14, .55);
  text-shadow: 0 0 5px #000, 0 0 12px currentColor;
}

/* 轴名 */
.lbl-axis {
  padding: 0 4px;
  font-size: 10px;
  letter-spacing: 1.6px;
  color: #9fb4c8;
  text-shadow: 0 0 8px rgba(0, 0, 0, .95);
}

/* 参考点（球心 / 南北极） */
.lbl-ref {
  font-size: 9px;
  letter-spacing: .6px;
  color: #6d7c8a;
  text-shadow: 0 0 6px rgba(0, 0, 0, .9);
}

/* 当前 / 被点击的点：四维组合标签 */
.lbl-current {
  max-width: 190px;
  padding: 4px 8px 5px;
  white-space: normal;
  font-size: 10px;
  line-height: 1.72;
  letter-spacing: .3px;
  text-align: left;
  border: 1px solid;
  border-radius: 3px;
  background: rgba(4, 8, 14, .62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.lbl-current b {
  font-weight: 400;
  letter-spacing: .2px;
}

.lbl-current i {
  display: inline-block;
  width: 3px;
  height: 3px;
  margin-right: 5px;
  border-radius: 50%;
  vertical-align: middle;
}

.lbl-current .cmb-line { display: block; }
.lbl-current .cmb-sep {
  display: inline-block;
  margin: 0 3px;
  color: rgba(255, 255, 255, .22);
}

/* ===== 顶部标题 ===== */
.hero {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  /* 必须压过点云标签层（.labels 是 4）：球顶的阶段名不该盖住标题与摘要 */
  z-index: 9;
  padding: 4px 56px 22px;
}

/* 标题区的压暗底：点云密集时靠这层把文字托出来。
   用伪元素而不是 background，是为了能做「中间实、四周渐隐」的柔和过渡。 */
.hero::before {
  content: "";
  position: absolute;
  inset: -34px -60px -10px;
  z-index: -1;
  border-radius: 50% 50% 46% 46%;
  background: radial-gradient(ellipse at 50% 42%,
    rgba(0, 0, 0, .82) 0%,
    rgba(0, 0, 0, .62) 42%,
    rgba(0, 0, 0, .28) 68%,
    rgba(0, 0, 0, 0) 100%);
  pointer-events: none;
}

/* 第一行：实时时间（页面最醒目的元素）+ 盘面状态胶囊 */
.hero-clock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0;
}

.hero-time {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(23px, 2.4vw, 28px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: .06em;
  color: #eef6ff;
  font-variant-numeric: tabular-nums;
  text-shadow:
    0 0 18px rgba(143, 216, 255, .3),
    0 0 46px rgba(80, 150, 220, .16);
}

.hero-date {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 9px 0 0;
  font-size: 11px;
  font-weight: 300;
  letter-spacing: .14em;
  text-indent: .14em;
  color: var(--ink-4);
}

.hero-stamp {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: .06em;
  color: #7d8ea3;
}

.hero-cls {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  letter-spacing: .2em;
  color: #8b9db2;
}

.hero-cls i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  transition: background .3s ease, box-shadow .3s ease;
}

.hero-cls b {
  font-weight: 300;
  letter-spacing: .2em;
  transition: color .3s ease;
}

.hero-date em {
  font-style: normal;
  color: #5a6675;
}

/* ===== 左下角：市场环境诊断 ===== */
.diag {
  position: absolute;
  left: 40px;
  bottom: 46px;
  max-width: min(390px, calc(100vw - 80px));
  padding-left: 15px;
  z-index: 6;
  pointer-events: none;
  --dc: #8b9db2;
}

/* 左侧 4px 高亮竖线，颜色跟随分类 */
.diag::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 4px;
  width: 4px;
  border-radius: 2px;
  background: var(--dc);
  box-shadow: 0 0 14px var(--dc), 0 0 4px var(--dc);
  transition: background .4s ease, box-shadow .4s ease;
}

.diag-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .04em;
  line-height: 1.35;
  color: var(--dc);
  transition: color .4s ease;
}

.diag-row {
  display: flex;
  gap: 10px;
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.78;
  color: #a0aabf;
}
.diag-row:last-child { margin-bottom: 0; }

.diag-k {
  flex: none;
  width: 32px;
  font-size: 12.5px;
  font-weight: 600;
  color: #e0e0e0;
  letter-spacing: .1em;
}

.diag-v { flex: 1; }

/* ===== 左下角版本号 ===== */
.ver {
  position: absolute;
  left: 40px;
  bottom: 18px;
  font-size: 10px;
  letter-spacing: .16em;
  color: #cdd8e4;
  opacity: .3;
  pointer-events: none;
  z-index: 5;
}

/* ===== 顶部全局状态：时间 / 盘面状态胶囊 / 三大指数 ===== */
.hs-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px 3px 9px;
  border: 1px solid rgba(140, 165, 190, .26);
  border-radius: 999px;
  background: rgba(120, 150, 180, .1);
  font-size: 11px;
  letter-spacing: .14em;
  text-indent: .14em;
  color: #9db2c8;
  transition: color .3s ease, border-color .3s ease, background .3s ease, box-shadow .3s ease;
}

.hs-tag b { font-weight: 400; }

.hs-tag i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5d6d7d;
}

/* 盘中：绿色呼吸 + 微弱外发光 */
.hs-tag[data-tone="open"] {
  color: #86f0bd;
  border-color: rgba(53, 208, 127, .42);
  background: rgba(53, 208, 127, .12);
  box-shadow: 0 0 14px rgba(53, 208, 127, .18);
}

.hs-tag[data-tone="open"] i {
  background: #35d07f;
  box-shadow: 0 0 8px rgba(53, 208, 127, .9);
  animation: hsPulse 2.4s ease-in-out infinite;
}

/* 盘后/午休：灰蓝；休市：更暗 */
.hs-tag[data-tone="closed"] {
  color: #a6b9cc;
  border-color: rgba(140, 165, 190, .34);
  background: rgba(120, 150, 180, .14);
}
.hs-tag[data-tone="closed"] i { background: #8b9aa8; opacity: .85; }
.hs-tag[data-tone="rest"] { color: #8598ab; background: rgba(120, 150, 180, .06); }
.hs-tag[data-tone="rest"] i { background: #4a5563; }

@keyframes hsPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.8); }
}

/* 第三行：三大指数 */
.hero-quotes {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 4px 14px;
  margin: 8px 0 0;
  font-size: 11px;
  letter-spacing: .04em;
  color: #8b9aa8;
}

.hs-quote { display: inline-flex; align-items: baseline; gap: 5px; }
.hs-quote em { font-style: normal; color: #6f7d8c; letter-spacing: .04em; }
.hs-quote b {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: #8b9aa8;
}
.hs-quote b.up { color: #ff6b6b; }
.hs-quote b.down { color: #35d07f; }

/* ===== 右下角运行日志 ===== */
.runlog {
  position: absolute;
  right: 26px;
  bottom: 108px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 300px;
  height: 118px;
  overflow: hidden;
  pointer-events: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: .02em;
  color: rgba(96, 220, 200, .34);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 44%, #000 96%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 44%, #000 96%, transparent 100%);
  transition: right .46s cubic-bezier(.22, .61, .36, 1);
}

.stage.is-panel-open .runlog { right: 406px; }

.log-line {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: logIn .32s ease-out both;
}

.log-line time { color: rgba(96, 220, 200, .28); margin-right: 6px; }
.log-line.is-warn { color: rgba(255, 176, 96, .42); }
.log-line.is-err { color: rgba(255, 110, 110, .46); }

@keyframes logIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== 左下角齿轮 + 设置弹窗 ===== */
.verbar {
  position: absolute;
  left: 40px;
  bottom: 18px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 4px;
}

.verbar .ver { position: static; left: auto; bottom: auto; }
.ver-brand { color: #cdd8e4; }
.ver-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: .08em;
}
.ver-tail { opacity: .72; }

.gear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 2px;
  background: transparent;
  color: #8b9aa8;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}

.gear:hover,
.gear[aria-expanded="true"] {
  color: #d3e0ec;
  border-color: rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .05);
}

.modal {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal[hidden] { display: none !important; }

.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 8, .62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(360px, 100%);
  max-height: 84%;
  overflow: auto;
  padding: 18px 18px 14px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 3px;
  background: rgba(12, 18, 26, .9);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
  color: #c3d0dc;
}

.modal-title {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .22em;
  color: #e2ecf6;
}

.modal-x {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #7c8b9b;
  font-size: 12px;
  cursor: pointer;
}

.modal-x:hover { color: #e2ecf6; }

.set-block { margin: 0 0 14px; }

.set-h {
  margin: 0 0 6px;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .18em;
  color: #6f7d8c;
}

.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  font-size: 11.5px;
  letter-spacing: .04em;
  color: #a9b8c7;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
  cursor: pointer;
}

.set-row:last-child { border-bottom: 0; }

.set-row input[type="checkbox"],
.set-row input[type="radio"] {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: #35c9a4;
  cursor: pointer;
}

.set-select {
  min-width: 108px;
  padding: 3px 6px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 2px;
  background: rgba(255, 255, 255, .04);
  color: #cfdcea;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.set-select option { background: #0d131b; color: #cfdcea; }

/* schema 驱动的输入控件：数字/时间/代码列表 */
.set-input {
  width: 74px;
  padding: 3px 6px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 2px;
  background: rgba(255, 255, 255, .04);
  color: #cfdcea;
  font: inherit;
  font-size: 11px;
  text-align: right;
}

.set-input:focus {
  outline: none;
  border-color: rgba(53, 201, 164, .5);
  box-shadow: 0 0 0 2px rgba(53, 201, 164, .12);
}

.set-input-wide {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  margin-left: 10px;
  text-align: left;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
  letter-spacing: .02em;
}

/* .set-row 是 flex，会盖掉 [hidden] 的 UA display:none */
.set-field[hidden] { display: none; }

.set-run {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(53, 201, 164, .38);
  border-radius: 2px;
  background: rgba(53, 201, 164, .1);
  color: #7fe3c6;
  font: inherit;
  font-size: 11.5px;
  letter-spacing: .06em;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, opacity .2s ease;
}

.set-run:hover:not(:disabled) { background: rgba(53, 201, 164, .18); border-color: rgba(53, 201, 164, .6); }
.set-run:disabled { opacity: .45; cursor: not-allowed; }
.set-run.is-busy { opacity: .8; cursor: progress; }
.set-run .set-note { font-size: 9.5px; letter-spacing: .06em; opacity: .6; }

.hist-list {
  max-height: 170px;
  overflow: auto;
  margin: 2px 0 0;
  border-top: 1px solid rgba(255, 255, 255, .05);
}

.hist-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 7px 4px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, .045);
  background: transparent;
  color: #a9b8c7;
  font: inherit;
  font-size: 11px;
  letter-spacing: .03em;
  text-align: left;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}

.hist-item:hover { background: rgba(255, 255, 255, .05); color: #e2ecf6; }
.hist-item.is-current { color: #7fe3c6; }

.hist-item .hist-combo {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  color: #8b9aa8;
  white-space: nowrap;
}

.hist-empty {
  margin: 8px 0;
  font-size: 10.5px;
  letter-spacing: .04em;
  color: #63717f;
}

.set-foot {
  margin: 4px 0 0;
  font-size: 9.5px;
  line-height: 1.6;
  letter-spacing: .04em;
  color: #63717f;
}

/* 3D 组件关闭时只收画布与标签，页面版式（标题/诊断/面板）不动 */
.stage.no-sphere .chart,
.stage.no-sphere .labels,
.stage.no-sphere .tip,
.stage.no-sphere .hint,
.stage.no-sphere .views { visibility: hidden; }

/* ===== 提示 ===== */
.hint {
  position: absolute;
  right: 26px;
  bottom: 46px;
  font-size: 10px;
  letter-spacing: .18em;
  color: #5c6a79;
  opacity: .55;
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
  text-align: right;
  transition: right .46s cubic-bezier(.22, .61, .36, 1);
}

/* 报告面板展开时，右下角工具条整体让到面板左侧，避免被压住点不到。
   406px = 面板宽 380（见下方 .panel 覆盖）+ 26px 边距 */
.stage.is-panel-open .hint { right: 406px; }

/* ===== 视角按钮 ===== */
.views {
  position: absolute;
  right: 26px;
  bottom: 20px;
  display: flex;
  gap: 2px;
  z-index: 6;
  transition: right .46s cubic-bezier(.22, .61, .36, 1);
}

.stage.is-panel-open .views { right: 406px; }

.vbtn {
  padding: 5px 11px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: #5f6d7c;
  font: inherit;
  font-size: 10px;
  letter-spacing: .16em;
  cursor: pointer;
  transition: color .22s ease, border-color .22s ease, background .22s ease;
}

.vbtn:hover { color: #b9c9d9; }

.vbtn.is-active {
  color: #cfe6ff;
  border-color: rgba(143, 216, 255, .22);
  background: rgba(143, 216, 255, .06);
}

.vdot {
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-right: 6px;
  border-radius: 50%;
  background: #46525f;
  vertical-align: middle;
  transition: background .25s ease, box-shadow .25s ease;
}

.vbtn-toggle[aria-pressed="true"] .vdot {
  background: #5fe0b0;
  box-shadow: 0 0 8px rgba(95, 224, 176, .8);
}

.vbtn-toggle[aria-pressed="true"] { color: #a9d8c8; }

/* ===== 右侧折叠面板 ===== */
.dock {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 46px;
  z-index: 8;
}

/* 收起时只露出一条极窄的边 */
.dock-edge {
  position: absolute;
  top: 50%;
  right: 0;
  width: 1px;
  height: 118px;
  margin-top: -59px;
  background: linear-gradient(180deg,
    rgba(143, 216, 255, 0) 0%,
    rgba(143, 216, 255, .28) 30%,
    rgba(143, 216, 255, .28) 70%,
    rgba(143, 216, 255, 0) 100%);
  opacity: .35;
  transition: opacity .35s ease;
}

.dock:hover .dock-edge { opacity: 0; }

.panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 320px;
  max-width: 88vw;
  background: var(--glass);
  backdrop-filter: blur(10px) saturate(115%);
  -webkit-backdrop-filter: blur(10px) saturate(115%);
  border-left: 1px solid rgba(143, 216, 255, .16);
  box-shadow:
    -18px 0 46px rgba(0, 0, 0, .55),
    inset 1px 0 0 rgba(143, 216, 255, .06);
  transform: translateX(calc(100% - 1px));
  transition: transform .46s cubic-bezier(.22, .61, .36, 1);
  overflow: hidden;
}

.dock:hover .panel,
.dock:focus-within .panel {
  transform: translateX(0);
}

.panel-inner {
  height: 100%;
  padding: 30px 20px 26px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(143, 216, 255, .18) transparent;
}

.panel-inner::-webkit-scrollbar { width: 4px; }
.panel-inner::-webkit-scrollbar-thumb {
  background: rgba(143, 216, 255, .18);
  border-radius: 2px;
}

.panel-block { margin-bottom: 22px; }
.panel-block:last-child { margin-bottom: 0; }

.panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 11px;
  font-size: 10px;
  font-weight: 300;
  letter-spacing: .22em;
  color: #7d8b9b;
}

.panel-tip {
  font-size: 9px;
  letter-spacing: .1em;
  color: #4c5966;
}

/* ===== 下拉 ===== */
.sel-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.sel-name {
  flex: none;
  width: 62px;
  font-size: 10px;
  letter-spacing: .08em;
  color: #7d8b9b;
  white-space: nowrap;
}

.sel-name i {
  display: inline-block;
  width: 3px;
  height: 3px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: middle;
}

.sel-row select {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--hair);
  border-radius: 2px;
  background-color: rgba(255, 255, 255, .03);
  color: #cfdcea;
  font: inherit;
  font-size: 11px;
  letter-spacing: .02em;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #5f6d7c 50%),
                    linear-gradient(135deg, #5f6d7c 50%, transparent 50%);
  background-position: calc(100% - 13px) 51%, calc(100% - 9px) 51%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  transition: border-color .2s ease, background-color .2s ease;
}

.sel-row select:hover { border-color: var(--hair-2); }
.sel-row select:focus { border-color: rgba(143, 216, 255, .38); }

.sel-row select option {
  background: #0b1119;
  color: #cfdcea;
}

/* ===== 概览卡 ===== */
.sum-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.sum-badge {
  padding: 3px 9px;
  border: 1px solid;
  border-radius: 2px;
  font-size: 11px;
  letter-spacing: .12em;
}

.sum-id {
  padding: 1px 6px;
  border: 1px solid var(--hair);
  border-radius: 2px;
  background: rgba(255, 255, 255, .03);
  color: var(--ink-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Roboto Mono", monospace;
  font-size: 9.5px;
  letter-spacing: .1em;
}

.sum-list {
  margin: 0 0 13px;
  padding: 0;
  list-style: none;
}

.sum-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .035);
  font-size: 10.5px;
}

.sum-list li:last-child { border-bottom: 0; }

.sum-dim {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #7d8b9b;
  white-space: nowrap;
}

.sum-dim i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
}

.sum-list b {
  font-weight: 400;
  font-size: 11px;
  text-align: right;
}

.sum-meta {
  display: grid;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, .05);
  font-size: 10px;
}

.sum-meta > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.sum-meta span { color: #6b7887; letter-spacing: .06em; }
.sum-meta b { font-weight: 400; font-size: 11px; color: #cfdcea; }
.sum-meta .dim { font-size: 9.5px; color: #55626f; }

.sum-rich {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, .05);
}

.sum-rich > div { display: grid; gap: 3px; }
.sum-rich span { font-size: 9.5px; color: #6b7887; letter-spacing: .08em; }
.sum-rich p {
  margin: 0;
  font-size: 10.5px;
  line-height: 1.7;
  color: #9fb0c0;
  letter-spacing: .02em;
}

.sum-desc {
  margin: 12px 0 0;
  font-size: 10px;
  line-height: 1.75;
  color: #8b9aa8;
  letter-spacing: .02em;
}

/* ===== 图例 ===== */
.legend { display: grid; gap: 1px; }

.lg-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: #8494a6;
  font: inherit;
  font-size: 10.5px;
  letter-spacing: .04em;
  text-align: left;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}

.lg-item:hover { background: rgba(255, 255, 255, .04); color: #cfdcea; }
.lg-item.is-off { opacity: .34; }
.lg-item.is-static { cursor: default; }
.lg-item.is-static:hover { background: transparent; }

.lg-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex: none;
  box-shadow: 0 0 0 1px rgba(200, 216, 232, .35);
}

.lg-dot-current {
  background: #f5253a;
  box-shadow: 0 0 0 1px #fff, 0 0 0 3px rgba(245, 37, 58, .22);
}

.lg-name { flex: 1; }

.lg-count {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9.5px;
  color: #55626f;
}

/* ===== tooltip ===== */
.tip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 9;
  min-width: 190px;
  max-width: 260px;
  padding: 10px 12px;
  border: 1px solid var(--hair);
  border-radius: 3px;
  background: rgba(8, 12, 19, .82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .55);
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s ease;
}

.tip.is-on { opacity: 1; }

.tip-head {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9px;
  letter-spacing: .1em;
  color: #55626f;
}

.tip-title {
  margin: 3px 0 8px;
  font-size: 12px;
  font-weight: 300;
  letter-spacing: .1em;
}

.tip-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
  font-size: 10px;
  color: #93a3b8;
}

.tip-k { display: inline-flex; align-items: center; gap: 5px; color: #6b7887; }
.tip-k i { width: 3px; height: 3px; border-radius: 50%; }
.tip-row b { font-weight: 400; color: #dfe9f5; }

.tip-meta {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 255, 255, .06);
  font-size: 9.5px;
  color: #6b7887;
}

.tip-meta b { color: #cfdcea; font-weight: 400; }

/* ===== 降级提示 ===== */
.fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  text-align: center;
  background: #000;
  z-index: 20;
}

.fallback[hidden] { display: none !important; }

.fallback-icon {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 210, 120, .5);
  border-radius: 50%;
  color: #ffd278;
  font-size: 16px;
  line-height: 32px;
  text-align: center;
}

.fallback h3 {
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 300;
  letter-spacing: .16em;
  color: #cfdcea;
}

.fallback p {
  max-width: 420px;
  margin: 0;
  font-size: 11px;
  line-height: 1.85;
  color: #6b7887;
}


@media (prefers-reduced-motion: reduce) {
  .panel { transition: none; }
}

/* =========================================================
   报告面板（技能输出专用）
   ========================================================= */
/* 报告模式：面板常开、略宽，留给长文本 */
.panel { width: 380px; }
.dock.is-open .panel { transform: translateX(0); }
.dock.is-open .dock-edge { opacity: 0; }

.rep-lead {
  margin: 0 0 16px;
  font-size: 12px;
  line-height: 1.78;
  color: #b9c4d6;
}
.rep-lead b { color: var(--dc, #e6edf7); font-weight: 500; }

.rep-dims { margin: 0; padding: 0; list-style: none; }
.rep-dims li {
  margin: 0 0 14px;
  padding: 0 0 0 10px;
  border-left: 1px solid rgba(143, 216, 255, .12);
}
.rep-dims li:last-child { margin-bottom: 0; }

.rep-row {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-size: clamp(10.5px, 3.1vw, 11.5px);
  line-height: 1.5;
}
.rep-row .rep-dim {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #7f8ea3;
  letter-spacing: .04em;
}
.rep-row .rep-dim i {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
}
.rep-row b { font-size: 12.5px; font-weight: 500; letter-spacing: .02em; }
.rep-row small {
  margin-left: auto;
  flex: none;
  font-size: 10px;
  color: #5f6b7c;
  letter-spacing: .02em;
}

.rep-ev {
  margin: 5px 0 0;
  font-size: 11.5px;
  line-height: 1.7;
  color: #8b98ac;
  text-wrap: pretty;
}

.rep-watch { margin: 0; padding: 0 0 0 2px; list-style: none; counter-reset: w; }
.rep-watch li {
  counter-increment: w;
  position: relative;
  margin: 0 0 9px;
  padding-left: 18px;
  font-size: 11.5px;
  line-height: 1.72;
  color: #a0aabf;
}
.rep-watch li:last-child { margin-bottom: 0; }
.rep-watch li::before {
  content: counter(w, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1px;
  font-size: 9.5px;
  letter-spacing: .04em;
  color: #5f6b7c;
  font-variant-numeric: tabular-nums;
}

.rep-foot {
  margin: 18px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(143, 216, 255, .08);
  font-size: 10px;
  line-height: 1.65;
  color: #55606f;
}


/* 依据行：维度名内联 + 原文证据 */
.rep-dims li { border-left: none; padding-left: 0; margin-bottom: 11px; }
.rep-ev .rep-dim {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 7px;
  font-size: 11.5px;
  letter-spacing: .04em;
}
.rep-ev .rep-dim i {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
}

/* 报告面板开合：两个把手都在屏幕右缘中部，右上角留给系统关闭按钮。
   收起时露出 .panel-toggle（屏幕右缘竖条），展开时交给 .panel-fold（面板左缘）。 */
.panel-toggle {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 12;
  display: block;
  width: 7px;
  height: 104px;
  padding: 0;
  border: 0;
  border-radius: 4px 0 0 4px;
  background: rgba(143, 216, 255, .16);
  cursor: pointer;
  transition: background .2s ease, opacity .18s ease;
}
.panel-toggle::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 12px rgba(143, 216, 255, .28);
  opacity: .5;
}
.panel-toggle:hover { background: rgba(143, 216, 255, .34); }
/* 展开时淡出，避免和面板左缘的收起把手重叠 */
.panel-toggle.is-off {
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
}

/* 报告页：面板只由 class 控制，不响应 hover/focus，避免收起后被鼠标扫开 */
.stage.is-report .dock:hover .panel,
.stage.is-report .dock:focus-within .panel {
  transform: translateX(calc(100% - 1px));
}
.stage.is-report .dock.is-open .panel {
  transform: translateX(0);
}
.stage.is-report .dock:hover .dock-edge { opacity: .35; }
.stage.is-report .dock.is-open .dock-edge { opacity: 0; }

/* 面板收起把手：面板左缘中部，右上角不放任何按钮（留给浏览器的页面控件） */
.panel-fold {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  z-index: 13;
  width: 20px;
  height: 60px;
  display: grid;
  place-items: center;
  padding: 0;
  font: inherit;
  font-size: 15px;
  line-height: 1;
  color: #8fa2b6;
  background: rgba(10, 14, 20, .62);
  border: 1px solid rgba(143, 216, 255, .16);
  border-left: 0;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.panel-fold:hover {
  color: #e6effa;
  border-color: rgba(143, 216, 255, .38);
  background: rgba(16, 22, 32, .82);
}

/* 副标题（可选字段 subtitle） */
.hero-sub {
  max-width: 620px;
  margin: 9px auto 0;
  font-size: 11px;
  line-height: 1.7;
  letter-spacing: .06em;
  color: #7c8b9f;
}

/* ── 定位阶段行与生成信息 ───────────────────────────────────── */
.rep-stage {
  display: inline-block;
  margin-right: 7px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .02em;
  color: #dbe6f4;
}
.rep-quote {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.68;
  color: #7d8a9d;
  text-wrap: pretty;
}
.hero-sub {
  margin: 8px 0 0;
  /* .hero 是 left:50% + translateX(-50%) 的收缩容器，子元素的 max-width
     只封顶不撑宽，摘要会缩成一条 300px 的窄柱、40 多字的结论被压成三行。
     给死宽度才能按预期两行排完。 */
  width: min(620px, 72vw);
  max-width: none;
  font-size: 12px;
  line-height: 1.7;
  color: #a9b6c7;
  text-wrap: pretty;
  /* 点云会从文字后面穿过，给文字一点暗底加描边才读得清 */
  text-shadow: 0 1px 3px rgba(0, 0, 0, .95), 0 0 14px rgba(0, 0, 0, .9);
  /* 摘要最多两行：长结论会把点云挤到屏幕外；620px 两行约 100 字，
     覆盖常见结论长度，超出才用省略号收尾。 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 定位依据里的维度圆点沿用分类色 */
.rep-ev .rep-dim { color: #7f8ea3; }

/* ===== 数据异常横幅 =====
   接口挂了不能只在页脚写一行小字：窄屏下面板是收起的，页脚根本看不到。
   放在顶部居中、压在点云之上，一眼就能发现。 */
.netbar {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 20px);
  padding: 7px 10px 7px 12px;
  border: 1px solid rgba(255, 176, 46, .5);
  border-radius: 6px;
  background: rgba(28, 18, 4, .92);
  color: #ffce7a;
  font-size: 11.5px;
  line-height: 1.5;
  letter-spacing: .02em;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.netbar[hidden] { display: none; }
.netbar-btn {
  flex: none;
  padding: 3px 9px;
  font: inherit;
  font-size: 11px;
  color: #ffce7a;
  background: rgba(255, 176, 46, .14);
  border: 1px solid rgba(255, 176, 46, .45);
  border-radius: 4px;
  cursor: pointer;
}
.netbar-btn:hover { background: rgba(255, 176, 46, .26); }

/* .hero-sub 用 -webkit-box 做行数截断后，[hidden] 的 UA 规则会被类选择器盖掉，
   导致空态仍然露出空的一段。这里显式兜回来。 */
.hero-sub[hidden] { display: none !important; }

/* =====================================================================
 * 窄屏（手机）覆盖层
 *
 * 必须放在文件最后：里面要改 .panel-toggle / .netbar 这些在后面才定义的
 * 选择器，同特异性下「后写的赢」，放前面会被基础样式盖掉（踩过一次）。
 * ===================================================================== */
@media (max-width: 768px) {
  /* 顶部整体下压，与原插件 style.css 一致：
     top 归零 + 上内边距 60px（基准值）+ 刘海安全区。
     这里曾经改成 14px，理由是「独立页面没有宿主关闭按钮需要避让」——那是只看了
     代码没看真机：手机上顶栏文字直接贴在状态栏/刘海下面，非常局促。原版这个 60px
     既让开安全区，也给了第一行呼吸空间，属于版式本身的一部分，不是宿主的临时补丁。 */
  .hero {
    top: 0;
    left: 0;
    right: 0;
    transform: none;
    width: auto;
    padding: calc(60px + env(safe-area-inset-top, 0px)) 20px 14px;
  }
  /* 压暗底跟着收窄，别糊到顶部按钮那一行 */
  .hero::before { inset: -18px -28px -8px; }

  /* 第一行是实时时间 + 状态胶囊：左右各留 24px 呼吸位即可 */
  .hero-clock {
    max-width: calc(100vw - 48px);
    margin: 0 auto;
    gap: 9px;
  }
  .hero-time { font-size: 22px; letter-spacing: .05em; }
  .hero-date {
    max-width: calc(100vw - 48px);
    margin: 8px auto 0;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    font-size: 10px;
    letter-spacing: .1em;
    text-indent: .1em;
    white-space: normal;
  }
  .hero-cls { letter-spacing: .1em; gap: 5px; }
  /* 盘面总结：允许换行、行高 1.6，左右各留 20px（.hero 内边距已给足），
     与上方日期拉开 10px */
  .hero-sub {
    width: auto;
    /* 手机上按「屏宽 80% 居中」收口：长结论不会横到屏幕两侧边缘 */
    max-width: 80vw;
    margin: 10px auto 0;
    font-size: 11.5px;
    line-height: 1.6;
    letter-spacing: .02em;
    white-space: normal;
    -webkit-line-clamp: 3;
  }
  /* 版本号在窄屏隐藏：与视角条挤在同一行 */
  .ver { display: none; }
  .hint { display: none; }
  /* 诊断区上移，给底部视角条留出一条呼吸缝；两者都避开刘海屏安全区 */
  .diag {
    left: calc(16px + env(safe-area-inset-left, 0px));
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    max-width: calc(100vw - 32px);
    padding-left: 12px;
  }
  .diag::before { width: 3px; }
  .diag-title { font-size: 15px; margin-bottom: 6px; }
  .diag-row { font-size: 11.5px; line-height: 1.76; gap: 8px; }
  .diag-k { width: 28px; font-size: 11px; }
  .views {
    right: calc(12px + env(safe-area-inset-right, 0px));
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    gap: 0;
  }
  .vbtn { padding: 5px 8px; font-size: 9px; letter-spacing: .1em; }
  /* 手机上那根 7px 把手太细，加宽到能稳稳点中；
     桌面靠鼠标悬停就能发现，手机没有悬停，必须给个可见的箭头标记 */
  .panel-toggle {
    width: 16px;
    height: 128px;
    right: calc(env(safe-area-inset-right, 0px));
  }
  .panel-toggle::after {
    /* 基础规则里 ::after 是纯光晕（content:"" + opacity:.5），
       这里要同时当箭头用，content / opacity 都得重新声明。 */
    content: "\2039"; /* ‹ */
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    font-size: 13px;
    line-height: 1;
    color: rgba(143, 216, 255, .9);
    box-shadow: 0 0 12px rgba(143, 216, 255, .28);
    opacity: 1;
  }
  .panel { width: 86vw; }
  .panel-inner { padding: 24px 16px 20px; }
  .rep-dims li { margin-bottom: 12px; }
  /* 手机上 .dock 是 z-index 8，主界面标题层 .hero 是 9：
     面板展开会占 86vw，标题会从面板左侧缝里透出来跟正文糊在一起。
     窄屏下面板就是整页，层级必须抬到最上面。 */
  .dock { z-index: 30; }
  .dock:not(.is-open) { z-index: 8; }
  /* 面板只占 86vw，左边那条缝会露出主界面文字；给 dock 铺一层全屏暗底，
     让未覆盖的区域「退后」而不是跟正文抢注意力。 */
  .dock.is-open::before {
    content: "";
    /* 宿主内是 absolute（相对 .dock），公开页是 fixed（相对视口）：
       两种情况下都用「向左多伸 14vw」补齐面板之外的 14vw 缝，全屏都被压暗 */
    position: fixed;
    inset: 0 0 0 -14vw;
    z-index: -1;
    background: rgba(2, 4, 8, .82);
    backdrop-filter: blur(3px);
  }
}

/* ===== 移动端：状态栏 / 日志 / 设置 ===== */
@media (max-width: 768px) {
  .hero-quotes {
    max-width: 92vw;
    margin: 7px auto 0;
    gap: 3px 10px;
    font-size: 10px;
  }
  .hs-quote { gap: 3px; }
  .hs-quote em { font-size: 9.5px; }
  .hs-tag { font-size: 10px; padding: 2px 9px 2px 7px; letter-spacing: .1em; }

  /* 底部 92px 是诊断块的地盘（混沌期/含义/策略），日志抬到它上面 */
  .runlog {
    left: 16px;
    right: 16px;
    bottom: 186px;
    width: auto;
    height: 64px;
    font-size: 9.5px;
    color: rgba(96, 220, 200, .34);
  }

  .verbar { left: 16px; bottom: 14px; gap: 2px; }
  /* 手机上左下角只剩「v0.1.22」：品牌与尾巴让位给底部视角条 */
  .verbar .ver { display: block; font-size: 9px; letter-spacing: .1em; }
  .ver-brand, .ver-tail { display: none; }
  .gear { width: 26px; height: 26px; font-size: 13px; }

  .modal { padding: 16px; }
  .modal-card { padding: 16px 14px 12px; }
  .set-row { font-size: 11px; }
}

/* 超窄屏（≤430px，多数手机竖屏）：状态行必须单行，压字号与间距 */
@media (max-width: 430px) {
  .hero-quotes { max-width: 94vw; gap: 3px 8px; }
  .hero-date { letter-spacing: .1em; text-indent: .1em; gap: 6px; }
  .hs-quotes { gap: 3px 8px; }
  .hs-quote { gap: 2px; }
  .hs-quote em { font-size: 9px; }
  .hs-quote b { font-size: 9.5px; }
}

/* =========================================================
   站点补丁（Cloudflare Pages 版）—— 由 scripts/sync-assets.py 追加在 style.css 之后
   ---------------------------------------------------------
   原版 .fallback 是 inset:0 + background:#000，一盖就把顶栏、诊断区、右侧面板
   全吃掉——「不支持 WebGL」等于「什么都看不到」。文字定位本来不依赖点云，
   这里改成居中的半透明提示卡，面板照常可读。
   ========================================================= */
.fallback {
  position: fixed;
  inset: auto;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  width: min(360px, 86vw);
  padding: 18px 20px 16px;
  gap: 6px;
  background: rgba(8, 13, 20, .88);
  border: 1px solid rgba(255, 210, 120, .26);
  border-radius: 10px;
  /* 5 只压过点云画布（4）：顶栏 9、面板 8、诊断 6 都在它之上，文字结论不会被挡 */
  z-index: 5;
  pointer-events: none;
}

.fallback p { font-size: 10.5px; line-height: 1.8; }

/* 窄屏隐藏版本角标：右下角视角工具条就在那儿，角标会压住「自动旋转」按钮 */
@media (max-width: 768px) {
  #buildBadge { display: none !important; }
}

/* =========================================================
   行情行（.hero-quotes）—— 顶栏第三行
   ---------------------------------------------------------
   格式与原插件 ui/shell.js 完全一致：每条只有「短名 + 涨跌幅」，
   例如「上证 +0.11%　深证 +0.05%　创业板 +0.99%」，不带点位、不带附加指标。
   样式沿用原版 style.css，这里只补两条降级规则。
   ========================================================= */
.hero-quotes[hidden],
.hero-quotes:empty { display: none; }

/* 数值缺失时不留空 b，否则会出现「上证 」这种半截 */
.hs-quote b:empty { display: none; }
