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

html, body, #root {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background: #0d1422;
  color: #f4f1ea;
  user-select: none;
}

.viewport-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}

.canvas-host {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.canvas-host:active {
  cursor: grabbing;
}

.glass {
  background: rgba(16, 22, 34, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(231, 193, 122, 0.25);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.38);
}

/* Top Bar */
.top-bar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 14px;
  z-index: 20;
  pointer-events: auto;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #f3d28e;
}

.brand-sub {
  font-size: 11px;
  color: #cbd5e1;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.btn {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #f4f1ea;
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
}

.btn:hover {
  background: rgba(231, 193, 122, 0.22);
  border-color: rgba(231, 193, 122, 0.6);
}

.btn.active {
  background: linear-gradient(135deg, #d4a656, #b78534);
  color: #131720;
  border-color: #f3d28e;
}

/* Left Explorer Panel */
.side-panel {
  position: absolute;
  top: 98px;
  left: 14px;
  width: 278px;
  max-height: calc(100% - 210px);
  overflow-y: auto;
  border-radius: 14px;
  padding: 12px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.side-panel.collapsed {
  width: auto;
  padding: 8px 12px;
}

.section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #e7c17a;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.floor-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.floor-btn {
  text-align: left;
  padding: 7px 9px;
  border-radius: 8px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tag {
  font-size: 9px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
}

.floor-btn.active .tag {
  background: rgba(19, 23, 32, 0.22);
  color: #131720;
}

.apt-list, .room-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.apt-btn, .room-btn {
  text-align: left;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.room-dims {
  font-size: 10px;
  opacity: 0.78;
}

.notice-box {
  font-size: 11px;
  line-height: 1.38;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(231, 193, 122, 0.14);
  border: 1px solid rgba(231, 193, 122, 0.4);
  color: #f7e4bc;
}

/* Bottom Camera Dock (prevents door prompt from ever overlapping mode buttons) */
.bottom-dock {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 28px);
  z-index: 22;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.bottom-bar {
  width: 100%;
  border-radius: 14px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}

.mode-row, .preset-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.preset-row .btn {
  padding: 4px 9px;
  font-size: 11px;
}

/* Prompts & Walkthrough HUD */
.door-prompt {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
  white-space: nowrap;
}

.walk-hint {
  position: absolute;
  top: 98px;
  right: 14px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 11px;
  line-height: 1.45;
  z-index: 20;
  max-width: 230px;
}

/* Mobile / Touch Joystick + Look Pad */
.touch-joy {
  position: absolute;
  bottom: 104px;
  left: 20px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(16, 22, 34, 0.55);
  border: 2px solid rgba(231, 193, 122, 0.45);
  z-index: 25;
  touch-action: none;
}

.touch-knob {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #e7c17a;
  left: 33px;
  top: 33px;
  pointer-events: none;
}

.touch-look {
  position: absolute;
  bottom: 104px;
  right: 20px;
  width: 130px;
  height: 110px;
  border-radius: 14px;
  background: rgba(16, 22, 34, 0.5);
  border: 1px dashed rgba(231, 193, 122, 0.45);
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #f3d28e;
  touch-action: none;
}

/* Specs Modal */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 18, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 18px;
}

.modal-card {
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 16px;
  padding: 20px;
  line-height: 1.5;
  font-size: 13px;
}

.modal-card h2 {
  color: #f3d28e;
  font-size: 18px;
  margin-bottom: 10px;
}

.modal-card h3 {
  color: #e7c17a;
  font-size: 14px;
  margin: 12px 0 6px;
}

.modal-card ul {
  padding-left: 18px;
}

@media (max-width: 768px) {
  .side-panel {
    width: 230px;
    top: 76px;
    max-height: calc(100% - 210px);
  }
  .walk-hint {
    display: none;
  }
  .brand-title {
    font-size: 13px;
  }
}
