/* 记忆识海 · 暗态星图（与 portal 亮态区分：这一页是「看数据」的暗房） */
:root {
  --bg-0: #05070F;
  --bg-1: #0A0F1E;
  --ink: #E8ECFF;
  --ink-dim: #9AA3C7;
  --line: rgba(140, 160, 255, 0.14);
  --panel: rgba(10, 16, 32, 0.34);
  --panel-brd: rgba(150, 180, 255, 0.24);
  --accent: #7DE3FF;
  --r-card: 14px;
}

* { box-sizing: border-box; }

/* 整页模式需要 html 也有高度，否则 .shihai-stage 的 100% 会塌成 0 */
html { height: 100%; }

/* 独立整页模式（/shihai/）：body 加 .shihai-page 才有暗底与满屏 */
body.shihai-page {
  margin: 0;
  height: 100%;
  background: radial-gradient(120% 90% at 50% 0%, #0B1226 0%, var(--bg-0) 60%, #03050C 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* 舞台：整页模式占满视口；嵌入模式由外层容器给高度 */
.shihai-stage {
  position: relative;
  width: 100%;
  height: 100%;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: radial-gradient(120% 90% at 50% 0%, #0B1226 0%, var(--bg-0) 60%, #03050C 100%);
  overflow: hidden;
  border-radius: 18px;
  -webkit-font-smoothing: antialiased;
}
.shihai-stage.embed { height: 660px; border: 1px solid var(--panel-brd); box-shadow: 0 24px 60px rgba(4, 8, 20, 0.45); }

#sky { position: absolute; inset: 0; display: block; cursor: grab; width: 100%; height: 100%; }
#sky:active { cursor: grabbing; }

/* 顶部 */
.topbar {
  position: absolute; top: 0; left: 0; right: 0;
  padding: 18px 22px;
  display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(3, 5, 12, 0.85) 0%, rgba(3, 5, 12, 0) 100%);
}
.brand { display: flex; align-items: center; gap: 9px; }
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent), 0 0 28px rgba(125, 227, 255, 0.5);
}
.backlink {
  font-size: 12px; color: var(--accent); text-decoration: none;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid rgba(125, 227, 255, 0.32);
  background: rgba(125, 227, 255, 0.08);
  pointer-events: auto; white-space: nowrap;
}
.backlink:hover { background: rgba(125, 227, 255, 0.18); border-color: rgba(125, 227, 255, 0.55); }
.backlink[hidden] { display: none; }
.brand .title { font-size: 17px; font-weight: 700; letter-spacing: 0.4px; }
.badge {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid rgba(255, 201, 120, 0.5); color: #FFC978;
  background: rgba(255, 201, 120, 0.1);
}
.meta { font-size: 12px; color: var(--ink-dim); }

/* 相机 */
.cameras {
  position: absolute; left: 22px; top: 74px;
  /* 底部安全区：.bottombar 是 left/right:22px + bottom:18px + 30px 高的兄弟绝对盒，
     顶边 = 视口高 - 48px。这里用 bottom:66px 刚性划界（而不是让高度依赖自身内容），
     两者之间恒定留 18px 空隙、永不重叠；同时给溢出兜底，视口不够高时
     左栏在自身盒内滚动，而不是让最后一个按钮（「静止」）压到时间轴滑杆下面、
     点下去变成拖时间轴。 */
  bottom: 66px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  display: flex; flex-direction: column; gap: 8px;
}
.cameras::-webkit-scrollbar { display: none; }
/* 不参与 flex 压缩：放不下时宁可滚动，也不把按钮压扁 */
.cameras > .cam, .cameras > .fx-ctrl { flex: 0 0 auto; }
.cam {
  pointer-events: auto;
  padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--panel-brd);
  background: rgba(10, 15, 30, 0.7);
  color: var(--ink-dim); font-size: 13px; cursor: pointer;
  transition: all .22s ease; text-align: left; min-width: 104px;
}
.cam:hover { color: var(--ink); border-color: rgba(125, 227, 255, 0.4); }
.cam.on {
  color: #04101C; font-weight: 700;
  background: linear-gradient(135deg, #7DE3FF, #9B8CFF);
  border-color: transparent;
  box-shadow: 0 6px 22px rgba(125, 227, 255, 0.28);
}
.cam small { display: block; font-size: 10px; opacity: .75; font-weight: 400; margin-top: 2px; }

/* 抽屉 */
.drawer {
  position: absolute; right: 22px; top: 74px; bottom: 96px;
  width: 340px; max-width: calc(100vw - 44px);
  border-radius: var(--r-card);
  border: 1px solid var(--panel-brd);
  background: var(--panel);
  padding: 18px;
  overflow-y: auto;
  font-size: 13px; line-height: 1.65;
  /* 空态时不拦截画布点击（否则右侧 340px 区域内的星点不到） */
  pointer-events: none;
  /* 半透明渐变代替 backdrop-filter：软件渲染下 blur 会打崩渲染进程，且性能极差 */
  box-shadow: 0 18px 50px rgba(3, 6, 16, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.drawer-empty .de { margin: 0 0 6px; color: var(--ink); font-size: 14px; }
.drawer-empty .de-sub { margin: 0; color: var(--ink-dim); font-size: 12px; }
.dr-title { font-size: 15px; font-weight: 700; margin: 0 0 4px; }
.dr-type { font-size: 11px; color: var(--ink-dim); margin-bottom: 12px; letter-spacing: .5px; }
.dr-sec { margin-top: 14px; }
.dr-sec h4 {
  margin: 0 0 8px; font-size: 11px; letter-spacing: 1px;
  color: var(--ink-dim); text-transform: uppercase; font-weight: 600;
}
.src {
  border-left: 2px solid rgba(125, 227, 255, 0.5);
  padding: 6px 0 6px 10px; margin-bottom: 8px;
}
.src .k { color: var(--accent); font-size: 11px; }
.src .v { color: var(--ink); font-size: 12.5px; }
.src .n { color: var(--ink-dim); font-size: 11.5px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.kv span:first-child { color: var(--ink-dim); }
.reject {
  margin-top: 14px; width: 100%; padding: 9px;
  border-radius: 10px; cursor: pointer;
  border: 1px solid rgba(255, 138, 138, 0.4);
  background: rgba(255, 138, 138, 0.1);
  color: #FFA9A9; font-size: 12.5px;
}
.reject:hover { background: rgba(255, 138, 138, 0.18); }

/* 底部 */
.bottombar {
  position: absolute; left: 22px; right: 22px; bottom: 18px;
  /* 高度必须恒定 30px：左栏底部安全区是按「底部条高度」算的，
     一旦 legend 折行把这里撑到 70px，左栏就会重新压到滑杆上。
     所以底部条不折行，图例超宽时自己横向滚动。 */
  display: flex; align-items: center; gap: 22px; flex-wrap: nowrap;
  height: 30px;
}
.timeline { display: flex; align-items: center; gap: 12px; flex: 0 1 auto; min-width: 260px; }
.tl-btn {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--panel-brd); background: rgba(10, 15, 30, 0.8);
  color: var(--ink); cursor: pointer; font-size: 11px;
}
.tl-btn:hover { border-color: rgba(125, 227, 255, 0.5); }
#tlSlider {
  flex: 1; -webkit-appearance: none; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, rgba(125, 227, 255, 0.65), rgba(155, 140, 255, 0.35));
  outline: none;
}
#tlSlider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: #EAF6FF; box-shadow: 0 0 12px rgba(125, 227, 255, 0.9); cursor: pointer;
}
.tl-date { font-size: 12px; color: var(--ink-dim); min-width: 86px; text-align: right; }

.legend {
  display: flex; gap: 14px; font-size: 11.5px; color: var(--ink-dim);
  /* 单行不折行：折行会把 .bottombar 撑高，左栏安全区就失效（见 .bottombar 注释） */
  flex: 1 1 auto; min-width: 0; flex-wrap: nowrap;
  overflow-x: auto; scrollbar-width: none;
}
.legend::-webkit-scrollbar { display: none; }
.legend .it { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }
.legend .ln { width: 20px; height: 2px; border-radius: 2px; }

.hint {
  position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%);
  font-size: 11.5px; color: rgba(154, 163, 199, 0.55); pointer-events: none;
  transition: opacity .6s ease;
}
.cam.toggle { margin-top: 6px; border-style: dashed; }

/* 视口不够高时左栏收紧一档：只缩内边距与间距，
   让 10 个按钮在 bottom:66px 的可见区里放得下 —— 不能让「静止」掉到滚动区外。 */
@media (max-height: 880px) {
  .cameras { gap: 6px; }
  .cam { padding: 6px 12px; }
  .fx-ctrl { padding: 6px 8px; }
}
/* 更矮的视口（如 1024×640）再收一档：去掉副标题，保证 10 个按钮仍然全部可见可点，
   而不是让用户「知道有个静止开关但得先滚动左栏才点得到」。 */
@media (max-height: 720px) {
  .cameras { gap: 4px; }
  .cam { padding: 5px 12px; font-size: 12px; }
  .cam small { display: none; }
  .cam.toggle { margin-top: 0; }
  .fx-ctrl { margin-top: 0; padding: 5px 8px; }
  .fx-ctrl label { margin-bottom: 4px; }
}
/* 嵌入 HormModel 页（.shihai-stage.embed 固定 660px，视口再高也不代表舞台够高） */
.shihai-stage.embed .cameras { gap: 6px; }
.shihai-stage.embed .cam { padding: 6px 12px; font-size: 12px; }
.shihai-stage.embed .cam small { display: none; }
.shihai-stage.embed .cam.toggle { margin-top: 0; }
.shihai-stage.embed .fx-ctrl { margin-top: 0; padding: 6px 8px; }

.cam.rec { margin-top: 2px; border-color: rgba(255, 150, 150, 0.4); color: #FFB4B4; }
.cam.rec:hover { border-color: rgba(255, 150, 150, 0.7); color: #FFD0D0; }
.cam.rec.recording {
  background: rgba(255, 90, 90, 0.18);
  color: #FFD5D5;
  border-color: rgba(255, 120, 120, 0.75);
  animation: recPulse 1.4s ease-in-out infinite;
}
@keyframes recPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 100, 100, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(255, 100, 100, 0); }
}
.cam.toggle.on {
  background: rgba(125, 227, 255, 0.16);
  color: #9FE9FF; border-color: rgba(125, 227, 255, 0.55);
  box-shadow: none;
}
/* 嵌在 HormModel 页时的页脚说明（亮色正文里的一行小字） */
.shihai-note {
  margin: 14px 2px 0; font-size: 12.5px; line-height: 1.7;
  color: var(--ink-dim, #6B7280);
}
/* 识海作为页面首个模块：暗带承接导航（导航为白字，浅底会看不清） */
.section.section-top {
  padding-top: 104px;
  padding-bottom: 44px;
  background: radial-gradient(120% 90% at 50% 0%, #0B1226 0%, #05070F 62%, #03050C 100%);
}
.section.section-top .section-h2 { color: #EAF6FF; }
.section.section-top .section-h2 .accent { color: #7DE3FF; }
.section.section-top .section-lead { color: #9AA3C7; }
.section.section-top .section-eyebrow {
  color: #7DE3FF;
  border-color: rgba(125, 227, 255, 0.34);
  background: rgba(125, 227, 255, 0.08);
}
.section.section-top .shihai-note { color: #8E97B8; }
.section.section-top .shihai-note strong { color: #C9D2F5; }
.section.section-top .shihai-note .shihai-full { color: #9FE9FF; border-bottom-color: rgba(159, 233, 255, 0.45); }
@media (max-width: 900px) {
  .section.section-top { padding-top: 84px; padding-bottom: 30px; }
}
.shihai-note strong { color: #4B5563; font-weight: 600; }
.shihai-note .shihai-full { margin-left: 10px; color: #6D5DE7; text-decoration: none; border-bottom: 1px dashed rgba(109, 93, 231, 0.45); }
.shihai-note .shihai-full:hover { color: #4C3FD0; }
.toast {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  padding: 12px 20px; border-radius: 12px;
  background: rgba(10, 15, 30, 0.94); border: 1px solid var(--panel-brd);
  font-size: 13px; max-width: 420px; text-align: center; line-height: 1.6;
}
.toast.warn { border-color: rgba(255, 201, 120, 0.45); color: #FFD79A; }

@media (max-width: 900px) {
  .shihai-stage.embed { height: 560px; border-radius: 14px; }
  .topbar { padding: 10px 12px; }
  .brand .title { font-size: 14px; }
  .meta { display: none; }                    /* 顶栏统计在手机上一行放不下，直接隐去 */
  .cameras {
    top: 52px; left: 10px; right: 10px;
    flex-direction: row; gap: 6px; overflow-x: auto; overflow-y: hidden;
    /* 手机端是顶部横向排，不吃桌面那份底部安全区（bottom:66px 必须清掉，
       否则左栏被拉成半屏高） */
    bottom: auto;
    padding-bottom: 4px; scrollbar-width: none;
  }
  .cameras::-webkit-scrollbar { display: none; }
  .cam { min-width: 74px; padding: 6px 10px; font-size: 12px; }
  .cam small { display: none; }                /* 副标题在手机上去掉，避免占高 */
  .cam.toggle { margin-top: 0; }
  .drawer {
    top: auto; left: 10px; right: 10px; bottom: 78px;
    width: auto; max-height: 46%; padding: 12px 14px;
    font-size: 12.5px; line-height: 1.6;
  }
  .drawer .dr-title { font-size: 14px; }
  .legend { display: none; }                   /* 手机端隐藏图例，把底部让给时间轴 */
  .bottombar { left: 10px; right: 10px; bottom: 12px; gap: 10px; }
  .timeline { min-width: 0; }
  .tl-date { min-width: 64px; font-size: 11px; }
  .hint { display: none; }
}

/* 抽屉有内容时才接管点击（空态穿透到画布） */
.drawer.has-content { pointer-events: auto; }

/* 空态：收成一张小提示卡（不占右侧 340px，避免压住星域） */
.drawer:not(.has-content) {
  width: auto; max-width: 300px;
  top: 84px; bottom: auto;
  padding: 14px 16px;
}

/* 光效调节（默认中间态；调到 0 即纯净省电模式） */
.fx-ctrl {
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--panel-brd);
  border-radius: 12px;
  background: rgba(10, 15, 30, 0.66);
}
.fx-ctrl label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--ink-dim); margin-bottom: 6px; letter-spacing: .3px;
}
.fx-ctrl label span { color: #9FE9FF; font-variant-numeric: tabular-nums; }
.fx-ctrl input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 3px; border-radius: 3px; outline: none;
  background: linear-gradient(90deg, rgba(125, 227, 255, 0.55), rgba(155, 140, 255, 0.35));
}
.fx-ctrl input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%;
  background: #EAF6FF; box-shadow: 0 0 10px rgba(125, 227, 255, 0.8); cursor: pointer;
}
@media (max-width: 900px) {
  .fx-ctrl { min-width: 132px; }
}

/* 雾/缺口：把「还差什么」写成可读的行动项，而不是灰字 */
.src.gap {
  border-left-color: rgba(255, 201, 120, 0.75);
  background: rgba(255, 201, 120, 0.06);
  border-radius: 0 8px 8px 0;
  padding-right: 8px;
}
.src.gap .v { color: #FFD79A; }

/* 证据面板 显示/隐藏 开关（用户要求：面板要能藏起来） */
.drawer-toggle {
  position: absolute; right: 34px; top: 84px; z-index: 6;
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--panel-brd);
  background: rgba(10, 15, 30, 0.85);
  color: var(--ink-dim); font-size: 13px; line-height: 1;
  cursor: pointer; padding: 0;
  transition: all .2s ease;
}
.drawer-toggle:hover { color: var(--ink); border-color: rgba(125, 227, 255, 0.5); }
.drawer-toggle.tab {
  width: auto; padding: 0 12px; height: 28px; border-radius: 999px;
  font-size: 12px; color: #9FE9FF; border-color: rgba(125, 227, 255, 0.4);
}
.drawer.collapsed { display: none; }
@media (max-width: 900px) {
  .drawer-toggle { right: 16px; top: 60px; }
}
