:root {
  color-scheme: dark;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #111315;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #111315;
}

button {
  font: inherit;
}

.viewer {
  position: relative;
  display: grid;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  place-items: center;
  padding: clamp(12px, 2.5vw, 40px);
  background: #111315;
}

.slide-stage {
  display: grid;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  place-items: center;
  border: 0;
  outline: 0;
  background: transparent;
  cursor: pointer;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}

.slide-stage:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.72);
  outline-offset: 4px;
}

.slide-stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.36);
}

.counter,
.fullscreen {
  position: fixed;
  z-index: 2;
  bottom: max(14px, env(safe-area-inset-bottom));
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 17, 19, 0.72);
  color: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.counter {
  left: 50%;
  min-width: 64px;
  padding: 7px 12px;
  transform: translateX(-50%);
  border-radius: 999px;
  font-size: 13px;
  line-height: 1;
  text-align: center;
  letter-spacing: 0.03em;
}

.fullscreen {
  right: max(14px, env(safe-area-inset-right));
  display: grid;
  width: 38px;
  height: 38px;
  padding: 9px;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
}

.fullscreen:hover {
  color: #fff;
  background: rgba(34, 37, 40, 0.88);
}

.fullscreen:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.72);
  outline-offset: 3px;
}

.fullscreen svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.collapse-icon {
  display: none;
}

:fullscreen .expand-icon {
  display: none;
}

:fullscreen .collapse-icon {
  display: block;
}

@media (max-width: 640px) {
  .viewer {
    padding: 8px;
  }

  .slide-stage img {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.32);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .slide-stage img {
    animation: slide-in 140ms ease-out;
  }

  @keyframes slide-in {
    from {
      opacity: 0.7;
    }
    to {
      opacity: 1;
    }
  }
}
