/* ===== 360° Virtual Tour — Styles ===== */

:root {
  --color-bg: #0f1117;
  --color-surface: #1a1d27;
  --color-primary: rgb(0, 107, 166);
  --color-primary-glow: rgba(0, 107, 166, 0.4);
  --color-text: #e2e8f0;
  --color-text-muted: #94a3b8;
  --color-border: #2d3348;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.6;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll {
  overflow: hidden;
}

button, a {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ===== FULLSCREEN LANDING ===== */
.fullscreen-landing {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #080c12;
}

.fullscreen-landing .key-plan-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
  filter: brightness(0.75);
}

/* ===== FLOATING TITLE ===== */
.landing-title {
  position: absolute;
  top: 2rem;
  right: 2rem;
  z-index: 50;
  background: none;
  border: none;
  box-shadow: none;
  color: #fff;
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
  padding: 0;
  white-space: normal;
  text-align: right;
  text-shadow: none;
  pointer-events: none;
  max-width: calc(100vw - 6rem);
}

/* ===== LANDING HINT ===== */
.landing-hint {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 60;
  color: #fff;
  font-family: var(--font);
  font-size: clamp(0.8rem, 2.5vw, 1rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  text-align: center;
  padding: 0.75rem 1.5rem;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 999px;
  pointer-events: none;
  white-space: nowrap;
  animation: hint-pulse 2s ease-out 3, hint-fadeout 2s ease-out 6s forwards;
}

@keyframes hint-pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

@keyframes hint-fadeout {
  to { opacity: 0; visibility: hidden; }
}

/* ===== HAMBURGER MENU TOGGLE ===== */
.menu-toggle {
  position: fixed;
  top: 1.25rem;
  left: 1.25rem;
  z-index: 200;
  width: 48px;
  height: 48px;
  background: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0;
  transition: transform 0.15s ease;
}

.menu-toggle:hover {
  transform: scale(1.1);
}

.menu-toggle:active {
  transform: scale(0.95);
}

.menu-toggle-bar {
  display: block;
  width: 26px;
  height: 3px;
  background: #fff;
  border-radius: 2px;
  filter: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.menu-toggle.active .menu-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle.active .menu-toggle-bar:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active .menu-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ===== SIDEBAR OVERLAY ===== */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 150;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 320px;
  max-width: 85vw;
  height: 100vh;
  height: 100dvh;
  z-index: 250;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-right: none;
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: var(--safe-top);
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-close {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
  line-height: 1;
}

.sidebar-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text);
}

.sidebar-nav {
  list-style: none;
  padding: 0.5rem 0;
  flex: 1;
}

.sidebar-nav li {
  margin: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  padding: 0.9rem 1.25rem;
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 400;
  transition: background 0.15s ease, color 0.15s ease;
  border-left: 3px solid transparent;
  min-height: 48px;
}

.sidebar-link:hover,
.sidebar-link:active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-left-color: #fff;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  padding-bottom: calc(1rem + var(--safe-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-qr-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  color: var(--color-text-muted);
  text-decoration: none;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s ease, color 0.15s ease;
  min-height: 48px;
}

.sidebar-qr-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* ===== HOTSPOTS CONTAINER ===== */
.hotspots-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ===== HOTSPOT ===== */
.hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  background: none;
  border: none;
  outline: none;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
}

.hotspot-dot {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.3),
    0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hotspot-number {
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  user-select: none;
  position: relative;
  z-index: 1;
}

.hotspot-dot::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #fff;
  transform: translate(-50%, -50%);
  animation: hotspot-ping 2s ease-out infinite;
  opacity: 0;
}

@keyframes hotspot-ping {
  0% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0.6;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.6);
    opacity: 0;
  }
}

.hotspot:hover .hotspot-dot,
.hotspot:focus .hotspot-dot {
  transform: scale(1.15);
  box-shadow:
    0 0 0 6px rgba(255, 255, 255, 0.3),
    0 4px 16px rgba(255, 255, 255, 0.4);
}

.hotspot:active .hotspot-dot {
  transform: scale(0.95);
}

/* ===== VIEWER OVERLAY ===== */
.viewer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 1000;
  background: #000;
  flex-direction: column;
}

.viewer-overlay::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.2);
  pointer-events: none;
  z-index: 1;
}

.pano-loader {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  background: #000;
  transition: opacity 0.4s ease;
}

.pano-loader.hidden {
  opacity: 0;
  pointer-events: none;
}

.pano-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

#aframe-container {
  flex: 1;
  position: relative;
}

#aframe-container a-scene {
  width: 100%;
  height: 100%;
}

.viewer-buttons {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999;
  pointer-events: none;
}

.viewer-buttons > * {
  pointer-events: auto;
}

/* Shared button base for viewer — plain white text, no backgrounds */
.close-btn,
.home-btn,
.info-btn,
.daynight-btn,
.vr-btn,
.close-description-btn {
  background: none;
  border: none;
  box-shadow: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease, transform 0.15s ease;
  z-index: 9990;
  position: fixed;
  opacity: 0.9;
}

.close-btn:hover,
.home-btn:hover,
.info-btn:hover,
.daynight-btn:hover,
.vr-btn:hover,
.close-description-btn:hover {
  opacity: 1;
  transform: scale(1.05);
}

.close-btn:active,
.home-btn:active,
.info-btn:active,
.daynight-btn:active,
.vr-btn:active,
.close-description-btn:active {
  transform: scale(0.92);
}

.close-btn {
  top: calc(1rem + var(--safe-top));
  right: calc(1rem + var(--safe-right));
  width: 48px;
  height: 48px;
  font-size: 1.75rem;
  line-height: 1;
}

.home-btn {
  top: calc(1rem + var(--safe-top));
  left: calc(1rem + var(--safe-left));
  height: 48px;
  padding: 0;
  gap: 0.5rem;
}

.home-btn-text {
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
}

/* ===== INFO BUTTON (inside 360 viewer) ===== */
.info-btn {
  bottom: calc(1.5rem + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  height: 48px;
  padding: 0;
  gap: 0.5rem;
}

.info-btn:hover {
  transform: translateX(-50%) scale(1.05);
}

.info-btn-text {
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ===== DAY/NIGHT TOGGLE BUTTON ===== */
.daynight-btn {
  bottom: calc(1.5rem + var(--safe-bottom));
  right: calc(1.5rem + var(--safe-right));
  height: 48px;
  padding: 0;
  gap: 0.5rem;
}

.daynight-btn-text {
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.daynight-icon {
  flex-shrink: 0;
}

/* ===== HIDE A-FRAME DEFAULT VR / AR BUTTONS ===== */
.a-enter-vr-button,
.a-enter-vr,
.a-enter-ar-button,
.a-enter-ar,
.a-orientation-modal,
[data-aframe-default-vr-ui] {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  position: absolute !important;
  overflow: hidden !important;
}

/* ===== VR MODE BUTTON ===== */
.vr-btn {
  bottom: calc(1.5rem + var(--safe-bottom));
  left: calc(1.5rem + var(--safe-left));
  height: 48px;
  padding: 0;
  gap: 0.5rem;
}

.vr-btn-text {
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ===== MOTION PROMPT (tap to enable gyroscope) ===== */
.motion-prompt {
  position: fixed;
  bottom: calc(4.5rem + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 9990;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: #fff;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.6rem 1.2rem;
  gap: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  white-space: nowrap;
  animation: motion-prompt-pulse 2s ease-in-out infinite;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.motion-prompt:hover {
  opacity: 0.9;
}

.motion-prompt:active {
  transform: translateX(-50%) scale(0.95);
}

@keyframes motion-prompt-pulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

/* ===== DESCRIPTION OVERLAY (fullscreen, on top of 360 viewer) ===== */
.description-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.description-content {
  position: relative;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: none;
  border-radius: 0;
  padding: calc(4rem + var(--safe-top)) 2.5rem calc(2.5rem + var(--safe-bottom));
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.description-content::before,
.description-content::after {
  content: '';
  flex: 1 1 auto;
}

.close-description-btn {
  top: calc(1rem + var(--safe-top));
  right: calc(1rem + var(--safe-right));
  z-index: 10000;
  font-size: 1.75rem;
  width: 48px;
  height: 48px;
  line-height: 1;
}

.description-title {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 600;
  margin-bottom: 1rem;
  color: #fff;
  max-width: 600px;
  text-align: center;
}

.description-text {
  font-size: clamp(0.9rem, 1.5vw, 1.05rem);
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.85);
  max-width: 600px;
  text-align: left;
}

.description-text ul {
  list-style: disc;
  padding-left: 1.5em;
  margin: 0.5em 0;
}

.description-text li {
  margin-bottom: 0.5em;
}

.description-text p {
  margin: 0.8em 0 0.3em;
  font-weight: 500;
}

/* ===== QR CODES OVERLAY ===== */
.qr-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.qr-overlay-content {
  position: relative;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: none;
  border-radius: 0;
  padding: calc(4rem + var(--safe-top)) 2.5rem calc(2.5rem + var(--safe-bottom));
  width: 100%;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.close-qr-btn {
  position: fixed;
  top: calc(1rem + var(--safe-top));
  right: calc(1rem + var(--safe-right));
  z-index: 10000;
  background: none;
  border: none;
  box-shadow: none;
  color: #fff;
  font-size: 1.75rem;
  width: 48px;
  height: 48px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.close-qr-btn:hover {
  opacity: 1;
  transform: scale(1.05);
}

.close-qr-btn:active {
  transform: scale(0.92);
}

.qr-page-header {
  text-align: center;
}

.qr-page-header h1 {
  font-family: var(--font);
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.25rem;
}

.qr-page-header p {
  font-family: var(--font);
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.7);
}

.qr-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 1.5rem;
  max-width: 700px;
  margin: 0 auto;
  justify-content: center;
}

.qr-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.qr-code {
  background: #fff;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-code canvas,
.qr-code img,
.qr-code table {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

.qr-label {
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: color 0.15s ease;
}

.qr-label:hover {
  color: #fff;
  text-decoration: underline;
}

/* =============================================================
   RESPONSIVE — MOBILE PORTRAIT: SCROLLABLE LANDING
   ============================================================= */
@media (max-width: 600px) and (orientation: portrait) {
  .fullscreen-landing {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    scrollbar-width: none;
  }
  .fullscreen-landing::-webkit-scrollbar {
    display: none;
  }
  .fullscreen-landing .key-plan-img {
    width: auto;
    height: 100%;
    max-width: none;
    object-fit: initial;
  }
  .landing-title {
    position: fixed;
  }
}

/* =============================================================
   RESPONSIVE — MOBILE PORTRAIT  (phones in portrait)
   ============================================================= */
@media (max-width: 600px) {
  .landing-title {
    font-size: clamp(0.85rem, 4vw, 1.2rem);
    top: calc(1.25rem + var(--safe-top));
    right: calc(1.25rem + var(--safe-right));
    max-width: calc(100vw - 2rem);
  }

  .menu-toggle {
    top: calc(0.75rem + var(--safe-top));
    left: calc(0.75rem + var(--safe-left));
    width: 44px;
    height: 44px;
  }

  .hotspot {
    width: 40px;
    height: 40px;
  }

  .hotspot-dot {
    width: 18px;
    height: 18px;
  }

  .hotspot-dot::after {
    width: 26px;
    height: 26px;
  }

  .close-btn {
    top: calc(0.75rem + var(--safe-top));
    right: calc(0.75rem + var(--safe-right));
    width: 44px;
    height: 44px;
    font-size: 1.5rem;
  }

  .home-btn {
    top: calc(0.75rem + var(--safe-top));
    left: calc(0.75rem + var(--safe-left));
    height: 44px;
  }

  .home-btn-text {
    font-size: 0.8rem;
  }

  .info-btn {
    bottom: calc(1rem + var(--safe-bottom));
    height: 44px;
  }

  .info-btn-text {
    font-size: 0.8rem;
  }

  .daynight-btn {
    bottom: calc(1rem + var(--safe-bottom));
    right: calc(1rem + var(--safe-right));
    height: 44px;
  }

  .daynight-btn-text {
    font-size: 0.8rem;
  }

  .vr-btn {
    bottom: calc(1rem + var(--safe-bottom));
    left: calc(1rem + var(--safe-left));
    height: 44px;
  }

  .vr-btn-text {
    font-size: 0.8rem;
  }

  .close-description-btn {
    top: calc(0.75rem + var(--safe-top));
    right: calc(0.75rem + var(--safe-right));
    width: 44px;
    height: 44px;
    font-size: 1.5rem;
  }

  .close-qr-btn {
    top: calc(0.75rem + var(--safe-top));
    right: calc(0.75rem + var(--safe-right));
    width: 44px;
    height: 44px;
    font-size: 1.5rem;
  }

  .description-content {
    padding: calc(3.5rem + var(--safe-top)) 1.25rem calc(2rem + var(--safe-bottom));
  }

  .description-title {
    font-size: 1.1rem;
  }

  .description-text {
    font-size: 0.88rem;
    line-height: 1.7;
  }
}

/* =============================================================
   RESPONSIVE — MOBILE LANDSCAPE  (phones rotated sideways)
   ============================================================= */
@media (max-height: 500px) and (orientation: landscape) {
  .fullscreen-landing {
    touch-action: none;
  }
  .fullscreen-landing .key-plan-img {
    object-position: center bottom;
  }

  .landing-title {
    top: 0.5rem;
    font-size: 0.85rem;
  }

  .menu-toggle {
    top: 0.5rem;
    left: calc(0.5rem + var(--safe-left));
    width: 48px;
    height: 48px;
  }

  .hotspot {
    width: 40px;
    height: 40px;
  }

  .hotspot-dot {
    width: 18px;
    height: 18px;
  }

  .hotspot-dot::after {
    width: 26px;
    height: 26px;
  }

  .close-btn {
    top: calc(0.4rem + var(--safe-top));
    right: calc(0.4rem + var(--safe-right));
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }

  .home-btn {
    top: calc(0.4rem + var(--safe-top));
    left: calc(0.4rem + var(--safe-left));
    height: 38px;
  }

  .home-btn-text {
    font-size: 0.75rem;
  }

  .info-btn {
    bottom: calc(0.4rem + var(--safe-bottom));
    height: 38px;
  }

  .info-btn-text {
    font-size: 0.75rem;
  }

  .daynight-btn {
    bottom: calc(0.4rem + var(--safe-bottom));
    right: calc(0.4rem + var(--safe-right));
    height: 38px;
  }

  .daynight-btn-text {
    font-size: 0.75rem;
  }

  .vr-btn {
    bottom: calc(0.4rem + var(--safe-bottom));
    left: calc(0.4rem + var(--safe-left));
    height: 38px;
  }

  .vr-btn-text {
    font-size: 0.75rem;
  }

  .close-description-btn {
    top: calc(0.4rem + var(--safe-top));
    right: calc(0.4rem + var(--safe-right));
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }

  .close-qr-btn {
    top: calc(0.4rem + var(--safe-top));
    right: calc(0.4rem + var(--safe-right));
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }

  .description-content {
    padding: 2.5rem 2rem 1.5rem;
  }

  .description-title {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }

  .description-text {
    font-size: 0.82rem;
    line-height: 1.6;
  }

  .sidebar {
    max-width: 60vw;
  }
}

/* =============================================================
   RESPONSIVE — QR CODES (tablets and phones)
   ============================================================= */
@media (max-width: 768px) {
  .qr-overlay-content {
    padding: calc(3.5rem + var(--safe-top)) 1rem calc(1.5rem + var(--safe-bottom));
    gap: 1rem;
  }

  .qr-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    padding: 0 1rem;
    max-width: 100%;
  }

  .qr-item {
    justify-self: center;
  }

  .qr-code {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    max-width: 120px;
    margin: 0 auto;
  }

  .qr-code canvas,
  .qr-code img {
    max-width: 100px;
    max-height: 100px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .qr-overlay-content {
    padding: 1.5rem 2rem;
    gap: 0.75rem;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
  }

  .qr-page-header {
    width: 100%;
  }

  .qr-page-header h1 {
    font-size: 1rem;
  }

  .qr-grid {
    gap: 0.75rem;
  }

  .qr-code {
    width: 80px;
    height: 80px;
    padding: 4px;
  }

  .qr-code canvas,
  .qr-code img {
    max-width: 70px;
    max-height: 70px;
  }

  .qr-label {
    font-size: 0.7rem;
  }
}

/* ===== LOADING PLACEHOLDER for key plan ===== */
.key-plan-img[src=""]::after,
.key-plan-img:not([src])::after {
  content: 'Place your key plan image at images/key-plan.jpg';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 400px;
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 1rem;
}
