* {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  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: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  background-color: #000;
  color: #fff;
}

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

#pano {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Interface theme (provisional) */

:root {
  --ui-bg: rgba(16, 19, 24, 0.58);
  --ui-bg-hover: rgba(44, 49, 58, 0.72);
  --ui-bg-fallback: rgba(16, 19, 24, 0.86);
  --ui-border: rgba(255, 255, 255, 0.14);
  --ui-hover: rgba(255, 255, 255, 0.12);
  --ui-text: #fff;
  --ui-muted: rgba(255, 255, 255, 0.6);
  --ui-accent: #e8a33d;
  --ui-accent-soft: rgba(232, 163, 61, 0.18);
  --ui-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  --ui-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ui-edge: 16px;
  --ui-size: 44px;
  --ui-gap: 8px;
  --ui-logo: 72px;
}

body.mobile {
  --ui-edge: 12px;
  --ui-size: 48px;
  --ui-logo: 56px;
}

/* Top of the buttons and title, centered on the logo. Declared on body so it follows the mobile values */
body {
  --ui-top: calc(var(--ui-edge) + (var(--ui-logo) - var(--ui-size)) / 2);
}

/* Shared translucent surface for every interface element */
#titleBar .sceneName,
#autorotateToggle,
#fullscreenToggle,
#sceneListToggle,
#sceneList,
#viewControls {
  background-color: var(--ui-bg-fallback);
  border: 1px solid var(--ui-border);
  -webkit-box-shadow: var(--ui-shadow);
  box-shadow: var(--ui-shadow);
  color: var(--ui-text);
  font-family: var(--ui-font);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  #titleBar .sceneName,
  #autorotateToggle,
  #fullscreenToggle,
  #sceneListToggle,
  #sceneList,
  #viewControls {
    background-color: var(--ui-bg);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    backdrop-filter: blur(14px) saturate(140%);
  }
}

.no-touch #autorotateToggle:hover,
.no-touch #fullscreenToggle:hover,
.no-touch #sceneListToggle:hover {
  background-color: var(--ui-bg-hover);
}

#autorotateToggle:focus-visible,
#fullscreenToggle:focus-visible,
#sceneListToggle:focus-visible,
#sceneList .scene:focus-visible,
.viewControlButton:focus-visible {
  outline: 2px solid var(--ui-accent);
  outline-offset: 2px;
}

/* Logo: top left */

#logo {
  position: absolute;
  top: var(--ui-edge);
  left: var(--ui-edge);
  width: var(--ui-logo);
  height: var(--ui-logo);
}

#logo img {
  display: block;
  width: 100%;
  height: 100%;
  -webkit-filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}

/* Scene name: top center, leaving the same room on both sides */

#titleBar {
  position: absolute;
  top: var(--ui-top);
  left: calc(var(--ui-edge) + 2 * var(--ui-size) + 2 * var(--ui-gap));
  right: calc(var(--ui-edge) + 2 * var(--ui-size) + 2 * var(--ui-gap));
  text-align: center;
  pointer-events: none;
}

#titleBar .sceneName {
  display: inline-block;
  max-width: 100%;
  height: var(--ui-size);
  padding: 0 22px;
  border-radius: 999px;
  vertical-align: top;
  line-height: calc(var(--ui-size) - 2px);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: auto;

  -moz-user-select: text;
  -webkit-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* On mobile there is no room at the top: the scene name goes to the bottom, centered */
.mobile #titleBar {
  top: auto;
  bottom: var(--ui-edge);
  left: calc(var(--ui-edge) + var(--ui-size) + var(--ui-gap));
  right: calc(var(--ui-edge) + var(--ui-size) + var(--ui-gap));
}

.mobile #titleBar .sceneName {
  font-size: 14px;
}

/* Top right buttons: autorotate and fullscreen */

#autorotateToggle,
#fullscreenToggle {
  position: absolute;
  top: var(--ui-top);
  right: var(--ui-edge);
  width: var(--ui-size);
  height: var(--ui-size);
  border-radius: 50%;
  -webkit-transition: background-color 0.2s, border-color 0.2s;
  transition: background-color 0.2s, border-color 0.2s;
}

#autorotateToggle {
  display: block;
}

#fullscreenToggle {
  display: none;
}

body.fullscreen-enabled #fullscreenToggle {
  display: block;
}

/* If there is a fullscreen button, autorotate must placed a bit to the left */
body.fullscreen-enabled #autorotateToggle {
  right: calc(var(--ui-edge) + var(--ui-size) + var(--ui-gap));
}

#autorotateToggle .icon,
#fullscreenToggle .icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
}

#autorotateToggle.enabled {
  border-color: var(--ui-accent);
}

#autorotateToggle .icon.on,
#fullscreenToggle .icon.on,
#sceneListToggle .icon.on {
  display: none;
}

#autorotateToggle .icon.off,
#fullscreenToggle .icon.off,
#sceneListToggle .icon.off {
  display: block;
}

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

#autorotateToggle.enabled .icon.off,
#fullscreenToggle.enabled .icon.off,
#sceneListToggle.enabled .icon.off {
  display: none;
}

/* Scene list toggle: bottom left */

#sceneListToggle {
  position: absolute;
  left: var(--ui-edge);
  bottom: var(--ui-edge);
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--ui-size);
  padding: 0 18px 0 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  -webkit-transition: background-color 0.2s, border-color 0.2s;
  transition: background-color 0.2s, border-color 0.2s;
}

#sceneListToggle.enabled {
  border-color: var(--ui-accent);
}

#sceneListToggle .icon {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mobile #sceneListToggle {
  justify-content: center;
  width: var(--ui-size);
  padding: 0;
}

.mobile #sceneListToggle .text {
  display: none;
}

/* Scene list: panel that opens above the toggle */

#sceneList {
  position: absolute;
  left: var(--ui-edge);
  bottom: calc(var(--ui-edge) + var(--ui-size) + var(--ui-gap));
  width: 280px;
  max-height: calc(100% - 2 * var(--ui-edge) - var(--ui-logo) - var(--ui-size) - 2 * var(--ui-gap));
  padding: 6px;
  border-radius: 16px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
  opacity: 0;
  visibility: hidden;
  -webkit-transform: translateY(8px);
  transform: translateY(8px);
  -webkit-transition: opacity 0.25s ease, -webkit-transform 0.25s ease, visibility 0s 0.25s;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s 0.25s;
}

#sceneList.enabled {
  opacity: 1;
  visibility: visible;
  -webkit-transform: none;
  transform: none;
  -webkit-transition: opacity 0.25s ease, -webkit-transform 0.25s ease, visibility 0s 0s;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s 0s;
}

.mobile #sceneList {
  right: var(--ui-edge);
  width: auto;
  max-width: 420px;
}

#sceneList .scenes {
  counter-reset: scene;
}

#sceneList .scene {
  display: block;
  border-radius: 10px;
  -webkit-transition: background-color 0.15s;
  transition: background-color 0.15s;
}

#sceneList .scene .text {
  padding: 0 12px;
  line-height: 36px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile #sceneList .scene .text {
  line-height: 44px;
  font-size: 15px;
}

/* Scene number before each name */
#sceneList .scene .text::before {
  counter-increment: scene;
  content: counter(scene, decimal-leading-zero);
  display: inline-block;
  width: 30px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  color: var(--ui-muted);
}

.no-touch #sceneList .scene:hover {
  background-color: var(--ui-hover);
}

#sceneList .scene.current {
  background-color: var(--ui-accent-soft);
}

#sceneList .scene.current .text {
  color: var(--ui-text);
  font-weight: 600;
}

#sceneList .scene.current .text::before {
  color: var(--ui-accent);
}

/* Hide scene list when only a single scene exists */
body.single-scene #sceneList,
body.single-scene #sceneListToggle {
  display: none;
}

/* Link hotspot */

.link-hotspot {
  width: 60px;
  height: 60px;
  margin-left: -30px;
  margin-top: -30px;
  opacity: 0.9;
  -webkit-transition: opacity 0.2s;
  transition: opacity 0.2s;
}

.no-touch .link-hotspot:hover {
  opacity: 1;
}

.mobile .link-hotspot {
  width: 70px;
  height: 70px;
}

.link-hotspot-icon {
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.link-hotspot-tooltip {
  position: absolute;
  left: 100%;
  top: 14px;
  /* ( 60 - (16 + 2*8) ) / 2 */

  margin-left: 3px;

  font-size: 16px;

  max-width: 300px;

  padding: 8px 10px;

  border-radius: 5px;

  background-color: rgb(58, 68, 84);
  background-color: rgba(58, 68, 84, 0.8);

  color: #fff;

  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;

  cursor: pointer;

  opacity: 0;

  -ms-transform: translateX(-8px);
  -webkit-transform: translateX(-8px);
  transform: translateX(-8px);

  -webkit-transition: -ms-transform 0.3s,
    -webkit-transform 0.3s,
    transform 0.3s,
    opacity 0.3s;
  transition: -ms-transform 0.3s,
    -webkit-transform 0.3s,
    transform 0.3s,
    opacity 0.3s;
}

.mobile .link-hotspot {
  top: 19px;
  /* ( 70 - (16 + 2*8) ) / 2 */
}

.no-touch .link-hotspot:hover .link-hotspot-tooltip {
  opacity: 1;
  -ms-transform: translateX(0);
  -webkit-transform: translateX(0);
  transform: translateX(0);
}

/* Prevent tooltip from triggering */
.link-hotspot-tooltip {
  pointer-events: none;
}

.no-touch .link-hotspot:hover .link-hotspot-tooltip {
  pointer-events: all;
}

/* Fallback mode without pointer-events (IE8-10) */
.tooltip-fallback .link-hotspot-tooltip {
  display: none;
}

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

/* Info hotspot */

.info-hotspot {
  line-height: 1.2em;
  opacity: 0.9;
  -webkit-transition: opacity 0.2s 0.2s;
  transition: opacity 0.2s 0.2s;
}

.no-touch .info-hotspot:hover {
  opacity: 1;
  -webkit-transition: opacity 0.2s;
  transition: opacity 0.2s;
}

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

.info-hotspot .info-hotspot-header {
  width: 40px;
  height: 40px;
  border-radius: 20px;
  background-color: rgb(103, 115, 131);
  cursor: pointer;
  -webkit-transition: width 0.3s ease-in-out 0.5s,
    border-radius 0.3s ease-in-out 0.5s;
  transition: width 0.3s ease-in-out 0.5s,
    border-radius 0.3s ease-in-out 0.5s;
}

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

.desktop.no-touch .info-hotspot .info-hotspot-header:hover {
  width: 260px;
  border-radius: 5px;
  -webkit-transition: width 0.3s ease-in-out,
    border-radius 0.3s ease-in-out;
  transition: width 0.3s ease-in-out,
    border-radius 0.3s ease-in-out;
}

.desktop .info-hotspot.visible .info-hotspot-header,
.desktop.no-touch .info-hotspot.visible .info-hotspot-header:hover {
  width: 260px;
  border-radius: 5px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
  -webkit-transition: width 0.3s ease-in-out,
    border-radius 0.3s ease-in-out;
  transition: width 0.3s ease-in-out,
    border-radius 0.3s ease-in-out;
}

.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: 90%;
  height: 90%;
  margin: 5%;
}

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

.desktop .info-hotspot.visible .info-hotspot-title-wrapper,
.desktop.no-touch .info-hotspot .info-hotspot-header:hover .info-hotspot-title-wrapper {
  width: 220px;
  padding: 0 5px;
  -webkit-transition: width 0s 0.4s,
    padding 0s 0.4s;
  transition: width 0s 0.4s,
    padding 0s 0.4s;
}

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

.info-hotspot .info-hotspot-title {
  display: inline-block;
  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;
  height: 40px;
  width: 40px;
  border-top-right-radius: 5px;
  background-color: rgb(78, 88, 104);
  visibility: hidden;
  -ms-transform: perspective(200px) rotateY(90deg);
  -webkit-transform: perspective(200px) rotateY(90deg);
  transform: perspective(200px) rotateY(90deg);
  -ms-transform-origin: 0 50% 0;
  -webkit-transform-origin: 0 50% 0;
  transform-origin: 0 50% 0;
  -webkit-transition: -ms-transform 0.3s 0.3s,
    -webkit-transform 0.3s 0.3s,
    transform 0.3s 0.3s,
    visibility 0s 0.6s;
  transition: -ms-transform 0.3s 0.3s,
    -webkit-transform 0.3s 0.3s,
    transform 0.3s 0.3s,
    visibility 0s 0.6s;
}

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

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

.info-hotspot .info-hotspot-text {
  position: absolute;
  width: 300px;
  height: auto;
  max-height: 200px;
  top: 40px;
  left: 0;
  padding: 10px;
  background-color: rgb(58, 68, 84);
  border-bottom-right-radius: 5px;
  border-bottom-left-radius: 5px;
  overflow-y: auto;
  visibility: hidden;
  /* rotate(90deg) causes transition flicker on Firefox 58 */
  -ms-transform: perspective(200px) rotateX(-89.999deg);
  -webkit-transform: perspective(200px) rotateX(-89.999deg);
  transform: perspective(200px) rotateX(-89.999deg);
  -ms-transform-origin: 50% 0 0;
  -webkit-transform-origin: 50% 0 0;
  transform-origin: 50% 0 0;
  -webkit-transition: -ms-transform 0.3s,
    -webkit-transform 0.3s,
    transform 0.3s,
    visibility 0s 0.3s;
  transition: -ms-transform 0.3s,
    -webkit-transform 0.3s,
    transform 0.3s,
    visibility 0s 0.3s;

  -moz-user-select: text;
  -webkit-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

.desktop .info-hotspot.visible .info-hotspot-text {
  visibility: visible;
  -ms-transform: perspective(200px) rotateX(0deg);
  -webkit-transform: perspective(200px) rotateX(0deg);
  transform: perspective(200px) rotateX(0deg);
  -webkit-transition: -ms-transform 0.3s 0.3s,
    -webkit-transform 0.3s 0.3s,
    transform 0.3s 0.3s,
    visibility 0s 0s;
  transition: -ms-transform 0.3s 0.3s,
    -webkit-transform 0.3s 0.3s,
    transform 0.3s 0.3s,
    visibility 0s 0s;
}

/* Info hotspot modal */

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

.info-hotspot-modal {
  top: 0;
  left: 0;
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 11000 !important;
  background-color: rgba(0, 0, 0, .5);
  line-height: 1.2em;
  opacity: 0;
  visibility: hidden;
  -webkit-transition: opacity 0.2s ease-in-out 0.5s,
    visibility 0s 0.7s;
  transition: opacity 0.2s ease-in-out 0.5s,
    visibility 0s 0.7s;
}

.info-hotspot-modal.visible {
  opacity: 1;
  visibility: visible;
  -webkit-transition: opacity 0.2s ease-in-out,
    visibility 0s 0s;
  transition: opacity 0.2s ease-in-out,
    visibility 0s 0s;
}

.info-hotspot-modal .info-hotspot-header {
  position: absolute;
  top: 60px;
  left: 10px;
  right: 10px;
  width: auto;
  height: 50px;
  background-color: rgb(103, 115, 131);
  background-color: rgba(103, 115, 131, 0.8);
  opacity: 0;
  -webkit-transition: opacity 0.3s ease-in-out 0.2s;
  transition: opacity 0.3s ease-in-out 0.2s;
}

.info-hotspot-modal.visible .info-hotspot-header {
  opacity: 1;
  -webkit-transition: opacity 0.3s ease-in-out 0.2s;
  transition: opacity 0.3s ease-in-out 0.2s;
}

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

.info-hotspot-modal .info-hotspot-icon {
  width: 90%;
  height: 90%;
  margin: 5%;
}

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

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

.info-hotspot-modal .info-hotspot-title {
  display: inline-block;
  vertical-align: middle;

  -moz-user-select: text;
  -webkit-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

.info-hotspot-modal .info-hotspot-close-wrapper {
  position: absolute;
  top: 0;
  right: 0;
  width: 50px;
  height: 50px;
  background-color: rgb(78, 88, 104);
  background-color: rgba(78, 88, 104, 0.8);
  cursor: pointer;
}

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

.info-hotspot-modal .info-hotspot-text {
  position: absolute;
  top: 110px;
  bottom: 10px;
  left: 10px;
  right: 10px;
  padding: 10px;
  background-color: rgb(58, 68, 84);
  background-color: rgba(58, 68, 84, 0.8);
  overflow-y: auto;
  opacity: 0;
  -webkit-transition: opacity 0.3s ease-in-out;
  transition: opacity 0.3s ease-in-out;

  -moz-user-select: text;
  -webkit-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

.info-hotspot-modal.visible .info-hotspot-text {
  opacity: 1;
  -webkit-transition: opacity 0.3s ease-in-out 0.4s;
  transition: opacity 0.3s ease-in-out 0.4s;
}

/* View control buttons: grouped at the bottom center */

#viewControls {
  display: none;
  position: absolute;
  bottom: var(--ui-edge);
  left: 50%;
  align-items: center;
  gap: 2px;
  height: var(--ui-size);
  padding: 0 4px;
  border-radius: 999px;
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%);
}

body.view-control-buttons #viewControls {
  display: flex;
}

/* Hide controls when width is too small */
@media (max-width: 600px) {
  body.view-control-buttons #viewControls {
    display: none;
  }
}

/* Mobile uses the bottom bar for the scene name; touch drag is enough there */
body.view-control-buttons.mobile #viewControls {
  display: none;
}

.viewControlButton {
  position: relative;
  display: block;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  -webkit-transition: background-color 0.15s;
  transition: background-color 0.15s;
}

.no-touch .viewControlButton:hover {
  background-color: var(--ui-hover);
}

.viewControlButton:active {
  background-color: rgba(255, 255, 255, 0.2);
}

.viewControlButton .icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
}

/* Separator between the direction and zoom groups */
.viewControlButton-5 {
  margin-left: 13px;
}

.viewControlButton-5::before {
  content: "";
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: -8px;
  width: 1px;
  background-color: var(--ui-border);
}
