:root {
  color-scheme: dark;
  --ink: #e9f0ed;
  --muted: #83999e;
  --mint: #b5ead0;
  --edge: #ffffff12;
  --panel: #10191fef;
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  background-color: #050910;
  color: var(--ink);
  font:
    14px system-ui,
    -apple-system,
    sans-serif;
}
canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  display: block;
  touch-action: none;
  outline: none;
}
button,
select,
input,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
}
button,
a,
input,
select,
textarea,
summary {
  touch-action: manipulation;
}
button {
  border: 0;
  background: none;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}
svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
[hidden] {
  display: none !important;
}
.chrome {
  position: fixed;
  z-index: 2;
  transition:
    opacity 0.6s,
    transform 0.6s;
}
.scene-top {
  top: max(14px, env(safe-area-inset-top));
  left: max(20px, env(safe-area-inset-left));
  right: max(20px, env(safe-area-inset-right));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}
.scene-top > * {
  pointer-events: auto;
}
.title-button {
  display: grid;
  grid-template-columns: auto 18px;
  align-items: center;
  column-gap: 10px;
  padding: 8px 0;
  text-align: left;
  max-width: calc(100% - 58px);
  filter: drop-shadow(0 2px 8px #000);
}
.brand {
  grid-column: 1/-1;
  color: var(--mint);
  font-size: 9px;
  letter-spacing: 3px;
  margin-bottom: 5px;
}
#system-name {
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 450;
}
.title-button svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}
.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border: 1px solid var(--edge);
  border-radius: 50%;
  background: #0b141b9c;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-size: 18px;
  font-weight: 350;
}
.icon-button:active,
.context-button:active {
  background: #263d3e;
  transform: scale(0.95);
}
#hide-ui {
  border-color: transparent;
  background: transparent;
  color: #b5c7c7;
}
.scene-dock {
  bottom: calc(18px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 32px);
  width: max-content;
}
.context-button {
  height: 52px;
  min-width: 148px;
  max-width: min(228px, calc(100vw - 156px));
  padding: 0 14px;
  display: grid;
  align-items: center;
  grid-template-columns: 8px minmax(0, 1fr) 18px;
  column-gap: 11px;
  border: 1px solid #b5ead023;
  border-radius: 30px;
  background: #0b141bba;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  text-align: left;
}
.context-dot {
  grid-row: 1/3;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 14px #b5ead03d;
}
#context-name {
  padding-top: 9px;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#context-kind {
  grid-column: 2;
  font-size: 9px;
  letter-spacing: 0.4px;
  color: var(--muted);
  padding-bottom: 8px;
}
.context-button svg {
  grid-column: 3;
  grid-row: 1/3;
  width: 16px;
  height: 16px;
  color: var(--muted);
}
body.focused .context-button {
  min-width: 110px;
  max-width: calc(100vw - 215px);
}
body.ui-quiet .chrome {
  opacity: 0;
  pointer-events: none;
}
body.ui-quiet .chrome * {
  pointer-events: none;
}
.gesture-hint {
  position: fixed;
  bottom: calc(92px + env(safe-area-inset-bottom));
  left: 20px;
  right: 20px;
  text-align: center;
  color: #9bb1b1;
  font-size: 10px;
  letter-spacing: 0.3px;
  pointer-events: none;
  transition: opacity 0.6s;
}
.gesture-hint.faded {
  opacity: 0;
}
.labels {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
.body-label {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 14px;
  min-height: 48px;
  color: #c8d8d7;
  font-size: 10px;
  text-shadow: 0 1px 8px #000;
  pointer-events: auto;
}
.scene-error {
  position: fixed;
  left: 24px;
  right: 24px;
  top: 44%;
  color: #ffbea8;
  text-align: center;
  font-size: 12px;
  pointer-events: none;
}
.scene-error:empty {
  display: none;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
dialog {
  color: var(--ink);
  background: var(--panel);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid #ffffff13;
  border-bottom: 0;
  box-shadow: 0 -20px 100px #0004;
  outline: none;
}
dialog::backdrop {
  background: #02060930;
}
#explorer-sheet {
  position: fixed;
  inset: auto 0 0;
  margin: 0 auto;
  width: 100%;
  max-width: 640px;
  max-height: min(78dvh, 760px);
  padding: 0 22px calc(16px + env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0;
  overflow: hidden;
}
#explorer-sheet[open] {
  display: flex;
  flex-direction: column;
  animation: slide-up 0.28s ease-out;
}
.sheet-handle {
  height: 28px;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  touch-action: none;
}
.sheet-handle span {
  width: 34px;
  height: 4px;
  background: #66818066;
  border-radius: 8px;
}
.sheet-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 4px 0 17px;
}
.eyebrow {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--muted);
}
h2 {
  font-size: 23px;
  font-weight: 450;
  letter-spacing: -0.5px;
  margin: 4px 0 0;
}
.sheet-heading .icon-button {
  width: 40px;
  min-width: 40px;
  height: 40px;
  flex-basis: 40px;
  background: #ffffff05;
  border-color: transparent;
}
.sheet-tabs {
  display: flex;
  gap: 5px;
  background: #0003;
  border: 1px solid var(--edge);
  border-radius: 24px;
  padding: 4px;
  margin-bottom: 20px;
  flex-shrink: 0;
}
.sheet-tabs button {
  flex: 1;
  min-height: 40px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--muted);
}
.sheet-tabs button[aria-selected="true"] {
  background: #ffffff0f;
  color: var(--ink);
}
.sheet-content {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #436064 transparent;
  padding-bottom: 5px;
}
.field-label {
  display: block;
  font-size: 9px;
  letter-spacing: 1.8px;
  color: var(--muted);
  margin: 0 0 12px;
}
.muted {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.7;
  overflow-wrap: anywhere;
}
select {
  max-width: 100%;
  background: #ffffff06;
  color: var(--ink);
  border: 1px solid var(--edge);
  border-radius: 12px;
  min-height: 48px;
  padding: 10px 14px;
  font-size: 13px;
}
#system-choice {
  width: 100%;
}
option {
  background: #10191f;
}
.body-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 20px 0;
}
.body-nav button {
  min-height: 58px;
  text-align: left;
  padding: 13px;
  border: 1px solid var(--edge);
  background: #ffffff03;
  border-radius: 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.body-nav button:active {
  background: #ffffff10;
}
.body-nav button[aria-pressed="true"] {
  border-color: #b5ead04a;
  background: #b5ead00b;
}
.dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset -5px -3px 8px #0008;
  flex-shrink: 0;
}
.wide-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 54px;
  border-top: 1px solid var(--edge);
  padding: 16px 2px;
  text-align: left;
  font-size: 12px;
}
.wide-button span {
  color: var(--muted);
}
.about {
  margin-top: 8px;
}
.about summary {
  min-height: 48px;
  padding: 15px 0;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}
.control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--edge);
  font-size: 13px;
  min-height: 62px;
}
.control-row select {
  max-width: 50%;
  font-size: 12px;
}
.control-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 26px;
  border-radius: 20px;
  background: #344348;
  margin: 0;
  cursor: pointer;
  transition: background 0.2s;
}
.control-row input[type="checkbox"]:after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #99abad;
  transition: transform 0.2s;
}
.control-row input[type="checkbox"]:checked {
  background: #b5ead0;
}
.control-row input[type="checkbox"]:checked:after {
  transform: translateX(18px);
  background: #143930;
}
.body-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.body-heading h3 {
  font-size: 25px;
  font-weight: 450;
  margin: 4px 0;
}
.live-tag {
  font-size: 8px;
  letter-spacing: 1px;
  color: var(--mint);
  border: 1px solid #b5ead029;
  padding: 7px 10px;
  border-radius: 20px;
}
.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.upload-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--edge);
  background: #ffffff04;
  border-radius: 15px;
  padding: 16px 13px;
  font-size: 12px;
  min-width: 0;
  cursor: pointer;
}
.upload-card small {
  font-size: 10px;
  color: var(--muted);
}
.upload-card input {
  width: 100%;
  max-width: 100%;
  font-size: 10px;
  color: var(--muted);
  margin-top: 8px;
}
.upload-card input::file-selector-button {
  color: #b5ead0;
  background: #b5ead00b;
  border: 1px solid #b5ead022;
  border-radius: 8px;
  padding: 8px;
  font-size: 10px;
}
input[type="range"] {
  width: 100%;
  height: 48px;
  accent-color: var(--mint);
  touch-action: pan-x;
}
output {
  font-size: 12px;
  color: var(--mint);
  font-variant-numeric: tabular-nums;
}
.text-button {
  min-height: 48px;
  font-size: 11px;
  color: var(--muted);
  padding: 12px 0;
}
.empty-state {
  text-align: center;
  padding: 20px 12px;
  color: var(--muted);
}
.empty-orbit {
  font-size: 42px;
  color: var(--mint);
}
.empty-state h3 {
  color: var(--ink);
  font-size: 23px;
  font-weight: 450;
}
.empty-state p {
  font-size: 12px;
  line-height: 1.8;
}
.empty-state button {
  justify-content: center;
}
a {
  color: var(--mint);
}
#system-dialog {
  inset: 0;
  max-height: 88dvh;
  width: min(760px, calc(100% - 24px));
  border-radius: 24px;
  padding: 20px;
}
#system-dialog .sheet-heading {
  padding: 0 0 8px;
}
.json-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 14px;
  margin: 16px 0;
}
#json-editor {
  width: 100%;
  height: 38dvh;
  resize: vertical;
  background: #050b11;
  color: #c9e7d9;
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 14px;
  font: 12px/1.6 monospace;
}
#editor-error {
  font-size: 12px;
  color: #ffb8a3;
}
.primary-button {
  width: 100%;
  min-height: 50px;
  border-radius: 16px;
  background: var(--mint);
  color: #102d25;
  font-size: 13px;
}
body.sheet-open .scene-dock {
  opacity: 0;
  pointer-events: none;
}
@keyframes slide-up {
  from {
    transform: translateY(40px);
    opacity: 0.4;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
@media (min-width: 760px) {
  .scene-top {
    top: 24px;
    left: 30px;
    right: 30px;
  }
  .scene-dock {
    bottom: 26px;
  }
  #explorer-sheet {
    inset: auto 20px 20px auto;
    margin: 0;
    width: 420px;
    max-height: 85dvh;
    border-bottom: 1px solid var(--edge);
    border-radius: 26px;
  }
  .gesture-hint {
    bottom: 100px;
  }
}
@media (max-height: 540px) and (orientation: landscape) {
  #explorer-sheet {
    inset: 0 0 0 auto;
    width: 360px;
    max-height: 100dvh;
    border-radius: 24px 0 0 24px;
  }
  .scene-top {
    top: 10px;
  }
  .scene-dock {
    bottom: 12px;
    left: 26%;
    max-width: calc(50% - 20px);
  }
  .gesture-hint {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
  }
}
/* A quiet, persistent information column beside the focused body. */
.planet-info {
  position: fixed;
  z-index: 1;
  right: max(18px, env(safe-area-inset-right));
  top: 50%;
  transform: translateY(-50%);
  width: 30%;
  max-width: 310px;
  max-height: calc(100dvh - 210px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 0 12px 16px;
  border-left: 1px solid #b5ead024;
  text-shadow: 0 1px 12px #0008;
  scrollbar-width: thin;
}
.planet-info h2 {
  font-size: clamp(20px, 3vw, 38px);
  font-weight: 400;
  margin: 9px 0 16px;
  overflow-wrap: anywhere;
}
.planet-info p {
  font-size: 12px;
  line-height: 1.8;
  color: #a5b9bb;
  margin: 0 0 18px;
}
.planet-info dl {
  margin: 0;
}
.planet-info dl > div {
  border-top: 1px solid #ffffff12;
  padding: 13px 0;
}
.planet-info dt {
  font-size: 9px;
  letter-spacing: 0.6px;
  color: #829b9f;
  line-height: 1.4;
}
.planet-info dd {
  margin: 5px 0 0;
  font-size: 14px;
  color: #e0ede7;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.info-edit,
.info-child {
  display: block;
  text-align: left;
  min-height: 48px;
  font-size: 11px;
  color: var(--mint);
  padding: 12px 0;
}
.info-child {
  border-bottom: 1px solid #ffffff14;
  width: 100%;
}
body.sheet-open .planet-info {
  opacity: 0.25;
  pointer-events: none;
}
.planet-info {
  transition: opacity 0.4s;
}
@media (max-width: 600px) {
  .planet-info {
    right: 14px;
    width: 30%;
    padding-left: 10px;
    max-height: calc(100dvh - 230px);
  }
  .planet-info .eyebrow {
    font-size: 8px;
    letter-spacing: 1px;
  }
  .planet-info h2 {
    font-size: 22px;
    margin: 7px 0 14px;
  }
  .planet-info p {
    font-size: 10px;
    line-height: 1.65;
    margin-bottom: 12px;
  }
  .planet-info dd {
    font-size: 12px;
  }
  .planet-info dt {
    font-size: 8px;
  }
  .planet-info dl > div {
    padding: 10px 0;
  }
  .info-edit,
  .info-child {
    font-size: 10px;
  }
  .info-edit {
    line-height: 1.6;
  }
}
@media (max-height: 540px) and (orientation: landscape) {
  .planet-info {
    top: 48%;
    width: 30%;
    max-height: calc(100dvh - 95px);
  }
  .planet-info h2 {
    font-size: 23px;
    margin: 4px 0 8px;
  }
  .planet-info p {
    font-size: 10px;
  }
  .planet-info dl > div {
    padding: 8px 0;
  }
}
