.viewer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 6, 7, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: modal-fade 0.15s ease;
}

.viewer-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

.viewer-image {
  max-width: 88vw;
  max-height: 86vh;
  border-radius: var(--radius-sm);
  transition: opacity 0.15s ease;
  user-select: none;
}

.viewer-video {
  max-width: 88vw;
  max-height: 86vh;
  border-radius: var(--radius-sm);
}

.viewer-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent);
}

.viewer-counter {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.8rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.viewer-top-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.viewer-icon-btn {
  color: rgba(255, 255, 255, 0.85);
}

.viewer-icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: transparent;
}

.viewer-icon-btn.icon-btn-danger:hover {
  background: var(--danger-soft);
  color: var(--danger-hover);
}

.viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 2.75rem;
  height: 2.75rem;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.viewer-nav svg {
  width: 20px;
  height: 20px;
}

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

.viewer-nav-prev {
  left: 1rem;
}

.viewer-nav-next {
  right: 1rem;
}

.viewer-bottombar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  padding: 2.5rem 1rem 1.25rem;
  text-align: center;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.65), transparent);
  pointer-events: none;
}

.viewer-filename {
  margin: 0 0 0.2rem;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-meta {
  margin: 0;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.78rem;
}

@media (max-width: 640px) {
  .viewer-nav {
    width: 2.25rem;
    height: 2.25rem;
  }

  .viewer-nav-prev {
    left: 0.4rem;
  }

  .viewer-nav-next {
    right: 0.4rem;
  }

  .viewer-topbar {
    padding: 0.6rem 0.6rem;
  }

  .viewer-image,
  .viewer-video {
    max-width: 94vw;
  }
}
