:root {
  --bg: #0e0f12;
  --fg: #f5f5f7;
  --muted: rgba(245, 245, 247, .6);
  --radius: 14px;
  --shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.slider {
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.stage {
  position: relative;
  width: min(100%, 1200px);
  height: 100%;
  overflow: hidden;
  border-radius: var(--radius);
  background: #000;
  box-shadow: var(--shadow);
}

.slide {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity .45s ease, transform .45s ease;
  transform: scale(1.02);
  display: flex;
  align-items: center;
  justify-content: center;
}

.slide.active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.slide img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.slide figcaption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 60px 24px 24px;
  background: linear-gradient(to top,
              rgba(0,0,0,.85) 0%,
              rgba(0,0,0,.55) 45%,
              rgba(0,0,0,0) 100%);
  color: var(--fg);
  font-size: clamp(14px, 1.4vw, 17px);
  line-height: 1.5;
  text-align: center;
  max-height: 40%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* Навигация */
.nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(20, 20, 24, .55);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .25s ease, background .25s ease, transform .15s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 3;
}

.stage:hover .nav { opacity: 1; }
.nav:hover       { background: rgba(40, 40, 46, .8); }
.nav:active      { transform: translateY(-50%) scale(.94); }

.nav.prev { left: 16px; }
.nav.next { right: 16px; }

/* Прогресс и счётчик */
.progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgba(255,255,255,.08);
  z-index: 4;
}
.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: #fff;
  transition: width .35s ease;
}

.counter {
  position: absolute;
  top: 14px;
  right: 16px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--fg);
  background: rgba(20, 20, 24, .55);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 4;
  font-variant-numeric: tabular-nums;
}

/* Заглушка */
.empty {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  color: var(--fg);
}
.empty h1 { font-weight: 600; margin: 0 0 8px; }
.empty p  { color: var(--muted); margin: 0; }
.empty code {
  background: rgba(255,255,255,.08);
  padding: 2px 6px;
  border-radius: 6px;
}

/* Мобильные */
@media (max-width: 720px) {
  .stage { border-radius: 0; box-shadow: none; width: 100%; }
  .nav   { display: none; }  /* свайп + тап работают */
  .counter { top: 10px; right: 10px; font-size: 12px; }
  .slide figcaption {
    padding: 40px 16px 20px;
    max-height: 50%;
  }
}