.woocommerce-product-gallery {
  position: relative;
}

.woocommerce-product-gallery .woocommerce-product-gallery__trigger {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  z-index: 25 !important;
}

.phi-3d-trigger {
  position: absolute;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid rgba(17, 17, 17, 0.7) !important;
  border-radius: 3px !important;
  background: rgba(255, 255, 255, 0.48) !important;
  color: #111 !important;
  box-shadow: none !important;
  font: 700 13px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0.08em;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background-color 160ms ease, transform 160ms ease;
}

.phi-3d-trigger:hover,
.phi-3d-trigger:focus-visible {
  border-color: #111 !important;
  background: rgba(255, 255, 255, 0.82) !important;
  color: #000 !important;
  transform: translateY(-1px);
}

.phi-3d-trigger:focus-visible,
.phi-3d-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.phi-3d-trigger-icon {
  font-size: 19px;
  line-height: 0.8;
}

.phi-3d-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: none;
  place-items: center;
  padding: clamp(12px, 3vw, 40px);
}

.phi-3d-modal.is-open {
  display: grid;
}

.phi-3d-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(5px);
}

.phi-3d-dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(1440px, 92vw);
  height: min(900px, 90vh);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  background: #111;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

.phi-3d-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 8px 12px 8px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  background: #111;
  color: #fff;
}

.phi-3d-header h2 {
  margin: 0;
  color: inherit;
  font: 600 16px/1.35 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.phi-3d-close {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid #3a3a3a !important;
  border-radius: 3px !important;
  background: #000 !important;
  color: #fff !important;
  box-shadow: none !important;
  font: 300 34px/1 sans-serif;
  cursor: pointer;
}

.phi-3d-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: #f4f4f4;
}

.phi-3d-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #222;
  font: 500 15px/1.4 system-ui, sans-serif;
}

.phi-3d-frame {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  opacity: 0;
  transition: opacity 180ms ease;
}

.phi-3d-modal.is-loaded .phi-3d-frame {
  opacity: 1;
}

.phi-3d-modal-open {
  overflow: hidden !important;
}

@media (max-width: 767px) {
  .phi-3d-modal {
    padding: 0;
  }

  .phi-3d-dialog {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .phi-3d-header {
    min-height: 54px;
    padding-left: 15px;
  }

  .phi-3d-trigger {
    min-height: 40px;
    padding: 9px 12px;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .phi-3d-trigger,
  .phi-3d-frame {
    transition: none;
  }
}
