:root {
  --glass-bg: rgba(252, 250, 246, 0.78);
  --glass-border: rgba(34, 32, 28, 0.11);
  --glass-shadow: 0 10px 30px rgba(24, 21, 16, 0.12);
  --ink: #22201c;
  --ink-muted: #656056;
  --accent: #556b56;
  --accent-dark: #3d4f3e;
  --radius-pill: 999px;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #e9e4db;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

#canvas-wrap {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}
#scene:active {
  cursor: grabbing;
}
body.walk-mode #scene {
  cursor: crosshair;
}

/* Top Left Badge */
.brand-badge {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  box-shadow: var(--glass-shadow);
}
.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d84c6f;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(216, 76, 111, 0.18);
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.brand-text strong {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.brand-text span {
  font-size: 11px;
  color: var(--ink-muted);
}

/* Top Center: 3 Style Buttons */
.style-bar {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  box-shadow: var(--glass-shadow);
}

.style-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, transform 0.15s ease, box-shadow 0.25s ease;
  white-space: nowrap;
}
.style-btn:hover {
  background: rgba(34, 32, 28, 0.06);
}
.style-btn.active {
  background: #23211d;
  color: #fbf9f5;
  box-shadow: 0 4px 12px rgba(24, 21, 16, 0.22);
}
.style-btn:active {
  transform: scale(0.97);
}

.swatch {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.14);
  flex-shrink: 0;
}
.sw-scandi { background: linear-gradient(135deg, #dcc6a4 50%, #99ae95 50%); }
.sw-luxury { background: linear-gradient(135deg, #3c2b21 50%, #c8a258 50%); }
.sw-family { background: linear-gradient(135deg, #e7c17a 50%, #e0825a 50%); }

/* Top Right Controls */
.top-right-controls {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 25;
  display: flex;
  gap: 8px;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  box-shadow: var(--glass-shadow);
  cursor: pointer;
  transition: all 0.22s ease;
}
.pill-btn:hover {
  background: rgba(255, 255, 255, 0.94);
}
.pill-btn.active {
  background: #23211d;
  color: #fdfbf7;
  border-color: transparent;
}

/* Big 2-Second Style Name Banner */
.style-banner {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1), transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.style-banner.visible {
  opacity: 1;
  transform: scale(1);
}
.style-banner-inner {
  text-align: center;
  padding: 28px 54px;
  border-radius: 24px;
  background: rgba(20, 18, 15, 0.56);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  color: #ffffff;
}
.style-banner-kicker {
  font-size: 11px;
  letter-spacing: 0.34em;
  font-weight: 600;
  opacity: 0.78;
  margin-bottom: 8px;
}
.style-banner-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 6vw, 68px);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.05;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}
.style-banner-sub {
  margin-top: 10px;
  font-size: 14px;
  letter-spacing: 0.08em;
  opacity: 0.9;
  font-weight: 500;
}

/* Intro Chip */
.intro-chip {
  position: fixed;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 22;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: rgba(28, 25, 21, 0.72);
  color: #f8f5ef;
  font-size: 12px;
  font-weight: 500;
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.intro-chip.visible {
  opacity: 1;
}
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a5c99f;
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.45); opacity: 0.45; }
}

/* Walk HUD */
.walk-hud {
  position: fixed;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 24;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: rgba(25, 23, 20, 0.78);
  color: #f9f6f0;
  font-size: 12px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  white-space: nowrap;
}
.walk-hud kbd {
  display: inline-block;
  padding: 1px 6px;
  margin: 0 1px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
}

.crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  z-index: 15;
}

/* Room Caption Bar (Bottom, above dock) */
.room-caption {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  min-width: 290px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 20px;
  border-radius: 16px;
  background: rgba(24, 22, 19, 0.8);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fbf9f5;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.room-caption-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
}
.room-caption-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.room-caption-meta {
  font-size: 12px;
  color: rgba(251, 249, 245, 0.75);
  margin-top: 2px;
}
.tour-timer {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 600;
  color: #c8dfc2;
  white-space: nowrap;
}
.tour-progress-wrap {
  margin-top: 9px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}
.tour-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, #9ec097, #e7c88a);
  transition: width 0.08s linear;
}

/* Bottom Control Dock */
.control-dock {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  box-shadow: var(--glass-shadow);
}

.dock-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 15px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.dock-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.dock-btn:hover {
  background: rgba(34, 32, 28, 0.07);
}
.dock-btn.active {
  background: #23211d;
  color: #fbf9f5;
  box-shadow: 0 4px 12px rgba(24, 21, 16, 0.22);
}
.dock-btn.dock-accent.active {
  background: var(--accent);
  color: #ffffff;
}
.dock-sep {
  width: 1px;
  height: 22px;
  background: rgba(34, 32, 28, 0.14);
  margin: 0 2px;
}

/* Loader */
.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ede7dc;
  transition: opacity 0.45s ease;
}
.loader.done {
  opacity: 0;
  pointer-events: none;
}
.loader-card {
  text-align: center;
  padding: 28px 36px;
  border-radius: 20px;
  background: rgba(255, 253, 249, 0.9);
  border: 1px solid rgba(34, 32, 28, 0.1);
  box-shadow: 0 18px 44px rgba(34, 32, 28, 0.12);
}
.loader-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(85, 107, 86, 0.2);
  border-top-color: #556b56;
  margin: 0 auto 14px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-title {
  font-weight: 700;
  font-size: 16px;
}
.loader-sub {
  font-size: 12.5px;
  color: var(--ink-muted);
  margin-top: 4px;
}

.hidden {
  display: none !important;
}

/* Responsive adjustments */
@media (max-width: 920px) {
  .brand-badge { display: none; }
  .style-bar { top: 12px; max-width: calc(100vw - 16px); }
  .style-btn { padding: 7px 10px; font-size: 12px; gap: 6px; }
  .top-right-controls { top: 60px; right: 12px; }
  .pill-btn { padding: 7px 11px; font-size: 12px; }
  .walk-hud { top: 104px; font-size: 11px; white-space: normal; text-align: center; max-width: calc(100vw - 24px); }
  .intro-chip { top: 104px; font-size: 11px; }
  .control-dock { max-width: calc(100vw - 16px); gap: 3px; padding: 5px; overflow-x: auto; }
  .dock-btn { padding: 7px 10px; font-size: 11.5px; gap: 5px; }
  .dock-btn svg { width: 14px; height: 14px; }
  .room-caption { bottom: 74px; padding: 10px 14px; min-width: 240px; }
  .room-caption-name { font-size: 15px; }
}
