: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;
  display: grid;
  grid-template-columns: minmax(48px, 72px) 1fr minmax(48px, 72px);
  align-items: stretch;
}

.stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  background: radial-gradient(circle at center, #1b1b1b 0%, #0a0a0a 70%);
}

#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 {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 20;
  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);
}

.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:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

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

.go-to-site {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 16px;
  border-radius: 12px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  background: rgba(24, 24, 24, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(4px);
}

.go-to-site:hover {
  background: rgba(36, 36, 36, 0.92);
}

/* [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-width: auto;
    min-height: 56px;
    padding: 16px 28px;
    font-size: 18px;
    letter-spacing: 0.03em;
    border-radius: 14px;
    justify-content: center;
    color: #fff;
    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);
  }
}

@media (max-width: 700px) {
  .viewer {
    grid-template-columns: 52px 1fr 52px;
  }

  .counter {
    top: 10px;
    left: 10px;
    font-size: 13px;
  }

  .go-to-site {
    right: 10px;
    bottom: 10px;
    width: calc(100% - 20px);
    max-width: 240px;
  }
}
