:root {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: #0a0a0a;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  overflow: hidden;
}

.viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.stage {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  min-height: 0;
  background: radial-gradient(circle at center, #1b1b1b 0%, #0a0a0a 70%);
}

.viewer-toolbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(5rem, 1fr) auto minmax(5rem, 1fr);
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  z-index: 20;
}

#prevBtn {
  justify-self: start;
}

#nextBtn {
  justify-self: end;
}

.stage-img-wrap {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.stage-img-wrap #viewerImage {
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  opacity: 1;
  transition: opacity 180ms ease;
}

#viewerImage.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.counter {
  justify-self: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  white-space: nowrap;
}

.nav {
  border: 0;
  color: rgba(255, 255, 255, 0.85);
  background: transparent;
  cursor: pointer;
  font-size: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.nav.nav-text {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 8px 16px;
  border-radius: 999px;
  line-height: 1.2;
  white-space: nowrap;
  min-width: 5rem;
}

.nav:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.nav:active {
  background: rgba(255, 255, 255, 0.1);
}

.nav[hidden] {
  visibility: hidden !important;
  pointer-events: none !important;
}

.go-to-site {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 14px 22px;
  border-radius: 14px;
  font-size: 16px;
  letter-spacing: 0.02em;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  background: linear-gradient(180deg, #1f8f56 0%, #146b3d 100%);
  border: 2px solid rgba(255, 255, 255, 0.45);
  box-shadow:
    0 10px 32px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.go-to-site:hover {
  background: linear-gradient(180deg, #27a062 0%, #187548 100%);
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* [hidden] alone is overridden by display:inline-flex above — force hide when toggled in JS */
.go-to-site[hidden] {
  display: none !important;
}

@media (min-width: 701px) {
  .go-to-site {
    left: auto;
    right: 24px;
    bottom: 28px;
    transform: none;
    min-height: 56px;
    padding: 16px 28px;
    font-size: 18px;
    letter-spacing: 0.03em;
  }
}

@media (max-width: 700px) {
  .viewer-toolbar {
    padding: 10px 12px;
    grid-template-columns: minmax(4.25rem, 1fr) auto minmax(4.25rem, 1fr);
    gap: 6px;
  }

  .nav.nav-text {
    font-size: 14px;
    padding: 7px 12px;
    min-width: 4.25rem;
  }

  .counter {
    font-size: 13px;
    padding: 6px 10px;
  }

  .go-to-site {
    right: 10px;
    bottom: 12px;
    left: 10px;
    width: auto;
    max-width: none;
    justify-content: center;
    min-height: 50px;
    padding: 14px 18px;
    font-size: 16px;
  }
}
