:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #101114;
  color: #f5f2e8;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

button {
  font: inherit;
}

.app-shell,
.viewer,
#tour-canvas {
  width: 100%;
  height: 100%;
}

.viewer {
  position: relative;
  background: #101114;
}

#tour-canvas {
  display: block;
  cursor: grab;
  touch-action: none;
}

#tour-canvas:active {
  cursor: grabbing;
}

.topbar {
  position: fixed;
  top: 18px;
  left: 18px;
  right: 18px;
  z-index: 4;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.tour-library {
  position: fixed;
  inset: 0;
  z-index: 7;
  overflow: auto;
  padding: clamp(26px, 5vh, 54px) 0 clamp(34px, 7vh, 76px);
  background:
    radial-gradient(circle at 50% 0%, rgb(154 215 203 / 10%), transparent 34%),
    linear-gradient(180deg, rgb(16 17 20 / 72%), #101114 82%),
    #101114;
}

.tour-library[hidden] {
  display: none;
}

.tour-grid {
  display: flex;
  flex-direction: column;
  gap: clamp(28px, 5vh, 48px);
  width: 100%;
}

.tour-category {
  width: 100%;
}

.tour-category > h2 {
  margin: 0 0 12px;
  padding: 0 clamp(18px, 4vw, 64px);
  color: rgb(255 249 237 / 88%);
  font-size: clamp(1rem, 1.6vw, 1.35rem);
  line-height: 1.15;
}

.tour-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr));
  gap: 24px;
  width: 100%;
  padding: 0 clamp(18px, 4vw, 64px) 18px;
}

.tour-card {
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  justify-items: stretch;
  justify-content: stretch;
  align-items: start;
  align-content: start;
  min-height: 0;
  border: 0;
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  background: transparent;
  color: #fff9ed;
  text-align: left !important;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.tour-card:hover,
.tour-card:focus-visible {
  background: rgb(255 255 255 / 4%);
  transform: translateY(-4px) scale(1.015);
}

.tour-card:hover .tour-thumb,
.tour-card:focus-visible .tour-thumb {
  border-color: rgb(154 215 203 / 72%);
}

.tour-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgb(154 215 203 / 28%), rgb(255 243 196 / 18%)),
    #262a31;
  background-position: center;
  background-size: cover;
  box-shadow: 0 10px 30px rgb(0 0 0 / 28%);
}

.tour-card-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 0 0 0 0;
  text-align: left !important;
}

.tour-card-body > * {
  align-self: stretch;
  width: 100%;
}

.tour-card h2 {
  display: block;
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.2;
  font-weight: 650;
  text-align: left !important;
}

.tour-card p {
  display: block;
  margin: 0;
  color: #9ca3af;
  font-size: 0.85rem;
  line-height: 1.35;
  text-align: left !important;
}

.empty-library {
  margin: 40px clamp(18px, 4vw, 64px);
  max-width: 620px;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 8px;
  padding: 18px;
  background: #181a1f;
  color: rgb(255 249 237 / 78%);
}

.eyebrow {
  margin: 0 0 2px;
  color: #9ad7cb;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2.4rem, 4.5vw);
  line-height: 1;
  text-shadow: 0 2px 18px rgb(0 0 0 / 70%);
}

.icon-button,
.webxr-button {
  min-width: 48px;
  height: 42px;
  border: 1px solid rgb(255 255 255 / 24%);
  border-radius: 8px;
  background: rgb(16 17 20 / 72%);
  color: #fff9ed;
  font-weight: 800;
  pointer-events: auto;
}

.icon-button:hover,
.webxr-button:hover,
.scene-chip:hover {
  border-color: rgb(255 255 255 / 58%);
}

.webxr-button {
  position: static !important;
  inset: auto !important;
  width: auto !important;
  padding: 0 14px !important;
  text-transform: uppercase;
}

.scene-strip {
  position: fixed;
  left: 50%;
  bottom: 92px;
  z-index: 4;
  display: flex;
  gap: 8px;
  max-width: calc(100vw - 36px);
  overflow-x: auto;
  padding: 8px;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 999px;
  background: rgb(10 12 15 / 58%);
  box-shadow: 0 16px 50px rgb(0 0 0 / 32%);
  backdrop-filter: blur(16px);
  transform: translateX(-50%);
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.control-strip {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: min(920px, calc(100vw - 36px));
  padding: 10px;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 999px;
  background: linear-gradient(180deg, rgb(24 27 31 / 72%), rgb(10 12 15 / 62%));
  box-shadow: 0 18px 60px rgb(0 0 0 / 38%);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.scene-chip {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 16px;
  background: transparent;
  color: #fff9ed;
  white-space: nowrap;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.control-button {
  min-height: 42px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 999px;
  padding: 0 16px;
  background: rgb(255 255 255 / 8%);
  color: #fff9ed;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 12%);
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease,
    opacity 160ms ease;
}

.icon-control {
  min-width: 68px;
}

.control-button:hover,
.control-button:focus-visible,
.scene-chip:hover,
.scene-chip:focus-visible {
  border-color: rgb(154 215 203 / 58%);
  background: rgb(154 215 203 / 16%);
  transform: translateY(-1px);
}

.control-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.viewer.navigation-hidden .topbar,
.viewer.navigation-hidden .scene-strip,
.viewer.navigation-hidden .control-strip,
.viewer.navigation-hidden .status-panel {
  opacity: 0;
  pointer-events: none;
}

.viewer.navigation-hidden .topbar {
  transform: translateY(-10px);
}

.viewer.navigation-hidden .scene-strip,
.viewer.navigation-hidden .control-strip {
  transform: translate(-50%, 16px);
}

.exit-panel {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-content: center;
  gap: 18px;
  background: #101114;
  text-align: center;
}

.exit-panel[hidden] {
  display: none;
}

.exit-panel h2 {
  margin: 0;
  font-size: 2rem;
}

.scene-chip.is-active {
  border-color: #9ad7cb;
  background: rgb(154 215 203 / 20%);
}

.reticle {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: 14px;
  height: 14px;
  border: 2px solid rgb(255 255 255 / 86%);
  border-radius: 50%;
  display: none;
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-shadow: 0 0 16px rgb(154 215 203 / 75%);
}

.viewer.is-xr .reticle {
  display: block;
}

.status-panel {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 4;
  max-width: min(430px, calc(100vw - 36px));
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgb(16 17 20 / 74%);
  color: #fff9ed;
  font-size: 0.92rem;
  line-height: 1.35;
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

@media (max-width: 640px) {
  .topbar {
    top: 12px;
    left: 12px;
    right: 12px;
  }

  .scene-strip {
    right: auto;
    bottom: 88px;
    left: 50%;
    max-width: calc(100vw - 24px);
  }

  .control-strip {
    right: auto;
    bottom: 12px;
    left: 50%;
    max-width: calc(100vw - 24px);
    border-radius: 24px;
  }

  .status-panel {
    left: 12px;
    right: 12px;
    bottom: 62px;
  }

  .tour-library {
    padding: 18px 0 40px;
  }

  .tour-grid {
    gap: 24px;
  }

  .tour-row {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 0 12px 14px;
  }

  .tour-category > h2 {
    padding: 0 12px;
  }

}
