html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #eee;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

#renderCanvas {
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  touch-action: none;
}

/* Poster Overlay displayed while 3D scene and model are loading */
.poster-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../images/model.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-color: #eee;
  pointer-events: none;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  z-index: 50;
}

.poster-overlay.hide {
  opacity: 0;
  visibility: hidden;
}

/* Custom Center Loader - Sleek Sharp Cyber-Luxe Box */
.custom-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  background: rgba(18, 19, 24, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2px solid #ff6600;
  border-radius: 0;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35), 0 0 25px rgba(255, 102, 0, 0.3);
  z-index: 100;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s ease;
}

.custom-loader.hide {
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -50%) scale(0.92);
}

.progress-track {
  position: relative;
  width: 290px;
  max-width: 82vw;
  height: 28px;
  background-color: #14151a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #ff8533, #ff5500);
  border-radius: 0;
  transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}

/* Dynamic high-tech diagonal animated stripes on fill */
.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.18) 0px,
    rgba(255, 255, 255, 0.18) 8px,
    transparent 8px,
    transparent 16px
  );
  background-size: 24px 24px;
  animation: loader-stripes 0.9s linear infinite;
}

@keyframes loader-stripes {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 24px 0;
  }
}

.progress-percentage {
  position: relative;
  z-index: 2;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 2px;
  line-height: 28px;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8), 0 0 10px rgba(0, 0, 0, 0.5);
  user-select: none;
}

/* AR Button - Sharp Modern Brand Theme */
#ar-button {
  position: absolute;
  left: max(24px, env(safe-area-inset-left, 0px));
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  white-space: nowrap;
  padding: 0px 22px 0px 48px;
  font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #ff6600;
  height: 42px;
  line-height: 42px;
  border-radius: 0;
  border: 2px solid #ff6600;
  background-color: #ffffff;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="%23ff6600"><path d="M3 4c0-1.1.9-2 2-2h4v2H5v4H3V4zm0 16c0 1.1.9 2 2 2h4v-2H5v-4H3v4zm16 2c1.1 0 2-.9 2-2v-4h-2v4h-4v2h4zM21 4c0-1.1-.9-2-2-2h-4v2h4v4h2V4zM12 7l5 3-5 3-5-3 5-3zm-5 5.5l4.5 2.7v5.3L6.5 17.8v-5.3zm12 0v5.3l-5 2.7v-5.3l5-2.7z"/></svg>');
  background-repeat: no-repeat;
  background-size: 20px 20px;
  background-position: 16px 50%;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 60;
  transition: all 0.2s ease;
}

#ar-button:hover {
  background-color: #ff6600;
  color: #ffffff;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 24 24" fill="%23ffffff"><path d="M3 4c0-1.1.9-2 2-2h4v2H5v4H3V4zm0 16c0 1.1.9 2 2 2h4v-2H5v-4H3v4zm16 2c1.1 0 2-.9 2-2v-4h-2v4h-4v2h4zM21 4c0-1.1-.9-2-2-2h-4v2h4v4h2V4zM12 7l5 3-5 3-5-3 5-3zm-5 5.5l4.5 2.7v5.3L6.5 17.8v-5.3zm12 0v5.3l-5 2.7v-5.3l5-2.7z"/></svg>');
}

#ar-button:active {
  background-color: #e65c00;
  color: #ffffff;
}

#ar-button:focus {
  outline: none;
}

#ar-button:focus-visible {
  outline: 2px solid #ff6600;
  outline-offset: 2px;
}

/* AR Prompt Toast */
.ar-prompt {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 19, 24, 0.9);
  color: #ffffff;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  border: 1px solid #ff6600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 80;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: none;
}

.ar-prompt.visible {
  opacity: 1;
  visibility: visible;
}

/* Interaction Prompt (Hand Icon) matching model-viewer */
.interaction-prompt {
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 45;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.interaction-prompt.visible {
  opacity: 1;
  visibility: visible;
}

.interaction-prompt-hand-wrap {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(18, 19, 24, 0.68);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  animation: prompt-hand-nudge 1.8s ease-in-out infinite;
}

.interaction-prompt-hand {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

@keyframes prompt-hand-nudge {
  0% {
    transform: translateX(-22px) rotate(-8deg);
  }
  50% {
    transform: translateX(22px) rotate(8deg);
  }
  100% {
    transform: translateX(-22px) rotate(-8deg);
  }
}

/* ==========================================================================
   Configurator UI: Floating Toggle, Drawer, Swatches & Toast
   ========================================================================== */

/* Floating Trigger Button in Corner */
.config-toggle-btn {
  position: absolute;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  right: max(24px, env(safe-area-inset-right, 0px));
  height: 42px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #ffffff;
  background: rgba(18, 19, 24, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid #ff6600;
  border-radius: 0;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 60;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.config-toggle-btn:hover {
  background-color: #ff6600;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(255, 102, 0, 0.4);
}

.config-toggle-btn:active {
  transform: scale(0.96);
}

.config-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Configurator Slide-up / Floating Panel */
.config-panel {
  position: absolute;
  bottom: 82px;
  right: 24px;
  width: 320px;
  max-width: calc(100vw - 48px);
  background: rgba(16, 17, 22, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: 2px solid #ff6600;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 24px rgba(255, 102, 0, 0.12);
  padding: 16px 18px;
  color: #ffffff;
  z-index: 70;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.25s ease;
  box-sizing: border-box;
}

.config-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.config-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.config-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.config-title-icon {
  width: 18px;
  height: 18px;
}

.config-panel-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #ffffff;
}

.config-close-btn {
  background: transparent;
  border: none;
  color: #8e909a;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.15s ease;
}

.config-close-btn:hover {
  color: #ff6600;
}

/* Sections */
.config-section {
  margin-bottom: 16px;
}

.config-section-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.config-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #8e909a;
  text-transform: uppercase;
}

.config-active-name {
  font-size: 12px;
  font-weight: 600;
  color: #ff6600;
  text-align: right;
  max-width: 170px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Leather Swatches */
.leather-swatches-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.swatch-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.swatch-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.45);
}

.swatch-btn.active {
  box-shadow: 0 0 0 2px #ff6600, 0 0 12px rgba(255, 102, 0, 0.6);
  transform: scale(1.08);
}

.swatch-btn.active::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
}

/* Leg Options (Grid of clean pills) */
.leg-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.leg-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #c2c4cf;
  font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 11px;
  font-weight: 500;
  padding: 9px 10px;
  cursor: pointer;
  text-align: left;
  line-height: 1.3;
  transition: all 0.18s ease;
  outline: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.leg-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.leg-btn.active {
  background: rgba(255, 102, 0, 0.15);
  border-color: #ff6600;
  color: #ffffff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px #ff6600;
}

/* Footer Hint */
.config-footer-hint {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #7b7e8c;
  line-height: 1.4;
}

.hint-icon {
  font-size: 13px;
  flex-shrink: 0;
}

/* Discreet Toast Notification for 3D Mesh Tap */
.config-toast {
  position: absolute;
  top: 36px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: rgba(16, 17, 22, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid #ff6600;
  color: #ffffff;
  padding: 8px 18px;
  font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 95;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
}

.config-toast.visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Responsive adjustment for Mobile screens */
@media (max-width: 540px) {
  .config-toggle-btn {
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    right: max(14px, env(safe-area-inset-right, 0px));
    left: auto;
    height: 38px;
    padding: 0 14px;
    font-size: 12px;
    gap: 6px;
  }

  .config-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding: 16px 18px calc(24px + env(safe-area-inset-bottom, 16px));
    transform: translateY(100%);
    z-index: 75;
  }

  .config-panel.open {
    transform: translateY(0);
  }

  #ar-button {
    left: max(14px, env(safe-area-inset-left, 0px));
    right: auto;
    transform: none;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    height: 38px;
    line-height: 38px;
    font-size: 12px;
    padding: 0px 14px 0px 36px;
    background-size: 16px 16px;
    background-position: 11px 50%;
  }
}


