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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f3f4f6; /* gray-100, same as original */
}

.viewer-wrap {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

model-viewer {
  width: 100%;
  height: 100%;
  background: #f3f4f6;
  cursor: grab;
  --progress-bar-color: transparent; /* hide built-in bar, we use our own */
}
model-viewer:active { cursor: grabbing; }

/* ---------- hotspots (tiny pulsing dot, same as original) ---------- */
.hotspot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 8px;
  height: 8px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
  /* keep full opacity even when model-viewer marks hotspot as occluded,
     matching the original always-visible overlay hotspots */
  opacity: 1 !important;
}
.hotspot .hotspot-core {
  width: 4px;
  height: 4px;
  border-radius: 9999px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  z-index: 1;
}
.hotspot .hotspot-ping {
  position: absolute;
  inset: -2px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.25);
  animation: hotspot-ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
  z-index: 0;
}
@keyframes hotspot-ping {
  75%, 100% { transform: scale(2); opacity: 0; }
}

/* ---------- loading splash ---------- */
.splash {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #f3f4f6;
  pointer-events: none;
}
.splash[hidden] { display: none; }
.splash.done { display: none; }
.splash-ar {
  z-index: 10001;
  pointer-events: auto;
}
.splash-lockup {
  display: flex;
  align-items: center;
  gap: 8px;
}
.splash-logo {
  width: 32px;
  height: 32px;
  display: block;
}
.splash-wordmark {
  color: #1f2937;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}
.splash-track {
  width: min(180px, 56vw);
  height: 3px;
  background: #e5e7eb;
  border-radius: 9999px;
  overflow: hidden;
}
.splash-fill {
  height: 100%;
  width: 0%;
  background: #c4c4c4;
  border-radius: 9999px;
  transition: width 0.3s ease-out;
}
.splash-fill.is-indeterminate {
  width: 40% !important;
  animation: splash-slide 1.2s ease-in-out infinite;
}
@keyframes splash-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
.splash-caption {
  color: #9ca3af;
  font-size: 12px;
  font-weight: 400;
}

/* ---------- corner brand badge ---------- */
.brand-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 40;
  height: 44px;
  max-width: 44px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  pointer-events: auto;
  box-sizing: border-box;
  transition: max-width 0.28s ease;
}
.brand-badge[hidden] { display: none; }
.brand-badge img {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: block;
}
.brand-badge-label {
  flex-shrink: 0;
  white-space: nowrap;
  opacity: 0;
  color: #1f2937;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.02em;
  transition: opacity 0.2s ease 0.05s;
}
.brand-badge:hover,
.brand-badge:focus-visible {
  max-width: 220px;
  padding-right: 14px;
  outline: none;
}
.brand-badge:hover .brand-badge-label,
.brand-badge:focus-visible .brand-badge-label {
  opacity: 1;
}

/* ---------- popup card ---------- */
.popup {
  position: absolute;
  z-index: 99;
  display: flex;
  flex-direction: column;
  bottom: 0;
  left: 0;
  width: 100%;
  /* mobile: compact bottom sheet sized to its content, so the model and its
   * hotspots stay visible above it (camera is reframed in app.js) */
  height: auto;
  max-height: 32vh;
  max-height: 32dvh;
  overflow: hidden;
  padding: 14px 16px 16px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid #000;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.05);
  color: #1e293b;
  animation: popup-in 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes popup-in {
  from { opacity: 0; transform: translateY(50px); }
  to   { opacity: 1; transform: translateY(0); }
}
.popup[hidden] { display: none; }

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 12px;
  flex-shrink: 0;
}
.popup-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #0f172a;
  padding-right: 16px;
  line-height: 1.375;
}
.popup-close {
  padding: 8px;
  border: none;
  background: transparent;
  border-radius: 9999px;
  cursor: pointer;
  color: #64748b;
  transition: background-color 0.15s;
  flex-shrink: 0;
}
.popup-close:hover { background: #f1f5f9; }
.popup-desc {
  color: #475569;
  line-height: 1.625;
  font-size: 14px;
  overflow-y: auto;
  flex: 1;
  padding-right: 8px;
}

.popup-nav {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-shrink: 0;
}
.popup-nav-btn {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 10px;
  color: #0f172a;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
}
.popup-nav-btn:hover { background: #f8fafc; }

@media (max-width: 767px) {
  .popup-header { margin-bottom: 8px; padding-bottom: 8px; }
  .popup-title { font-size: 16px; }
  .popup-close { padding: 4px; }
  .popup-close svg { width: 20px; height: 20px; display: block; }
  .popup-desc { font-size: 13px; line-height: 1.5; min-height: 0; }
  .popup-nav { margin-top: 10px; }
  .popup-nav-btn { padding: 8px 10px; font-size: 11px; }
}

@media (min-width: 768px) {
  .popup {
    top: 25%;
    right: 32px;
    bottom: auto;
    left: auto;
    width: 384px;
    height: auto;
    max-height: none;
    padding: 32px;
    border-radius: 16px;
  }
  .popup-header { margin-bottom: 16px; padding-bottom: 16px; }
  .popup-title { font-size: 30px; }
}

/* ---------- bottom action buttons ---------- */
.actions {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 90%;
  max-width: 420px;
}
.actions[hidden] { display: none; }
.actions-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
}
@media (min-width: 768px) {
  .actions { width: auto; max-width: none; }
  .actions-main { flex-direction: row; width: auto; }
}

.btn-lid {
  pointer-events: auto;
  width: 100%;
  padding: 16px 32px;
  background: rgba(39, 39, 42, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  transition: background-color 0.2s;
  font-family: inherit;
}
.btn-lid:hover { background: #000; }

.btn-ar {
  pointer-events: auto;
  width: 100%;
  padding: 16px 32px;
  background: #fff;
  border: 1.5px solid #18181b;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  transition: background-color 0.2s;
  font-family: inherit;
}
.btn-ar:hover { background: #fafafa; }
.btn-ar:disabled { opacity: 0.7; cursor: default; }
.btn-ar span {
  color: #000;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding-top: 2px;
}
@media (min-width: 768px) {
  .btn-lid, .btn-ar { width: auto; padding-top: 12px; padding-bottom: 12px; }
}

/* ---------- QR modal (desktop) ---------- */
.qr-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.qr-modal[hidden] { display: none; }
.qr-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 360px;
  max-width: 92vw;
  padding: 32px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  text-align: center;
}
.qr-close-btn { position: absolute; top: 12px; right: 12px; }
.qr-title { font-size: 20px; font-weight: 700; color: #0f172a; }
.qr-sub { font-size: 13px; color: #64748b; line-height: 1.5; margin-bottom: 8px; }
.qr-code svg { display: block; width: 192px; height: 192px; }
