:root {
  --gold: #e0b973;
  --gold-soft: rgba(224, 185, 115, 0.25);
  --gold-border: rgba(224, 185, 115, 0.36);
  --obsidian: rgba(11, 14, 21, 0.72);
  --obsidian-deep: rgba(9, 12, 18, 0.88);
  --text: #f3efe6;
  --text-muted: rgba(243, 239, 230, 0.72);
  --font-display: 'Cinzel', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html,
body,
#app {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #070b12;
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

#scene-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: default;
}

body.explore-active #scene-canvas {
  cursor: grab;
}

body.explore-active #scene-canvas:active {
  cursor: grabbing;
}

#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0) 56%,
    rgba(5, 8, 14, 0.36) 86%,
    rgba(4, 6, 11, 0.62) 100%
  );
  z-index: 2;
}

.hidden {
  display: none !important;
}

/* Top Bar */
#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 28px;
  pointer-events: none;
}

.brand {
  pointer-events: auto;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.65);
}

.brand-kicker {
  display: block;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 4px;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text);
  line-height: 1.1;
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: var(--obsidian);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.pill-btn:hover {
  background: rgba(24, 29, 41, 0.88);
  border-color: var(--gold-border);
}

.pill-btn:active {
  transform: scale(0.98);
}

.pill-btn.small {
  padding: 7px 13px;
  font-size: 12px;
}

.pill-primary {
  border-color: var(--gold-border);
  background: rgba(24, 20, 14, 0.78);
  color: #f9e8c3;
}

.pill-primary:hover {
  background: rgba(46, 36, 20, 0.9);
  border-color: var(--gold);
}

.sound-icon {
  color: var(--gold);
  font-size: 13px;
}

/* Tour Mode HUD */
#tour-hud {
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 28px 32px 26px;
}

.chapter-badge {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 18px;
  border-radius: 999px;
  background: var(--obsidian);
  border: 1px solid rgba(224, 185, 115, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: opacity 0.5s ease;
}

.chapter-numeral {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.12em;
}

.chapter-title {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
}

.caption-container {
  max-width: 720px;
  margin: 0 auto 22px;
  text-align: center;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.caption-container.visible {
  opacity: 1;
  transform: translateY(0);
}

.caption-text {
  font-family: var(--font-serif);
  font-size: clamp(20px, 2.2vw, 27px);
  font-weight: 500;
  line-height: 1.38;
  color: #fbf7ee;
  padding: 10px 22px;
  border-radius: 10px;
  background: rgba(8, 11, 17, 0.54);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
  letter-spacing: 0.01em;
}

.tour-progress-wrap {
  width: min(560px, 90vw);
  margin: 0 auto;
  padding: 8px 16px 6px;
  border-radius: 12px;
  background: rgba(8, 11, 17, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.tour-progress-track {
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
  margin-bottom: 8px;
}

.tour-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #c99746, #f4d694);
  border-radius: 999px;
}

.tour-time-row {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.75);
}

/* Explore Mode HUD */
#explore-hud {
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
}

#hotspot-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.hotspot-pin {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px 5px 7px;
  border-radius: 999px;
  border: 1px solid rgba(224, 185, 115, 0.55);
  background: rgba(10, 13, 20, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  transition: opacity 0.25s ease, border-color 0.2s ease, background 0.2s ease;
}

.hotspot-pin:hover,
.hotspot-pin.active {
  border-color: var(--gold);
  background: rgba(34, 27, 16, 0.92);
}

.hotspot-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(224, 185, 115, 0.28);
  flex-shrink: 0;
}

.explore-toolbar {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  z-index: 18;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--obsidian);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

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

.seg-btn.active {
  background: rgba(224, 185, 115, 0.22);
  color: #fae7be;
}

/* Landmark Strip */
.landmark-strip {
  position: fixed;
  bottom: 44px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 40px);
  pointer-events: auto;
  z-index: 17;
}

.landmark-pills {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px;
  border-radius: 999px;
  background: var(--obsidian);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow-x: auto;
  scrollbar-width: none;
}

.landmark-pills::-webkit-scrollbar {
  display: none;
}

.landmark-pill {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.landmark-pill:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.landmark-pill.active {
  color: #fce9c4;
  background: rgba(224, 185, 115, 0.2);
  border-color: var(--gold-border);
}

/* Architectural Info Drawer */
.info-drawer {
  position: fixed;
  right: 26px;
  top: 86px;
  width: min(370px, calc(100vw - 40px));
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  padding: 22px 22px 18px;
  border-radius: 16px;
  background: var(--obsidian-deep);
  border: 1px solid var(--gold-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
  z-index: 22;
  user-select: text;
}

.drawer-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.drawer-close:hover {
  color: var(--text);
  border-color: var(--gold-border);
}

.drawer-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.drawer-elevation {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--gold);
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(224, 185, 115, 0.14);
  border: 1px solid rgba(224, 185, 115, 0.3);
}

.drawer-category {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.drawer-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.25;
  color: #fbf5e8;
  margin-bottom: 12px;
  padding-right: 22px;
}

.drawer-body {
  font-size: 13.5px;
  line-height: 1.62;
  color: rgba(243, 239, 230, 0.88);
  margin-bottom: 14px;
}

.uncertainty-box {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(224, 185, 115, 0.08);
  border: 1px solid rgba(224, 185, 115, 0.24);
  margin-bottom: 14px;
}

.uncertainty-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold);
  margin-bottom: 6px;
}

.uncertainty-text {
  font-size: 12.5px;
  line-height: 1.55;
  color: rgba(248, 238, 218, 0.86);
}

.drawer-nav {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.explore-footnote {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: rgba(243, 239, 230, 0.68);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
  pointer-events: auto;
  white-space: nowrap;
}

.link-btn {
  background: none;
  border: none;
  color: var(--gold);
  font-family: inherit;
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-btn:hover {
  color: #f9dfb0;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(5, 7, 12, 0.72);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-card {
  position: relative;
  width: min(580px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  padding: 28px;
  border-radius: 18px;
  background: #0d111a;
  border: 1px solid var(--gold-border);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  user-select: text;
}

.modal-p {
  font-size: 14px;
  line-height: 1.65;
  color: rgba(243, 239, 230, 0.88);
  margin-bottom: 12px;
}

.uncertainty-list {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.8px;
  line-height: 1.52;
  color: rgba(248, 238, 218, 0.88);
}

@media (max-width: 820px) {
  #top-bar {
    padding: 14px 16px;
  }

  .explore-toolbar {
    top: 72px;
    flex-wrap: wrap;
    justify-content: center;
    width: calc(100vw - 24px);
  }

  .chapter-badge {
    top: 70px;
  }

  .info-drawer {
    top: auto;
    bottom: 100px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: 44vh;
  }

  .explore-footnote {
    font-size: 10.5px;
    max-width: calc(100vw - 20px);
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
