:root {
  color-scheme: dark;
  --bg: #080d16;
  --panel: #0d1420;
  --surface: #151f2b;
  --line: #25313e;
  --text: #edf1f3;
  --muted: #9caabb;
  --mint: #a3e8d3;
  --gold: #f3cb90;
  --red: #ffa7a7;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  font-size: 16px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}
button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #17212d;
  color: var(--text);
  padding: 10px 15px;
  cursor: pointer;
  font-size: 0.875rem;
  min-height: 42px;
  transition:
    background 0.15s,
    border-color 0.15s;
}
button:hover {
  background: #233343;
  border-color: #546977;
}
button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 4px;
}
.primary {
  background: var(--mint);
  color: #102720;
  border-color: var(--mint);
  font-weight: 650;
}
.primary:hover {
  background: #c4f3e2;
  border-color: #c4f3e2;
}
.quiet {
  background: transparent;
  border-color: transparent;
}
.full {
  width: 100%;
}
.topbar {
  height: 86px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 38px;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: 0.06em;
}
.brand small {
  font-size: 10px;
  color: #a7b7c9;
  display: block;
  margin-top: 5px;
  letter-spacing: 0.2em;
}
.project-label {
  font-size: 14px;
  color: var(--muted);
  border-left: 1px solid var(--line);
  padding-left: 28px;
}
.project-label span {
  font-size: 11px;
  margin-left: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 5px;
}
.topbar nav {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.workspace {
  margin: 24px 28px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 302px;
  grid-template-rows: minmax(540px, calc(100dvh - 286px)) auto;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--panel);
}
.observatory {
  position: relative;
  min-width: 0;
  min-height: 540px;
  background: #080d18;
  overflow: hidden;
}
#universe {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
#loadState {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 9;
  padding: 28px;
  gap: 20px;
}
#loadState[hidden] {
  display: none;
}
.scene-caption {
  position: absolute;
  left: 30px;
  top: 27px;
  pointer-events: none;
}
.eyebrow {
  color: #7d9dba;
  font-size: 11px;
  letter-spacing: 0.17em;
  font-weight: 600;
}
.scene-caption h1 {
  font-size: 32px;
  font-weight: 500;
  letter-spacing: 0.12em;
  margin: 12px 0 9px;
}
.scene-caption p {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
  line-height: 1.6;
}
.scene-switcher {
  position: absolute;
  top: 28px;
  right: 24px;
  display: flex;
  padding: 4px;
  gap: 2px;
  background: #0c1620d9;
  border: 1px solid #2b3b49;
  border-radius: 10px;
}
.scene-switcher button {
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: #9bafc1;
  font-size: 13px;
  min-height: 38px;
}
.scene-switcher button span {
  font:
    10px ui-monospace,
    monospace;
  color: #688599;
  margin-right: 7px;
}
.scene-switcher button.active {
  background: #223746;
  color: #dcf7ec;
}
.scene-meta {
  position: absolute;
  left: 30px;
  top: 155px;
  display: flex;
  gap: 16px;
  font:
    12px ui-monospace,
    monospace;
  color: #a2afbd;
}
.view-tools {
  position: absolute;
  right: 23px;
  bottom: 70px;
  display: grid;
  gap: 6px;
}
.view-tools button {
  background: #0e1b25c9;
  backdrop-filter: blur(8px);
  padding: 6px 8px;
  min-width: 42px;
  font-size: 14px;
}
.canvas-foot {
  position: absolute;
  bottom: 21px;
  left: 30px;
  right: 28px;
  display: flex;
  justify-content: space-between;
  gap: 15px;
  color: #8e9daf;
  font-size: 12px;
  pointer-events: none;
}
.legend {
  display: flex;
  gap: 15px;
}
.legend span:before {
  content: "";
  display: inline-block;
  width: 20px;
  border-top: 1px solid #9bdccb;
  vertical-align: middle;
  margin-right: 6px;
}
.legend .legend-dash:before {
  border-top: 1px dashed var(--gold);
}
.first-action {
  position: absolute;
  bottom: 70px;
  left: 30px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: #11252dee;
  border: 1px solid #37605e;
  padding: 8px 10px 8px 18px;
  border-radius: 9px;
  font-size: 14px;
  box-shadow: 0 8px 30px #0004;
}
.first-action button {
  border: 0;
  background: #b0e8d6;
  color: #15312d;
  padding: 8px 12px;
  min-height: 36px;
}
.first-action button:last-child {
  background: transparent;
  color: #9ebdb6;
  padding: 8px;
  min-width: 32px;
}
.inspector {
  border-left: 1px solid var(--line);
  padding: 24px 20px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #344652 transparent;
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-heading h2 {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.06em;
  margin: 8px 0 22px;
}
.round {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  margin-top: 0;
  font-size: 23px;
}
.body-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.body-chip {
  position: relative;
  padding: 8px 9px;
  font-size: 12px;
  color: #bbc8d5;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 37px;
  background: transparent;
}
.body-chip.active {
  background: #233338;
  border-color: #618a7c;
  color: #e3faef;
}
.body-chip i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--body-color);
  box-shadow: 0 0 10px color-mix(in srgb, var(--body-color), transparent 65%);
}
.object-section {
  border-top: 1px solid var(--line);
  padding-top: 19px;
}
.object-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
h3 {
  font-weight: 500;
  font-size: 16px;
  margin: 0;
}
.badge {
  font-size: 11px;
  color: #e8c997;
  border: 1px solid #5d5038;
  background: #29241b;
  border-radius: 5px;
  padding: 4px 8px;
}
.mass-label {
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  color: #a5b7c7;
}
.mass-label output {
  color: var(--text);
  font:
    15px ui-monospace,
    monospace;
}
input[type="range"] {
  width: 100%;
  margin: 15px 0 7px;
  accent-color: var(--mint);
  height: 20px;
}
.range-labels {
  display: flex;
  justify-content: space-between;
  color: #7f92a5;
  font-size: 11px;
}
.quick-actions {
  display: flex;
  gap: 8px;
  margin: 19px 0;
}
.quick-actions button {
  flex: 1;
  padding: 8px;
  font-size: 13px;
}
details {
  font-size: 14px;
}
summary {
  cursor: pointer;
  min-height: 42px;
  padding: 11px 0;
  color: #c8d4e0;
}
summary span {
  font-size: 11px;
  color: #8295a8;
  margin-left: 14px;
}
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}
.field-grid label {
  font-size: 12px;
  color: #a6b9c9;
}
.field-grid input,
.field-grid select,
.modal-input {
  display: block;
  width: 100%;
  min-width: 0;
  margin-top: 6px;
  background: #080f18;
  border: 1px solid #334653;
  border-radius: 6px;
  padding: 10px;
  color: #eff4f9;
  font-size: 14px;
}
.field-note {
  color: #899bae;
  font-size: 12px;
  line-height: 1.7;
  margin: 14px 0;
}
.danger {
  background: transparent;
  color: var(--red);
  border-color: #653f47;
  margin: 10px 0;
}
.insight {
  border-top: 1px solid var(--line);
  padding: 23px 0 20px;
  margin-top: 15px;
}
.insight-heading {
  display: flex;
  gap: 9px;
  align-items: center;
}
.insight h3 {
  font-size: 14px;
  color: #e1e8e7;
}
.spark {
  color: #b4dfce;
}
.insight p {
  font-size: 13px;
  color: #a7b6c7;
  line-height: 1.85;
  margin: 14px 0 8px;
}
.text-button {
  border: 0;
  background: transparent;
  padding: 6px 0;
  color: var(--mint);
  font-size: 12px;
  min-height: 35px;
}
.branch-box {
  border: 1px solid #344349;
  border-radius: 8px;
  padding: 13px;
  background: #131f27;
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
}
.toggle-row small {
  display: block;
  font-size: 11px;
  color: #8ea39f;
  margin-top: 5px;
}
input[type="checkbox"] {
  accent-color: var(--mint);
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.branch-box p,
.display-options p {
  font-size: 12px;
  color: #99aaa9;
  line-height: 1.7;
  margin: 13px 0 0;
}
.display-options {
  margin-top: 15px;
}
.display-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 9px 0;
  font-size: 13px;
}
.control-dock {
  grid-column: 1/-1;
  border-top: 1px solid var(--line);
  background: #111b28;
  padding: 15px 22px 12px;
}
.time-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.time-controls button {
  background: transparent;
  border-color: #344453;
  padding: 8px 14px;
  min-height: 40px;
}
.time-controls .primary {
  background: var(--mint);
  color: #123127;
  border-color: var(--mint);
  min-width: 84px;
}
.speed-control {
  font-size: 13px;
  color: #9fb1c1;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 8px;
}
.speed-control select {
  border: 0;
  background: #172331;
  border-radius: 6px;
  padding: 9px;
  color: #e3ecee;
  font-size: 13px;
}
.divider {
  height: 22px;
  width: 1px;
  background: #344453;
  margin: 0 4px;
}
.live-badge {
  margin-left: auto;
  font-size: 12px;
  color: #9bb2b0;
}
.live-badge:before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mint);
  margin-right: 7px;
}
.command-bar {
  display: flex;
  align-items: center;
  border: 1px solid #334757;
  background: #09131f;
  border-radius: 9px;
  margin-top: 14px;
  padding: 5px 6px 5px 15px;
  gap: 12px;
}
.command-mark {
  font-size: 24px;
  color: #bfdad4;
}
.command-bar input {
  flex: 1;
  min-width: 0;
  padding: 9px 0;
  background: transparent;
  border: 0;
  color: #f0f5f5;
  font-size: 14px;
  outline: none;
}
.command-bar:focus-within {
  border-color: var(--mint);
}
.command-bar input::placeholder {
  color: #8196a9;
}
.command-bar button {
  min-height: 35px;
  padding: 7px 16px;
  color: #d2ebe4;
  background: #233c42;
  border: 0;
}
.rule-badge {
  font-size: 11px;
  color: #93aab8;
  white-space: nowrap;
  border-left: 1px solid #334451;
  padding-left: 12px;
}
.command-reply {
  font-size: 12px;
  color: #8d9eaf;
  padding: 9px 0 0;
  line-height: 1.5;
  min-height: 26px;
}
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 10px 30px;
  font-size: 11px;
  color: #7d91a6;
  gap: 15px;
}
.footer button {
  font-size: 12px;
  color: #a3b5c5;
  background: transparent;
  border: 0;
  min-height: 32px;
  padding: 6px;
}
.footer > span:last-child {
  font-size: 11px;
}
dialog {
  width: min(540px, calc(100vw - 28px));
  border: 1px solid #3b4e5b;
  border-radius: 16px;
  background: #111d2a;
  color: var(--text);
  padding: 24px;
  max-height: 85dvh;
  box-shadow: 0 30px 100px #000a;
}
dialog::backdrop {
  background: #030811b8;
  backdrop-filter: blur(5px);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.modal-head h2 {
  font-weight: 500;
  font-size: 22px;
  margin: 0;
}
.modal-head button {
  font-size: 23px;
  padding: 0;
  width: 38px;
  min-height: 38px;
  border: 0;
  background: transparent;
}
.modal-body p,
#modalBody p {
  font-size: 14px;
  line-height: 1.9;
  color: #bccbd7;
}
#modalBody h3 {
  margin-top: 24px;
  margin-bottom: 10px;
  color: #c3e9d8;
}
#modalBody ul,
#modalBody ol {
  padding-left: 22px;
  color: #c2cfda;
  line-height: 1.9;
  font-size: 14px;
}
#modalBody code {
  color: #b9e5d4;
  font-size: 13px;
}
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 16px 0;
}
.modal-actions button {
  flex: 1;
}
.muted {
  color: #98aabc;
  font-size: 12px;
  line-height: 1.8;
}
.notice {
  border-left: 2px solid var(--gold);
  background: #242720;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.8;
  color: #e2d2a8;
}
.error {
  color: var(--red);
  font-size: 13px;
  line-height: 1.8;
}
#toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%) translateY(30px);
  opacity: 0;
  pointer-events: none;
  background: #d4f1e5;
  color: #112c28;
  padding: 13px 22px;
  border-radius: 9px;
  font-size: 14px;
  box-shadow: 0 10px 50px #0009;
  transition: 0.2s;
  z-index: 30;
  max-width: 90vw;
  width: max-content;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
[hidden] {
  display: none !important;
}
@media (min-width: 1500px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) 340px;
  }
  .inspector {
    padding: 28px;
  }
  .scene-caption {
    left: 38px;
    top: 35px;
  }
  .scene-caption h1 {
    font-size: 38px;
  }
}
@media (max-width: 1100px) {
  .scene-switcher {
    top: 126px;
    left: 27px;
    right: auto;
  }
  .scene-meta {
    top: 185px;
  }
  .scene-caption h1 {
    font-size: 28px;
  }
  .workspace {
    margin: 18px 18px 0;
    grid-template-columns: minmax(0, 1fr) 285px;
  }
  .canvas-foot {
    flex-direction: column;
    gap: 7px;
  }
  .first-action {
    gap: 10px;
    left: 22px;
    font-size: 12px;
  }
  .topbar {
    padding: 0 22px;
  }
  .project-label {
    display: none;
  }
}
@media (max-width: 760px) {
  .topbar {
    height: 74px;
    padding: 0 16px;
    gap: 12px;
  }
  .brand {
    font-size: 16px;
    gap: 8px;
  }
  .brand small {
    font-size: 8px;
  }
  .brand img {
    width: 30px;
  }
  .topbar nav {
    gap: 2px;
  }
  .topbar nav button {
    padding: 8px 10px;
    min-height: 40px;
    font-size: 13px;
  }
  #helpBtn {
    display: none;
  }
  .workspace {
    margin: 10px 10px 0;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
  }
  .observatory {
    height: 58dvh;
    min-height: 430px;
    max-height: 660px;
    order: 0;
  }
  .scene-caption {
    left: 20px;
    top: 21px;
  }
  .scene-caption .eyebrow {
    font-size: 9px;
  }
  .scene-caption h1 {
    font-size: 27px;
    letter-spacing: 0.1em;
    margin: 10px 0 7px;
  }
  .scene-caption p {
    font-size: 12px;
  }
  .scene-switcher {
    top: 115px;
    left: 18px;
    right: 18px;
    justify-content: space-between;
    border-radius: 7px;
    padding: 3px;
  }
  .scene-switcher button {
    flex: 1;
    font-size: 12px;
    padding: 7px 5px;
    min-height: 36px;
  }
  .scene-meta {
    top: 169px;
    left: 21px;
    font-size: 10px;
    gap: 13px;
  }
  .view-tools {
    right: 14px;
    bottom: 65px;
    gap: 4px;
  }
  .view-tools button {
    min-height: 38px;
    min-width: 38px;
    font-size: 12px;
    padding: 5px;
  }
  .canvas-foot {
    bottom: 14px;
    left: 20px;
    right: 14px;
    font-size: 10px;
    gap: 7px;
  }
  .legend {
    gap: 12px;
  }
  .first-action {
    left: 14px;
    bottom: 72px;
    font-size: 11px;
    padding: 6px 7px 6px 12px;
    gap: 7px;
    max-width: calc(100% - 66px);
  }
  .first-action span {
    max-width: 110px;
    line-height: 1.7;
  }
  .first-action button {
    font-size: 12px;
    padding: 8px;
    min-height: 38px;
  }
  .first-action button:last-child {
    padding: 5px;
    min-width: 24px;
  }
  .control-dock {
    order: 1;
    padding: 12px 12px 10px;
  }
  .time-controls {
    gap: 6px;
    flex-wrap: wrap;
  }
  .time-controls button {
    font-size: 12px;
    min-height: 40px;
    padding: 8px 9px;
  }
  .time-controls .primary {
    min-width: 60px;
  }
  .speed-control {
    gap: 5px;
    margin: 0;
    font-size: 12px;
  }
  .speed-control select {
    padding: 9px 4px;
  }
  .divider {
    margin: 0 3px;
  }
  .live-badge {
    display: none;
  }
  .command-bar {
    padding-left: 10px;
    gap: 7px;
    margin-top: 12px;
  }
  .command-bar input {
    font-size: 12px;
  }
  .command-bar button {
    font-size: 12px;
    padding: 8px 11px;
  }
  .command-mark {
    font-size: 20px;
  }
  .rule-badge {
    font-size: 9px;
    padding-left: 7px;
  }
  .command-reply {
    font-size: 11px;
  }
  .inspector {
    order: 2;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 22px 20px;
    max-height: none;
    overflow: visible;
  }
  .panel-heading h2 {
    font-size: 18px;
    margin-bottom: 16px;
  }
  .body-list {
    margin-bottom: 19px;
  }
  .body-chip {
    font-size: 13px;
    padding: 10px;
    min-height: 42px;
  }
  .insight p {
    font-size: 14px;
  }
  .insight h3 {
    font-size: 15px;
  }
  .mass-label {
    font-size: 15px;
  }
  .quick-actions button {
    min-height: 44px;
    font-size: 14px;
  }
  .display-options label {
    font-size: 14px;
  }
  .footer {
    margin: 12px 20px;
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
    font-size: 10px;
    gap: 5px;
  }
  .footer > span:first-child {
    width: 100%;
  }
  .footer > span:last-child {
    font-size: 10px;
  }
  dialog {
    padding: 20px;
  }
  .modal-head h2 {
    font-size: 21px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
.command-bar .rule-badge {
  background: transparent;
  font-size: 11px;
  border-left: 1px solid #334451;
  border-radius: 0;
  color: #a3bdc6;
  padding: 4px 10px;
  min-height: 32px;
  font-weight: 400;
}
.command-bar .rule-badge:hover {
  color: var(--mint);
}
@media (max-width: 760px) {
  .command-bar .rule-badge {
    padding: 4px 5px;
    font-size: 10px;
  }
  .command-bar input {
    font-size: 13px;
  }
  .canvas-foot .gesture-help {
    font-size: 11px;
  }
}
