/* 3D 实验室左右浮窗与底部播放控制条 */
.side-panel {
  position: fixed;
  top: 68px;
  bottom: 100px;
  z-index: 20;
  width: 300px;
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  transition: transform 0.28s ease, opacity 0.2s ease;
}

.left-panel {
  left: 12px;
}

.right-panel {
  right: 12px;
  width: 330px;
}

@media (max-width: 1023px) {
  .left-panel {
    transform: translateX(-120%);
  }
  .left-panel.open {
    transform: translateX(0);
  }
  .right-panel {
    transform: translateX(120%);
  }
  .right-panel.open {
    transform: translateX(0);
  }
}

.panel-sec-title {
  margin: 0 0 8px 0;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-subtle);
}

.panel-divider {
  border: none;
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  margin: 0;
}

/* 预设按钮 */
.preset-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.preset-btn {
  width: 100%;
  text-align: left;
  padding: 8px 11px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.78);
  color: #334155;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.15s ease;
}

.preset-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.preset-btn.active {
  border-color: #93c5fd;
  background: rgba(239, 246, 255, 0.92);
  color: #1e40af;
}

.preset-tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 600;
}
.tag-blue { background: #dbeafe; color: #1e40af; }
.tag-rose { background: #ffe4e6; color: #be123c; }
.tag-amber { background: #fef3c7; color: #92400e; }
.tag-purple { background: #f3e8ff; color: #6b21a8; }

/* 滑块组 */
.dim-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dim-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 4px;
}

.dim-val {
  background: #f1f5f9;
  color: var(--ink);
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
}

.dim-a { color: #e11d48; }
.dim-b { color: #059669; }
.dim-c { color: #2563eb; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  background: #e2e8f0;
  height: 6px;
  border-radius: 999px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--blue);
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.45);
}

/* 视角切换 */
.view-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.view-btn {
  padding: 8px 8px;
  border-radius: 11px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.view-btn:hover {
  background: #f8fafc;
}

.view-btn.active {
  background: #1e293b;
  color: #ffffff;
  border-color: #1e293b;
}

/* 开关选项 */
.toggle-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
}

.toggle-item input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
  cursor: pointer;
}

.legend-box {
  padding: 8px 10px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  color: var(--ink-muted);
}

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 4px;
}
.dot-blue { background: #3b82f6; }
.dot-amber { background: #f59e0b; }
.dot-rose { background: #e11d48; }

/* 右侧俯视图与公式 */
.topdown-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.dim-badge {
  font-size: 11px;
  font-weight: 700;
  background: #f1f5f9;
  color: var(--ink-muted);
  padding: 2px 8px;
  border-radius: 6px;
}

.topdown-canvas-wrap {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 6px;
  display: flex;
  justify-content: center;
}

#topdown-canvas {
  width: 100%;
  height: auto;
  max-height: 170px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.metric-card {
  border-radius: 12px;
  padding: 8px;
  text-align: center;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.metric-card.highlight {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.metric-label {
  font-size: 11px;
  color: var(--ink-subtle);
}

.metric-card.highlight .metric-label {
  color: var(--blue);
  font-weight: 600;
}

.metric-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  margin-top: 2px;
}

.metric-card.highlight .metric-num {
  color: var(--blue-dark);
}

.insight-badge {
  margin-top: 8px;
  padding: 9px 11px;
  border-radius: 11px;
  font-size: 12px;
  line-height: 1.5;
  border: 1px solid;
}

.insight-emerald { background: var(--emerald-soft); border-color: #a7f3d0; color: #065f46; }
.insight-amber { background: var(--amber-soft); border-color: #fde68a; color: #92400e; }
.insight-rose { background: var(--rose-soft); border-color: #fecdd3; color: #9f1239; }

.formula-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.formula-template {
  font-size: 11px;
  color: var(--ink-subtle);
  margin-bottom: 5px;
}

.formula-sub {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  word-break: break-word;
}

.formula-result {
  color: var(--blue-dark);
  font-size: 14px;
}

.event-counts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.event-box {
  border-radius: 10px;
  padding: 6px 4px;
  text-align: center;
  border: 1px solid;
}
.event-face { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.event-edge { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.event-vertex { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }

.event-name { font-size: 10.5px; font-weight: 600; }
.event-val { font-size: 14px; font-weight: 800; margin-top: 2px; }

.formula-tip {
  margin: 0;
  font-size: 11.5px;
  color: var(--ink-subtle);
  line-height: 1.5;
}

/* 底部播放控制条 */
.playback-footer {
  position: fixed;
  bottom: 12px;
  left: 12px;
  right: 12px;
  z-index: 25;
  display: flex;
  justify-content: center;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.playback-bar {
  pointer-events: auto;
  width: 100%;
  max-width: 760px;
  border-radius: 18px;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.playback-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.playback-status-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-cube-text {
  font-weight: 700;
  color: var(--ink);
}

.status-layer-pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--ink-muted);
  font-weight: 600;
}

.status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
.badge-neutral { background: #f1f5f9; color: var(--ink-muted); }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-rose { background: #ffe4e6; color: #9f1239; }

.playback-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctrl-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

.ctrl-btn:hover {
  background: #f1f5f9;
}

.ctrl-btn.primary {
  width: 38px;
  height: 38px;
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

.ctrl-btn.primary:hover {
  background: var(--blue-dark);
}

.speed-btn {
  width: auto;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
}

.progress-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-pct {
  font-size: 12px;
  font-family: ui-monospace, monospace;
  color: var(--ink-subtle);
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}
