:root {
  --pv-bg: #0cc17b;
  --pv-white: #fff;
  --pv-blue: #1998d5;
  --transition-fast: 0.3s ease;
  --icon-size: 24px;
  --bp-desktop: 1024px;
  --bp-tablet: 768px;
  --bp-mobile: 600px;
  --menu-margin: 12px;
  --menu-max-height: 398px;
  /* scale based on available viewport height and width */
  --menu-height-scale: calc((100vh - 2 * var(--menu-margin)) / var(--menu-max-height));
  --menu-width-scale: calc((100vw - 2 * var(--menu-margin)) / var(--menu-max-height));
  --menu-scale: min(1, var(--menu-height-scale), var(--menu-width-scale));
  --label-scale: var(--menu-scale);
  /* use more moderate legend scaling to prevent excessive shrinking */
  --legend-min-scale: 1;
  --legend-scale: max(var(--legend-min-scale), var(--menu-scale));
}

body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
}

/* Sets the size of the model viewer*/
model-viewer {
  width: 100%;
  height: 100%;
  background-color: var(--pv-bg);
}

/* Visible Hotspot dots */
.Hotspot {
  background: var(--pv-white);
  border-radius: 32px;
  border: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
  cursor: pointer;
  height: 16px;
  padding: 2px;
  position: relative;
  transition: opacity 1.6s cubic-bezier(0.4, 0, 0.2, 1);
  width: 16px;
  opacity: 1; /* Default semi-transparent */
}
/* Keyframes */
@keyframes hotspot-pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}
.Hotspot.pulse {
  animation: hotspot-pulse 0.8s cubic-bezier(0.4, 0, 0.2, 1) 1;
  opacity: 1 !important;
}

.Hotspot.pulse > .HotspotAnnotation {
  animation: hotspot-pulse 0.8s cubic-bezier(0.4, 0, 0.2, 1) 1;
  opacity: 1 !important;
}

/* Hidden Hotspots merged */
.Hotspot:not([data-visible]) {
  background: transparent;
  border: 4px solid var(--pv-white);
  box-shadow: none;
  opacity: .4;
  transform: translateY(calc(-50% + 4px));
  transition: transform .3s, opacity .3s;
  pointer-events: auto; /* allow occluded hotspots to be clickable */
}

.Hotspot:focus,
.Hotspot:hover {
  opacity: 1 !important;
}

.Hotspot.selected {
  background: #ffa80a !important;
  border: 4px solid #ffa80a !important;
  color: #fff;
  opacity: 1 !important;
}

.Hotspot:focus {
  border: 4px solid var(--pv-blue);
  height: 32px;
  outline: none;
  width: 32px;
}

.Hotspot>* {
  opacity: 1;
  transform: translateY(-50%);
}

/* Hotspot labels */
.HotspotAnnotation {
  background: var(--pv-white);
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  color: rgba(0, 0, 0, 0.8);
  display: block;
  font-family: Helvetica Neue, sans-serif;
  font-size: 14px;
  font-weight: 400;
  left: calc(100% + 1em);
  max-width: 266px;
  overflow-wrap: break-word;
  padding: 0.5em 1em;
  position: absolute;
  top: 50%;
  width: max-content;
  opacity: 0.8;
  transition: transform 0.2s cubic-bezier(.4,2,.6,1), opacity 0.2s, background 0.2s, color 0.2s;
  transform-origin: left center;
  z-index: 2;
}

.Hotspot.selected > .HotspotAnnotation,
.Hotspot:hover > .HotspotAnnotation {
  opacity: 1 !important;
  transform: scale(1.5) translateY(-35%);
  z-index: 10;
}

.Hotspot.selected > .HotspotAnnotation {
  background: #2b7193 !important;
  color: #fff !important;
}

.progress-bar {
  display: block;
  width: 33%;
  height: 10%;
  max-height: 2%;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate3d(-50%, -50%, 0);
  border-radius: 25px;
  box-shadow: 0px 3px 10px 3px rgba(0, 0, 0, 0.5), 0px 0px 5px 1px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.9);
  background-color: rgba(0, 0, 0, 0.5);
}

.update-bar {
  background-color: rgba(255, 255, 255, 0.9);
  width: 0%;
  height: 100%;
  border-radius: 25px;
  float: left;
  transition: width 0.3s;
}

#ar-button {
  background-image: url(ar_icon.png);
  background-repeat: no-repeat;
  background-size: 20px 20px;
  background-position: 12px 50%;
  background-color: var(--pv-white);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  bottom: 16px;
  padding: 0px 16px 0px 40px;
  font-family: Roboto Regular, Helvetica Neue, sans-serif;
  font-size: 14px;
  color: var(--pv-blue);
  height: 36px;
  line-height: 36px;
  border-radius: 18px;
  border: 1px solid #DADCE0;
}

#ar-button:active {
  background-color: #E8EAED;
}

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

#ar-button:focus-visible {
  outline: 1px solid var(--pv-blue);
}

@keyframes circle {
  from {
    transform: translateX(-50%) rotate(0deg) translateX(50px) rotate(0deg);
  }

  to {
    transform: translateX(-50%) rotate(360deg) translateX(50px) rotate(-360deg);
  }
}

@keyframes elongate {
  from {
    transform: translateX(100px);
  }

  to {
    transform: translateX(-100px);
  }
}

model-viewer>#ar-prompt {
  position: absolute;
  left: 50%;
  bottom: 60px;
  animation: elongate 2s infinite ease-in-out alternate;
  display: none;
}

model-viewer[ar-status="session-started"]>#ar-prompt {
  display: block;
}

model-viewer>#ar-prompt>img {
  animation: circle 4s linear infinite;
}


.hide {
  display: none;
}

#legendBtn {
  display: flex;
  justify-content: flex-end;
  position: absolute;
  bottom: 10px;
  right: 10px;
  height: 32px;
  width: 32px;
  background: transparent;
  border-radius: 32px;
  border-style: solid;
  border-width: 10px;
  border-color: var(--pv-white);
  -webkit-transition: border-color 0.3s ease-in-out;
  transition: border-color 0.3s ease-in-out;
  pointer-events: all;
  cursor: pointer;
}

#legendBtn:hover {
  border-color: var(--pv-blue);
}

/* Legend overlay centered, auto-sizing to content, scroll if too tall */
#legend-container {
  position: fixed;
  /* position higher to use vertical space better */
  bottom: 25%;
  left: calc(var(--menu-margin) + var(--nav-width) + 12px);
  transform-origin: bottom left;
  /* auto-height to fit content snugly */
  height: auto;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  gap: calc(1rem * var(--menu-scale));
  z-index: 1001;
  width: auto;
  max-width: calc(100vw - var(--nav-width) - 2rem);
  box-sizing: border-box;
  /* prevent scrollbars, fit content exactly */
  overflow: visible;
  padding: calc(1rem * var(--menu-scale));
  /* use menu scale directly for consistent scaling */
  transform: scale(var(--legend-scale));
}

#legend-container .legend-row {
  display: flex;
  align-items: center;
  gap: calc(0.5rem * var(--menu-scale));
}

#legend-container .legend-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#legend-container .legend-icon.desktop-icon {
  margin-left: calc(0.25rem * var(--menu-scale));
}

#legend-container .legend-text {
  margin: calc(0.75rem * var(--menu-scale)) calc(0.5rem * var(--menu-scale)) 0 calc(0.5rem * var(--menu-scale));
  color: var(--pv-blue);
  font-size: calc(2.5em * var(--menu-scale));
  font-family: DINCondensed-Bold, sans-serif;
}

#legend-container .legend-row svg {
  width: auto;
  height: calc(5.5em * var(--menu-scale));
  flex-shrink: 0;
}

#legend-container.hide {
  display: none !important;
}

.flipped {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--pv-blue);
  border-radius: 50%;
  border: none;
  width: calc(48px * var(--menu-scale));
  height: calc(48px * var(--menu-scale));
  transition: max-width 0.3s ease-in-out;
}

#mobile {
  display: none;
}

@media screen and (max-width: var(--bp-tablet)) {
  .flipped:hover {
    max-width: 48px;
  }

  #mobile {
    display: block;
  }

  #legend-container {
    max-height: fit-content;
  }

  #legendBtn:hover {
    -webkit-transition: border-color 0s ease-in-out;
    transition: border-color 0s ease-in-out;
  }
}

@media screen and (max-width: var(--bp-mobile)) {
  .flipped:hover {
    max-width: 48px;
  }

  #mobile {
    display: block;
  }

  #legend-container {
    max-height: fit-content;
  }

  #legendBtn:hover {
    -webkit-transition: border-color 0s ease-in-out;
    transition: border-color 0s ease-in-out;
  }
}

#unbox-progress-container {
  position: fixed;
  bottom: 30px;
  /* Adjust according to your needs */
  left: 50%;
  transform: translateX(-50%);
  height: 10px;
  /* Adjust the height as needed */
  width: 60%;
  /* Adjust the width as needed */
  background-color: rgba(255, 255, 255, 0.6);
  border-radius: 10px;
  /* Rounded corners */
}

#unbox-progress-bar {
  height: 100%;
  width: 0%;
  background-color: var(--pv-blue);
  border-radius: 10px;
  /* Rounded corners */
}

#step-textbox-container {
  position: fixed;
  bottom: 55px;
  left: 50%;
  transform: translateX(-50%);
  height: 75px;
  width: 60%;
  background-color: rgba(25, 152, 213, 0.3);
  border-radius: 10px;
  display: flex;
  /* Enable Flexbox */
  align-items: center;
  /* Center content vertically */
  justify-content: center;
  /* Center content horizontally */
}

#step-textbox {
  text-align: center;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  /* Adjust as needed */
  padding: 0 10px;
  /* Optional: Add some horizontal padding if needed */
  font-family: Futura, Helvetica Neue, sans-serif;
  font-size: 1em;
  font-weight: 300;
}

.hidden {
  display: none !important;
}

/* Screen-reader only (visually hidden) */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
  white-space: nowrap;
}

/* ---- Merged from 3dpv-menu-styles.css ---- */
/* Base styles for menu UI */
.menu-container {
  position: absolute;
  bottom: var(--menu-margin);
  left: var(--menu-margin);
  z-index: 10;
  transform: scale(var(--menu-scale)) !important;
  transform-origin: bottom left !important;
}

.button-container {
  position: absolute;
  bottom: 80px;
  left: 0;
  display: flex;
  flex-direction: column-reverse;
  gap: 16px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.button-container.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.button-container.visible .menu-button:nth-child(4) {
  transition-delay: 100ms;
}

.button-container.visible .menu-button:nth-child(3) {
  transition-delay: 150ms;
}

.button-container.visible .menu-button:nth-child(2) {
  transition-delay: 200ms;
}

.button-container.visible .menu-button:nth-child(1) {
  transition-delay: 250ms;
}

.button-container.visible .menu-button {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.main-button {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.9);
  color: #3b82f6;
  border: none;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: relative;
  z-index: 20;
}

.main-button:hover {
  background-color: #ffffff;
}

.main-button.active {
  background-color: #3b82f6;
  color: white;
}

.menu-button {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.9);
  color: #3b82f6;
  border: none;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  position: relative;
}

.menu-button:hover {
  background-color: #ffffff;
}

.menu-button.active {
  background-color: #3b82f6;
  color: white;
}

.button-label {
  position: absolute;
  left: 64px;
  background-color: #1f2937;
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  /* compensate parent scaling: effective scale = var(--label-scale) */
  transform: scale(calc(var(--label-scale) / var(--menu-scale))) translateX(-10px);
  transform-origin: left center;
  transition: all 0.2s ease;
  pointer-events: none;
}

/* Show labels on touch-only and hybrid devices when menu is visible */
@media (any-pointer: coarse) {
  .button-container.visible .button-label {
    opacity: 1;
    transform: scale(calc(var(--label-scale) / var(--menu-scale))) translateX(0);
  }
}

/* Show labels on non-touch (hover-capable) devices on button hover */
@media (hover: hover) and (pointer: fine) {
  .button-container.visible .menu-button:hover .button-label {
    opacity: 1;
    transform: scale(calc(var(--label-scale) / var(--menu-scale))) translateX(0);
  }
}

.menu-button:hover .button-label {
  opacity: 1;
  transform: scale(calc(var(--label-scale) / var(--menu-scale))) translateX(0);
}

.icon {
  width: var(--icon-size);
  height: var(--icon-size);
  transform-origin: center;
  transition: transform var(--transition-fast);
}

.hidden {
  display: none;
}

.nav-card {
  position: absolute;
  bottom: 24px;
  left: 96px;
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 24px;
  width: 320px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  pointer-events: none;
}

.nav-card.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.nav-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.nav-card-header h3 {
  font-size: 18px;
  font-weight: 500;
  color: #1e40af;
}

.nav-card-header button {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
}

.nav-card-header button:hover {
  color: #374151;
}

.nav-card-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-icon {
  background-color: #e0f2fe;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-title {
  font-weight: 500;
  color: #3b82f6;
  margin-bottom: 4px;
}

.nav-desc {
  font-size: 14px;
  color: #6b7280;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
  font-size: 20px;
  font-weight: 600;
  color: #1e40af;
}

.modal-header button {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
}

.modal-header button:hover {
  color: #374151;
}

.modal-body {
  padding: 24px;
}

.modal-body h4 {
  font-size: 18px;
  font-weight: 500;
  color: #1f2937;
  margin-bottom: 12px;
}

.modal-body p {
  color: #4b5563;
  margin-bottom: 16px;
  line-height: 1.5;
}

.help-section {
  margin-bottom: 20px;
}

.help-section h5 {
  font-size: 16px;
  font-weight: 500;
  color: #3b82f6;
  margin-bottom: 8px;
}

.help-section ul {
  list-style-type: none;
  padding-left: 0;
}

.help-section li {
  padding: 6px 0;
  color: #4b5563;
  line-height: 1.4;
}

@media (max-width: var(--bp-tablet)) {
  .nav-card {
    bottom: 96px;
    left: 24px;
    width: 280px;
  }

  .modal-content {
    width: 95%;
    max-height: 70vh;
  }
}

/* ---- end merged styles ---- */

/* Menu toggle icon rotation */
#menu-icon {
  transform-origin: center;
  transition: transform var(--transition-fast);
}

#menu-btn[aria-expanded="true"] #menu-icon {
  transform: rotate(45deg);
}

#menu-btn.active {
  border-color: var(--pv-blue);
  /* optionally, mirror hover background or icon color */
  color: var(--pv-white);
}

/* Flip individual arrow paths when menu is open */
#open-close-btn[data-animation="reverse"] .icon path {
  transform: rotate(180deg);
}

/* Enable per-path transition */
.icon path {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform var(--transition-fast);
}

/* Spin counter-clockwise on reset */
@keyframes spin-ccw {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(-360deg);
  }
}

.reset-spin {
  animation: spin-ccw 0.6s ease;
}

/* Active state for nav help button when legend is visible */
#nav-card-btn.active {
  border-color: var(--pv-blue);
  /* optionally, mirror hover background or icon color */
  color: var(--pv-white);
}

/* Disable and fade controls when legend is open */
.menu-container.legend-visible #open-close-btn,
.menu-container.legend-visible #reset-btn,
.menu-container.legend-visible #hotspots-btn {
  opacity: 0.6;
  pointer-events: none;
}

/* Ensure hidden attribute hides elements */
[hidden] {
  display: none !important;
}

/* Centralized menu scaling */
