/* MyToui Theme — product-gallery lightbox owns one fixed viewport layer. */
.mytoui-theme .mytoui-gallery-lightbox {
  position: fixed;
  z-index: 2147483200;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px;
  background: var(--mt-lightbox-bg, rgba(15,23,42,.92));
  overscroll-behavior: contain;
  touch-action: none;
}
.mytoui-theme .mytoui-gallery-lightbox[hidden] { display: none !important; }

.mytoui-theme .mytoui-gallery-lightbox__thumbs {
  z-index: 8;
  order: 1;
  display: flex;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  padding: 4px 64px 10px;
  overflow-x: auto;
  scrollbar-width: none;
  touch-action: pan-x;
}
.mytoui-theme .mytoui-gallery-lightbox__thumbs::-webkit-scrollbar { display: none; }
.mytoui-theme .mytoui-gallery-lightbox__thumb {
  flex: 0 0 68px;
  width: 68px;
  height: 68px;
  padding: 2px;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 11px;
  background: rgba(255,255,255,.12);
}
.mytoui-theme .mytoui-gallery-lightbox__thumb.is-active { border-color: #fff; background: #fff; }
.mytoui-theme .mytoui-gallery-lightbox__thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }

.mytoui-theme .mytoui-gallery-lightbox__stage {
  position: relative;
  order: 2;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: auto;
  touch-action: pan-x pan-y;
}
.mytoui-theme .mytoui-gallery-lightbox__image {
  display: block;
  max-width: 92%;
  max-height: 100%;
  object-fit: contain;
  transform: scale(var(--mt-lightbox-scale,1));
  transform-origin: center;
  transition: transform .16s ease;
}
.mytoui-theme .mytoui-gallery-lightbox__nav {
  position: fixed;
  z-index: 10;
  top: 50%;
  display: grid;
  place-items: center;
  width: max(52px,var(--mt-lightbox-control-size,44px));
  height: max(52px,var(--mt-lightbox-control-size,44px));
  padding: 0;
  border: 1px solid var(--mt-lightbox-control-border,rgba(255,255,255,.28));
  border-radius: 50%;
  color: var(--mt-lightbox-control-color,#fff);
  background: var(--mt-lightbox-control-bg,rgba(17,24,39,.82));
  box-shadow: 0 8px 24px rgba(0,0,0,.26);
  transform: translateY(-50%);
}
.mytoui-theme .mytoui-gallery-lightbox__nav.is-prev { left: 12px; }
.mytoui-theme .mytoui-gallery-lightbox__nav.is-next { right: 12px; }
.mytoui-theme .mytoui-gallery-lightbox__nav svg { width: 46%; height: 46%; fill: none; stroke: currentColor; stroke-width: 2; }

.mytoui-theme .mytoui-gallery-lightbox__bottom {
  z-index: 9;
  order: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-bottom: max(6px,env(safe-area-inset-bottom,0px));
  pointer-events: auto;
}
.mytoui-theme .mytoui-gallery-lightbox__zoom-group { display: flex; align-items: center; justify-content: center; gap: 7px; flex-wrap: wrap; }
.mytoui-theme .mytoui-gallery-lightbox__zoom-btn {
  display: grid;
  place-items: center;
  min-width: max(52px,var(--mt-lightbox-control-size,44px));
  height: max(52px,var(--mt-lightbox-control-size,44px));
  padding: 0 10px;
  border: 1px solid var(--mt-lightbox-control-border,rgba(255,255,255,.28));
  border-radius: 12px;
  color: var(--mt-lightbox-control-color,#fff);
  background: var(--mt-lightbox-control-bg,rgba(17,24,39,.82));
  font-weight: 850;
  box-shadow: 0 6px 18px rgba(0,0,0,.22);
}
.mytoui-theme .mytoui-gallery-lightbox__zoom-btn.is-active { outline: 2px solid rgba(255,255,255,.7); }
.mytoui-theme .mytoui-gallery-lightbox__close {
  position: fixed;
  z-index: 12;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: var(--mt-lightbox-close-size,48px);
  height: var(--mt-lightbox-close-size,48px);
  padding: 0;
  border: 1px solid var(--mt-lightbox-close-border,#991b1b);
  border-radius: 14px;
  color: var(--mt-lightbox-close-color,#fff);
  background: var(--mt-lightbox-close-bg,#dc2626);
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 8px 24px rgba(220,38,38,.24);
}

@media (max-width: 768px) {
  .mytoui-theme .mytoui-gallery-lightbox { padding: 12px; }
  .mytoui-theme .mytoui-gallery-lightbox__thumbs { justify-content: flex-start; padding-inline: 58px; }
  .mytoui-theme .mytoui-gallery-lightbox__thumb { flex-basis: 62px; width: 62px; height: 62px; }
  .mytoui-theme .mytoui-gallery-lightbox__nav.is-prev { left: 8px; }
  .mytoui-theme .mytoui-gallery-lightbox__nav.is-next { right: 8px; }
}
