:root {
  --bg: #fff8fb; /* blush backdrop */
  --panel: #ffffff;
  --text: #342e37;
  --muted: #8b6f82;
  --accent: #c77dff; /* orchid */
  --accent-2: #ffd6e7; /* soft rose */
  --border: #f1e6ee;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden; /* prevent body scroll */
  background: radial-gradient(
      1200px 600px at 90% -100px,
      #ffeaf4 20%,
      transparent 60%
    ),
    radial-gradient(1200px 600px at 0% 120%, #f6f0ff 20%, transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu,
    Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
}
#app-scroll {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* iOS momentum scrolling */
  overscroll-behavior-y: contain;    /* prevent pull-to-refresh */
}

header {
  padding: 36px 16px 10px;
  text-align: center;
}
header h1 {
  margin: 6px 0 10px;
  font-family: "Playfair Display", serif;
  font-weight: 700;
  font-size: 44px;
  letter-spacing: 0.5px;
}
header p {
  margin: 0;
  color: var(--muted);
}

header .amp {
  color: var(--accent);
}

.secondary-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.secondary-btn:hover {
  background: var(--accent-2);
}

#upload-section {
  display: flex;
  justify-content: center;
  padding: 18px;
}
.dropzone {
  outline: none;
  padding: 0;
  display: inline-grid;
  place-items: center;
  width: auto;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.dropzone:focus-visible {
  outline: none;
}
.dropzone.dragover .primary-btn {
  box-shadow: 0 0 0 6px var(--accent-2);
}
.dropzone .icon {
  width: 32px;
  height: 32px;
  color: var(--accent);
}
.dropzone .dz-text {
  display: none;
}
.primary-btn {
  background: linear-gradient(135deg, var(--accent), #ff77b4);
  color: #fff;
  border: 0;
  padding: 12px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
}
.primary-btn.big {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 22px;
  font-size: 16px;
}
.primary-btn .icon {
  width: 22px;
  height: 22px;
  color: #fff;
}

/* Floating action button (sticky upload) */
.fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #ff77b4);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 12px 30px rgba(199, 125, 255, 0.35);
  z-index: 999;
}
.fab .icon {
  width: 26px;
  height: 26px;
  color: #fff;
}
.fab:active {
  transform: translateY(1px);
}
.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.progress {
  display: none;
  margin-top: 10px;
  color: var(--muted);
  /* display will be controlled by JS (inline-flex when active) */
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.progress[hidden] {
  display: none !important;
}
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 16px;
  max-width: 1200px;
  margin: 0 auto;
}
.item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.04);
  position: relative;
}
.download-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  text-decoration: none;
  z-index: 5;
}
.download-btn .icon {
  width: 18px;
  height: 18px;
  color: #fff;
}
.download-btn:hover {
  background: rgba(0, 0, 0, 0.65);
}
.item img.thumb,
.item video.video {
  width: 100%;
  height: 240px;
  object-fit: cover;
  background: #f7f0f9;
}
.meta {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* Lightbox */
.lightbox[hidden] {
  display: none;
}
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
}
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}
.lightbox-content {
  position: absolute;
  inset: 0;
  margin: auto;
  max-width: min(95vw, 1200px);
  max-height: min(92vh, 900px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}
.lightbox-download {
  position: absolute;
  top: 14px;
  right: 60px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  border: 0;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.lightbox-download .icon {
  width: 18px;
  height: 18px;
}
.lightbox img,
.lightbox video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.35);
}
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 64px;
  border: none;
  background: rgba(255, 255, 255, 0.85);
  color: #333;
  border-radius: 12px;
  cursor: pointer;
}
.lightbox-nav.prev {
  left: 8px;
}
.lightbox-nav.next {
  right: 8px;
}
.lightbox-nav::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  border-right: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
}
.lightbox-nav.prev::before {
  transform: rotate(135deg);
}
.lightbox-nav.next::before {
  transform: rotate(-45deg);
}
.lightbox-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  border: 0;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 20px;
  font-weight: 700;
}

@media (min-width: 1400px) {
  #gallery {
    max-width: 1400px;
  }
}
