.spatial-workspace {
  display: grid;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 34rem;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.65rem;
  overflow: hidden;
}

.spatial-toolbar {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
}

.spatial-toolbar__actions {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.45rem;
}

.spatial-toolbar__view-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid rgb(255 255 255 / 0.07);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.025);
  padding: 0.2rem;
}

.spatial-toolbar__view-switch .nodedc-button {
  border-radius: 999px;
}

.spatial-viewport-shell {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 1rem;
  background: #06070a;
  box-shadow: none;
}

.rerun-viewport,
.rerun-viewport__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.rerun-viewport__canvas[data-presented="false"] {
  visibility: hidden;
}

.recorded-session-preloaders {
  position: fixed;
  left: -10000px;
  top: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.rerun-viewport {
  --rerun-native-chrome-height: 72px;
  overflow: hidden;
}

/* Rerun WebViewer 0.34.1 keeps three fixed 24px canvas rows even after its
   panels are overridden: the native top row, recording tab and view tab.
   They are drawn inside WASM and cannot be styled independently, so crop the
   fixed native chrome while keeping the actual 3D viewport full-height. */
.rerun-viewport__canvas {
  top: calc(-1 * var(--rerun-native-chrome-height));
  bottom: auto;
  height: calc(100% + var(--rerun-native-chrome-height));
}

.rerun-viewport__canvas canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.rerun-viewport__camera-lock {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  left: 0;
  width: calc(46% - 2px);
  cursor: default;
  touch-action: none;
}

.rerun-viewport:is([data-status="loading"], [data-status="error"])
  .rerun-viewport__canvas {
  visibility: hidden;
  pointer-events: none;
}

.rerun-viewport__notice {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  border: 0;
  border-radius: 1rem;
  background: rgb(10 11 14 / 0.82);
  padding: 0.9rem 1rem;
  transform: translate(-50%, -50%);
  backdrop-filter: blur(18px);
}

.rerun-viewport__notice strong,
.rerun-viewport__notice span {
  display: block;
}

.rerun-viewport__notice strong {
  font-size: 0.72rem;
}

.rerun-viewport__notice span {
  margin-top: 0.18rem;
  color: var(--nodedc-text-muted);
  font-size: 0.61rem;
}

.rerun-viewport__notice--error {
  background: rgb(10 11 14 / 0.9);
}

.rerun-viewport__retry {
  margin-top: 0.65rem;
  border: 1px solid var(--station-hairline-strong);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.08);
  padding: 0.42rem 0.7rem;
  color: var(--nodedc-text-primary);
  font: inherit;
  font-size: 0.61rem;
  cursor: pointer;
}

.rerun-viewport__retry:hover,
.rerun-viewport__retry:focus-visible {
  background: rgb(255 255 255 / 0.14);
  outline: none;
}

.busy-indicator {
  width: 1rem;
  height: 1rem;
  flex: 0 0 1rem;
  border: 2px solid rgb(255 255 255 / 0.12);
  border-top-color: var(--nodedc-text-primary);
  border-radius: 50%;
  animation: viewer-spin 900ms linear infinite;
}

@keyframes viewer-spin {
  to { transform: rotate(360deg); }
}

.empty-spatial-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #06070a;
}

.empty-spatial-stage__grid {
  display: none;
}

.spatial-axis {
  position: absolute;
  right: 2rem;
  bottom: 5.2rem;
  width: 4.4rem;
  height: 4.4rem;
  color: var(--nodedc-text-muted);
  font-size: 0.53rem;
}

.spatial-axis::before,
.spatial-axis::after {
  position: absolute;
  bottom: 0.65rem;
  left: 0.75rem;
  width: 2.7rem;
  height: 1px;
  background: rgb(255 255 255 / 0.2);
  content: "";
  transform-origin: left center;
}

.spatial-axis::before { transform: rotate(-24deg); }
.spatial-axis::after { transform: rotate(-90deg); }
.spatial-axis span { position: absolute; }
.spatial-axis span[data-axis="x"] { right: 0; bottom: 0; color: var(--nodedc-text-muted); }
.spatial-axis span[data-axis="y"] { top: 0; left: 0.55rem; color: var(--nodedc-text-muted); }
.spatial-axis span[data-axis="z"] { right: 0.55rem; bottom: 2.2rem; color: var(--nodedc-text-muted); }

.empty-spatial-stage__message {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  max-width: 25rem;
  justify-items: center;
  gap: 0.62rem;
  transform: translate(-50%, -58%);
  text-align: center;
}

.empty-spatial-stage__icon {
  display: grid;
  width: 3.4rem;
  height: 3.4rem;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.035);
  color: var(--nodedc-text-secondary);
}

.empty-spatial-stage__message strong {
  color: var(--nodedc-text-primary);
  font-size: 0.82rem;
}

.empty-spatial-stage__message p {
  margin: 0;
  color: var(--nodedc-text-muted);
  font-size: 0.67rem;
  line-height: 1.5;
}

.scene-status,
.scene-metrics,
.scene-adapter-note,
.scene-selection,
.scene-timeline {
  position: absolute;
  z-index: 3;
  border: 0;
  background: rgb(9 10 13 / 0.74);
  backdrop-filter: blur(16px);
}

.scene-status--top-left {
  top: 0.85rem;
  left: 0.85rem;
  display: grid;
  justify-items: start;
  gap: 0.42rem;
  border-radius: 0.9rem;
  padding: 0.7rem;
}

.scene-status small {
  max-width: 18rem;
  color: var(--nodedc-text-muted);
  font-size: 0.57rem;
  line-height: 1.35;
}

.scene-metrics {
  top: 0.85rem;
  right: 0.85rem;
  display: grid;
  min-width: 10rem;
  border-radius: 0.9rem;
  padding: 0.35rem 0.75rem;
}

.scene-metrics > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 0;
  padding: 0.38rem 0;
}

.scene-metrics > div:last-child { border-bottom: 0; }
.scene-metrics span { color: var(--nodedc-text-muted); font-size: 0.56rem; }
.scene-metrics strong { color: var(--nodedc-text-primary); font-size: 0.72rem; }
.scene-metrics small { color: var(--nodedc-text-muted); font-size: 0.52rem; font-weight: 500; }

.scene-adapter-note {
  top: 50%;
  left: 50%;
  display: flex;
  max-width: 34rem;
  align-items: center;
  gap: 0.65rem;
  border-radius: 0.9rem;
  color: var(--nodedc-text-secondary);
  padding: 0.75rem 0.9rem;
  font-size: 0.63rem;
  line-height: 1.4;
  transform: translate(-50%, 5.2rem);
}

.scene-adapter-note > svg { flex: 0 0 auto; color: var(--nodedc-text-secondary); }

.scene-selection {
  right: 0.85rem;
  bottom: 4.6rem;
  display: grid;
  max-width: 19rem;
  gap: 0.2rem;
  border-radius: 0.85rem;
  padding: 0.65rem 0.75rem;
}

.scene-selection span,
.scene-selection small { color: var(--nodedc-text-muted); font-size: 0.55rem; }
.scene-selection strong { overflow: hidden; font-size: 0.66rem; text-overflow: ellipsis; white-space: nowrap; }

.scene-operation-status-stack {
  position: absolute;
  z-index: 11;
  right: 0.85rem;
  bottom: 7.15rem;
  display: grid;
  justify-items: end;
  gap: 0.3rem;
}

.scene-operation-status {
  display: inline-flex;
  max-width: min(24rem, calc(100% - 1.7rem));
  align-items: center;
  gap: 0.42rem;
  border: 1px solid rgb(255 255 255 / 0.07);
  border-radius: 999px;
  background: rgb(9 10 13 / 0.7);
  color: var(--nodedc-text-muted);
  padding: 0.42rem 0.65rem;
  font: inherit;
  font-size: 0.52rem;
  font-weight: 680;
  line-height: 1;
  white-space: nowrap;
  backdrop-filter: blur(14px);
}

.scene-operation-status .busy-indicator {
  width: 0.66rem;
  height: 0.66rem;
  flex-basis: 0.66rem;
  border-width: 1px;
}

.scene-operation-status--action {
  color: var(--nodedc-text-secondary);
  cursor: pointer;
}

.scene-operation-status--action:hover,
.scene-operation-status--action:focus-visible {
  border-color: rgb(255 255 255 / 0.14);
  background: rgb(20 21 25 / 0.82);
  color: var(--nodedc-text-primary);
  outline: none;
}

.scene-operation-status--error {
  color: rgb(var(--nodedc-danger-rgb));
}

.scene-timeline {
  right: 0.75rem;
  bottom: 0.75rem;
  left: 0.75rem;
  display: grid;
  min-width: 0;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.6rem;
  border-radius: 0.9rem;
  padding: 0.4rem;
}

.scene-timeline__track {
  height: 0.3rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.08);
}

.scene-timeline__track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--nodedc-text-primary);
}

.scene-timeline__track[data-disabled="true"] { opacity: 0.46; }
.scene-timeline code { color: var(--nodedc-text-muted); font-size: 0.57rem; }

.scene-timeline__follow {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  border-radius: var(--nodedc-radius-circle);
  background: transparent;
  color: var(--nodedc-text-muted);
  padding: 0.3rem 0.45rem;
  font-size: 0.52rem;
  font-weight: 820;
}

.scene-timeline__follow::before {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--nodedc-text-muted);
  content: "";
}

.scene-timeline__follow[data-active="true"] {
  background: transparent;
  color: var(--nodedc-text-primary);
}

.scene-timeline__follow[data-active="true"]::before {
  background: rgb(var(--nodedc-success-rgb));
}

.spatial-contract-strip {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 1rem;
  color: var(--nodedc-text-muted);
  font-size: 0.57rem;
}

.spatial-contract-strip span {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
}

.spatial-contract-strip i {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--nodedc-text-muted);
}

.spatial-contract-strip i[data-state="ready"] { background: var(--nodedc-text-primary); }
.spatial-contract-strip i[data-state="contract"] { background: rgb(var(--nodedc-warning-rgb)); }

@media (prefers-reduced-motion: reduce) {
  .busy-indicator { animation: none; }
}
