* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; margin: 0; overflow-x: hidden; overflow-y: auto; }
body {
  font-family: "Microsoft YaHei UI", "Segoe UI", sans-serif;
  color: #f4f7fb;
  background: #020307;
}
.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* 单列布局：舞台全宽（Params 侧栏已移除） */
  align-content: start; /* 不拉伸：舞台按自然高度置顶，多余空间留白，内容超屏则滚动 */
  width: 100vw;
  min-height: 100vh; /* 至少占满一屏；内容更高时页面可上下滚动 */
  background:
    radial-gradient(circle at 78% 14%, rgba(80, 112, 180, 0.10), transparent 28%),
    linear-gradient(135deg, #04050b 0%, #090812 42%, #020307 100%);
}
/* 右上角 Overview 按钮 */
.params-toggle {
  position: fixed;
  top: 12px;
  right: 14px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(140, 180, 220, 0.28);
  border-radius: 8px;
  background: rgba(12, 17, 29, 0.86);
  color: #cbd6e5;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.params-toggle:hover,
.params-toggle.active {
  color: #061017;
  background: linear-gradient(180deg, #8cecff, #46c8f7);
  border-color: transparent;
}
.stage { display: grid; grid-template-rows: auto auto auto; align-content: start; gap: 8px; padding: 12px; min-width: 0; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 7px; }
.metrics article {
  background: rgba(9, 11, 18, 0.72);
  border: 1px solid rgba(135, 170, 210, 0.14);
  border-radius: 8px;
  padding: 12px;
}
.metrics article { padding: 8px 10px; min-height: 56px; }
.metrics span { display: block; font-size: 12px; color: #8f9aaa; margin-bottom: 6px; }
.metrics span { font-size: 11px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metrics strong { display: block; font-size: 19px; line-height: 1.05; color: #f7fbff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metrics small { display: block; color: #8cecff; font-size: 11px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewport {
  position: relative;
  min-height: 0;
  border: 1px solid rgba(135, 170, 210, 0.16);
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}
canvas { display: block; width: 100%; height: 100%; }
.satellite-inset {
  position: absolute;
  right: 16px;
  top: 16px;
  width: min(180px, 17vw);
  aspect-ratio: 1.22;
  border: 1px solid rgba(140, 190, 235, .28);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(2, 5, 12, .72);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .38), inset 0 0 24px rgba(70, 160, 255, .08);
  backdrop-filter: blur(3px);
  z-index: 4;
}
.satellite-inset canvas { width: 100%; height: 100%; }
.inset-title {
  position: absolute;
  left: 10px;
  top: 8px;
  color: rgba(225, 238, 255, .86);
  font-size: 12px;
  letter-spacing: 0;
  z-index: 1;
  pointer-events: none;
}
.albedo-inset {
  position: absolute;
  left: 16px;
  bottom: 14px;
  width: min(500px, 42vw);
  height: min(196px, 30vh);
  padding: 8px 10px 8px;
  border: 1px solid rgba(255, 204, 112, .26);
  border-radius: 8px;
  background: rgba(3, 7, 14, .86);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .42), inset 0 0 24px rgba(255, 185, 80, .04);
  backdrop-filter: blur(4px);
  z-index: 4;
}
.albedo-chart-head,
.albedo-chart-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 19px;
  color: #aeb8c8;
  font-size: 11px;
}
.albedo-chart-head b { color: #ffd177; font-size: 12px; }
.albedo-chart-foot { color: #8290a3; }
.albedo-chart-foot span:last-child { color: #80e9ff; }
.albedo-inset canvas {
  width: 100%;
  height: calc(100% - 38px);
}
.hint {
  position: absolute;
  left: 14px;
  bottom: min(224px, calc(30vh + 28px));
  color: rgba(220, 232, 248, 0.58);
  font-size: 12px;
  pointer-events: none;
}
.error {
  display: none;
  position: absolute;
  left: 16px;
  top: 16px;
  right: 16px;
  max-height: 40%;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(255, 107, 122, 0.45);
  border-radius: 8px;
  background: rgba(30, 8, 16, 0.92);
  color: #ffd4dc;
  font: 12px/1.45 Consolas, monospace;
  white-space: pre-wrap;
  z-index: 5;
}
.action-card button {
  width: 100%;
  height: 34px;
  border: 1px solid rgba(90, 210, 255, .32);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(36, 68, 96, .94), rgba(15, 25, 41, .94));
  color: #e7f8ff;
  font-weight: 650;
  cursor: pointer;
}
.action-card button:hover {
  background: linear-gradient(180deg, #8cecff, #46c8f7);
  color: #061017;
}

/* ===== 数据仪表盘 ===== */
.dashboard {
  display: grid;
  grid-template-rows: auto auto;
  gap: 8px;
}
/* 数字动态区：星上时间(跨两行) | 温度模块(两行) | 发电数据对比(两行) */
.readout-strip {
  display: grid;
  /* 列序：星上时间 → 发电数据(电流/电压/功率, 宽列) → 电池板温度(单卡窄列) */
  grid-template-columns: minmax(130px, 0.55fr) minmax(0, 1.9fr) minmax(150px, 0.55fr);
  gap: 6px;
  align-items: stretch;
}
.ro-module {
  display: grid;
  grid-auto-rows: 1fr;
  gap: 6px;
  min-width: 0;
}
/* 实时数据区单行高度：温度两卡并排（试验阵行注释期间整条只有一行） */
.ro-temp-module { grid-auto-flow: column; grid-auto-columns: 1fr; }
.ro {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  background: rgba(9, 11, 18, 0.72);
  border: 1px solid rgba(135, 170, 210, 0.14);
  border-radius: 8px;
  min-height: 54px;
}
.ro > span { font-size: 11px; color: #8f9aaa; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ro > b {
  font-size: 20px;
  line-height: 1.05;
  color: #f7fbff;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ro > i { position: absolute; right: 10px; bottom: 8px; font-style: normal; font-size: 11px; color: #8cecff; }
/* 星上时间：占满模块两行高度、内容纵向居中 */
.ro-time { height: 100%; justify-content: center; }
.ro-time > b { font-size: 18px; color: #8cecff; white-space: normal; }
/* 开屏快放徽标：追赶段（后端帧带 replay 标记）期间显示，追上转 1× 后隐藏 */
.replay-badge {
  align-self: flex-start;
  margin-top: 2px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
  color: #ff6b7a;
  border: 1px solid rgba(255, 107, 122, 0.5);
  border-radius: 9px;
  background: rgba(255, 107, 122, 0.12);
  animation: replay-pulse 1.1s ease-in-out infinite;
}
@keyframes replay-pulse {
  50% { opacity: 0.45; }
}
.ro.sep-gaas { border-left: 2px solid rgba(255, 209, 102, .5); }
/* 发电数据行：标签在上，压/流/功率三值并排 */
.ro-power { justify-content: center; }
/* 压/流/功率 三值均分整行宽度，标签在上、细线分隔 */
/* flex:1 让数据行撑到卡片内容区底部，单位 bottom:0 即与温度卡 ℃ (bottom:8px 于卡片) 同高 */
.ro-power-vals { display: flex; align-items: stretch; width: 100%; margin-top: 4px; flex: 1 1 auto; }
.ro-power-vals em {
  flex: 1 1 0;
  min-width: 0;
  display: flex; flex-direction: column; gap: 1px;
  font-style: normal;
  padding: 0 12px;
}
.ro-power-vals em:first-child { padding-left: 0; }
.ro-power-vals em + em { border-left: 1px solid rgba(135, 170, 210, 0.18); }
.ro-power-vals .pv-lbl { font-size: 10px; color: #8f9aaa; }
.ro-power-vals .pv-val { display: inline-flex; align-items: baseline; gap: 3px; }
/* 单位固定在数据单元右侧（与温度卡 .ro > i 的贴右样式一致） */
.ro-power-vals em { position: relative; }
.ro-power-vals .pv-val i { position: absolute; right: 12px; bottom: 0; }
.ro-power-vals em:last-child .pv-val i { right: 0; }
.ro-power-vals b {
  font-size: 16px; line-height: 1.05; color: #f7fbff; font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.ro-power-vals i { position: static; font-style: normal; font-size: 11px; color: #8cecff; }
/* 电流占标称最大电流(500mA)的百分比 = 太阳翼功率增益占比，跟在数值后 */
.ro-power-vals .pv-pct { margin-left: 7px; font-size: 11px; color: #67ffcc; font-variant-numeric: tabular-nums; }

/* ===== 双面在轨“铁证”字段（黄色加粗）：Bifacial 卡的 Rear 值 + GaAs 的 BackGain % 及百分比 ===== */
.pv-lbl .hl-proof { font-size: inherit; line-height: inherit; font-weight: 700; color: #ffd166; }
.ro-power-vals .pv-pct.hl-proof { font-weight: 800; color: #ffd166; }
/* Bifacial 卡 Front/Rear 分栏：Front 次要小号，Rear 大号黄色为重点 */
.bif-split { display: flex; align-items: baseline; gap: 16px; }
.bif-split .bif-part { display: inline-flex; align-items: baseline; gap: 5px; font-style: normal; min-width: 0; }
.bif-split i { font-style: normal; font-size: 11px; color: #8f9aaa; }
.bif-split b {
  font-size: 16px; line-height: 1.05; color: #c9d6e6; font-weight: 600;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.bif-split .bif-rear i { color: #ffd166; font-weight: 700; }
.bif-split .bif-rear b { font-size: 19px; color: #ffd166; font-weight: 800; }

.rt-charts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  height: 300px; /* 实时图固定高度（与底部两图同高） */
}
.rt-chart {
  display: flex;
  flex-direction: column;
  padding: 6px 8px 4px;
  background: rgba(3, 7, 14, 0.86);
  border: 1px solid rgba(135, 170, 210, 0.16);
  border-radius: 8px;
  min-width: 0;
  min-height: 0;   /* 允许缩到 145px 行高，不被 canvas 内容撑大 */
  overflow: hidden; /* 兜底：canvas 任何溢出都裁掉，绝不压到下方图 */
}
.rt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 18px; }
.rt-head > span { font-size: 12px; color: #cdd8e6; }
.rt-head > small { color: #8290a3; font-size: 10px; display: flex; align-items: center; gap: 3px; }
/* height:0 打断全局 canvas{height:100%} 的循环引用；由 flex 拉伸到剩余高度 */
.rt-chart canvas { width: 100%; height: 0; flex: 1 1 auto; min-height: 0; }
/* 悬停取值光标 */
.rt-chart canvas, .albedo-figure canvas { cursor: crosshair; }

/* ===== 实验总名称（stage 顶栏） ===== */
.stage-title {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #e8f3ff;
}
.stage-title i {
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: linear-gradient(180deg, #8cecff, #46c8f7);
}

/* ===== 7 天预测总览（右上角按钮 + 弹窗，2×2 对比图） ===== */
.forecast-toggle { right: 96px; }
.forecast-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 12, .7);
  backdrop-filter: blur(5px);
}
.forecast-dialog {
  display: flex;
  flex-direction: column;
  width: min(1520px, 95vw);
  height: min(860px, 90vh);
  min-height: 0;
  padding: 12px 16px 10px;
  border: 1px solid rgba(140, 236, 255, .28);
  border-radius: 12px;
  background: rgba(4, 9, 18, .97);
  box-shadow: 0 18px 60px rgba(0, 0, 0, .6);
}
.forecast-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 30px;
}
.forecast-head .fc-title { color: #dbe8f6; font-size: 14px; font-weight: 600; }
.fc-ranges { display: flex; gap: 0; border: 1px solid rgba(140, 180, 220, .28); border-radius: 6px; overflow: hidden; }
.fc-ranges button {
  height: 24px;
  padding: 0 12px;
  border: none;
  border-right: 1px solid rgba(140, 180, 220, .18);
  background: transparent;
  color: #9fb0c5;
  font-size: 11px;
  cursor: pointer;
}
.fc-ranges button:last-child { border-right: none; }
.fc-ranges button:hover { color: #dff2ff; background: rgba(140, 200, 240, .12); }
.fc-ranges button.active { color: #061017; background: linear-gradient(180deg, #8cecff, #46c8f7); }
.forecast-head .fc-info { flex: 1 1 auto; color: #8290a3; font-size: 11px; text-align: right; }
.fc-close {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(140, 180, 220, .28);
  border-radius: 6px;
  background: transparent;
  color: #cbd6e5;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.fc-close:hover { color: #061017; background: linear-gradient(180deg, #8cecff, #46c8f7); border-color: transparent; }
.forecast-grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  min-height: 0;
  margin-top: 8px;
}
.fc-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 6px 10px;
  border: 1px solid rgba(135, 170, 210, .16);
  border-radius: 8px;
  background: rgba(1, 4, 10, .76);
}
.fc-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; height: 20px; }
.fc-head > span { font-size: 12px; color: #cdd8e6; }
.fc-head > small { color: #8290a3; font-size: 10px; display: flex; align-items: center; gap: 3px; }
.fc-head b { color: #8cecff; font-weight: 600; margin-left: 8px; }
.fc-head .dot, .forecast-foot .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 2px 0 6px; }
/* height:0 打断全局 canvas{height:100%} 循环引用，由 flex 拉到剩余高度 */
.fc-card canvas { width: 100%; height: 0; flex: 1 1 auto; min-height: 0; }
.forecast-foot {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 20px;
  margin-top: 6px;
  color: #8290a3;
  font-size: 11px;
}
.dot.c-eclipse { background: rgba(90, 110, 150, .8); }
@media (max-width: 1100px) {
  .forecast-grid { grid-template-columns: 1fr; grid-template-rows: repeat(4, 1fr); }
}

/* ===== 底部轨道图（反照图已隐藏，Orekit 轨道单列全宽平铺） ===== */
.bottom-figures {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  height: 300px; /* 固定较小高度，不吃满剩余空间 */
  min-height: 0;
}
.figure {
  position: relative;
  min-height: 0;
  border: 1px solid rgba(135, 170, 210, 0.16);
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}
.albedo-figure {
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  border-color: rgba(255, 204, 112, .26);
  background: rgba(3, 7, 14, .9);
}
.albedo-figure .albedo-chart-head,
.albedo-figure .albedo-chart-foot {
  flex: 0 0 auto;
  height: 20px;
}
.albedo-figure canvas { width: 100%; flex: 1 1 auto; min-height: 0; }
.figure-title {
  right: auto;
  left: 12px;
  top: 10px;
  color: rgba(225, 238, 255, .9);
  font-size: 13px;
  font-weight: 600;
  z-index: 3;
}
.orbit-figure .hint { left: 12px; bottom: 10px; }
/* 太阳距离压缩说明：置于标题下方，消除“太阳为何离地球这么近”的困惑 */
.orbit-figure .figure-note {
  position: absolute;
  left: 12px;
  top: 31px;
  z-index: 3;
  font-size: 11px;
  color: #8fa7bd;
}

@media (max-width: 1420px) {
  .metrics article { min-height: 50px; padding: 7px 9px; }
  .metrics strong { font-size: 17px; }
  .satellite-inset { width: min(150px, 16vw); }
  .ro > b { font-size: 17px; }
  .ro-power-vals b { font-size: 15px; }
  .ro-power-vals em { padding: 0 10px; }
}
@media (max-width: 1100px) {
  .readout-strip { grid-template-columns: 1fr; }
  .rt-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); height: 320px; }
}
