:root {
  color-scheme: light;
  --bg: #f1f4f8;
  --panel: #fff;
  --ink: #21354b;
  --muted: #7b8ba0;
  --line: #e6ecf2;
  --blue: #477dd8;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
body {
  font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
}
button,
input,
select,
a {
  font: inherit;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 10px;
  padding: 9px 12px;
  transition:
    background 0.2s,
    border-color 0.2s;
}
button:hover {
  background: #edf4ff;
  border-color: #c5d8f5;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #95b8f5;
  outline-offset: 3px;
}
button:disabled {
  cursor: default;
  opacity: 0.45;
}
button.primary {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}
svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
[hidden] {
  display: none !important;
}
.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0 20px 12px;
  gap: 14px;
}
.topbar {
  height: 80px;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  width: 42px;
  height: 45px;
  display: grid;
  place-items: center;
  color: #42678b;
  background: #e4edf6;
  border: 1px solid #d4e1ee;
  border-radius: 13px;
}
.brand-mark svg {
  width: 25px;
  height: 25px;
}
.brand h1 {
  font-size: 19px;
  margin: 0 0 5px;
  font-weight: 650;
}
.brand p {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.toolbar button {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.toolbar .back {
  color: #55779b;
  text-decoration: none;
  margin-right: 10px;
}
.workspace {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 16px;
  position: relative;
}
.side-panel {
  width: 250px;
  flex: 0 0 250px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  scrollbar-width: thin;
}
.panel-closed .side-panel {
  display: none;
}
.section {
  padding: 20px;
  border-bottom: 1px solid var(--line);
}
.section h2 {
  font-size: 14px;
  margin: 0 0 10px;
}
.section h3 {
  font-size: 12px;
  margin: 0 0 14px;
  color: #506987;
}
.intro p,
.note {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.8;
}
.model-tag {
  display: inline-block;
  font-size: 10px;
  padding: 5px 8px;
  background: #edf4ff;
  border: 1px solid #e2ebfa;
  border-radius: 5px;
  color: #7697c3;
}
.view-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.view-grid button {
  font-size: 11px;
  padding: 8px 4px;
}
.view-grid button.active {
  color: var(--blue);
  border-color: #b6cefa;
  background: #edf4ff;
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  font-size: 11px;
}
input[type='checkbox'] {
  accent-color: var(--blue);
  width: 16px;
  height: 16px;
}
input[type='range'] {
  accent-color: var(--blue);
  width: 100%;
  height: 18px;
  margin: 6px 0 14px;
  cursor: pointer;
}
.range-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}
output {
  font-size: 10px;
  color: var(--blue);
  background: #f1f6ff;
  padding: 4px 6px;
  border-radius: 5px;
  font-variant-numeric: tabular-nums;
}
.play {
  width: 100%;
  margin: 0 0 16px;
}
.stage-label {
  color: #5179a6;
  background: #f2f7ff;
  padding: 8px;
  border-radius: 6px;
  font-size: 11px;
  text-align: center;
}
.speed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 11px;
}
select {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
}
.panel-bottom {
  padding: 18px 20px;
}
.panel-bottom button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 11px;
}
.panel-bottom p {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.8;
}
.viewport {
  flex: 1;
  min-width: 0;
  min-height: 0;
  position: relative;
  border: 1px solid #dee7f1;
  border-radius: 18px;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, #fbfcfe, #e9eff6);
}
.night .viewport {
  background: radial-gradient(ellipse at 50% 40%, #243344, #101c2a);
}
.canvas-host {
  position: absolute;
  inset: 0;
  touch-action: none;
}
.canvas-host canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.view-caption {
  position: absolute;
  top: 26px;
  left: 28px;
  pointer-events: none;
}
.view-caption p {
  font-size: 9px;
  letter-spacing: 0.15em;
  color: #8da8ca;
  margin: 0 0 10px;
}
.view-caption h2 {
  font-size: 13px;
  margin: 0 0 9px;
  font-weight: 600;
  color: #59769c;
}
.view-caption span {
  font-size: 10px;
  color: #8da0bb;
}
.engine-badge {
  position: absolute;
  top: 24px;
  right: 24px;
  color: #4d9b88;
  background: #ffffffb8;
  font-size: 10px;
  padding: 7px 12px;
  border-radius: 20px;
}
.engine-badge::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 7px;
}
.zoom-dock {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.zoom-dock button {
  width: 36px;
  height: 36px;
  padding: 8px;
  box-shadow: 0 2px 8px #365c8a0f;
}
.help-pill {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 18px;
  border: 1px solid #e2eaf4;
  border-radius: 30px;
  background: #ffffffc4;
  color: #8aa0bd;
  font-size: 10px;
  white-space: nowrap;
  pointer-events: none;
}
.motion-dock {
  position: absolute;
  bottom: 65px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px;
  background: #ffffffdf;
  border: 1px solid #e1eaf6;
  border-radius: 14px;
  white-space: nowrap;
}
.motion-dock button {
  color: #416fae;
  font-size: 11px;
  padding: 7px 12px;
  background: #edf4ff;
  border-color: #d5e4fb;
}
.motion-dock span {
  font-size: 10px;
  color: #7b91ad;
  padding-right: 8px;
}
.labels-host {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.part-label {
  position: absolute;
  background: #ffffffdf;
  color: #426a99;
  border: 1px solid #d5e3f6;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 10px;
  white-space: nowrap;
}
.statusbar {
  min-height: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 9px;
  color: #94a5ba;
}
.fallback {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f5f8fc;
  padding: 20px;
  text-align: center;
}
.fallback img {
  width: min(70%, 480px);
  max-height: 60%;
  object-fit: contain;
}
.fallback p {
  color: #5b789e;
  font-size: 12px;
}
.modal {
  position: fixed;
  inset: 0;
  background: #15304c88;
  display: grid;
  place-items: center;
  z-index: 20;
  padding: 20px;
}
.modal-card {
  max-width: 800px;
  max-height: 90vh;
  background: white;
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-card button {
  align-self: flex-end;
}
.modal-card img {
  max-width: 100%;
  min-height: 0;
  object-fit: contain;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 50px;
  transform: translateX(-50%);
  background: #21354be8;
  color: white;
  border-radius: 10px;
  padding: 11px 18px;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  font-size: 12px;
}
.toast.show {
  opacity: 1;
}
html.embed .app {
  padding: 0;
  gap: 0;
}
html.embed .topbar,
html.embed .side-panel,
html.embed .statusbar,
html.embed .view-caption,
html.embed .engine-badge,
html.embed .zoom-dock,
html.embed .help-pill {
  display: none;
}
html.embed .viewport {
  border: 0;
  border-radius: 0;
}
html.embed .motion-dock {
  bottom: 16px;
}
@media (max-width: 880px) {
  .app {
    padding: 0 10px 8px;
    gap: 10px;
  }
  .topbar {
    min-height: 65px;
    height: 65px;
  }
  .brand h1 {
    font-size: 15px;
  }
  .brand p {
    font-size: 8px;
    letter-spacing: 0;
  }
  .toolbar button span,
  .toolbar .back,
  #referenceBtn {
    display: none;
  }
  .toolbar button {
    width: 32px;
    height: 32px;
    padding: 7px;
  }
  .workspace {
    gap: 10px;
  }
  .side-panel {
    width: 216px;
    flex-basis: 216px;
  }
  .section {
    padding: 16px;
  }
  .engine-badge {
    top: 65px;
    left: 20px;
    right: auto;
    font-size: 9px;
  }
  .view-caption {
    top: 20px;
    left: 20px;
  }
  .view-caption span {
    display: none;
  }
  .statusbar span:first-child {
    display: none;
  }
  .statusbar {
    justify-content: center;
  }
  .help-pill {
    font-size: 9px;
    padding: 9px 12px;
  }
}
@media (max-width: 620px) {
  .side-panel {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 235px;
    z-index: 10;
    box-shadow: 0 12px 35px #20354d22;
  }
  .brand-mark {
    width: 34px;
    height: 36px;
  }
  .brand {
    gap: 8px;
  }
  .brand h1 {
    font-size: 13px;
  }
  .toolbar {
    gap: 5px;
  }
  .viewport {
    border-radius: 14px;
  }
  .help-pill {
    max-width: calc(100% - 20px);
    white-space: normal;
    text-align: center;
    font-size: 9px;
  }
  .motion-dock {
    bottom: 64px;
    gap: 5px;
  }
  .motion-dock span {
    max-width: 120px;
    white-space: normal;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
