.coa-lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, 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));
}

.coa-lightbox[hidden] {
  display: none;
}

.coa-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.88);
  cursor: zoom-out;
}

.coa-lightbox__panel {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.coa-lightbox__toolbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.coa-lightbox__close {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.coa-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.coa-lightbox__close-x {
  font-size: 1.1rem;
  line-height: 1;
}

.coa-lightbox__counter {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.coa-lightbox__stage {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.coa-lightbox__figure {
  margin: 0;
  flex: 1;
  min-width: 0;
  text-align: center;
}

.coa-lightbox__figure img {
  display: block;
  max-width: 100%;
  max-height: min(72vh, 760px);
  width: auto;
  height: auto;
  margin: 0 auto;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  background: #fff;
}

.coa-lightbox__figure figcaption {
  margin-top: 0.75rem;
  color: #e2e8f0;
  font-size: clamp(0.78rem, 2.4vw, 0.88rem);
  line-height: 1.45;
}

.coa-lightbox__nav {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.coa-lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.2);
}

.coa-lightbox__nav[hidden] {
  display: none;
}

.coa-lightbox__hint {
  margin: 0;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.coa-lightbox__library {
  margin: 0;
  font-size: 0.72rem;
}

.coa-lightbox__library a {
  color: #93c5fd;
  font-weight: 600;
}

@media (max-width: 640px) {
  .coa-lightbox__nav {
    width: 2.2rem;
    height: 2.2rem;
    font-size: 1.1rem;
  }

  .coa-lightbox__close-text {
    display: none;
  }

  .coa-lightbox__close {
    padding: 0.45rem 0.65rem;
  }
}
