:root { color-scheme: dark; font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #15191f; color: #edf0f4; font-synthesis: none; }
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, select, input { font: inherit; }
button, select, .file-button { min-height: 42px; border: 1px solid #4a5665; border-radius: 8px;
  background: #151b23; color: #edf0f4; padding: 8px 11px; }
button { cursor: pointer; touch-action: manipulation; }
button:active { background: #344252; }
.app { width: min(1500px, 100% - 24px); margin: auto; padding: 16px 0 28px; }
.topbar, .toolbar, .workspace, .panel-head, .actions { display: flex; }
.topbar { align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.topbar h1 { margin: 0; font-size: clamp(22px, 4vw, 30px); }
.topbar span, .eyebrow, .stage-help, .note { color: #aab6c4; font-size: 12px; }
.eyebrow { margin: 0 0 4px; letter-spacing: .15em; }
.toolbar { flex-wrap: wrap; align-items: end; gap: 9px; padding: 12px;
  background: #202630; border: 1px solid #343d49; border-radius: 12px; }
.toolbar label, .panel label { display: grid; gap: 5px; font-size: 12px; color: #c3ccd7; }
.toolbar select { min-width: 112px; }
.check { display: flex !important; align-items: center; min-height: 42px; }
input { accent-color: #8db6e7; }
.workspace { align-items: stretch; gap: 12px; margin-top: 12px; }
.stage-wrap { flex: 1 1 60%; min-width: 0; }
#model-stage { position: relative; height: min(70vh, 760px); min-height: 390px; overflow: hidden;
  border: 1px solid #343d49; border-radius: 12px;
  background: radial-gradient(ellipse at 50% 42%, #384454, #202630 72%); }
#model-stage canvas { display: block; width: 100%; height: 100%; }
#status { position: absolute; z-index: 2; top: 10px; left: 12px; right: 12px;
  color: #e6edf5; font-size: 12px; pointer-events: none; }
.stage-help { padding: 8px 4px; }
.panel { flex: 0 0 min(440px, 40%); min-width: 300px; padding: 12px;
  background: #202630; border: 1px solid #343d49; border-radius: 12px; }
.panel-head { justify-content: space-between; align-items: center; gap: 8px; }
.panel-head h2 { margin: 0; font-size: 18px; }
#panel-content { display: grid; gap: 12px; padding-top: 12px; }
#part-select { width: 100%; min-height: 150px; padding: 6px; }
#selection-kind, .note, #io-status, .edit-section p { font-size: 12px; line-height: 1.6; color: #aab6c4; }
.actions { gap: 7px; flex-wrap: wrap; }
.actions button { flex: 1; }
.edit-section { border-top: 1px solid #3a4552; padding-top: 10px; }
.edit-section h3 { margin: 0 0 8px; font-size: 15px; }
.edit-section p { margin: 0 0 8px; }
.control-group { margin: 10px 0; }
.control-group h4 { margin: 0 0 5px; color: #dbe3ed; font-size: 13px; }
.axis-row { display: grid; grid-template-columns: 78px minmax(70px, 1fr) 86px;
  align-items: center; gap: 8px; min-height: 44px; }
.axis-row label { font-size: 12px; }
.axis-row input[type="range"] {
  width: 100%;
  min-height: 44px;
  appearance: none;
  background: transparent;
  touch-action: pan-y;
}
.axis-row input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 8px;
  background: #647386;
}
.axis-row input[type="range"]::-webkit-slider-thumb {
  width: 28px;
  height: 28px;
  margin-top: -10px;
  appearance: none;
  border-radius: 50%;
  background: #a9c8ed;
}
.axis-row input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 8px;
  background: #647386;
}
.axis-row input[type="range"]::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: #a9c8ed;
}
.axis-row input[type="number"] { width: 100%; min-height: 40px; padding: 5px;
  border: 1px solid #4a5665; border-radius: 7px; background: #151b23; color: #fff; font-size: 16px; }
#color-input { width: 100%; height: 48px; }
.file-button { display: flex; align-items: center; justify-content: center; cursor: pointer; }
.file-button input { display: none; }
.note { margin: 6px 0; }
.error { color: #ff9a9a !important; }
@media (max-width: 850px) {
  .app { width: calc(100% - 16px); padding-top: 10px; }
  .topbar { align-items: flex-start; flex-direction: column; gap: 4px; }
  .workspace { flex-direction: column; }
  #model-stage { height: 52vh; min-height: 340px; }
  .panel { flex: auto; min-width: 0; width: 100%; }
  .toolbar { gap: 8px; }
  .toolbar label { flex: 1 1 130px; }
}
@media (max-width: 420px) {
  .axis-row { grid-template-columns: 55px minmax(55px, 1fr) 78px; gap: 5px; }
  .toolbar button { flex: 1 1 auto; }
}
