/* ============================================================
   SpaceX 风格设计系统
   纯黑背景 #000000 · 高对比白字 #F0F0FA · 锐利矩形 · 单色调
   色彩仅用于摆体内容(轨迹/图例),界面框架一律黑白灰
   动效统一 cubic-bezier(0.19, 1, 0.22, 1)
   ============================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #000000;
  --ink: #f0f0fa;
  --ink-soft: rgba(240, 240, 250, 0.9);
  --muted: #808080;
  --line: rgba(240, 240, 250, 0.35);
  --line-soft: rgba(240, 240, 250, 0.15);
  --ease: cubic-bezier(0.19, 1, 0.22, 1);
  --mono: Consolas, "Courier New", monospace;
}

body {
  font-family: "Helvetica Neue", Arial, "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}

#container {
  display: flex;
  width: 100vw;
  height: 100vh;
}

#control-panel {
  width: 300px;
  min-width: 300px;
  background: var(--bg);
  border-right: 1px solid var(--line);
  padding: 16px;
  overflow-y: auto;
}

#control-panel::-webkit-scrollbar {
  width: 4px;
}

#control-panel::-webkit-scrollbar-track {
  background: var(--bg);
}

#control-panel::-webkit-scrollbar-thumb {
  background: var(--line);
}

#control-panel h2 {
  text-align: left;
  margin-bottom: 16px;
  color: var(--ink);
  font-size: 1em;
  font-weight: 700;
  letter-spacing: 3px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

/* 区块:不再使用填充色块,以 1px 分隔线划分 */

.param-section {
  border-top: 1px solid var(--line);
  padding: 12px 0;
  margin-bottom: 0;
}

.param-section h3 {
  color: var(--ink);
  font-size: 0.82em;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

.control-group {
  margin-bottom: 10px;
}

.control-group label {
  display: block;
  margin-bottom: 5px;
  font-size: 0.78em;
  color: var(--ink-soft);
}

.control-group label span {
  color: var(--ink);
  font-weight: 700;
  font-family: var(--mono);
}

.control-group input[type="range"] {
  width: 100%;
  height: 2px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--line);
  border-radius: 0;
  outline: none;
  cursor: pointer;
}

.control-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: var(--ink);
  border-radius: 0;
  cursor: pointer;
  transition: transform 0.22s var(--ease);
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.3);
}

.control-group input[type="checkbox"] {
  margin-right: 8px;
  cursor: pointer;
  accent-color: var(--ink);
}

/* 按钮:锐利矩形,线框 + 悬停反白 */

.button-group {
  display: flex;
  gap: 8px;
  margin: 15px 0;
}

.button-group button {
  flex: 1;
  padding: 10px 12px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 0;
  font-size: 0.82em;
  font-weight: 700;
  letter-spacing: 3px;
  cursor: pointer;
  transition:
    background 0.22s var(--ease),
    color 0.22s var(--ease);
}

.button-group button:hover {
  background: var(--ink);
  color: var(--bg);
}

/* 数据读数:等宽字体 */

.data-display {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.data-display h3 {
  color: var(--ink);
  font-size: 0.82em;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

.data-display p {
  margin-bottom: 4px;
  font-size: 0.75em;
  color: var(--muted);
}

.data-display p span {
  color: var(--ink);
  font-weight: 700;
  font-family: var(--mono);
}

#canvas-container {
  flex: 1;
  position: relative;
}

#canvas-container canvas {
  display: block;
}

/* 混沌对比 */

#compare-resync {
  width: 100%;
  padding: 8px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 0;
  font-weight: 700;
  font-size: 0.82em;
  letter-spacing: 3px;
  cursor: pointer;
  transition:
    background 0.22s var(--ease),
    color 0.22s var(--ease);
}

#compare-resync:hover {
  background: var(--ink);
  color: var(--bg);
}

#compare-delta,
#compare-field {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 4px 6px;
  font-family: inherit;
  font-size: 0.85em;
}

/* 物理模式:分段切换(选中反白) */

.segment {
  display: flex;
  border: 1px solid var(--ink);
}

.segment button {
  flex: 1;
  padding: 7px 0;
  background: transparent;
  color: var(--ink);
  border: none;
  border-radius: 0;
  font-size: 0.78em;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  transition:
    background 0.22s var(--ease),
    color 0.22s var(--ease);
}

.segment button + button {
  border-left: 1px solid var(--ink);
}

.segment button.active {
  background: var(--ink);
  color: var(--bg);
}

/* 区块头(标题 + 区块级按钮) */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-header h3 {
  margin-bottom: 0;
}

#random-btn {
  padding: 4px 10px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0;
  font-size: 0.72em;
  letter-spacing: 1px;
  cursor: pointer;
  transition:
    background 0.22s var(--ease),
    color 0.22s var(--ease),
    border-color 0.22s var(--ease);
}

#random-btn:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

#compare-delta {
  width: 80px;
  font-family: var(--mono);
}

#compare-field,
#physics-mode {
  max-width: 100%;
}

#compare-readout p {
  margin-bottom: 4px;
  font-size: 0.78em;
  color: var(--muted);
}

#compare-readout p span {
  color: var(--ink);
  font-weight: 700;
  font-family: var(--mono);
}

.compare-legend {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.compare-legend-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75em;
  color: var(--ink-soft);
  border: 1px solid var(--line-soft);
  padding: 5px 8px;
}

.compare-dot {
  width: 9px;
  height: 9px;
  border-radius: 0;
  display: inline-block;
}

.compare-dot-a {
  background: #ff5722;
}

.compare-dot-b {
  background: #4caf50;
}

.compare-hint {
  font-size: 0.72em;
  color: var(--muted);
  border-left: 2px solid var(--line-soft);
  padding-left: 8px;
  margin-top: 10px;
}

/* 拨动开关:全高滑块贴轨滑动,四周 1px 缝隙,选中反白 */

.switch {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  position: relative;
  display: block;
  width: 40px;
  height: 18px;
  border: 1px solid var(--ink);
  background: transparent;
  transition: background 0.22s var(--ease);
}

.switch-knob {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 14px;
  height: 14px;
  background: var(--ink);
  transition:
    transform 0.22s var(--ease),
    background 0.22s var(--ease);
}

.switch input:checked + .switch-track {
  background: var(--ink);
}

.switch input:checked + .switch-track .switch-knob {
  background: var(--bg);
  transform: translateX(22px);
}

#numerical-warning {
  color: var(--ink);
  font-weight: 700;
  font-size: 0.78em;
  letter-spacing: 1px;
  border: 1px solid var(--ink);
  padding: 6px 8px;
  margin-bottom: 10px;
}

/* 多杆链:每杆参数卡片(分隔线式,不用色块) */

.link-card {
  border-bottom: 1px solid var(--line-soft);
  padding: 8px 0;
  margin-bottom: 4px;
}

.link-card h4 {
  color: var(--muted);
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.link-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
}

.link-grid .control-group {
  margin-bottom: 4px;
}

.spherical-slider-group {
  display: none;
  grid-column: 1 / -1;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed var(--line-soft);
}

#control-panel.mode-spherical .spherical-slider-group {
  display: grid;
}

/* ===== 界面分级:简单(默认,仅核心操作)/ 高级(全部控制) ===== */

.advanced-only {
  display: none;
}

#control-panel.ui-advanced .advanced-only {
  display: block;
}

@media (max-width: 480px) {
  #compare-delta {
    width: 64px;
  }

  #compare-field {
    max-width: 140px;
  }
}
