/* Dynamic environment preview shell and its local Three.js/fallback canvas. */
body.tech-workspace .environment-scene-shell {
  position: absolute;
  z-index: 6;
  top: 61px;
  left: 18px;
  width: min(350px, calc(100% - 36px));
  overflow: hidden;
  color: #dceee9;
  background: rgba(13, 22, 23, .95);
  border: 1px solid #395653;
  border-radius: 7px;
  box-shadow: 0 14px 30px rgba(8, 21, 22, .26), inset 0 0 0 1px rgba(98, 214, 196, .05);
  backdrop-filter: blur(9px);
}

body.tech-workspace .environment-scene-handle { display: none; }

body.tech-workspace .environment-scene-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 10px 8px;
  border-bottom: 1px solid #2b4140;
}

body.tech-workspace .environment-scene-title,
body.tech-workspace .environment-scene-head-actions,
body.tech-workspace .environment-scene-title > div,
body.tech-workspace .environment-scene-status,
body.tech-workspace .environment-scene-control-row,
body.tech-workspace .environment-scene-control-row label,
body.tech-workspace .environment-scene-telemetry-note {
  display: flex;
  align-items: center;
}

body.tech-workspace .environment-scene-title { gap: 8px; min-width: 0; }
body.tech-workspace .environment-scene-title > svg { width: 16px; height: 16px; color: var(--tech-cyan); stroke-width: 1.7; }
body.tech-workspace .environment-scene-title > div { align-items: baseline; gap: 7px; min-width: 0; }
body.tech-workspace .environment-scene-title span { color: #eff8f4; font-size: 12px; font-weight: 700; white-space: nowrap; }
body.tech-workspace .environment-scene-title small { color: #79afa7; font: 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .08em; white-space: nowrap; }
body.tech-workspace .environment-scene-head-actions { gap: 7px; min-width: 0; }
body.tech-workspace .environment-scene-status { gap: 4px; color: #92aaa5; font: 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: nowrap; }
body.tech-workspace .environment-scene-status > span { width: 5px; height: 5px; border-radius: 50%; background: var(--tech-amber); box-shadow: 0 0 8px rgba(224, 174, 85, .58); }
body.tech-workspace .environment-scene-status em { color: inherit; font: inherit; font-style: normal; }
body.tech-workspace .environment-scene-shell[data-scene-state="ready"] .environment-scene-status > span { background: var(--tech-cyan); box-shadow: 0 0 8px rgba(98, 214, 196, .66); }
body.tech-workspace .environment-scene-shell[data-scene-state="fallback"] .environment-scene-status > span { background: var(--tech-amber); }
body.tech-workspace .environment-scene-shell[data-scene-state="error"] .environment-scene-status > span { background: var(--tech-coral); box-shadow: 0 0 8px rgba(201, 117, 98, .66); }

body.tech-workspace .environment-scene-icon-btn,
body.tech-workspace .environment-scene-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  padding: 0;
  color: #a8c4bd;
  background: #1a2a2b;
  border: 1px solid #35504d;
  border-radius: 4px;
  cursor: pointer;
}
body.tech-workspace .environment-scene-icon-btn:hover,
body.tech-workspace .environment-scene-play:hover { color: var(--tech-cyan); border-color: var(--tech-cyan-deep); background: #203b3b; }
body.tech-workspace .environment-scene-icon-btn:focus-visible,
body.tech-workspace .environment-scene-play:focus-visible { outline: 2px solid var(--tech-amber); outline-offset: 1px; }
body.tech-workspace .environment-scene-icon-btn svg,
body.tech-workspace .environment-scene-play svg { width: 14px; height: 14px; stroke-width: 1.8; }
body.tech-workspace .environment-scene-collapse-closed,
body.tech-workspace .environment-scene-pause-icon { display: none; }
body.tech-workspace .environment-scene-shell.is-collapsed .environment-scene-collapse-open,
body.tech-workspace .environment-scene-play[data-playing="true"] .environment-scene-play-icon { display: none; }
body.tech-workspace .environment-scene-shell.is-collapsed .environment-scene-collapse-closed,
body.tech-workspace .environment-scene-play[data-playing="true"] .environment-scene-pause-icon { display: block; }

body.tech-workspace .environment-scene-modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  margin: 8px 10px 7px;
  padding: 2px;
  background: #182627;
  border: 1px solid #304745;
  border-radius: 5px;
}
body.tech-workspace .environment-scene-modes button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 25px;
  padding: 0 4px;
  color: #8ea9a3;
  background: transparent;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
  font: 600 10px/1 "Segoe UI", "Microsoft YaHei", sans-serif;
}
body.tech-workspace .environment-scene-modes button:hover { color: #e8f7f2; background: #213536; }
body.tech-workspace .environment-scene-modes button.active { color: #09201e; background: var(--tech-cyan); box-shadow: 0 0 12px rgba(98, 214, 196, .2); }
body.tech-workspace .environment-scene-modes button:focus-visible { outline: 2px solid var(--tech-amber); outline-offset: 1px; }
body.tech-workspace .environment-scene-modes svg { width: 12px; height: 12px; stroke-width: 1.8; }

body.tech-workspace .environment-scene-viewport {
  position: relative;
  height: 168px;
  margin: 0 10px;
  overflow: hidden;
  isolation: isolate;
  background: #122121;
  border: 1px solid #2c4845;
  border-radius: 4px;
}
body.tech-workspace .environment-scene-grid {
  position: absolute;
  inset: 0;
  opacity: .52;
  background-image: linear-gradient(rgba(98, 214, 196, .12) 1px, transparent 1px), linear-gradient(90deg, rgba(98, 214, 196, .12) 1px, transparent 1px);
  background-size: 22px 22px;
  transform: perspective(220px) rotateX(52deg) scale(1.5) translateY(13px);
  transform-origin: center bottom;
}
body.tech-workspace .environment-scene-viewport[data-renderer] .environment-scene-grid { opacity: .14; }
body.tech-workspace .environment-scene-viewport::after { position: absolute; inset: 0; z-index: 2; content: ""; background: linear-gradient(180deg, rgba(18, 33, 33, .04), rgba(12, 27, 29, .28)); pointer-events: none; }
body.tech-workspace .environment-scene-azimuth { position: absolute; z-index: 5; top: 7px; right: 8px; display: grid; width: 39px; height: 39px; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; color: #73928c; font: 8px/1 ui-monospace, SFMono-Regular, Consolas, monospace; text-align: center; }
body.tech-workspace .environment-scene-azimuth span { align-self: center; }
body.tech-workspace .environment-scene-azimuth span:first-child { color: var(--tech-amber); }
body.tech-workspace .environment-scene-azimuth svg { position: absolute; inset: 10px; width: 19px; height: 19px; color: var(--tech-cyan); stroke-width: 1.3; }
body.tech-workspace .environment-scene-placeholder { position: absolute; z-index: 6; inset: 65px 0 auto; display: flex; align-items: center; justify-content: center; gap: 5px; color: #7fa19a; font-size: 10px; }
body.tech-workspace .environment-scene-placeholder svg { width: 14px; height: 14px; color: #5ab8aa; stroke-width: 1.6; }
body.tech-workspace .environment-scene-placeholder strong { color: #b1d2ca; font-weight: 600; }
body.tech-workspace .environment-scene-placeholder span { color: #6f8c87; }
body.tech-workspace .environment-scene-placeholder[hidden] { display: none; }
body.tech-workspace .environment-scene-signal { position: absolute; z-index: 6; display: inline-flex; align-items: center; gap: 3px; padding: 4px 5px; color: #b3d1ca; background: rgba(20, 47, 45, .82); border: 1px solid #3c756b; border-radius: 3px; font: 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
body.tech-workspace .environment-scene-signal svg { width: 12px; height: 12px; color: var(--tech-cyan); }
body.tech-workspace .environment-scene-signal strong { color: var(--tech-cyan); font-weight: 700; }
body.tech-workspace .environment-scene-signal-mountain { left: 10px; bottom: 9px; }
body.tech-workspace .environment-scene-signal-water { left: 73px; bottom: 9px; border-color: #3d6880; }
body.tech-workspace .environment-scene-signal-water svg { color: #7ac0e5; }
body.tech-workspace .environment-scene-signal-water strong { color: #7ac0e5; }
body.tech-workspace .environment-scene-signal-sha { left: 136px; bottom: 9px; border-color: #814b45; }
body.tech-workspace .environment-scene-signal-sha svg,
body.tech-workspace .environment-scene-signal-sha strong { color: var(--tech-coral); }

body.tech-workspace .environment-scene-canvas {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}
body.tech-workspace .environment-scene-canvas:active { cursor: grabbing; }
body.tech-workspace .environment-scene-shell[data-preview-mode="plan"] .environment-scene-canvas { cursor: default; }
body.tech-workspace .environment-scene-label-layer { position: absolute; z-index: 5; inset: 0; overflow: hidden; pointer-events: none; }
body.tech-workspace .environment-scene-label {
  position: absolute;
  top: 0;
  left: 0;
  max-width: 112px;
  overflow: hidden;
  padding: 3px 5px;
  color: #d9eee8;
  background: rgba(13, 32, 32, .84);
  border: 1px solid #3b6963;
  border-radius: 3px;
  font: 8px/1.2 "Segoe UI", "Microsoft YaHei", sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
  translate: -50% -115%;
}
body.tech-workspace .environment-scene-label-water { color: #c9ecff; border-color: #386a82; }
body.tech-workspace .environment-scene-label-sha { color: #ffd5ce; border-color: #874f47; }

body.tech-workspace .environment-scene-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.tech-workspace .environment-scene-viewport:focus-visible {
  outline: 2px solid var(--tech-amber);
  outline-offset: 2px;
}

body.tech-workspace .environment-scene-controls { display: grid; gap: 5px; margin: 9px 10px 8px; }
body.tech-workspace .environment-scene-control-row { gap: 7px; min-width: 0; }
body.tech-workspace .environment-scene-control-row label { flex: 0 0 66px; gap: 4px; color: #87a29c; font-size: 9px; white-space: nowrap; }
body.tech-workspace .environment-scene-control-row label svg { width: 12px; height: 12px; color: var(--tech-amber); stroke-width: 1.7; }
body.tech-workspace .environment-scene-control-row input[type="range"] { min-width: 0; flex: 1 1 auto; height: 3px; accent-color: var(--tech-cyan); cursor: pointer; }
body.tech-workspace .environment-scene-control-row output { flex: 0 0 72px; color: #a8c3bc; font: 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; text-align: right; white-space: nowrap; }
body.tech-workspace .environment-scene-speed-row output { flex-basis: 37px; }
body.tech-workspace .environment-scene-play { width: 25px; height: 25px; flex: 0 0 25px; color: var(--tech-cyan); }

body.tech-workspace .environment-scene-telemetry { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 7px 10px; color: #7d9892; background: #172627; border-top: 1px solid #2b4140; font: 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
body.tech-workspace .environment-scene-telemetry span { display: inline-flex; align-items: baseline; gap: 4px; }
body.tech-workspace .environment-scene-telemetry small { color: #6f8984; font-size: 8px; }
body.tech-workspace .environment-scene-telemetry strong { color: var(--tech-cyan); font-size: 10px; font-weight: 600; }
body.tech-workspace .environment-scene-telemetry-note { gap: 4px; margin-left: auto; white-space: nowrap; }
body.tech-workspace .environment-scene-telemetry-note svg { width: 11px; height: 11px; color: var(--tech-cyan); }

body.tech-workspace .environment-scene-shell.is-collapsed { width: min(238px, calc(100% - 36px)); }
body.tech-workspace .environment-scene-shell.is-collapsed .environment-scene-modes,
body.tech-workspace .environment-scene-shell.is-collapsed .environment-scene-viewport,
body.tech-workspace .environment-scene-shell.is-collapsed .environment-scene-controls,
body.tech-workspace .environment-scene-shell.is-collapsed .environment-scene-telemetry { display: none; }

@media (max-width: 900px) {
  body.tech-workspace .environment-scene-shell { left: 12px; width: min(292px, calc(100% - 24px)); }
  body.tech-workspace .environment-scene-viewport { height: 132px; }
}

@media (max-width: 720px) {
  body.tech-workspace .environment-scene-shell { position: fixed; top: auto; right: 8px; bottom: 205px; left: 8px; width: auto; max-height: 228px; overflow: auto; border-radius: 7px 7px 4px 4px; scrollbar-width: thin; }
  body.tech-workspace .environment-scene-shell.is-collapsed { width: auto; }
  body.tech-workspace .environment-scene-handle { display: block; width: 34px; height: 3px; margin: 5px auto 0; background: #58746f; border-radius: 3px; }
  body.tech-workspace .environment-scene-head { padding-top: 7px; }
  body.tech-workspace .environment-scene-viewport { height: 98px; }
  body.tech-workspace .environment-scene-placeholder { inset: 38px 0 auto; }
  body.tech-workspace .environment-scene-signal-mountain { bottom: 6px; }
  body.tech-workspace .environment-scene-signal-water,
  body.tech-workspace .environment-scene-signal-sha { bottom: 6px; }
  body.tech-workspace .environment-scene-controls { margin-top: 7px; }
  body.tech-workspace .environment-scene-telemetry { padding-bottom: 8px; }
}

@media (max-width: 390px) {
  body.tech-workspace .environment-scene-title > div { align-items: flex-start; flex-direction: column; gap: 2px; }
  body.tech-workspace .environment-scene-status { display: none; }
  body.tech-workspace .environment-scene-control-row label { flex-basis: 59px; }
  body.tech-workspace .environment-scene-control-row output { flex-basis: 66px; }
}

@media (prefers-reduced-motion: reduce) {
  body.tech-workspace .environment-scene-grid { transform: none; }
}
