.xhq-product-viewer {
  --xhq-viewer-top: max(12px, env(safe-area-inset-top, 0px));
  --xhq-viewer-right: max(12px, env(safe-area-inset-right, 0px));
  --xhq-viewer-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  --xhq-viewer-left: max(12px, env(safe-area-inset-left, 0px));
  box-sizing: border-box;
  position: fixed;
  inset: var(--xhq-viewer-top) var(--xhq-viewer-right) var(--xhq-viewer-bottom) var(--xhq-viewer-left);
  width: min(1100px, calc(100vw - var(--xhq-viewer-left) - var(--xhq-viewer-right)));
  height: min(900px, calc(100vh - var(--xhq-viewer-top) - var(--xhq-viewer-bottom)));
  height: min(900px, calc(100dvh - var(--xhq-viewer-top) - var(--xhq-viewer-bottom)));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: 16px;
  background: #fff;
  color: #183444;
  box-shadow: 0 24px 100px rgba(6, 23, 34, .3);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  overscroll-behavior: contain;
}

.xhq-product-viewer[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.xhq-product-viewer::backdrop {
  background: rgba(8, 25, 36, .62);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.xhq-product-viewer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px 16px;
  border-bottom: 1px solid #e4ecef;
  background: #fff;
}

.xhq-product-viewer__title {
  min-width: 0;
  margin: 0;
  color: inherit;
  font-size: clamp(15px, 2vw, 18px);
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.xhq-product-viewer__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid #dce7eb;
  border-radius: 10px;
  background: #f4f8f9;
  color: #294c5d;
  font: inherit;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.xhq-product-viewer__close:hover {
  background: #e7f1ee;
  color: #106c57;
}

.xhq-product-viewer__close:focus-visible {
  outline: 3px solid #38a78d;
  outline-offset: 3px;
}

.xhq-product-viewer__stage {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: clamp(12px, 2.5vw, 28px);
  overflow: hidden;
  background: #f5f8f9;
}

.xhq-product-viewer__image {
  grid-area: 1 / 1;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
}

.xhq-product-viewer__status {
  grid-area: 1 / 1;
  max-width: 100%;
  margin: 0;
  color: #617985;
  font-size: 14px;
  line-height: 1.7;
  text-align: center;
  overflow-wrap: anywhere;
}

.xhq-product-viewer [hidden] {
  display: none !important;
}

@media (max-height: 480px) {
  .xhq-product-viewer__header { padding: 6px 12px; }
  .xhq-product-viewer__stage { padding: 8px; }
}
