

:root {
  color-scheme: dark;
  --ink: #f4efe5;
  --muted: #9d9a92;
  --panel: rgba(17, 19, 18, 0.88);
  --line: rgba(244, 239, 229, 0.13);
  --line-strong: rgba(244, 239, 229, 0.3);
  --accent: #e58a52;
  --control-height: 34px;
  --control-radius: 4px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #0b0d0c;
}

body {
  color: var(--ink);
  font-family: "Courier New", Courier, monospace;
  -webkit-font-smoothing: antialiased;
}

button,
select,
input {
  font: inherit;
}

button,
select {
  color: var(--ink);
}

button {
  border: 0;
}

.lab-shell {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 420px;
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  grid-template-rows: 60px minmax(0, 1fr);
  overflow: hidden;
  isolation: isolate;
  background: #0b0d0c;
}

.world-canvas {
  position: relative;
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
  outline: none;
}

.topbar,
.toolrail,
.inspector {
  position: absolute;
  z-index: 2;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.topbar {
  position: relative;
  grid-column: 1 / -1;
  grid-row: 1;
  top: auto;
  right: auto;
  left: auto;
  height: 44px;
  margin: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 7px 6px 13px;
  border-radius: 6px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.brand-mark {
  color: var(--accent);
  font-size: 17px;
  line-height: 1;
}

.brand h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.scene-controls {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.scene-picker {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
  text-transform: lowercase;
}

.scene-picker select,
.compact-button {
  height: var(--control-height);
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: rgba(255, 255, 255, 0.025);
  transition:
    border-color 120ms ease,
    background 120ms ease,
    color 120ms ease;
}

.scene-picker select {
  width: 126px;
  min-width: 126px;
  padding: 0 28px 0 9px;
  color: var(--ink);
  color-scheme: dark;
  background-color: #171a18;
  outline: none;
}

.scene-picker select option {
  color: var(--ink);
  background-color: #171a18;
}

.compact-button {
  min-width: 62px;
  padding: 0 10px;
  font-size: 10px;
  cursor: pointer;
}

.compact-button:hover,
.compact-button:focus-visible,
.scene-picker select:focus {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.07);
}

.compact-button.active {
  border-color: rgba(229, 138, 82, 0.64);
  color: #ffae78;
  background: rgba(229, 138, 82, 0.1);
}

.toolrail {
  position: relative;
  grid-column: 1;
  grid-row: 2;
  align-self: start;
  top: auto;
  left: auto;
  display: grid;
  grid-template-columns: 46px;
  gap: 2px;
  margin: 8px 0 8px 8px;
  padding: 4px;
  border-radius: 6px;
}

.tool-button {
  position: relative;
  width: 46px;
  height: 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  color: var(--muted);
  background: transparent;
  font-size: 8px;
  line-height: 1;
  cursor: pointer;
  transition:
    color 120ms ease,
    border-color 120ms ease,
    background 120ms ease,
    transform 120ms ease;
}

.tool-button:hover,
.tool-button:focus-visible {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.045);
  outline: none;
}

.tool-button:active {
  transform: translateY(1px);
}

.tool-button.active {
  color: #fff;
  border-color: rgba(229, 138, 82, 0.62);
  background: rgba(229, 138, 82, 0.12);
}

.tool-glyph {
  min-height: 20px;
  color: currentColor;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  line-height: 18px;
}

.inspector {
  top: 72px;
  right: 12px;
  width: 212px;
  padding: 12px;
  border-radius: 6px;
}

.inspector-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.inspector-heading > div {
  min-width: 0;
}

.inspector-heading strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.close-button {
  width: 24px;
  height: 24px;
  color: var(--muted);
  background: transparent;
  font-size: 18px;
  cursor: pointer;
}

.close-button:hover {
  color: #fff;
}

.body-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 13px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.body-readout button {
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: rgba(255, 255, 255, 0.04);
  font-size: 9px;
  cursor: pointer;
}

.inspector label {
  display: block;
  margin-top: 11px;
}

.inspector label > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
}

.inspector output {
  color: var(--ink);
}

.inspector input[type="range"] {
  width: 100%;
  height: 18px;
  margin: 4px 0 0;
  accent-color: var(--accent);
  cursor: ew-resize;
}

.inspector input:disabled {
  opacity: 0.28;
}

.delete-button {
  width: 100%;
  height: var(--control-height);
  margin-top: 15px;
  padding: 0 8px;
  border: 1px solid rgba(216, 102, 114, 0.35);
  border-radius: var(--control-radius);
  color: #e98b95;
  background: rgba(216, 102, 114, 0.06);
  font-size: 10px;
  cursor: pointer;
}

.delete-button:hover {
  border-color: rgba(216, 102, 114, 0.68);
  background: rgba(216, 102, 114, 0.12);
}

@media (max-width: 760px) {
  .lab-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 96px 54px minmax(0, 1fr);
  }

  .world-canvas {
    grid-column: 1;
    grid-row: 3;
  }

  .topbar {
    grid-column: 1;
    grid-row: 1;
    top: auto;
    right: auto;
    left: auto;
    height: auto;
    margin: 8px;
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
  }

  .brand {
    padding: 1px 4px;
  }

  .scene-controls {
    justify-content: stretch;
  }

  .scene-picker {
    flex: 1 1 auto;
  }

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

  .scene-picker select {
    width: 100%;
    min-width: 0;
  }

  .toolrail {
    grid-column: 1;
    grid-row: 2;
    top: auto;
    right: auto;
    left: auto;
    grid-template-columns: repeat(10, minmax(38px, 1fr));
    width: auto;
    margin: 0 8px 8px;
    gap: 2px;
    overflow: hidden;
  }

  .tool-button {
    width: auto;
    height: 44px;
  }

  .tool-button > span:last-child {
    display: none;
  }

  .inspector {
    top: auto;
    right: 8px;
    bottom: 50px;
    left: 8px;
    width: auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px 12px;
    padding: 10px 12px;
  }

  .inspector-heading,
  .body-readout {
    margin: 0;
  }

  .inspector-heading {
    grid-column: 1 / 3;
  }

  .body-readout {
    align-self: start;
  }

  .inspector label {
    margin: 0;
  }

  .delete-button {
    grid-column: 3;
    margin-top: 0;
  }

}

@media (max-width: 480px) {
  .compact-button {
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
    font-size: 10px;
  }

  .toolrail {
    grid-template-columns: repeat(5, 1fr);
  }

  .tool-button {
    width: auto;
    height: 37px;
  }

  .tool-glyph {
    min-height: 18px;
    font-size: 18px;
    line-height: 16px;
  }

  .inspector {
    grid-template-columns: repeat(2, 1fr);
  }

  .inspector-heading {
    grid-column: 1;
  }

  .body-readout {
    grid-column: 2;
  }

  .delete-button {
    grid-column: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
