/* Spatial laboratory: a contained dark instrument on a white page. */
.spatial-section {
  background: #fff;
  color: var(--ink, #121a29);
}

.spatial-section > .wrap > .section-head,
.spatial-section .section-head h2,
.spatial-section .section-head h2 > span {
  color: var(--ink, #121a29);
}

.spatial-section .section-head > p {
  color: var(--muted, #687080);
}

.spatial-module {
  --scene-bg: #0b1019;
  --scene-panel: #121b28;
  --scene-control: #1a2636;
  --scene-line: #2b3748;
  --scene-text: #f3f6fb;
  --scene-muted: #adb8c9;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #202a38;
  border-radius: var(--radius, 32px);
  background: var(--scene-bg);
  color: var(--scene-text);
  color-scheme: dark;
}

.spatial-module *,
.spatial-module *::before,
.spatial-module *::after {
  box-sizing: border-box;
}

.spatial-module [hidden] {
  display: none !important;
}

.spatial-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  padding: 20px 22px;
}

.scene-tabs {
  display: flex;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  padding: 4px;
  border-radius: 16px;
  background: var(--scene-panel);
}

.spatial-module button {
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.scene-tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px 7px;
  min-height: 44px;
  min-width: 0;
  padding: 10px 15px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--scene-muted);
  font-size: 13px;
  font-weight: 550;
  line-height: 1.4;
  letter-spacing: 0;
  text-align: center;
  transition: background .18s ease, color .18s ease;
}

.scene-tabs button > span {
  color: #a6b6d2;
  font-size: 11px;
  font-weight: 450;
  line-height: 1.4;
}

.scene-tabs button[aria-selected="true"],
.scene-tabs button.is-active {
  background: #f3f5f8;
  color: #152033;
}

.scene-tabs button[aria-selected="true"] > span,
.scene-tabs button.is-active > span {
  color: #55667f;
}

.scene-tabs button:hover:not(:disabled):not([aria-selected="true"]) {
  background: #1c293b;
  color: #fff;
}

.spatial-toolbar > [data-scene-dimensions] {
  min-width: 0;
  max-width: 320px;
  color: var(--scene-muted);
  font-size: 12px;
  font-weight: 450;
  line-height: 1.65;
  letter-spacing: 0;
  text-align: right;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.spatial-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  align-items: stretch;
  gap: 14px;
  padding: 0 18px 18px;
}

.scene-viewport {
  position: relative;
  min-width: 0;
  min-height: 500px;
  overflow: hidden;
  border-radius: 22px;
  background: #080b0f;
  isolation: isolate;
}

.scene-viewport canvas[data-scene-canvas] {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  margin: 0;
  border: 0;
  border-radius: inherit;
  background: #080b0f;
}

.scene-loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 28px;
  background: #080b0f;
  color: #d1d9e6;
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
  pointer-events: none;
}

.scene-loading::before {
  content: "";
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border: 2px solid #344054;
  border-top-color: #e5ecf6;
  border-radius: 50%;
  animation: spatial-loading-turn 1s linear infinite;
}

.scene-loading > span {
  display: none;
}

.scene-caption {
  position: absolute;
  z-index: 2;
  top: 14px;
  left: 14px;
  display: -webkit-box;
  width: fit-content;
  max-width: min(430px, calc(100% - 28px));
  max-height: 52px;
  overflow: hidden;
  padding: 8px 11px;
  border-radius: 12px;
  background: #121b28;
  color: #bdc8d8;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  pointer-events: none;
}

.scene-controls {
  position: absolute;
  right: 14px;
  bottom: 14px;
  left: 14px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-width: 0;
}

.scene-controls > span {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 190px;
  margin-right: auto;
  padding: 8px 10px;
  border-radius: 12px;
  background: #121b28;
  color: var(--scene-muted);
  font-size: 12px;
  line-height: 1.45;
}

.scene-controls > span > i {
  flex: none;
}

.scene-controls > span svg {
  width: 18px;
  height: 18px;
}

.scene-controls > button {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid #344358;
  border-radius: 12px;
  background: #172334;
  color: #e7edf8;
  transition: background .18s ease, border-color .18s ease;
}

.scene-controls > button svg {
  width: 19px;
  height: 19px;
}

.scene-controls > button:hover:not(:disabled) {
  background: #25364e;
  border-color: #637b9c;
}

.scene-side {
  min-width: 0;
  padding: 20px;
  border-radius: 22px;
  background: var(--scene-panel);
}

.scene-side > .overline {
  display: block;
  margin: 0 0 14px;
  color: #9eacc1;
  font-size: 10px;
  font-weight: 550;
  line-height: 1.5;
  letter-spacing: .055em;
}

.scene-side > h3 {
  display: none;
}

.view-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
}

.view-modes button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  min-width: 0;
  min-height: 52px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #1a2636;
  color: #b5c1d3;
  font-size: 12px;
  font-weight: 450;
  line-height: 1.4;
  letter-spacing: 0;
  text-align: left;
  overflow-wrap: anywhere;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.view-modes button > i {
  flex: none;
  color: #adbed9;
}

.view-modes button svg {
  width: 18px;
  height: 18px;
}

.view-modes button[aria-pressed="true"],
.view-modes button.is-active {
  border-color: #d5e0f0;
  background: #e8edf5;
  color: #17243a;
  font-weight: 600;
}

.view-modes button[aria-pressed="true"] > i,
.view-modes button.is-active > i {
  color: #254edb;
}

.view-modes button:hover:not(:disabled):not([aria-pressed="true"]) {
  border-color: #405775;
  background: #223147;
  color: #fff;
}

.scene-materials {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--scene-line);
}

.scene-materials > span {
  flex-basis: 100%;
  color: var(--scene-muted);
  font-size: 12px;
  line-height: 1.5;
}

.scene-materials button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 80px;
  gap: 7px;
  min-width: 0;
  min-height: 44px;
  padding: 8px;
  border: 1px solid #354256;
  border-radius: 12px;
  background: #1a2636;
  color: #c9d2e0;
  line-height: 1.4;
  transition: background .18s ease, border-color .18s ease;
}

.scene-materials button::after {
  content: attr(aria-label);
  font-size: 11px;
  font-weight: 450;
}

.scene-materials button[aria-pressed="true"] {
  border-color: #d8e3f4;
  background: #293a53;
  color: #fff;
}

.scene-materials button:hover:not(:disabled) {
  border-color: #9eb2d0;
}

.scene-materials .swatch {
  display: block;
  flex: 0 0 19px;
  width: 19px;
  height: 19px;
  border: 1px solid #ffffff30;
  border-radius: 5px;
}

.scene-materials .swatch.wood {
  background: #b49875;
}

.scene-materials .swatch.stone {
  background: #bfc1b8;
}

.scene-light-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  min-width: 0;
  margin-top: 14px;
}

.scene-time {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  min-height: 44px;
  padding: 9px 7px;
  border: 1px solid #354256;
  border-radius: 12px;
  background: #1a2636;
  color: #bdc9da;
  font-size: 12px;
  font-weight: 450;
  line-height: 1.4;
  letter-spacing: 0;
  transition: background .18s ease, border-color .18s ease;
}

.scene-time svg {
  width: 17px;
  height: 17px;
}

.scene-time[aria-pressed="true"] {
  border-color: #c8d6ea;
  background: #e8edf5;
  color: #17243a;
  font-weight: 550;
}

.scene-time:hover:not(:disabled):not([aria-pressed="true"]) {
  border-color: #6b82a1;
  background: #26364c;
}

.scene-side > [data-scene-status] {
  margin: 14px 0 0;
  color: #a7b5c9;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.scene-side > [data-scene-status][data-status="error"] {
  color: #ffd0c7;
}

.spatial-module button:disabled,
.spatial-module button[aria-disabled="true"] {
  opacity: .4;
  cursor: not-allowed;
}

.spatial-module button:focus-visible,
.spatial-module canvas:focus-visible {
  outline: 3px solid #bfd5ff;
  outline-offset: 3px;
}

.spatial-module canvas:focus-visible {
  outline-offset: -4px;
}

.spatial-module[data-scene-state="error"] .scene-caption {
  display: none;
}

/* Three separate future-facing cards, followed by the explicit roadmap note. */
.reality-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.reality-grid > button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  min-height: 250px;
  padding: 25px;
  border: 1px solid #e3e6eb;
  border-radius: 24px;
  background: var(--soft, #f3f4f6);
  color: var(--ink, #121a29);
  font-family: inherit;
  letter-spacing: 0;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color .18s ease;
}

.reality-grid > button:nth-child(2) {
  border-color: #e5d8c3;
  background: #f4ecdf;
}

.reality-grid > button:nth-child(3) {
  border-color: #e2ddec;
  background: #f0edf6;
}

.reality-grid > button > span {
  color: #647082;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: .045em;
}

.reality-grid > button > h3 {
  margin: 13px 0 10px;
  color: var(--ink, #121a29);
  font-size: 23px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.01em;
}

.reality-grid > button > p {
  max-width: 300px;
  margin: 0 0 22px;
  color: #626b7b;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.65;
}

.reality-grid > button > i {
  display: grid;
  place-items: center;
  align-self: flex-end;
  width: 40px;
  height: 40px;
  margin-top: auto;
  border-radius: 12px;
  background: #fff;
  color: #263f65;
  transition: background .18s ease, color .18s ease;
}

.reality-grid > button > i svg {
  width: 20px;
  height: 20px;
}

.reality-grid > button:hover {
  border-color: #b9c5d5;
}

.reality-grid > button:hover > i {
  background: #17243a;
  color: #fff;
}

.reality-grid > button:focus-visible {
  outline: 3px solid var(--blue, #254edb);
  outline-offset: 3px;
}

.spatial-note {
  max-width: 930px;
  margin: 18px 0 0;
  color: var(--muted, #687080);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.75;
  letter-spacing: 0;
}

@media (max-width: 1000px) {
  .spatial-toolbar {
    flex-wrap: wrap;
    padding: 18px;
  }

  .spatial-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 0 14px 14px;
  }

  .scene-viewport {
    height: 480px;
    min-height: 480px;
  }

  .scene-side {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    gap: 16px 24px;
    padding: 20px;
  }

  .scene-side > .overline {
    grid-column: 1 / -1;
    font-size: 11px;
  }

  .scene-side > h3 {
    display: none;
  }

  .view-modes {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .view-modes button {
    min-height: 70px;
    font-size: 13px;
  }

  .scene-materials,
  .scene-light-controls {
    margin-top: 0;
  }

  .scene-materials {
    padding-top: 0;
    border-top: 0;
  }

  .scene-light-controls {
    align-self: end;
  }

  .scene-side > [data-scene-status] {
    grid-column: 1 / -1;
    margin-top: 0;
  }

  .reality-grid {
    gap: 12px;
  }

  .reality-grid > button {
    min-height: 255px;
    padding: 21px;
  }

  .reality-grid > button > h3 {
    font-size: 21px;
  }
}

@media (max-width: 640px) {
  .spatial-module {
    border-radius: 26px;
  }

  .spatial-toolbar {
    display: block;
    padding: 12px 12px 14px;
  }

  .scene-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    padding: 4px;
  }

  .scene-tabs button {
    display: block;
    padding: 10px 7px;
    font-size: 12px;
    line-height: 1.5;
  }

  .scene-tabs button > span {
    display: block;
    margin-top: 2px;
    font-size: 10px;
    line-height: 1.5;
  }

  .spatial-toolbar > [data-scene-dimensions] {
    display: block;
    max-width: none;
    margin-top: 11px;
    padding-inline: 5px;
    font-size: 12px;
    text-align: left;
  }

  .spatial-body {
    gap: 10px;
    padding: 0 10px 10px;
  }

  .scene-viewport {
    height: 390px;
    min-height: 390px;
    border-radius: 20px;
  }

  .scene-caption {
    top: 12px;
    left: 12px;
    max-width: calc(100% - 24px);
    max-height: 49px;
    padding: 7px 9px;
    border-radius: 10px;
    font-size: 11px;
    line-height: 1.55;
  }

  .scene-controls {
    right: 10px;
    bottom: 12px;
    left: 10px;
    gap: 6px;
  }

  .scene-controls > span {
    gap: 5px;
    max-width: 116px;
    padding: 7px 8px;
    font-size: 11px;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }

  .scene-controls > span svg {
    width: 16px;
    height: 16px;
  }

  .scene-side {
    display: block;
    padding: 17px 15px;
    border-radius: 20px;
  }

  .scene-side > .overline {
    margin-bottom: 12px;
  }

  .view-modes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .view-modes button {
    flex-direction: column;
    align-items: flex-start;
    min-height: 72px;
    padding: 10px;
    font-size: 12px;
    line-height: 1.4;
  }

  .scene-materials {
    gap: 8px;
    margin-top: 18px;
    padding-top: 17px;
    border-top: 1px solid var(--scene-line);
  }

  .scene-materials button::after {
    font-size: 12px;
  }

  .scene-light-controls {
    margin-top: 13px;
  }

  .scene-side > [data-scene-status] {
    margin-top: 15px;
    font-size: 12px;
    line-height: 1.7;
  }

  .reality-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin-top: 16px;
  }

  .reality-grid > button {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px;
    gap: 0 17px;
    min-height: 0;
    padding: 22px;
    border-radius: 22px;
  }

  .reality-grid > button > span,
  .reality-grid > button > h3,
  .reality-grid > button > p {
    grid-column: 1;
  }

  .reality-grid > button > h3 {
    margin: 10px 0 8px;
    font-size: 21px;
    line-height: 1.25;
  }

  .reality-grid > button > p {
    margin: 0;
    font-size: 13px;
    line-height: 1.7;
  }

  .reality-grid > button > i {
    grid-column: 2;
    grid-row: 1 / 4;
    align-self: center;
    margin: 0;
  }

  .spatial-note {
    margin-top: 16px;
    font-size: 12px;
    line-height: 1.8;
  }
}

@media (max-width: 360px) {
  .scene-controls > span {
    display: none;
  }

  .scene-tabs button {
    padding-inline: 5px;
    font-size: 11px;
  }

  .scene-tabs button > span {
    font-size: 10px;
  }

  .scene-side {
    padding-inline: 13px;
  }

  .reality-grid > button {
    grid-template-columns: minmax(0, 1fr) 36px;
    gap: 0 12px;
    padding: 20px;
  }

  .reality-grid > button > i {
    width: 36px;
    height: 36px;
  }
}

@keyframes spatial-loading-turn {
  to { transform: rotate(360deg); }
}

.motion-off .spatial-module *,
.motion-off .spatial-module *::before,
.motion-off .reality-grid * {
  animation: none !important;
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .spatial-module *,
  .spatial-module *::before,
  .reality-grid * {
    animation: none !important;
    transition: none !important;
  }
}

.view-modes button{flex-direction:column;justify-content:center;align-items:center;text-align:center;gap:5px;min-height:70px;padding:9px 7px;overflow-wrap:normal;word-break:normal}.scene-caption{max-height:none}
