:root {
  --bg: #09090b;
  --surface: #111114;
  --surface-hover: #18181d;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #fafafa;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  --accent: #ffffff;
  --accent-text: #09090b;
  --danger: #f87171;
  --radius: 10px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(9, 9, 11, 0.84);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
}

.brand-mark {
  width: 24px;
  height: 17px;
  opacity: 0.92;
  flex-shrink: 0;
}

/* Hero / Gallery Info */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 36px 24px 72px;
}

.gallery-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.gallery-title-wrap h1 {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 10px;
}

.gallery-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  font-size: 14px;
  color: var(--text-muted);
}

.meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-dim);
}

.gallery-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 999px;
  transition: transform 0.15s ease, opacity 0.15s ease, background-color 0.15s ease;
  white-space: nowrap;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: 999px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.35);
}

.zip-progress-wrap {
  width: 240px;
  display: none;
  flex-direction: column;
  gap: 6px;
}

.zip-progress-wrap.active {
  display: flex;
}

.zip-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.zip-progress-fill {
  height: 100%;
  width: 0%;
  background: #ffffff;
  transition: width 0.2s ease;
}

.zip-progress-text {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}

/* Photo Grid */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.photo-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  group: true;
}

.photo-trigger {
  width: 100%;
  height: 100%;
  display: block;
  position: relative;
  overflow: hidden;
}

.photo-trigger img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}

.photo-card:hover .photo-trigger img {
  transform: scale(1.03);
}

.photo-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0) 48%);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.photo-card:hover .photo-overlay,
.photo-card:focus-within .photo-overlay {
  opacity: 1;
}

.photo-card-footer {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 2;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.photo-card:hover .photo-card-footer,
.photo-card:focus-within .photo-card-footer {
  opacity: 1;
  transform: translateY(0);
}

.photo-name {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.86);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

.photo-download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(15, 15, 18, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  backdrop-filter: blur(8px);
  flex-shrink: 0;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.photo-download-btn:hover {
  background: #ffffff;
  color: #09090b;
  transform: scale(1.06);
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 5, 7, 0.96);
  backdrop-filter: blur(10px);
  display: none;
  flex-direction: column;
}

.lightbox.open {
  display: flex;
}

.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  gap: 12px;
}

.lightbox-info {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.lightbox-counter {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  white-space: nowrap;
}

.lightbox-filename {
  font-size: 14px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lightbox-close {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  transition: background-color 0.15s ease;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.18);
}

.lightbox-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 68px;
  overflow: hidden;
  user-select: none;
}

.lightbox-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(24, 24, 29, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text);
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.18);
}

.lightbox-prev {
  left: 16px;
}

.lightbox-next {
  right: 16px;
}

/* Status / Landing Cards */
.center-screen {
  min-height: calc(100vh - 70px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.status-card {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  text-align: center;
}

.status-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
}

.status-icon.error {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.25);
  background: rgba(248, 113, 113, 0.08);
}

.status-card h1 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 10px;
}

.status-card p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-muted);
}

.code-form {
  margin-top: 24px;
  display: flex;
  gap: 8px;
}

.code-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 12px 18px;
  color: var(--text);
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  outline: none;
}

.code-input:focus {
  border-color: #ffffff;
}

.footer-note {
  text-align: center;
  padding: 24px;
  font-size: 12px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}

@media (max-width: 640px) {
  .topbar-inner {
    padding: 14px 16px;
  }
  .container {
    padding: 24px 14px 48px;
  }
  .gallery-actions {
    width: 100%;
    align-items: stretch;
  }
  .zip-progress-wrap {
    width: 100%;
  }
  .zip-progress-text {
    text-align: left;
  }
  .photo-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .photo-overlay,
  .photo-card-footer {
    opacity: 1;
    transform: none;
  }
  .photo-name {
    display: none;
  }
  .photo-card-footer {
    justify-content: flex-end;
    bottom: 8px;
    right: 8px;
  }
  .lightbox-stage {
    padding: 12px;
  }
  .lightbox-nav {
    width: 38px;
    height: 38px;
  }
  .lightbox-prev {
    left: 8px;
  }
  .lightbox-next {
    right: 8px;
  }
  .lightbox-bar {
    padding: 12px 14px;
  }
  .btn-secondary span {
    display: none;
  }
}
