html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background:
    radial-gradient(1350px 860px at 12% -6%, rgba(235, 198, 138, 0.36), rgba(235, 198, 138, 0) 56%),
    radial-gradient(1050px 720px at 88% 4%, rgba(196, 147, 88, 0.38), rgba(196, 147, 88, 0) 60%),
    radial-gradient(1200px 900px at 50% 120%, rgba(112, 76, 41, 0.54), rgba(112, 76, 41, 0) 66%),
    linear-gradient(158deg, #3a2818 0%, #5a3a22 38%, #7c4f2d 72%, #9b6a3d 100%);
}
    #viewer {
      width:100vw;
      height:100vh;
      background:
        radial-gradient(1200px 760px at 12% -2%, rgba(226, 186, 122, 0.34), rgba(226, 186, 122, 0) 58%),
        radial-gradient(1000px 700px at 90% 8%, rgba(188, 138, 83, 0.30), rgba(188, 138, 83, 0) 62%),
        linear-gradient(160deg, #422d1a 0%, #644125 56%, #845534 100%);
    }
    .intro-backdrop {
      position: fixed;
      inset: 0;
      z-index: 5;
      pointer-events: none;
      opacity: 1;
      transition: opacity .9s ease;
      background:
        radial-gradient(1200px 760px at 12% -2%, rgba(226, 186, 122, 0.38), rgba(226, 186, 122, 0) 58%),
        radial-gradient(1000px 700px at 90% 8%, rgba(188, 138, 83, 0.34), rgba(188, 138, 83, 0) 62%),
        linear-gradient(160deg, #422d1a 0%, #644125 56%, #845534 100%);
    }
    .intro-backdrop.hide {
      opacity: 0;
    }
    #viewer canvas { background: transparent !important; }

    /* --- TOP UI LAYER (doesn't block dragging) --- */
    .ui {
      position: fixed;
      inset: 0;
      z-index: 20;
      pointer-events: none;
    }

    /* Dev HUD (yaw/pitch/fov + cursor) */
    .dev-hud {
      position: absolute;
      left: 14px;
      top: 14px;
      padding: 8px 10px;
      border-radius: 10px;
      background: rgba(0,0,0,.55);
      border: 1px solid rgba(255,255,255,.15);
      font: 600 12px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      color: rgba(255,255,255,.92);
      letter-spacing: .2px;
      user-select: none;
      pointer-events: none;
    }
    .dev-row { white-space: nowrap; }

    /* Hamburger: top-right, WHITE, NO background box */
    .hamburger {
      position: absolute;
      top: 14px;
      right: 14px;
      width: 44px;
      height: 44px;
      display: grid;
      place-items: center;
      pointer-events: auto;
      cursor: pointer;
      background: transparent;
      border: 0;
      padding: 0;
      z-index: 2;
    }
    .hamburger .lines {
      width: 22px;
      height: 14px;
      position: relative;
    }
    .hamburger .lines span {
      position: absolute;
      left: 0;
      right: 0;
      height: 2px;
      border-radius: 999px;
      background: rgba(255,255,255,.95);
    }
    .hamburger .lines span:nth-child(1) { top: 0; }
    .hamburger .lines span:nth-child(2) { top: 6px; opacity: .9; }
    .hamburger .lines span:nth-child(3) { bottom: 0; opacity: .85; }

    /* Simple dropdown menu */
    .menu {
      position: absolute;
      top: 56px;
      right: 14px;
      width: 240px;
      display: none;
      pointer-events: auto;
      border-radius: 16px;
      background: rgba(0,0,0,.55);
      border: 1px solid rgba(255,255,255,.12);
      backdrop-filter: blur(12px);
      box-shadow: 0 18px 60px rgba(0,0,0,.35);
      padding: 10px 8px 8px;
      z-index: 3;
    }
    .menu.open { display: block; }

    /* ✅ Logo inside menu (top of menu) */
    .menu-logo-wrap {
      display: flex;
      justify-content: center;
      padding: 6px 6px 4px;
    }
    .menu-logo {
      width: 140px;
      height: auto;
      display: block;
      filter: drop-shadow(0 4px 12px rgba(0,0,0,.35));
      opacity: .95;
      user-select: none;
      -webkit-user-drag: none;
    }

    .menu button {
      width: 100%;
      padding: 10px 10px;
      border-radius: 12px;
      background: transparent;
      border: 0;
      cursor: pointer;
      text-align: left;
      color: rgba(255,255,255,.92);
      font-size: 13px;
      font-weight: 700;
    }
    .menu .menu-label {
      width: 100%;
      padding: 10px 10px;
      border-radius: 12px;
      background: transparent;
      text-align: left;
      color: rgba(255,255,255,.92);
      font-size: 13px;
      font-weight: 700;
      cursor: default;
      pointer-events: none;
      box-sizing: border-box;
    }
    .menu p,
    .menu a {
      display: block;
      margin: 0;
      padding: 8px 10px;
      color: rgba(255,255,255,.92);
      font-size: 13px;
      font-weight: 700;
      text-decoration: none;
      border-radius: 10px;
    }
    .menu a:hover {
      background: rgba(255,255,255,.08);
    }
    .menu button:hover { background: rgba(255,255,255,.10); }
    .menu .sep { height:1px; background: rgba(255,255,255,.12); margin: 2px 6px 3px; }
    .menu .sep + button { padding-top: 6px; }
    .menu .sep + .menu-label { padding-top: 6px; }

    /* Center brand overlay */
    .center {
      position: fixed;
      inset: 0;
      z-index: 20;
      display: grid;
      place-items: center;
      pointer-events: none;
      transition: opacity .35s ease, transform .35s ease;
    }
    .center.hide {
      opacity: 0;
      transform: translateY(8px) scale(.98);
    }

    /* Heading elements WITHOUT border/box */
    .brand {
      display: grid;
      place-items: center;
      gap: 10px;
      padding: 0;
      border-radius: 0;
      background: transparent;
      border: none;
      backdrop-filter: none;
      box-shadow: none;
      max-width: min(92vw, 520px);
      text-align: center;
    }
    .brand .logo-frame {
      display: grid;
      place-items: center;
      padding: 14px 18px;
      border-radius: 999px;
      background: rgba(20, 56, 40, .42);
      border: 1px solid rgba(140,140,140,.35);
      backdrop-filter: blur(6px);
      box-shadow:
        inset 0 0 0 1px rgba(40,40,40,.6),
        0 18px 50px rgba(0,0,0,.45);
    }
    .brand img {
      width: min(240px, 70vw);
      height: auto;
      display: block;
      filter: drop-shadow(0 10px 22px rgba(0,0,0,.45));
      user-select: none;
      -webkit-user-drag: none;
    }
    .brand .title {
      margin: 0;
      color: rgba(255,255,255,.92);
      font-weight: 900;
      letter-spacing: .2px;
      font-size: 14px;
      text-shadow: 0 10px 22px rgba(0,0,0,.55);
    }
    .brand .title-chip {
      display: inline-block;
      padding: 8px 12px;
      border-radius: 999px;
      background: rgba(20, 56, 40, .40);
      border: 1px solid rgba(140,140,140,.35);
      backdrop-filter: blur(6px);
      box-shadow:
        inset 0 0 0 1px rgba(40,40,40,.6),
        0 12px 30px rgba(0,0,0,.4);
    }

    /* Hint animation */
    .hint {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      color: rgba(255,255,255,.85);
      font-size: 12px;
      font-weight: 800;
      letter-spacing: .2px;
      transition: opacity .25s ease, transform .25s ease;
      text-shadow: 0 10px 22px rgba(0,0,0,.55);
    }
    .hint.hide {
      opacity: 0;
      transform: translateY(6px);
    }
    .center-status {
      position: relative;
      width: min(92vw, 420px);
      min-height: 74px;
      display: grid;
      place-items: center;
    }
    .center-status .loading-card,
    .center-status .hint {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      margin: 0;
      white-space: nowrap;
    }
    .center-status .loading-card {
      transform: translate(-50%, calc(-50% + 56px));
    }
    .center-status .hint.hide {
      opacity: 0;
      transform: translate(-50%, calc(-50% + 6px));
    }
    .hint-subtext {
      margin-top: 6px;
      color: rgba(255,255,255,.7);
      font-size: 11px;
      font-weight: 700;
      letter-spacing: .2px;
      text-shadow: 0 10px 22px rgba(0,0,0,.55);
    }
    .swipe {
      width: 56px;
      height: 18px;
      border-radius: 999px;
      background: rgba(255,255,255,.10);
      position: relative;
      overflow: hidden;
      border: 1px solid rgba(255,255,255,.10);
    }
    .swipe .dot {
      width: 10px;
      height: 10px;
      border-radius: 999px;
      background: rgba(255,255,255,.95);
      position: absolute;
      top: 50%;
      left: 9px;
      transform: translateY(-50%);
      animation: swipe 1.35s ease-in-out infinite;
    }
    @keyframes swipe {
      0%   { left: 9px;  opacity: .55; }
      25%  { opacity: 1; }
      50%  { left: 36px; opacity: 1; }
      75%  { opacity: 1; }
      100% { left: 9px;  opacity: .55; }
    }

    /* Popup for info */
    .popup-backdrop {
      position: fixed;
      inset: 0;
      z-index: 9998; /* very high so it always appears */
      background: rgba(0,0,0,.35);
      opacity: 0;
      pointer-events: none;
      transition: opacity .2s ease;
    }
    .popup-backdrop.open {
      opacity: 1;
      pointer-events: auto;
    }
    .popup {
      position: fixed;
      left: 14px;
      right: 14px;
      bottom: 14px;
      z-index: 9999; /* very high so it always appears */
      max-width: 560px;
      margin: 0 auto;
      border-radius: 18px;
      background: rgba(15,15,15,.92);
      border: 1px solid rgba(255,255,255,.12);
      backdrop-filter: blur(12px);
      box-shadow: 0 18px 60px rgba(0,0,0,.45);
      padding: 12px 14px;
      transform: translateY(20px);
      opacity: 0;
      pointer-events: none;
      transition: opacity .2s ease, transform .2s ease;
    }
    .popup.open {
      opacity: 1;
      transform: translateY(0);
      pointer-events: auto;
    }
    .popup-top {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 10px;
    }
    .popup-title {
      margin: 0;
      color: rgba(255,255,255,.92);
      font-size: 14px;
      font-weight: 900;
    }
    .popup-close {
      border: 1px solid rgba(255,255,255,.12);
      background: rgba(255,255,255,.10);
      color: rgba(255,255,255,.92);
      border-radius: 12px;
      padding: 7px 10px;
      cursor: pointer;
      font-weight: 800;
    }
    .popup-text {
      margin: 8px 0 0;
      color: rgba(255,255,255,.78);
      font-size: 13px;
      line-height: 1.35;
    }
    .popup-images {
      display: none;
      margin-top: 10px;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
    }
    .popup-images.has-images {
      display: grid;
    }
    .popup-image-btn {
      display: block;
      border: 1px solid rgba(255,255,255,.14);
      background: rgba(255,255,255,.06);
      border-radius: 10px;
      padding: 0;
      overflow: hidden;
      cursor: pointer;
    }
    .popup-image {
      display: block;
      width: 100%;
      height: 120px;
      object-fit: cover;
      transition: transform .18s ease;
    }
    .popup-image-btn:hover .popup-image {
      transform: scale(1.03);
    }
    .popup-map-wrap {
      grid-column: 1 / -1;
      border: 1px solid rgba(255,255,255,.14);
      background: rgba(255,255,255,.06);
      border-radius: 10px;
      overflow: hidden;
    }
    .popup-map-iframe {
      display: block;
      width: 100%;
      height: 260px;
      border: 0;
    }
    .image-lightbox-backdrop {
      position: fixed;
      inset: 0;
      z-index: 10000;
      background: rgba(0,0,0,.82);
      opacity: 0;
      pointer-events: none;
      transition: opacity .2s ease;
    }
    .image-lightbox-backdrop.open {
      opacity: 1;
      pointer-events: auto;
    }
    .image-lightbox {
      position: fixed;
      inset: 16px;
      z-index: 10001;
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      pointer-events: none;
      transition: opacity .2s ease;
    }
    .image-lightbox.open {
      opacity: 1;
      pointer-events: auto;
    }
    .image-lightbox-img {
      max-width: min(96vw, 1400px);
      max-height: calc(100vh - 80px);
      width: auto;
      height: auto;
      border-radius: 10px;
      box-shadow: 0 24px 80px rgba(0,0,0,.55);
      background: rgba(0,0,0,.2);
    }
    .image-lightbox-close {
      position: fixed;
      top: 16px;
      right: 16px;
      z-index: 10002;
      border: 1px solid rgba(255,255,255,.18);
      background: rgba(15,15,15,.86);
      color: rgba(255,255,255,.95);
      border-radius: 12px;
      padding: 9px 12px;
      cursor: pointer;
      font-weight: 800;
    }

    /* Loading overlay for panorama switching */
    .loading-overlay {
      position: fixed;
      inset: 0;
      z-index: 12;
      display: grid;
      place-items: center;
      background:
        radial-gradient(980px 700px at 18% 0%, rgba(232, 192, 132, 0.40), rgba(232, 192, 132, 0) 58%),
        radial-gradient(900px 620px at 84% 14%, rgba(184, 136, 82, 0.34), rgba(184, 136, 82, 0) 62%),
        linear-gradient(160deg, rgba(60, 40, 24, 0.66) 0%, rgba(95, 61, 36, 0.70) 55%, rgba(128, 86, 50, 0.74) 100%);
      opacity: 1;
      transition: opacity .25s ease;
      pointer-events: auto;
    }
    .loading-overlay.hide {
      opacity: 0;
      pointer-events: none;
    }
    .nav-tap-hint {
      position: fixed;
      left: 50%;
      bottom: 24px;
      transform: translate(-50%, 10px);
      z-index: 30;
      max-width: min(92vw, 560px);
      padding: 10px 14px;
      border-radius: 999px;
      border: 1px solid rgba(255,255,255,.18);
      background: rgba(0,0,0,.56);
      color: rgba(255,255,255,.92);
      font-size: 12px;
      font-weight: 700;
      text-align: center;
      letter-spacing: .2px;
      backdrop-filter: blur(8px);
      box-shadow: 0 10px 28px rgba(0,0,0,.35);
      opacity: 0;
      pointer-events: none;
      transition: opacity .2s ease, transform .2s ease;
    }
    .nav-tap-hint.show {
      opacity: 1;
      transform: translate(-50%, 0);
    }
    .loading-card {
      display: grid;
      place-items: center;
      gap: 10px;
      padding: 16px 18px;
      border-radius: 16px;
      background: rgba(20, 58, 42,.48);
      border: 1px solid rgba(120,120,120,.35);
      box-shadow: 0 12px 30px rgba(0,0,0,.45);
      text-align: center;
    }
    .spinner {
      width: 44px;
      height: 44px;
      border-radius: 50%;
      border: 3px solid rgba(255,255,255,.2);
      border-top-color: rgba(255,255,255,.9);
      animation: spin .9s linear infinite;
    }
    .loading-text {
      color: rgba(255,255,255,.9);
      font-size: 12px;
      font-weight: 800;
      letter-spacing: .4px;
    }
    @keyframes spin {
      to { transform: rotate(360deg); }
    }
