:root {
  --bg: #0e1116;
  --panel: rgba(20, 25, 34, 0.92);
  --panel-border: #2a3242;
  --text: #e6ebf2;
  --muted: #8b97a8;
  --accent: #4fa3ff;
  --accent2: #ffb24f;
  --good: #45d483;
}

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

html, body { height: 100%; overflow: hidden; }

body {
  font-family: "Segoe UI", -apple-system, "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

#app { position: relative; width: 100vw; height: 100vh; }

#scene { display: block; width: 100%; height: 100%; }

#panel {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 300px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

#panel h1 { font-size: 18px; letter-spacing: 0.5px; }
#panel .sub { color: var(--muted); font-size: 12px; margin-bottom: 14px; }

section { margin-bottom: 16px; }

.field-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; }

.model-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.model-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  background: #1a2130;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  font-size: 11px;
  transition: all 0.15s;
}
.model-btn .ico { font-size: 22px; }
.model-btn:hover { border-color: var(--accent); transform: translateY(-2px); }
.model-btn.active { border-color: var(--accent); background: #233252; box-shadow: 0 0 0 1px var(--accent) inset; }

.upload-section { display: grid; gap: 8px; }
.file-input { display: none; }
.upload-btn {
  width: 100%;
  flex: none;
  border-style: dashed;
  min-height: 38px;
}
.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}
.toggle-row input { accent-color: var(--accent); }
.upload-status {
  min-height: 28px;
  padding: 7px 8px;
  border: 1px solid var(--panel-border);
  border-radius: 7px;
  background: #161c28;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.upload-status.ok { border-color: rgba(69, 212, 131, 0.35); color: var(--good); }
.upload-status.warn { border-color: rgba(255, 178, 79, 0.45); color: var(--accent2); }
.upload-status.error { border-color: rgba(255, 88, 88, 0.45); color: #ff8a8a; }

.slider-row { margin-bottom: 12px; }
.slider-row label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.slider-row label span { color: var(--accent); font-weight: 600; }

input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  height: 5px;
  border-radius: 4px;
  background: #2a3242;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 6px rgba(79, 163, 255, 0.6);
}

.btn-row { display: flex; gap: 8px; }
button {
  flex: 1;
  padding: 9px 6px;
  border: 1px solid var(--panel-border);
  border-radius: 9px;
  background: #1a2130;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
button:hover { border-color: var(--accent); background: #222c3e; }
button.primary { background: var(--accent); border-color: var(--accent); color: #06121f; font-weight: 700; }
button.primary:hover { background: #6fb4ff; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.stats .bar {
  height: 8px;
  background: #1a2130;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 10px;
}
#progressBar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--good));
  transition: width 0.1s linear;
}

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; font-size: 12px; }
.stat-grid > div { display: flex; justify-content: space-between; background: #161c28; padding: 6px 8px; border-radius: 7px; }
.stat-grid .k { color: var(--muted); }

.state {
  margin-top: 10px;
  padding: 6px;
  text-align: center;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
}
.state.idle { background: #1a2130; color: var(--muted); }
.state.preview { background: rgba(79, 163, 255, 0.14); color: #8fc5ff; }
.state.printing { background: rgba(69, 212, 131, 0.15); color: var(--good); }
.state.paused { background: rgba(255, 178, 79, 0.15); color: var(--accent2); }
.state.done { background: rgba(79, 163, 255, 0.18); color: var(--accent); }

.tips h3 { font-size: 12px; margin-bottom: 6px; color: var(--text); }
.tips ul { list-style: none; }
.tips li { font-size: 11px; color: var(--muted); padding: 3px 0 3px 14px; position: relative; line-height: 1.4; }
.tips li::before { content: "▹"; position: absolute; left: 0; color: var(--accent); }

#hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--muted);
  background: rgba(20, 25, 34, 0.7);
  padding: 6px 14px;
  border-radius: 20px;
  backdrop-filter: blur(8px);
}

/* 滚动条 */
#panel::-webkit-scrollbar { width: 6px; }
#panel::-webkit-scrollbar-thumb { background: #2a3242; border-radius: 3px; }
