:root {
  --bg: #120c09;
  --panel: rgba(18, 12, 9, 0.42);
  --text: #fff8f1;
  --muted: rgba(255, 248, 241, 0.72);
  --accent: rgba(255, 248, 241, 0.22);
  --accent-strong: rgba(255, 248, 241, 0.94);
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
  --radius: 999px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: #000;
  overflow: hidden;
}

.nav-button {
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 180ms ease, background-color 180ms ease, opacity 180ms ease;
}

.nav-button:active {
  transform: scale(0.98);
}

.viewer {
  position: relative;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
}

.carousel-track {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.slide {
  min-width: 100%;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  -webkit-overflow-scrolling: touch;
}

.slide-card {
  margin: 0;
  width: 100%;
  min-height: 100%;
}

.slide-card img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: initial;
  user-select: none;
  -webkit-user-drag: none;
  background: #000;
}

.empty-state {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 32px;
  color: var(--muted);
  font-size: 1rem;
  text-align: center;
}

.nav-button {
  position: absolute;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 2;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--panel);
  color: var(--accent-strong);
  font-size: 1.9rem;
  line-height: 1;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  opacity: 0.92;
}

.nav-prev {
  left: max(12px, env(safe-area-inset-left));
}

.nav-next {
  right: max(12px, env(safe-area-inset-right));
}

.viewer-footer {
  position: absolute;
  right: 0;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 0;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding-inline: 84px;
  pointer-events: none;
}

.counter {
  padding: 8px 14px;
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.counter.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.dots {
  display: flex;
  justify-content: center;
  flex-wrap: nowrap;
  gap: 6px;
  max-width: min(100%, 220px);
  overflow-x: auto;
  padding: 2px 4px;
  scrollbar-width: none;
  pointer-events: auto;
}

.dots::-webkit-scrollbar {
  display: none;
}

.dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 248, 241, 0.28);
  -webkit-tap-highlight-color: transparent;
}

.dot.is-active {
  background: var(--accent-strong);
  transform: scale(1.12);
}

@media (max-width: 640px) {
  .nav-button {
    width: 50px;
    height: 50px;
  }

  .nav-prev {
    left: 14px;
  }

  .nav-next {
    right: 14px;
  }

  .viewer-footer {
    padding-inline: 80px;
  }

  .dots {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }

  .carousel-track {
    scroll-behavior: auto;
  }
}
