.domain-media-upload { padding: 14px; border: 1px dashed #9ba6b4; border-radius: 12px; }
.domain-media-upload input[type=file] { display: block; width: 100%; margin-top: 10px; }
.domain-media-upload p { font-size: 12px; line-height: 1.6; }
.domain-media-preview, .domain-existing-media { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.domain-media-preview figure, .domain-existing-media figure { width: 140px; max-width: 100%; margin: 0; overflow-wrap: anywhere; }
.domain-media-preview img, .domain-media-preview video, .domain-existing-media img, .domain-existing-media video { display: block; width: 100%; height: 100px; object-fit: contain; background: #eef1f5; border-radius: 8px; }
.domain-media-preview figcaption, .domain-existing-media label { display: block; font-size: 12px; margin-top: 6px; }

.domain-public-gallery { position: relative; width: 100%; min-width: 0; max-width: 100%; direction: ltr; }
.domain-public-gallery:focus-visible { outline: 3px solid #1b75bc; outline-offset: 3px; }
.domain-gallery-viewport { display: flex; width: 100%; aspect-ratio: 622 / 427; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; border-radius: 8px; background: #000; }
.domain-gallery-viewport::-webkit-scrollbar { display: none; }
.domain-gallery-viewport > img, .domain-gallery-viewport > video { cursor: zoom-in; }
.domain-gallery-viewport > :focus-visible { outline: 3px solid #64c9ff; outline-offset: -3px; }
html.domain-media-lightbox-open { overflow: hidden; }
.domain-media-lightbox {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  height: 100%;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: max(64px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  border: 0;
  background: transparent;
  overflow: hidden;
}
.domain-media-lightbox[open] { display: flex; align-items: center; justify-content: center; }
.domain-media-lightbox::backdrop { background: rgb(0 0 0 / 88%); }
.domain-media-lightbox > img, .domain-media-lightbox > video {
  display: block;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border: 0;
  border-radius: 0;
}
.domain-media-lightbox-close {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 0;
  border-radius: 50%;
  background: #2b2b2b;
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
}
.domain-media-lightbox-close svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.domain-media-lightbox-close:hover { background: #17834c; }
.domain-media-lightbox-close:focus-visible { outline: 3px solid #64c9ff; outline-offset: 2px; }
.video-area .domain-gallery-viewport > img, .video-area .domain-gallery-viewport > video { display: block; flex: 0 0 100%; width: 100%; min-width: 0; max-width: 100%; height: 100%; margin: 0; aspect-ratio: auto; object-fit: contain; scroll-snap-align: start; scroll-snap-stop: always; }
.domain-gallery-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 1; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid #ffffff80; border-radius: 50%; color: #fff; background: #0009; font-size: 23px; cursor: pointer; touch-action: manipulation; }
.domain-gallery-arrow:hover { background: #000d; }
.domain-gallery-arrow:focus-visible { outline: 3px solid #64c9ff; outline-offset: 2px; }
.domain-gallery-prev { left: 8px; }
.domain-gallery-next { right: 8px; }
.domain-gallery-counter { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); padding: 3px 10px; border-radius: 12px; background: #000b; color: #fff; font-size: 12px; line-height: 1.5; pointer-events: none; }
@media (max-width: 480px) {
  .domain-gallery-arrow { width: 44px; height: 44px; font-size: 20px; }
  .domain-gallery-prev { left: 4px; }
  .domain-gallery-next { right: 4px; }
}
