:root {
  --surface: #1a1a1a;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f0ede8;
  --accent: #c9a96e;
  --radius: 20px;
  --dot-size: 7px;

  --modal-w-normal: min(95vw, 600px);
  --modal-w-zoomed: min(99vw, 960px);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 101;
  display: flex;
  align-items: start;
  justify-content: center;
  overflow-y: auto;
  pointer-events: none;
}

.modal-box {
  position: relative;
  border-radius: var(--radius);
  width: var(--modal-w-normal);
  aspect-ratio: 2 / 3;
  display: flex;
  flex-direction: column;
  overflow: auto;
  transform: scale(0.88) translateY(24px);
  opacity: 0;
  transition:
    transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.35s ease,
    width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
}
.modal-box.active {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}
.modal-box.zoomed {
  width: var(--modal-w-zoomed);
}

.carousel-wrapper {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  cursor: grab;
  background: #fffdfd;
}
.carousel-wrapper.grabbing { cursor: grabbing; }

.carousel-track {
  display: flex;
  touch-action: none;
  user-select: none;
}
.carousel-track.animating {
  transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide {
  min-width: 100%;
  position: relative;
  padding-top: calc(100% * 3 / 2);
  overflow: hidden;
  flex-shrink: 0;
}
.slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.carousel-top {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
}

.top-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(2px);
  color: #000000;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}
.top-btn:hover {
  background: rgba(218, 218, 218, 0.65);
  border-color: rgba(255, 255, 255, 0.45);
}

.arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-100%);
  z-index: 5;
  width: 12px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #252525;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.arrow:hover {
  background: rgba(255, 255, 255, 0.15);
}
.arrow:active { transform: translateY(-100%) scale(0.9); }
.prev { left: 10px; }
.next { right: 10px; }

.carousel-bottom {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.dots {
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: all;
}
.dot {
  width: var(--dot-size);
  height: var(--dot-size);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  border: none;
  padding: 0;
  transition: background 0.25s, width 0.25s, border-radius 0.25s;
  -webkit-tap-highlight-color: transparent;
}
.dot.active {
  background: #ffffff;
  width: calc(var(--dot-size) * 2.8);
  border-radius: 4px;
}

/* RESPONSIVE */
@media (max-width: 500px) {
  :root {
    --modal-w-normal: 92vw;
    --modal-w-zoomed: 98vw;
  }
  
  .modal {
    align-items: center;
  }

  .arrow {
    font-size: 1rem;
  }
}