/* ================================================================
   page-u01-l02 专用样式 · 生态瓶平衡台（圈层观察版）
   作用域限定在 [data-sim-variant="u01l02"]，
   不会影响 common/ 原版实现，也不影响同样使用 eco-bottle 的 lesson103。
   ================================================================ */

/* 脚本安装前先把台子藏起来，避免原版界面闪一下再被替换
   （脚本会移除 data-sim-pending；8 秒兜底也会移除，不会一直藏着） */
.ldbd-sim[data-sim-variant="u01l02"][data-sim-pending="1"] .ldbd-lab {
  visibility: hidden;
}

/* ---- 舞台：画布铺满 ---- */
.ldbd-sim[data-sim-variant="u01l02"] .ldbd-lab-stage {
  min-height: 268px;
}
.ldbd-sim[data-sim-variant="u01l02"] .ldbd-lab-stage canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: none;
  display: block;
  border: none;
  border-radius: 0;
  background: transparent;
}

/* ---- 面板 ---- */
.ldbd-sim[data-sim-variant="u01l02"] .ldbd-lab-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: auto;
}

/* ---- 目标卡 ---- */
.u01l02-goal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  padding: 7px 10px;
  border-radius: 9px;
  background: #eef7f4;
  border: 1px solid #cfe4de;
  font-size: 12.5px;
  line-height: 1.35;
  color: #1f4a45;
}
.u01l02-goal-t {
  font-weight: 700;
  color: #2a6f6a;
}
.u01l02-goal-s {
  margin-left: auto;
  font-weight: 700;
  color: #b26a00;
}
.u01l02-goal-s.is-ok {
  color: #1b8a5a;
}
.u01l02-goal.is-ok {
  background: #e6f6ee;
  border-color: #a9dcc3;
}

/* ---- 预训练：可展开的三个词 ---- */
.u01l02-pre {
  border: 1px dashed #cfe4de;
  border-radius: 9px;
  padding: 6px 10px;
  background: #fbfdfc;
  font-size: 12.5px;
  color: #3d5c57;
}
.u01l02-pre > summary {
  cursor: pointer;
  font-weight: 700;
  color: #2a6f6a;
}
.u01l02-pre dl {
  margin: 8px 0 2px;
}
.u01l02-pre dt {
  font-weight: 700;
  color: #102a27;
  margin-top: 6px;
}
.u01l02-pre dd {
  margin: 2px 0 0;
  line-height: 1.5;
}

/* ---- 滑块行 ---- */
.u01l02-ctl {
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 9px;
  padding: 7px 10px 6px;
  background: #fff;
}
.u01l02-ctl-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #1f4a45;
}
.u01l02-ctl-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.u01l02-ctl-name i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.u01l02-ctl-val {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}
.u01l02-ctl-val b {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 17px;
  color: #102a27;
}
.u01l02-ctl-val em {
  font-style: normal;
  font-size: 11px;
  color: #7b8f8b;
}
.u01l02-ctl input[type="range"] {
  width: 100%;
  margin: 6px 0 0;
}
.u01l02-ctl[data-ctl="water"] input[type="range"] {
  accent-color: #1976d2;
}
.u01l02-ctl[data-ctl="plant"] input[type="range"] {
  accent-color: #2e7d32;
}
.u01l02-ctl[data-ctl="animal"] input[type="range"] {
  accent-color: #e08b3a;
}

/* ---- 可见的量化参照：滑块下的「稳定绿带」刻度 ---- */
.u01l02-band {
  position: relative;
  height: 9px;
  margin-top: 5px;
  border-radius: 5px;
  background: #eef2f1;
  overflow: hidden;
}
.u01l02-band-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  background: #b7e3c8;
  border-left: 1px solid #6fbf90;
  border-right: 1px solid #6fbf90;
}
.u01l02-band-txt {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: #5a7a74;
}
.u01l02-ctl.is-in .u01l02-band-zone {
  background: #7fd3a3;
}
.u01l02-ctl.is-out .u01l02-ctl-val b {
  color: #c62828;
}

/* ---- 氧气收支条（机制可视化：水草产氧 vs 小动物耗氧） ---- */
.u01l02-o2 {
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 9px;
  padding: 7px 10px 8px;
  background: #fff;
}
.u01l02-o2-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: #1f4a45;
}
.u01l02-o2-state {
  font-weight: 700;
  color: #b26a00;
}
.u01l02-o2-state.is-ok {
  color: #1b8a5a;
}
.u01l02-o2-track {
  position: relative;
  height: 14px;
  margin-top: 6px;
  border-radius: 7px;
  background: #f0f4f3;
  overflow: hidden;
}
.u01l02-o2-gap {
  position: absolute;
  top: 0;
  bottom: 0;
  background: #cfe9d8;
}
.u01l02-o2-gap.is-short {
  background: #f6d7cf;
}
.u01l02-o2-mk {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 3px;
  border-radius: 2px;
}
.u01l02-o2-mk.is-plant {
  background: #2e7d32;
}
.u01l02-o2-mk.is-animal {
  background: #e08b3a;
}
.u01l02-o2-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 5px;
  font-size: 11.5px;
  color: #4a6b66;
}
.u01l02-o2-legend i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: inline-block;
  margin-right: 4px;
}

/* ---- 动作按钮 ---- */
.u01l02-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.u01l02-acts button {
  flex: 1 1 0;
  min-width: 88px;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #2a6f6a;
  background: #fff;
  color: #2a6f6a;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}
.u01l02-acts button:hover {
  background: #e8f5f2;
}
.u01l02-acts button.is-primary {
  background: #2a6f6a;
  color: #fff;
}
.u01l02-acts button.is-primary:hover {
  background: #235b57;
}

/* ---- 反馈行（过程层反馈） ---- */
.u01l02-fb {
  margin: 0;
  padding: 8px 10px;
  border-radius: 9px;
  background: #f2f7f6;
  border-left: 3px solid #9fbdb7;
  font-size: 12.5px;
  line-height: 1.5;
  color: #21403c;
}
.u01l02-fb.is-ok {
  background: #e9f7f0;
  border-left-color: #1b8a5a;
}
.u01l02-fb.is-warn {
  background: #fff7e6;
  border-left-color: #e0a800;
  color: #7a5200;
}
.u01l02-fb b {
  color: #102a27;
}

/* ---- 引导性提问（不给结论） ---- */
.u01l02-ask {
  margin: 0;
  padding: 8px 10px;
  border-radius: 9px;
  background: #eef7f4;
  font-size: 12.5px;
  line-height: 1.5;
  color: #1f4a45;
}

/* ---- 读屏专用文本 ---- */
.u01l02-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- 窄屏 ---- */
@media (max-width: 900px) {
  .ldbd-sim[data-sim-variant="u01l02"] {
    height: auto;
    max-height: none;
    overflow: visible;
  }
  .ldbd-sim[data-sim-variant="u01l02"] .ldbd-lab-body {
    grid-template-columns: 1fr;
  }
  .ldbd-sim[data-sim-variant="u01l02"] .ldbd-lab-stage {
    height: 44vh;
    min-height: 250px;
  }
  .ldbd-sim[data-sim-variant="u01l02"] .ldbd-lab-panel {
    overflow: visible;
  }
}
