:root {
  --ink: #080705;
  --panel: rgba(10, 9, 7, 0.68);
  --panel-strong: rgba(13, 11, 8, 0.84);
  --line: rgba(229, 190, 109, 0.28);
  --gold: #d9a84f;
  --gold-bright: #f0c66d;
  --sand: #d7c6a4;
  --stone: #8f8778;
  --lapis: #1e6d81;
  --white: #fff8ec;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -ms-text-size-adjust: none;
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  -ms-content-zooming: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

html,
body {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  overflow: hidden;
  font-family: Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  background: var(--ink);
  color: var(--white);
}

button,
a {
  font: inherit;
}

button {
  border: 0;
}

a,
a:hover,
a:active,
a:visited {
  color: inherit;
  text-decoration: none;
}

#pano {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

#pano::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.56) 0%, rgba(0, 0, 0, 0.08) 24%, rgba(0, 0, 0, 0.12) 66%, rgba(0, 0, 0, 0.58) 100%),
    radial-gradient(circle at 50% 35%, rgba(30, 109, 129, 0.08), transparent 48%);
}

.tour-titlebar {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  left: 50%;
  width: min(680px, calc(100% - 36px));
  transform: translateX(-50%);
  z-index: 20;
  pointer-events: none;
  text-align: center;
}

.title-copy {
  display: grid;
  gap: 4px;
  padding: 13px 22px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(12, 11, 9, 0.76), rgba(12, 11, 9, 0.52));
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.tour-kicker,
.title-copy p {
  margin: 0;
  color: var(--sand);
  font-size: 0.78rem;
  line-height: 1.35;
}

.tour-kicker {
  color: var(--gold-bright);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.title-copy h1 {
  margin: 0;
  color: var(--white);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.65rem, 2.6vw, 2.7rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.38);
}

.icon-button,
.control-button {
  color: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(14px);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.no-touch .icon-button:hover,
.no-touch .control-button:hover {
  border-color: rgba(240, 198, 109, 0.72);
  background: rgba(32, 27, 19, 0.82);
  transform: translateY(-1px);
}

.icon-button:focus-visible,
.control-button:focus-visible,
.scene:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

.scene-toggle {
  position: absolute;
  top: max(22px, env(safe-area-inset-top));
  left: max(18px, env(safe-area-inset-left));
  z-index: 35;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
}

.icon-menu,
.icon-menu::before,
.icon-menu::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--gold-bright);
}

.icon-menu {
  position: relative;
}

.icon-menu::before,
.icon-menu::after {
  content: "";
  position: absolute;
  left: 0;
}

.icon-menu::before {
  top: -6px;
}

.icon-menu::after {
  top: 6px;
}

#sceneList {
  position: absolute;
  top: calc(max(22px, env(safe-area-inset-top)) + 58px);
  left: max(18px, env(safe-area-inset-left));
  z-index: 30;
  width: min(315px, calc(100% - 36px));
  max-height: calc(100% - 164px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  transform: translateX(calc(-100% - 28px));
  opacity: 0;
  transition: transform 260ms ease, opacity 220ms ease;
}

#sceneList.enabled {
  transform: translateX(0);
  opacity: 1;
}

.panel-heading {
  display: grid;
  gap: 5px;
  padding: 16px 18px 13px;
  border-bottom: 1px solid rgba(229, 190, 109, 0.2);
}

.panel-heading span {
  color: var(--gold-bright);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.panel-heading strong {
  color: var(--sand);
  font-size: 0.92rem;
  font-weight: 500;
}

#sceneList .scenes {
  display: grid;
  gap: 4px;
  max-height: calc(100vh - 260px);
  padding: 10px;
  overflow: auto;
}

#sceneList li {
  display: block;
}

#sceneList .scene {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 50px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--sand);
  background: rgba(255, 255, 255, 0.03);
}

.scene-number {
  color: var(--gold-bright);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

#sceneList .scene .text {
  overflow: hidden;
  color: var(--white);
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.no-touch #sceneList .scene:hover,
#sceneList .scene.current {
  border-color: rgba(240, 198, 109, 0.5);
  background: linear-gradient(90deg, rgba(217, 168, 79, 0.2), rgba(30, 109, 129, 0.12));
}

body.single-scene #sceneList,
body.single-scene #sceneListToggle {
  display: none;
}

.scene-info {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 76px);
  z-index: 20;
  width: min(420px, calc(100% - 36px));
  padding: 14px 17px;
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.scene-info .sceneName {
  display: block;
  color: var(--white);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.32rem;
  font-weight: 700;
  line-height: 1.1;
}

.scene-info .sceneDescription {
  margin: 5px 0 0;
  color: var(--sand);
  font-size: 0.88rem;
  line-height: 1.4;
}

.control-dock {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 25;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
  width: min(620px, calc(100% - 36px));
}

.control-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  color: var(--white);
  font-size: 0.84rem;
  font-weight: 750;
  line-height: 1;
}

.control-button > span[aria-hidden="true"] {
  color: var(--gold-bright);
  font-size: 1.32rem;
  line-height: 0.7;
}

.icon-control .icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.icon-control .icon.on,
#fullscreenToggle.enabled .icon.off,
#autorotateToggle.enabled .icon.off {
  display: none;
}

#fullscreenToggle.enabled .icon.on,
#autorotateToggle.enabled .icon.on {
  display: block;
}

body.fullscreen-disabled #fullscreenToggle {
  display: none;
}

.vr-control {
  cursor: help;
}

.vr-control.unavailable {
  color: rgba(255, 248, 236, 0.54);
  border-color: rgba(229, 190, 109, 0.16);
  background: rgba(10, 9, 7, 0.46);
}

.vr-control.unavailable > span[aria-hidden="true"] {
  color: rgba(240, 198, 109, 0.48);
  font-size: 0.83rem;
  font-weight: 900;
}

.instruction-overlay {
  position: absolute;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 18;
  width: min(460px, calc(100% - 36px));
  transform: translateX(-50%);
  padding: 11px 15px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: rgba(255, 248, 236, 0.86);
  background: rgba(8, 7, 5, 0.48);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(14px);
  font-size: 0.82rem;
  line-height: 1.35;
  text-align: center;
  pointer-events: none;
}

.loading-indicator {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  gap: 14px;
  align-content: center;
  color: var(--white);
  background: rgba(5, 4, 3, 0.56);
  opacity: 0;
  visibility: hidden;
  transition: opacity 220ms ease, visibility 0s 220ms;
  pointer-events: none;
}

.loading-indicator.visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 220ms ease;
}

.loader-ring {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(240, 198, 109, 0.22);
  border-top-color: var(--gold-bright);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.link-hotspot {
  width: 58px;
  height: 58px;
  margin-left: -29px;
  margin-top: -29px;
  opacity: 0.94;
  transition: opacity 180ms ease, transform 180ms ease;
}

.no-touch .link-hotspot:hover {
  opacity: 1;
  transform: scale(1.05);
}

.mobile .link-hotspot {
  width: 66px;
  height: 66px;
  margin-left: -33px;
  margin-top: -33px;
}

.link-hotspot-icon {
  width: 100%;
  height: 100%;
  cursor: pointer;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.42));
}

.link-hotspot-tooltip {
  position: absolute;
  left: 100%;
  top: 13px;
  max-width: 270px;
  margin-left: 7px;
  padding: 8px 10px;
  overflow: hidden;
  color: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  font-size: 0.86rem;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-8px);
  transition: transform 220ms ease, opacity 220ms ease;
}

.no-touch .link-hotspot:hover .link-hotspot-tooltip {
  opacity: 1;
  pointer-events: all;
  transform: translateX(0);
}

.tooltip-fallback .link-hotspot-tooltip {
  display: none;
}

.no-touch .tooltip-fallback .link-hotspot:hover .link-hotspot-tooltip {
  display: block;
}

.info-hotspot {
  line-height: 1.2;
  opacity: 0.95;
  transition: opacity 180ms ease;
}

.no-touch .info-hotspot:hover,
.info-hotspot.visible {
  opacity: 1;
}

.info-hotspot .info-hotspot-header {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel-strong);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
  cursor: pointer;
  transition: width 260ms ease, border-radius 260ms ease;
}

.mobile .info-hotspot .info-hotspot-header {
  width: 50px;
  height: 50px;
}

.desktop.no-touch .info-hotspot .info-hotspot-header:hover,
.desktop .info-hotspot.visible .info-hotspot-header {
  width: 260px;
  border-radius: 8px 8px 0 0;
}

.info-hotspot .info-hotspot-icon-wrapper {
  width: 40px;
  height: 40px;
}

.mobile .info-hotspot .info-hotspot-icon-wrapper {
  width: 50px;
  height: 50px;
}

.info-hotspot .info-hotspot-icon {
  width: 86%;
  height: 86%;
  margin: 7%;
}

.info-hotspot .info-hotspot-title-wrapper {
  position: absolute;
  left: 42px;
  top: 0;
  width: 0;
  height: 42px;
  padding: 0;
  overflow: hidden;
  transition: width 0s 220ms, padding 0s 220ms;
}

.desktop .info-hotspot.visible .info-hotspot-title-wrapper,
.desktop.no-touch .info-hotspot .info-hotspot-header:hover .info-hotspot-title-wrapper {
  width: 218px;
  padding: 0 10px 0 4px;
  transition: width 0s 180ms, padding 0s 180ms;
}

.info-hotspot .info-hotspot-title-wrapper::before,
.info-hotspot-modal .info-hotspot-title-wrapper::before {
  content: "";
  display: inline-block;
  height: 100%;
  vertical-align: middle;
}

.info-hotspot .info-hotspot-title,
.info-hotspot-modal .info-hotspot-title {
  display: inline-block;
  color: var(--white);
  vertical-align: middle;
  -moz-user-select: text;
  -webkit-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

.info-hotspot .info-hotspot-close-wrapper {
  position: absolute;
  left: 260px;
  top: 0;
  width: 40px;
  height: 42px;
  border-radius: 0 8px 0 0;
  background: rgba(217, 168, 79, 0.18);
  visibility: hidden;
  transform: perspective(200px) rotateY(90deg);
  transform-origin: 0 50% 0;
  transition: transform 220ms ease, visibility 0s 220ms;
}

.desktop .info-hotspot.visible .info-hotspot-close-wrapper {
  visibility: visible;
  transform: perspective(200px) rotateY(0deg);
  transition: transform 220ms ease;
}

.info-hotspot .info-hotspot-close-icon {
  width: 70%;
  height: 70%;
  margin: 15%;
}

.info-hotspot .info-hotspot-text {
  position: absolute;
  top: 42px;
  left: 0;
  width: 300px;
  max-height: 200px;
  padding: 12px;
  overflow-y: auto;
  color: var(--sand);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 8px 8px 8px;
  background: var(--panel-strong);
  visibility: hidden;
  transform: perspective(200px) rotateX(-89.999deg);
  transform-origin: 50% 0 0;
  transition: transform 220ms ease, visibility 0s 220ms;
  -moz-user-select: text;
  -webkit-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

.desktop .info-hotspot.visible .info-hotspot-text {
  visibility: visible;
  transform: perspective(200px) rotateX(0deg);
  transition: transform 220ms ease 160ms;
}

.desktop .info-hotspot-modal {
  display: none;
}

.info-hotspot-modal {
  position: absolute;
  inset: 0;
  z-index: 11000 !important;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.58);
  line-height: 1.2;
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease, visibility 0s 180ms;
}

.info-hotspot-modal.visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 180ms ease;
}

.info-hotspot-modal .info-hotspot-header {
  position: absolute;
  top: 72px;
  left: 14px;
  right: 14px;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background: var(--panel-strong);
  opacity: 0;
  transition: opacity 240ms ease 140ms;
}

.info-hotspot-modal.visible .info-hotspot-header {
  opacity: 1;
}

.info-hotspot-modal .info-hotspot-icon-wrapper {
  width: 52px;
  height: 52px;
}

.info-hotspot-modal .info-hotspot-icon {
  width: 86%;
  height: 86%;
  margin: 7%;
}

.info-hotspot-modal .info-hotspot-title-wrapper {
  position: absolute;
  top: 0;
  left: 52px;
  right: 52px;
  height: 52px;
  padding: 0 10px;
}

.info-hotspot-modal .info-hotspot-close-wrapper {
  position: absolute;
  top: 0;
  right: 0;
  width: 52px;
  height: 52px;
  background: rgba(217, 168, 79, 0.18);
  cursor: pointer;
}

.info-hotspot-modal .info-hotspot-close-icon {
  width: 70%;
  height: 70%;
  margin: 15%;
}

.info-hotspot-modal .info-hotspot-text {
  position: absolute;
  top: 124px;
  right: 14px;
  bottom: 14px;
  left: 14px;
  padding: 14px;
  overflow-y: auto;
  color: var(--sand);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: var(--panel-strong);
  opacity: 0;
  transition: opacity 240ms ease;
  -moz-user-select: text;
  -webkit-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

.info-hotspot-modal.visible .info-hotspot-text {
  opacity: 1;
  transition: opacity 240ms ease 220ms;
}

.viewControlButton {
  display: none;
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 40px;
  height: 40px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

body.view-control-buttons .viewControlButton {
  display: block;
}

@media (max-width: 760px) {
  .tour-titlebar {
    top: max(12px, env(safe-area-inset-top));
    width: min(100% - 92px, 480px);
  }

  .title-copy {
    padding: 11px 14px 12px;
    text-align: left;
  }

  .tour-kicker {
    display: none;
  }

  .title-copy h1 {
    font-size: 1.25rem;
  }

  .title-copy p {
    font-size: 0.73rem;
  }

  .scene-toggle {
    top: max(12px, env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    width: 42px;
    height: 42px;
  }

  #sceneList {
    top: calc(max(12px, env(safe-area-inset-top)) + 54px);
    left: max(12px, env(safe-area-inset-left));
    width: min(330px, calc(100% - 24px));
    max-height: min(54vh, 420px);
  }

  #sceneList .scenes {
    max-height: calc(54vh - 66px);
  }

  .scene-info {
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: calc(max(12px, env(safe-area-inset-bottom)) + 98px);
    width: auto;
    padding: 12px 14px;
  }

  .scene-info .sceneName {
    font-size: 1.08rem;
  }

  .scene-info .sceneDescription {
    font-size: 0.78rem;
  }

  .control-dock {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
    width: auto;
    justify-content: center;
    gap: 7px;
  }

  .control-button {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 42px;
    padding: 0 10px;
    font-size: 0.75rem;
  }

  .icon-control .icon {
    width: 16px;
    height: 16px;
  }

  .instruction-overlay {
    display: none;
  }
}

@media (max-width: 520px) {
  .control-button span:not([aria-hidden="true"]) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .control-button {
    flex: 0 0 44px;
    width: 44px;
    padding: 0;
  }

  .control-button > span[aria-hidden="true"] {
    font-size: 1.34rem;
  }

  .vr-control > span[aria-hidden="true"] {
    font-size: 0.82rem;
  }

  .scene-info {
    bottom: calc(max(12px, env(safe-area-inset-bottom)) + 66px);
  }
}

@media (max-width: 600px) {
  body.view-control-buttons .viewControlButton {
    display: none;
  }
}

.viewControlButton .icon {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 30px;
  height: 30px;
}

.viewControlButton-1 {
  margin-left: -145px;
}

.viewControlButton-2 {
  margin-left: -95px;
}

.viewControlButton-3 {
  margin-left: -45px;
}

.viewControlButton-4 {
  margin-left: 5px;
}

.viewControlButton-5 {
  margin-left: 55px;
}

.viewControlButton-6 {
  margin-left: 105px;
}

/* Minimal UI override */
#titleBar,
.tour-titlebar,
#sceneList,
.tour-panel,
#sceneInfo,
.scene-info,
#instructionOverlay,
.instruction-overlay,
#previousScene,
#nextScene,
#sceneListToggle,
.scene-toggle {
  display: none !important;
}

#controlDock,
.control-dock {
  position: fixed !important;
  right: max(16px, env(safe-area-inset-right)) !important;
  bottom: max(16px, env(safe-area-inset-bottom)) !important;
  left: auto !important;
  top: auto !important;
  width: auto !important;
  transform: none !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 10px !important;
  z-index: 9999 !important;
  background: transparent !important;
  pointer-events: auto !important;
}

#autorotateToggle,
#vrToggle,
#fullscreenToggle {
  display: inline-flex !important;
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 0 !important;
  min-height: 44px !important;
  padding: 0 14px !important;
  position: static !important;
}

#autorotateToggle {
  order: 1 !important;
}

#vrToggle {
  order: 2 !important;
}

#fullscreenToggle {
  order: 3 !important;
}

#autorotateToggle span:not([aria-hidden="true"]),
#vrToggle span:not([aria-hidden="true"]),
#fullscreenToggle span:not([aria-hidden="true"]) {
  position: static !important;
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: nowrap !important;
}

#vrToggle > span[aria-hidden="true"] {
  display: none !important;
}
