:root {
  --bg-obsidian: #120f0d;
  --bg-walnut-deep: #181411;
  --bg-walnut-panel: rgba(26, 21, 18, 0.92);
  --bg-walnut-elevated: #251e19;
  --bg-walnut-hover: #312821;
  --bg-walnut-active: #3a2f26;

  --border-hairline: rgba(218, 196, 168, 0.14);
  --border-strong: rgba(218, 196, 168, 0.28);
  --border-gold: #d4a72c;

  --text-alabaster: #f5efe6;
  --text-warm-sand: #c9bca9;
  --text-warm-muted: #9e907e;

  --accent-gold: #d4a72c;
  --accent-gold-bright: #e8be48;
  --accent-gold-surface: rgba(212, 167, 44, 0.16);
  --accent-jade: #4ca982;
  --accent-amber: #d9823b;
  --accent-crimson: #d9534f;

  --font-sans: 'Anuphan', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Chakra Petch', 'Anuphan', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --shadow-soft: 0 12px 32px rgba(8, 6, 4, 0.55), 0 2px 8px rgba(8, 6, 4, 0.35);
  --shadow-float: 0 8px 24px rgba(8, 6, 4, 0.48);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

::selection {
  background: var(--accent-gold);
  color: var(--bg-obsidian);
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-obsidian);
  color: var(--text-alabaster);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  caret-color: var(--accent-gold);
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-obsidian);
}

::-webkit-scrollbar-thumb {
  background: #463a30;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-gold);
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent-gold-bright);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.hidden {
  display: none !important;
}

/* Main Application Grid Shell */
.app-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: 320px 1fr;
  grid-template-rows: 62px 1fr 122px;
  grid-template-areas:
    "header header"
    "sidebar stage"
    "sidebar dock";
  background: var(--bg-obsidian);
}

/* 1. Top Command & Visibility Telemetry Bar */
.top-command-bar {
  grid-area: header;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px;
  background: var(--bg-walnut-deep);
  border-bottom: 1px solid var(--border-hairline);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-emblem {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: var(--bg-walnut-elevated);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-gold-bright);
}

.brand-emblem svg {
  width: 20px;
  height: 20px;
}

.brand-titles h1 {
  font-family: var(--font-display);
  font-size: 1.0rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-alabaster);
  white-space: nowrap;
}

.brand-titles p {
  font-size: 0.72rem;
  color: var(--text-warm-sand);
  white-space: nowrap;
}

/* Visibility Layer Toggles */
.visibility-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-obsidian);
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid var(--border-hairline);
  overflow-x: auto;
  min-width: 0;
}

.bar-group-title {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-warm-sand);
  padding: 0 4px;
  white-space: nowrap;
}

.layer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-warm-sand);
  background: var(--bg-walnut-elevated);
  border: 1px solid transparent;
  transition: background-color 160ms var(--ease-out-expo), border-color 160ms var(--ease-out-expo), color 160ms var(--ease-out-expo);
  white-space: nowrap;
}

.layer-toggle svg {
  width: 14px;
  height: 14px;
}

.layer-toggle:hover {
  background: var(--bg-walnut-hover);
  color: var(--text-alabaster);
}

.layer-toggle.active {
  background: var(--accent-gold-surface);
  color: var(--text-alabaster);
  border-color: var(--border-gold);
}

.layer-toggle.active svg {
  color: var(--accent-gold-bright);
}

.layer-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(18, 15, 13, 0.65);
  color: var(--accent-gold-bright);
}

/* Split-Flap Inspired Live Telemetry Counter */
.telemetry-readout {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.readout-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 2px 8px;
  background: var(--bg-obsidian);
  border: 1px solid var(--border-hairline);
  border-radius: 6px;
}

.readout-label {
  font-size: 0.66rem;
  color: var(--text-warm-sand);
}

.readout-value {
  font-family: var(--font-mono);
  font-size: 0.98rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: var(--text-alabaster);
}

.readout-value.highlight {
  color: var(--accent-gold-bright);
}

.header-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--bg-walnut-elevated);
  color: var(--text-alabaster);
  border: 1px solid var(--border-strong);
  transition: background-color 160ms var(--ease-out-expo), transform 160ms var(--ease-out-expo);
  white-space: nowrap;
}

.header-action-btn:hover {
  background: var(--bg-walnut-hover);
}

.header-action-btn.primary {
  background: var(--accent-gold);
  color: var(--bg-obsidian);
  border-color: var(--accent-gold-bright);
}

.header-action-btn.primary:hover {
  background: var(--accent-gold-bright);
}

/* 2. Left Sidebar: Preset Layouts & Screen Slides */
.left-panel {
  grid-area: sidebar;
  z-index: 20;
  background: var(--bg-walnut-deep);
  border-right: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
  padding: 10px 12px;
  gap: 8px;
}

.panel-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 2px;
  flex-shrink: 0;
}

.section-head h2,
.screen-config-section h2 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-alabaster);
}

.screen-config-section {
  flex: 0 0 auto;
  padding-top: 8px;
  border-top: 1px solid var(--border-hairline);
}

.screen-config-section h2 {
  margin-bottom: 6px;
}

.text-btn {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--accent-gold-bright);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-btn:hover {
  color: var(--text-alabaster);
}

.section-desc {
  font-size: 0.73rem;
  color: var(--text-warm-sand);
  margin-bottom: 8px;
  flex-shrink: 0;
}

.section-desc code {
  font-family: var(--font-mono);
  font-size: 0.71rem;
  color: var(--accent-gold-bright);
  background: rgba(212, 167, 44, 0.12);
  padding: 1px 4px;
  border-radius: 3px;
}

.preset-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  min-height: 0;
  flex: 1 1 auto;
  padding-right: 3px;
}

.preset-card {
  width: 100%;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  padding: 6px 7px;
  border-radius: 7px;
  background: var(--bg-walnut-elevated);
  border: 1px solid var(--border-hairline);
  text-align: left;
  min-width: 0;
  max-width: 100%;
  flex-shrink: 0;
  transition: background-color 160ms var(--ease-out-expo), border-color 160ms var(--ease-out-expo);
}

.preset-card:hover {
  background: var(--bg-walnut-hover);
  border-color: var(--border-strong);
}

.preset-card.active {
  background: var(--bg-walnut-active);
  border-color: var(--border-gold);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.preset-card img {
  width: 64px;
  height: 50px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid var(--border-hairline);
  background: var(--bg-obsidian);
}

.preset-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.preset-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
}

.preset-title-row strong {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-alabaster);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-tag {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-warm-sand);
  flex-shrink: 0;
}

.preset-tag.default-tag {
  background: var(--accent-gold);
  color: var(--bg-obsidian);
  font-weight: 700;
}

.preset-meta p {
  font-size: 0.7rem;
  line-height: 1.3;
  color: var(--text-warm-sand);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.preset-cap {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent-gold-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-presets-box {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-hairline);
  flex-shrink: 0;
}

.custom-presets-box h3 {
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-warm-sand);
}

.custom-preset-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.custom-preset-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-walnut-elevated);
  border: 1px solid var(--border-hairline);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 0.74rem;
}

.screen-slide-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.slide-chip {
  padding: 5px 6px;
  border-radius: 6px;
  font-size: 0.71rem;
  font-weight: 500;
  background: var(--bg-walnut-elevated);
  color: var(--text-warm-sand);
  border: 1px solid var(--border-hairline);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color 150ms var(--ease-out-expo), border-color 150ms var(--ease-out-expo);
}

.slide-chip:hover {
  background: var(--bg-walnut-hover);
  color: var(--text-alabaster);
}

.slide-chip.active {
  background: var(--accent-gold-surface);
  color: var(--text-alabaster);
  border-color: var(--border-gold);
}

/* 3. Center 3D Viewport Stage */
.viewport-stage {
  grid-area: stage;
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #14110f;
}

#sceneCanvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
  outline: none;
}

/* Zone Split Telemetry Pill */
.zone-hud-pill {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border-radius: 8px;
  background: var(--bg-walnut-panel);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-float);
  font-size: 0.78rem;
}

.zone-stat {
  display: flex;
  align-items: center;
  gap: 6px;
}

.zone-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.zone-m1 {
  background: var(--accent-gold-bright);
}

.zone-m2 {
  background: var(--accent-jade);
}

.zone-name {
  color: var(--text-warm-sand);
  font-weight: 500;
}

.zone-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
  color: var(--text-alabaster);
}

.zone-unit {
  color: var(--text-warm-sand);
  font-size: 0.72rem;
}

.zone-divider {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(212, 167, 44, 0.16);
  color: var(--accent-gold-bright);
  border: 1px solid rgba(212, 167, 44, 0.35);
}

/* Camera Mode Bar */
.camera-bar {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border-radius: 8px;
  background: var(--bg-walnut-panel);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-float);
}

.cam-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-warm-sand);
  transition: background-color 150ms var(--ease-out-expo), color 150ms var(--ease-out-expo);
}

.cam-btn svg {
  width: 15px;
  height: 15px;
}

.cam-btn:hover {
  background: var(--bg-walnut-hover);
  color: var(--text-alabaster);
}

.cam-btn.active {
  background: var(--accent-gold);
  color: var(--bg-obsidian);
  font-weight: 600;
}

/* Floating Object Selection Inspector */
.selection-inspector {
  position: absolute;
  bottom: 44px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  min-width: 580px;
  max-width: 94%;
  background: var(--bg-walnut-panel);
  border: 1px solid var(--border-gold);
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-hairline);
}

.inspector-title-group {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.inspector-title-group strong {
  font-size: 0.88rem;
  color: var(--accent-gold-bright);
}

.inspector-coords {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-warm-sand);
}

.icon-close-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-warm-sand);
  background: var(--bg-walnut-elevated);
}

.icon-close-btn:hover {
  color: var(--text-alabaster);
  background: var(--bg-walnut-hover);
}

.inspector-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.control-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cluster-label {
  font-size: 0.74rem;
  color: var(--text-warm-sand);
  margin-right: 2px;
}

#sliderRotation {
  width: 90px;
  accent-color: var(--accent-gold);
}

.ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 500;
  background: var(--bg-walnut-elevated);
  color: var(--text-alabaster);
  border: 1px solid var(--border-hairline);
}

.ctrl-btn svg {
  width: 14px;
  height: 14px;
}

.ctrl-btn:hover {
  background: var(--bg-walnut-hover);
  border-color: var(--border-strong);
}

.ctrl-btn.action-ungroup {
  border-color: var(--accent-gold);
  color: var(--accent-gold-bright);
}

.ctrl-btn.danger {
  color: #ffb8b5;
  border-color: rgba(217, 83, 79, 0.4);
}

.ctrl-btn.danger:hover {
  background: rgba(217, 83, 79, 0.22);
}

.swatch-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
}

.swatch-btn[data-color="black"] {
  background: #171615;
}

.swatch-btn[data-color="gold"] {
  background: #d4a72c;
}

.swatch-btn[data-color="white"] {
  background: #ebe5dc;
}

.swatch-btn[data-color="wood"] {
  background: #8b5a2b;
}

.swatch-btn.active {
  border-color: var(--accent-gold-bright);
  transform: scale(1.12);
}

/* Status Strip at Bottom of 3D Canvas */
.canvas-status-strip {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: rgba(18, 15, 13, 0.84);
  border-top: 1px solid var(--border-hairline);
  font-size: 0.75rem;
  color: var(--text-warm-sand);
}

.snap-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.snap-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.snap-toggle input {
  accent-color: var(--accent-gold);
}

.mini-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--bg-walnut-elevated);
  border: 1px solid var(--border-hairline);
  color: var(--text-alabaster);
  font-size: 0.73rem;
}

.mini-tool-btn svg {
  width: 13px;
  height: 13px;
}

.mini-tool-btn:hover:not(:disabled) {
  background: var(--bg-walnut-hover);
}

/* 4. Bottom Dock: Free Drag-and-Drop Furniture Palette */
.furniture-dock {
  grid-area: dock;
  z-index: 20;
  background: var(--bg-walnut-deep);
  border-top: 1px solid var(--border-hairline);
  padding: 8px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.dock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.dock-header h2 {
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-alabaster);
}

.dock-quick-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dock-util-btn {
  padding: 3px 10px;
  border-radius: 5px;
  font-size: 0.74rem;
  font-weight: 500;
  background: var(--bg-walnut-elevated);
  color: var(--text-warm-sand);
  border: 1px solid var(--border-hairline);
}

.dock-util-btn:hover {
  background: var(--bg-walnut-hover);
  color: var(--text-alabaster);
}

.dock-util-btn.danger-subtle:hover {
  color: #ffb8b5;
  border-color: rgba(217, 83, 79, 0.45);
}

.dock-items-scroll {
  display: flex;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  min-width: 0;
  max-width: 100%;
}

.spawn-card {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 11px;
  border-radius: 8px;
  background: var(--bg-walnut-elevated);
  border: 1px solid var(--border-hairline);
  text-align: left;
  transition: transform 150ms var(--ease-out-expo), border-color 150ms var(--ease-out-expo), background-color 150ms var(--ease-out-expo);
}

.spawn-card:hover {
  background: var(--bg-walnut-hover);
  border-color: var(--border-gold);
  transform: translateY(-2px);
}

.spawn-card.featured {
  border-color: rgba(212, 167, 44, 0.45);
  background: rgba(212, 167, 44, 0.1);
}

.spawn-icon {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--bg-obsidian);
  border: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-gold-bright);
}

.spawn-icon svg {
  width: 24px;
  height: 24px;
}

.spawn-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.spawn-info strong {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-alabaster);
  white-space: nowrap;
}

.spawn-info span {
  font-size: 0.69rem;
  color: var(--text-warm-sand);
  white-space: nowrap;
}

/* 5. Reference Photo & Blueprint Drawer */
.reference-drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(10, 8, 6, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.drawer-panel {
  width: min(1140px, 96vw);
  max-height: 90vh;
  background: var(--bg-walnut-deep);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-hairline);
}

.drawer-header h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--text-alabaster);
}

.drawer-header p {
  font-size: 0.8rem;
  color: var(--text-warm-sand);
}

.drawer-body {
  padding: 18px 20px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 18px;
}

.gallery-featured {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-obsidian);
  border: 1px solid var(--border-hairline);
  border-radius: 10px;
  padding: 12px;
}

.gallery-featured img {
  width: 100%;
  height: 410px;
  object-fit: contain;
  border-radius: 6px;
  background: #0b0908;
}

.gallery-featured-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.gallery-featured-bar strong {
  font-size: 0.92rem;
  color: var(--accent-gold-bright);
}

.gallery-featured-bar p {
  font-size: 0.78rem;
  color: var(--text-warm-sand);
  margin-top: 2px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  align-content: start;
  max-height: 490px;
  overflow-y: auto;
  padding-right: 4px;
}

.gallery-thumb {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  border-radius: 8px;
  background: var(--bg-walnut-elevated);
  border: 1px solid var(--border-hairline);
  text-align: left;
}

.gallery-thumb:hover {
  border-color: var(--border-strong);
}

.gallery-thumb.active {
  border-color: var(--border-gold);
  background: var(--bg-walnut-active);
}

.gallery-thumb img {
  width: 100%;
  height: 96px;
  object-fit: cover;
  border-radius: 5px;
}

.gallery-thumb span {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-alabaster);
}

/* Responsive Adaptation for Tablets & Mobile Viewports */
@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 270px minmax(0, 1fr);
  }
  .brand-titles p {
    display: none;
  }
  .selection-inspector {
    min-width: 92%;
  }
}

@media (max-width: 780px) {
  html,
  body {
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
    width: 100%;
    max-width: 100%;
  }

  .app-shell {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
  }

  .top-command-bar {
    order: 1;
    width: 100%;
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 6px;
  }

  .brand-block {
    gap: 7px;
  }

  .brand-emblem {
    width: 28px;
    height: 28px;
  }

  .brand-titles h1 {
    font-size: 0.85rem;
  }

  .brand-titles p {
    display: none;
  }

  .telemetry-readout {
    gap: 4px;
    margin-left: auto;
  }

  .readout-cell {
    padding: 2px 5px;
  }

  .readout-label {
    font-size: 0.6rem;
  }

  .readout-value {
    font-size: 0.82rem;
  }

  .header-action-btn {
    padding: 4px 6px;
    font-size: 0.68rem;
  }

  #btnExportSnapshot {
    display: none;
  }

  .visibility-bar {
    order: 3;
    width: 100%;
    max-width: 100%;
    padding: 3px 5px;
  }

  .viewport-stage {
    order: 2;
    width: 100%;
    height: 46vh;
    min-height: 320px;
    flex-shrink: 0;
  }

  .zone-hud-pill {
    top: 6px;
    left: 6px;
    right: 6px;
    padding: 4px 8px;
    font-size: 0.68rem;
    gap: 4px;
    justify-content: space-between;
  }

  .zone-name {
    display: none;
  }

  .camera-bar {
    top: 38px;
    left: 6px;
    right: 6px;
    padding: 3px;
    overflow-x: auto;
  }

  .cam-btn {
    flex-shrink: 0;
    padding: 4px 7px;
    font-size: 0.68rem;
  }

  .cam-btn span {
    white-space: nowrap;
  }

  .canvas-status-strip {
    padding: 4px 8px;
    font-size: 0.68rem;
  }

  .interaction-hint {
    display: none;
  }

  .snap-controls {
    width: 100%;
    justify-content: space-between;
    gap: 4px;
  }

  .mini-tool-btn {
    padding: 3px 6px;
    font-size: 0.66rem;
  }

  .furniture-dock {
    order: 3;
    width: 100%;
    padding: 8px 10px;
  }

  .dock-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  .dock-header h2 {
    font-size: 0.76rem;
    white-space: normal;
  }

  .left-panel {
    order: 4;
    width: 100%;
    border-right: none;
    border-top: 1px solid var(--border-hairline);
    max-height: none;
    overflow: visible;
    padding: 10px;
  }

  .preset-list {
    overflow: visible;
  }

  .drawer-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .gallery-featured img {
    height: 220px;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: 100%;
    max-width: 390px;
  }
}
