.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--fx-lb-bg, #0b0a09);
  color: var(--ink-light);
  display: none;
  flex-direction: column;
  width: 100vw;
  height: 100dvh;
  max-height: 100vh;
  overflow: hidden;
  user-select: none;
}

.lightbox::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse at 50% 42%, var(--fx-glow, rgba(232, 190, 107, 0.2)), transparent 68%);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.lightbox.open { display: flex; }
.lightbox.open::before { opacity: 0.22; }

.lb-progress-track {
  position: relative;
  z-index: 3;
  height: 2px;
  width: 100%;
  background: rgba(250, 246, 240, 0.1);
  flex-shrink: 0;
  overflow: hidden;
}

.lb-progress-fill {
  height: 100%;
  width: 100%;
  background: var(--fx-accent, var(--accent-gold-soft));
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 0.26s ease;
}

.lb-topbar {
  position: relative;
  z-index: 3;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 16px;
  min-height: 54px;
  background: rgba(14, 12, 10, 0.92);
  border-bottom: 1px solid rgba(232, 190, 107, 0.14);
  transition: opacity 0.22s ease;
}

.lb-status { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lb-counter { font-size: 0.84rem; font-weight: 600; letter-spacing: 0.08em; color: var(--fx-accent, var(--accent-gold-soft)); white-space: nowrap; }
.lb-album { font-size: 0.82rem; color: rgba(250, 246, 240, 0.72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.lb-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(232, 190, 107, 0.28);
  background: rgba(28, 24, 21, 0.84);
  color: var(--ink-light);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, opacity 0.2s ease;
}

.lb-icon-btn[aria-pressed="true"] {
  background: rgba(232, 190, 107, 0.24);
  border-color: var(--accent-gold-soft);
}

.lb-clean-exit {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 10;
  display: none;
}

.lightbox.is-clean .lb-clean-exit { display: inline-flex; }
.lightbox.is-clean .lb-topbar,
.lightbox.is-clean .lb-bottom,
.lightbox.is-clean .lb-nav {
  opacity: 0;
  pointer-events: none;
}

.lb-stage {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 68px;
  overflow: hidden;
}

.lb-frame-box {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-photo {
  position: absolute;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 2px;
  cursor: zoom-in;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.lb-photo.is-active {
  opacity: 1;
  pointer-events: auto;
}

.lb-stage.is-zoomed { overflow: auto; padding: 12px; cursor: zoom-out; }
.lb-stage.is-zoomed .lb-frame-box { display: block; width: auto; height: auto; }
.lb-stage.is-zoomed .lb-photo.is-active {
  position: relative;
  max-width: none;
  max-height: none;
  width: min(1720px, 185vw);
  height: auto;
  cursor: zoom-out;
}

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(232, 190, 107, 0.34);
  background: rgba(18, 15, 13, 0.78);
  color: var(--ink-light);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, opacity 0.2s ease;
}

.lb-nav--prev { left: 14px; }
.lb-nav--next { right: 14px; }
.lb-nav[hidden] { display: none; }

.lb-bottom {
  position: relative;
  z-index: 3;
  flex-shrink: 0;
  background: rgba(14, 12, 10, 0.96);
  border-top: 1px solid rgba(232, 190, 107, 0.16);
  padding: 10px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: opacity 0.22s ease;
}

.lb-meta { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-width: 0; }
.lb-meta-text { min-width: 0; }
.lb-meta h3 { margin: 0; font-size: 1.12rem; color: var(--ink-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-meta p { margin: 0; font-size: 0.8rem; color: rgba(250, 246, 240, 0.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.lb-book-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(232, 190, 107, 0.42);
  color: var(--accent-gold-soft);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.lb-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(232, 190, 107, 0.35) transparent;
}

.lb-thumb {
  flex: 0 0 auto;
  width: 66px;
  height: 48px;
  padding: 0;
  border-radius: 3px;
  border: 2px solid transparent;
  overflow: hidden;
  background: #231e1b;
  opacity: 0.56;
  cursor: pointer;
  transition: opacity 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.lb-thumb.is-active { opacity: 1; border-color: var(--fx-accent, var(--accent-gold-soft)); transform: translateY(-1px); }
.lb-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }

@media (hover: hover) and (pointer: fine) {
  .lb-icon-btn:hover { background: rgba(232, 190, 107, 0.22); border-color: var(--accent-gold-soft); }
  .lb-nav:hover { background: var(--accent-crimson); border-color: var(--accent-gold-soft); }
  .lb-book-cta:hover { background: var(--accent-crimson); border-color: var(--accent-crimson); color: #fff; }
  .lb-thumb:hover { opacity: 0.92; }
}

@media (max-width: 680px) {
  .lb-topbar { padding: 6px 10px; min-height: 52px; }
  .lb-album, .lb-icon-btn span { display: none; }
  .lb-stage { padding: 8px 6px; }
  .lb-nav { width: 44px; height: 44px; font-size: 1.3rem; }
  .lb-nav--prev { left: 8px; }
  .lb-nav--next { right: 8px; }
  .lb-bottom { padding: 8px 12px 10px; gap: 8px; }
  .lb-meta { gap: 10px; }
  .lb-meta h3 { font-size: 0.98rem; }
  .lb-meta p { font-size: 0.74rem; }
  .lb-book-cta { padding: 0 12px; font-size: 0.76rem; }
  .lb-thumb { width: 56px; height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox::before, .lb-photo, .lb-progress-fill, .lb-topbar, .lb-bottom, .lb-nav { transition-duration: 0.01ms !important; }
}
