:root {
  /* --- Design Tokens --- */
  --c-bg-dark: #0b0d10;
  --c-surface: rgba(15, 17, 21, 0.85);
  --c-surface-hover: rgba(25, 27, 32, 0.95);
  --c-text-main: #e6e6e6;
  --c-text-muted: #9ca3af;
  --c-accent: #c5a880; /* Sandstone / Muted Gold */
  
  --f-family: 'Roboto', 'Inter', -apple-system, sans-serif;
  
  --border-thin: 1px solid rgba(255, 255, 255, 0.08);
  --border-active: 1px solid var(--c-accent);
  
  --shadow-soft: 0 10px 30px rgba(0,0,0,0.5);
  --blur-strength: 12px;
  
  --radius-sm: 4px;
  --radius-md: 8px;
  
  /* Cursors (from previous setup, updated colors) */
  --canvas-opacity: 1;
  /* Updated Dot: White core with Gold tint */
  --cursor-dot: url('data:image/svg+xml;utf8,<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><defs><radialGradient id="grad"><stop offset="0%" stop-color="%23c5a880"/><stop offset="100%" stop-color="%23c5a880" stop-opacity="0"/></radialGradient></defs><circle cx="8" cy="8" r="5" fill="url(%23grad)"/></svg>') 8 8, auto;
  /* Updated Drag: Technical Circle */
  --cursor-drag: url('data:image/svg+xml;utf8,<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><circle cx="16" cy="16" r="10" fill="none" stroke="%23666" stroke-width="1.5"/><circle cx="16" cy="16" r="2" fill="%23888"/></svg>') 16 16, auto;
  --cursor-active: url('data:image/svg+xml;utf8,<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><circle cx="16" cy="16" r="8" fill="none" stroke="white" stroke-width="2"/><circle cx="16" cy="16" r="3" fill="white"/></svg>') 16 16, auto;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
}

body {
  overflow: hidden;
  font-family: var(--f-family);
  background-color: var(--c-bg-dark);
  color: var(--c-text-main);
  -webkit-font-smoothing: antialiased;
  cursor: default;
}

canvas {
  opacity: var(--canvas-opacity);
  cursor: var(--cursor-drag);
  transition: opacity 1s ease;
  pointer-events: auto !important;
}

pc-app {
  pointer-events: none;
}

canvas:active {
  cursor: var(--cursor-active);
}

/* --- Typography Utilities --- */
h1, h2, h3 {
  font-weight: 300;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

a {
  color: var(--c-accent);
  text-decoration: none;
  transition: opacity 0.3s;
  cursor: var(--cursor-dot) !important;
}

a:hover {
  opacity: 0.8;
}

button {
  font-family: inherit;
  cursor: var(--cursor-dot) !important;
}

.hidden {
  display: none !important;
}

/* --- Layout Containers --- */

/* Global Scrollbar Customization */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--c-accent);
  border-radius: 10px;
  opacity: 0.5;
}

::-webkit-scrollbar-thumb:hover {
  background: #e5c8a0; /* Brighter version of accent */
}

/* Firefox support */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--c-accent) transparent;
}

/* 1. Viewer Root & Overlays */
#viewer-root {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none; /* Let clicks pass to canvas */
}

#vignette-dark {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(circle at center, transparent 0%, rgba(0,0,0,0.3) 60%, rgba(0,0,0,0.8) 100%);
}

#vignette-blur {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  mask-image: radial-gradient(circle at center, transparent 30%, black 100%);
  -webkit-mask-image: radial-gradient(circle at center, transparent 30%, black 100%);
}

/* UI Layer Root - Full screen but transparent to clicks */
#ui, #annotations, #startScreen, #orientationWarning {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

#startScreen { z-index: 100; }
#orientationWarning { z-index: 9999; }

/* Enable clicks for interactive elements and their contents */
.switcher-button, 
.hotspot-list-item, 
#hotspot-list,
.annotation-panel,
.annotation-panel *,
.pc-annotation-hotspot,
#startButton,
#branding a,
#branding img,
#initialInfoPanel,
#initialInfoPanel *,
#settingsPanel,
#infoPanelContent,
#infoPanelContent *,
#orientationWarning {
  pointer-events: auto;
}

/* 2. Main Title (Top Left) */
#viewer-title {
  position: fixed;
  top: 3vh;
  left: 3vw;
  z-index: 20;
  pointer-events: none;
}

.viewer-title-main {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--c-text-main);
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
  border-left: 3px solid var(--c-accent);
  padding-left: 15px;
  line-height: 1;
}

.viewer-title-sub {
  font-size: 0.8rem;
  color: var(--c-text-muted);
  margin-top: 6px;
  margin-left: 18px; /* Align with text start */
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* 3. Branding & Logos (Bottom Left) */
#branding {
  position: fixed;
  left: 3vw;
  bottom: 2vh; /* Aligned with right logo */
  z-index: 20;
  display: flex;
  align-items: center;
  pointer-events: none;
}

.branding-content {
  display: flex;
  align-items: center;
  gap: 0.8vw;
}

#branding img {
  height: 3.2vh; /* Slightly larger */
  width: auto;
  border-radius: 0.5vh; /* Match right logo */
  filter: grayscale(100%) opacity(0.6);
  transition: all 0.4s ease;
}

#branding img:hover {
  filter: grayscale(0%) opacity(1);
}

/* 4. Model Switcher (Bottom Center) */
#modelSwitcher {
  position: fixed;
  bottom: 7vh;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0; /* Connected tabs */
  z-index: 30;
  background: var(--c-surface);
  backdrop-filter: blur(var(--blur-strength));
  border: var(--border-thin);
  border-radius: 50px; /* Pill shape */
  padding: 4px;
}

.switcher-button {
  background: transparent;
  color: var(--c-text-muted);
  border: none;
  padding: 10px 24px;
  border-radius: 40px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  min-width: 120px;
  text-align: center;
}

.switcher-button:hover {
  color: var(--c-text-main);
  background: rgba(255,255,255,0.05);
}

a.switcher-button {
    text-decoration: none;
}

.switcher-button.active {
  background: var(--c-accent);
  color: #000; /* Contrast on gold */
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(197, 168, 128, 0.3);
}

/* 5. Hotspot List (Left Sidebar) */
#hotspot-list {
  position: fixed;
  top: 50%;
  left: 3vw;
  transform: translateY(-50%);
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 60vh;
  overflow-y: auto;
  cursor: var(--cursor-drag); /* Custom cursor consistency */
  
  /* Scrollbar on the left side */
  direction: rtl;
  padding-left: 10px;
  padding-right: 0;
  
  /* Smooth Fade */
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease, transform 0.5s ease;
  
  /* Container visual */
  border-left: 1px solid rgba(255,255,255,0.05);
}

.hotspot-list-item {
  direction: ltr; /* Reset text direction to left-to-right */
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px 15px;
  cursor: var(--cursor-dot) !important;
  color: var(--c-text-muted);
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
  margin-left: -1px; /* Align with container border */
}

.hotspot-list-item:hover {
  color: var(--c-text-main);
  background: linear-gradient(90deg, rgba(255,255,255,0.03), transparent);
  border-left-color: rgba(255,255,255,0.3);
}

.hotspot-list-item.active {
  color: var(--c-accent);
  border-left-color: var(--c-accent);
  background: linear-gradient(90deg, rgba(197, 168, 128, 0.1), transparent);
}

.hotspot-list-icon {
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.5;
  width: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.hotspot-list-label {
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  font-weight: 300;
  text-transform: uppercase;
}

/* 6. Info Panel (Right) */
#annotation-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 27vw;
  height: 100vh;
  z-index: 25;
  cursor: var(--cursor-drag); /* Custom cursor consistency */

  background: var(--c-surface);
  backdrop-filter: blur(var(--blur-strength));
  border-left: var(--border-thin);
  
  transform: translateX(100%);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); /* Elegant easing */
  
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 40px rgba(0,0,0,0.5);
}

#annotation-panel.visible {
  transform: translateX(0);
}

.annotation-panel-content {
  padding: 30px;
  overflow-y: auto;
  height: 100%;
}

.annotation-panel-title {
  font-family: var(--f-family);
  font-size: 1.4rem;
  color: var(--c-accent);
  margin-bottom: 20px;
  padding-left: 15px;
  border-left: 3px solid var(--c-accent);
  line-height: 1.3;
}

.annotation-panel-body {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #ccc;
  font-weight: 300;
}

.annotation-image {
  width: 100%;
  border-radius: var(--radius-sm);
  margin-bottom: 15px;
  border: 1px solid rgba(255,255,255,0.1);
  filter: sepia(20%) contrast(1.1); /* Historical vibe */
}

.annotation-panel-branding, .annotation-image-caption {
  font-size: 0.7rem;
  color: var(--c-text-muted);
  font-style: italic;
  margin-bottom: 20px;
  border-left: 2px solid #444;
  padding-left: 10px;
}

/* 7. Start Screen (Overlay) */
#startScreen {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, transparent 0%, rgba(0,0,0,0.5) 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 100;
  transition: opacity 0.8s ease;
  pointer-events: auto; /* Block everything behind */
  cursor: var(--cursor-drag);
}

#startButton {
  pointer-events: auto; /* Re-enable for the button */
  background: rgba(15, 17, 21, 0.6);
  backdrop-filter: blur(10px);
  color: var(--c-text-main);
  padding: 15px 40px;
  border: 1px solid var(--c-accent);
  border-radius: 2px;
  font-size: 1rem;
  font-weight: 300;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: var(--cursor-dot) !important;
  transition: all 0.4s ease;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

#startButton:hover {
  background: var(--c-accent);
  color: #000;
  box-shadow: 0 0 30px rgba(197, 168, 128, 0.4);
  transform: scale(1.05);
}

/* Prominent Glow for Start Button */
@keyframes pulse-glow-prominent {
  0% { border-color: var(--c-text-muted); color: var(--c-text-main); box-shadow: 0 0 5px rgba(197, 168, 128, 0.1); }
  50% { border-color: var(--c-accent); color: var(--c-accent); box-shadow: 0 0 25px rgba(197, 168, 128, 0.6); }
  100% { border-color: var(--c-text-muted); color: var(--c-text-main); box-shadow: 0 0 5px rgba(197, 168, 128, 0.1); }
}

/* Border-only pulsing for Hotspot List */
@keyframes pulse-border-only {
  0% { border-left-color: rgba(255, 255, 255, 0.05); }
  50% { border-left-color: var(--c-accent); }
  100% { border-left-color: rgba(255, 255, 255, 0.05); }
}

#startButton {
  animation: pulse-glow-prominent 2.5s ease-in-out infinite;
}

.pulse-attention {
  animation: pulse-border-only 2.5s ease-in-out infinite;
  border-left: 2px solid var(--c-accent); /* Base width */
}

/* 8. Initial Info Panel (Floating) */
#initialInfoPanel {
  position: fixed;
  top: 50%;
  right: 2vw;
  transform: translateY(-50%);
  width: 500px;
  max-height: 85vh;
  cursor: var(--cursor-drag); /* Custom cursor consistency */
  
  background: var(--c-surface);
  backdrop-filter: blur(var(--blur-strength));
  border: var(--border-thin);
  border-radius: var(--radius-md);
  
  padding: 40px;
  z-index: 110; /* Above start screen */
  box-shadow: var(--shadow-soft);
  
  opacity: 1;
  transition: opacity 0.5s ease;
  overflow-y: auto;
}

.initial-info-panel-title {
  font-family: var(--f-family);
  font-size: 1.4rem;
  color: var(--c-accent);
  text-align: left;
  margin-bottom: 20px;
  padding-left: 15px;
  border-left: 3px solid var(--c-accent);
  line-height: 1.3;
}

.initial-info-panel-image {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin-bottom: 15px;
  border: 1px solid rgba(255,255,255,0.1);
  filter: sepia(20%) contrast(1.1);
}

.initial-info-panel-text {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #ccc;
  font-weight: 300;
  margin-bottom: 30px;
}

/* Camera Controls Guide */
.camera-controls-guide {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 20px;
}

.controls-title {
  font-size: 0.8rem;
  color: var(--c-accent);
  margin-bottom: 15px;
  letter-spacing: 0.1em;
}

.control-item {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 12px;
}

.control-icon-wrap {
  width: 24px;
  height: 24px;
  color: var(--c-text-muted);
  flex-shrink: 0;
}

.control-text {
  display: flex;
  flex-direction: column;
}

.control-text .action {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--c-text-main);
}

.control-text .detail {
  font-size: 0.75rem;
  color: var(--c-text-muted);
}

/* 9. Orientation Warning */
#orientationWarning {
  display: none;
  position: fixed;
  background-color: #000;
  z-index: 9999;
  color: var(--c-accent);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 40px;
}

.rotate-icon path {
  fill: var(--c-accent);
}

/* --- MOBILE OPTIMIZATION --- */
@media (max-width: 768px) {
  
  /* Titles */
  #viewer-title {
    top: 20px;
    left: 20px;
  }
  .viewer-title-main { font-size: 1.2rem; padding-left: 10px; border-width: 2px; }
  .viewer-title-sub { display: none; } /* Simplify */

  /* Bottom Controls (Model Switcher) */
  #modelSwitcher {
    bottom: 20px;
    width: 90%;
    border-radius: 12px;
  }
  .switcher-button {
    flex: 1;
    padding: 12px 0;
    font-size: 0.7rem;
  }

  /* Hotspot List (Top Horizontal Scroll or compact list) */
  #hotspot-list {
    top: auto;
    bottom: 100px; /* Above model switcher */
    left: 20px;
    right: auto;
    transform: none;
    max-height: 30vh;
    border-left: 2px solid var(--c-accent); /* Stronger indicator */
    background: linear-gradient(90deg, rgba(0,0,0,0.8), transparent);
    padding: 10px;
    border-radius: 0 8px 8px 0;
  }
  
  .hotspot-list-item {
    padding: 8px 10px;
    font-size: 0.8rem;
  }

  /* Info Panel (Bottom Sheet) */
  #annotation-panel {
    width: 100%;
    height: 65vh;
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    border-left: none;
    border-top: 1px solid var(--c-accent);
    transform: translateY(100%);
    border-radius: 20px 20px 0 0;
  }
  
  #annotation-panel.visible {
    transform: translateY(0);
  }

  /* Start Screen */
  #initialInfoPanel {
    width: 90%;
    right: 5%;
    left: 5%;
    top: 15%;
    transform: none;
    max-height: 60vh;
  }
  
  /* Orientation Warning */
  @media (orientation: portrait) {
    #ui, #hotspot-list, #annotation-panel, #viewer-title, #modelSwitcher, #branding, #initialInfoPanel, #startScreen {
      display: none !important;
    }
    #orientationWarning {
      display: flex;
    }

/* Hide utility */
#controlsWrap { display: none; } /* Hide old controls permanently */
  }
}
