:root {
  --bg: #f7f0e8;
  --bg-2: #f1e6d8;
  --card: #fffaf4;
  --ink: #3a2f2a;
  --ink-soft: #7a6c62;
  --line: #e7dac9;
  --accent: #b08457; /* warm gold */
  --accent-deep: #8a6440;
  --rose: #c98b8b;
  --ok: #6f8f6a;
  --err: #c0584f;
  --radius: 18px;
  --shadow: 0 18px 50px -24px rgba(80, 54, 32, 0.45);
}

* {
  box-sizing: border-box;
}

/* The [hidden] attribute must win over our class-level display rules
   (.field/.banner set display:grid, which would otherwise override it). */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* never let anything scroll the page sideways */
}

body {
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; /* no double-tap-to-zoom (pinch blocked in JS) */
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(
      120% 90% at 50% -10%,
      var(--bg-2) 0%,
      var(--bg) 55%
    )
    fixed;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(12px, 4vw, 40px);
  padding-top: max(env(safe-area-inset-top), 18px);
  padding-bottom: max(env(safe-area-inset-bottom), 18px);
  -webkit-font-smoothing: antialiased;
}

.card {
  width: 100%;
  max-width: 560px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(22px, 6vw, 40px);
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}

.hero__flourish {
  font-size: 26px;
  color: var(--accent);
  margin-bottom: 6px;
}

.hero__eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-deep);
}

.hero__names {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  font-size: clamp(34px, 11vw, 52px);
  line-height: 1.05;
  margin: 8px 0 4px;
  color: var(--ink);
}

.hero__date {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
  font-style: italic;
}

.hero__lede {
  margin: 14px auto 0;
  max-width: 38ch;
  color: var(--ink-soft);
  font-size: 15.5px;
  line-height: 1.55;
}

.hero__lede strong {
  color: var(--accent-deep);
  font-weight: 600;
}

/* ---------- Form ---------- */
.form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field__label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.field__label em {
  font-weight: 400;
  font-style: normal;
  color: var(--ink-soft);
}

.field__hint {
  font-size: 13px;
  color: var(--err);
}

input[type="text"] {
  width: 100%;
  /* 16px minimum stops iOS Safari from zooming the page on focus */
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdfa;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(176, 132, 87, 0.18);
}

.btn {
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  border: none;
  border-radius: 14px;
  padding: 16px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.06s ease, filter 0.15s ease;
}

.btn:active {
  transform: translateY(1px) scale(0.997);
}

.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  box-shadow: 0 10px 24px -12px rgba(138, 100, 64, 0.8);
}

.btn--primary:hover {
  filter: brightness(1.04);
}

.btn__icon {
  font-size: 24px;
  line-height: 1;
  margin-top: -2px;
}

/* bilingual lines on the CTA */
.btn__lines {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
}
.btn__main {
  font-size: 17.5px;
  font-weight: 600;
}
.btn__sub {
  font-size: 12.5px;
  font-weight: 500;
  opacity: 0.82;
}

/* glowy, attention-grabbing CTA */
.btn--glow {
  position: relative;
  overflow: hidden;
  animation: ctaGlow 2.6s ease-in-out infinite;
}
@keyframes ctaGlow {
  0%,
  100% {
    box-shadow: 0 10px 24px -12px rgba(138, 100, 64, 0.85),
      0 0 0 0 rgba(201, 139, 139, 0);
    transform: translateY(0);
  }
  50% {
    box-shadow: 0 16px 34px -10px rgba(138, 100, 64, 0.95),
      0 0 30px 6px rgba(201, 139, 139, 0.4);
    transform: translateY(-1px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .btn--glow {
    animation: none;
  }
}
/* animated sheen sweeping across the button */
.btn__sheen {
  position: absolute;
  top: 0;
  left: -60%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    100deg,
    transparent,
    rgba(255, 255, 255, 0.35),
    transparent
  );
  transform: skewX(-18deg);
  animation: ctaSheen 3.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes ctaSheen {
  0%,
  60% {
    left: -60%;
  }
  100% {
    left: 130%;
  }
}

/* bouncing arrows pointing at the button */
.point {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  color: var(--accent);
  margin: 6px 0 10px; /* clearance so the bounce never touches the button */
  height: 26px;
}
.point span {
  font-size: 22px;
  line-height: 0.6;
  animation: pointBob 1.4s ease-in-out infinite;
}
.point span:nth-child(2) {
  opacity: 0.5;
  animation-delay: 0.18s;
}
@keyframes pointBob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(5px);
  }
}

/* ---------- Language switcher ---------- */
.langbar {
  width: 100%;
  max-width: 560px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 auto 10px;
  padding: 0 4px;
}
.langbar__flags {
  display: flex;
  gap: 6px;
}
.lang {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 23px;
  cursor: pointer;
  padding: 0;
  opacity: 0.55;
  transition: opacity 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.lang .flag {
  line-height: 1;
}
.lang.is-on {
  opacity: 1;
  border-color: var(--accent);
  box-shadow: 0 2px 8px -3px rgba(138, 100, 64, 0.6);
}
.lang:active {
  transform: scale(0.94);
}
.langbar__label {
  font-size: 12.5px;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.dropzone {
  display: none; /* shown on devices that support hover/drag (desktop) */
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 14px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone p {
  margin: 0;
}

.dropzone.is-drag {
  border-color: var(--accent);
  background: rgba(176, 132, 87, 0.08);
  color: var(--accent-deep);
}

@media (hover: hover) and (pointer: fine) {
  .dropzone {
    display: block;
  }
}

/* ---------- Overall progress ---------- */
.overall {
  margin-top: 22px;
}

.overall__head {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.progress {
  height: 10px;
  border-radius: 999px;
  background: var(--bg-2);
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--rose), var(--accent));
  transition: width 0.2s ease;
}

/* ---------- Banner ---------- */
.banner {
  margin-top: 20px;
  border-radius: 14px;
  padding: 16px 18px;
  display: grid;
  gap: 3px;
  text-align: center;
}

.banner--done {
  background: rgba(111, 143, 106, 0.12);
  border: 1px solid rgba(111, 143, 106, 0.3);
  color: #41603c;
}

.banner--done strong {
  font-size: 16px;
}

.banner--done span {
  font-size: 14px;
}

/* ---------- File list ---------- */
.files {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
  /* never let a huge batch bury the gallery: cap height + scroll internally */
  max-height: 44vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.files-toggle {
  margin: 14px auto 0;
  display: block;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-deep);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
}

.file {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "name status"
    "bar  bar";
  gap: 8px 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fffdfa;
}

.file__name {
  grid-area: name;
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file__meta {
  color: var(--ink-soft);
  font-weight: 400;
  font-size: 12.5px;
}

.file__status {
  grid-area: status;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.file__status--queued {
  color: var(--ink-soft);
}
.file__status--uploading {
  color: var(--accent-deep);
}
.file__status--done {
  color: var(--ok);
}
.file__status--error {
  color: var(--err);
  cursor: pointer;
  text-decoration: underline;
}

.file__bar {
  grid-area: bar;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-2);
  overflow: hidden;
}

.file__bar > span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.2s ease;
}

.file.is-done .file__bar > span {
  background: var(--ok);
}
.file.is-error .file__bar > span {
  background: var(--err);
}

/* ---------- Footer ---------- */
.foot {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.foot p {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.no-scroll {
  overflow: hidden;
}

/* ===========================================================================
   Gallery
   ======================================================================== */
.gallery {
  width: 100%;
  max-width: 980px;
  margin: 28px auto 0;
  padding: 0 clamp(10px, 4vw, 24px) 48px;
}

.gallery__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gallery__title {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  font-size: clamp(26px, 7vw, 36px);
  color: var(--ink);
  margin: 0;
}

.gallery__refresh {
  font-size: 20px;
  line-height: 1;
  color: var(--accent-deep);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  cursor: pointer;
  flex: none;
}
.gallery__refresh.is-spinning {
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.gallery__count {
  margin: 4px 0 16px;
  color: var(--ink-soft);
  font-size: 13.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gallery__empty {
  margin: 24px 0;
  text-align: center;
  color: var(--ink-soft);
  font-size: 15px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
@media (min-width: 560px) {
  .grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }
}
@media (min-width: 820px) {
  .grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.cell {
  position: relative;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: none;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-2);
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.08s ease;
}
.cell:active {
  transform: scale(0.96);
  filter: brightness(0.92);
}

.cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.cell img[src] {
  opacity: 1;
}

/* blur-up placeholder sits behind the real preview */
.cell__lqip {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(8px);
  transform: scale(1.1);
  opacity: 1 !important;
  z-index: 0;
}
.cell > img:not(.cell__lqip) {
  position: relative;
  z-index: 1;
}
.cell__video,
.cell__thumb {
  z-index: 1; /* above the blur-up placeholder */
}

.cell.is-blank,
.lb__strip-item.is-blank {
  background: #d9cbb8;
}
.cell.is-blank::after {
  content: "🖼";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  opacity: 0.5;
}
.cell--video.is-blank {
  background: #4a423b;
}
.cell--video.is-blank::after {
  content: "";
}

/* selection check overlay */
.cell__check {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: rgba(0, 0, 0, 0.25);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.12s ease;
}
.gallery.is-selecting .cell__check {
  opacity: 1;
}
.cell.is-selected .cell__check {
  background: var(--accent-deep);
  border-color: #fff;
}
.cell.is-selected .cell__check::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.gallery.is-selecting .cell.is-selected img {
  transform: scale(0.9);
  transition: transform 0.12s ease;
}

.cell__play {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 2px;
}

/* ---------- Scrubber ---------- */
.scrubber {
  display: none !important; /* removed: the right-side fast-scroll slider */
  position: fixed;
  top: 18vh;
  right: 2px;
  bottom: 12vh;
  width: 38px;
  z-index: 40;
  touch-action: none;
}
.scrubber--hidden {
  display: none;
}

.scrubber__thumb {
  position: absolute;
  right: 4px;
  top: 0;
  width: 30px;
  height: 46px;
  border-radius: 14px;
  background: rgba(176, 132, 87, 0.92);
  box-shadow: 0 4px 12px -4px rgba(80, 54, 32, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  opacity: 0.55;
  transition: opacity 0.2s ease;
}
.scrubber.is-active .scrubber__thumb,
.scrubber__thumb:hover {
  opacity: 1;
}
.scrubber__thumb span {
  width: 12px;
  height: 1.5px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 2px;
}

.scrubber__bubble {
  position: absolute;
  right: 44px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 10px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.scrubber__bubble.is-visible {
  opacity: 0.95;
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(20, 14, 10, 0.94);
  display: flex;
  flex-direction: column;
}

.lb__stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  overflow: hidden;
  touch-action: none; /* we handle pinch / pan / swipe ourselves */
}

.lb__media {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

/* Reels-style inline video */
.lb__videowrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
}
.lb__videowrap video {
  cursor: pointer;
}
.lb__playpause {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  padding-left: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
/* show the play indicator only when paused AND not mid-buffer */
.lb__videowrap.is-paused:not(.is-loading) .lb__playpause {
  opacity: 1;
}

/* "Loading full quality…" bar (bottom of the video) */
.lb__load {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(78%, 340px);
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 9px 14px;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 12px;
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.lb__videowrap.is-loading .lb__load {
  opacity: 1;
}
.lb__load-label {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  text-align: center;
}
.lb__load-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  overflow: hidden;
}
.lb__load-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: #fff;
  transition: width 0.25s ease;
  /* animated shimmer while early/indeterminate */
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.7),
    #fff,
    rgba(255, 255, 255, 0.7)
  );
}

/* "tap for sound" cue (shown once full quality is playing, still muted) */
.lb__soundcue {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  padding: 8px 16px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
/* expanding rings that dissipate outward (sonar/ripple).
   Uses box-shadow spread: grows equally on all sides (even padding) AND is
   paint-only — no layout per frame — so it stays smooth while the video
   decodes (animating top/left/etc. janked after a few cycles). */
.lb__soundcue::before,
.lb__soundcue::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  pointer-events: none;
}
.lb__videowrap.show-sound .lb__soundcue {
  opacity: 1;
}
.lb__videowrap.show-sound .lb__soundcue::before {
  animation: cueRipple 2.2s ease-out infinite;
}
.lb__videowrap.show-sound .lb__soundcue::after {
  animation: cueRipple 2.2s ease-out infinite 1.1s; /* offset 2nd ring */
}
@keyframes cueRipple {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55);
  }
  70%,
  100% {
    box-shadow: 0 0 0 13px rgba(255, 255, 255, 0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .lb__videowrap.show-sound .lb__soundcue::before,
  .lb__videowrap.show-sound .lb__soundcue::after {
    animation: none;
  }
}

.lb__spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
  pointer-events: none;
}

.lb__btn {
  position: absolute;
  z-index: 3; /* always above the photo/video in the stage */
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.lb__btn:disabled {
  opacity: 0.25;
  cursor: default;
}

.lb__close {
  top: calc(env(safe-area-inset-top) + 12px);
  right: 14px;
  width: 42px;
  height: 42px;
  font-size: 26px;
  z-index: 2;
}

.lb__nav {
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  font-size: 30px;
  line-height: 1;
}
.lb__prev {
  left: 10px;
}
.lb__next {
  right: 10px;
}
@media (hover: none) {
  /* on touch, lean on swiping rather than tiny arrows */
  .lb__nav {
    width: 40px;
    height: 40px;
    opacity: 0.6;
  }
}

.lb__bottom {
  flex: none;
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(0, 0, 0, 0.35);
}

.lb__bar {
  padding: 14px 18px 10px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.lb__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #fff;
  min-width: 0;
}
.lb__caption {
  font-weight: 600;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb__date {
  font-size: 13px;
  opacity: 0.75;
}

.lb__download {
  flex: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.lb__download.is-spinning {
  opacity: 0.6;
  pointer-events: none;
}

/* ---------- Filmstrip ---------- */
.lb__strip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  padding: 14px 0 14px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
}
.lb__strip::-webkit-scrollbar {
  display: none;
}
/* spacers so the first/last thumbnail can scroll to the centre */
.lb__strip::before,
.lb__strip::after {
  content: "";
  flex: 0 0 50vw;
}

.lb__strip-item {
  position: relative;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 5px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  opacity: 0.5;
  scroll-snap-align: center;
  transition: opacity 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.lb__strip-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.lb__strip-item.is-current {
  opacity: 1;
  border-color: #fff;
  transform: scale(1.55);
}
.lb__strip-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* ---------- Duplicate-skipped note ---------- */
.dupnote {
  margin: -2px 2px 0;
  font-size: 13px;
  color: var(--accent-deep);
  text-align: center;
}

.capacity {
  margin: 10px 6px 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent-deep);
  text-align: center;
}

.prep-hint {
  margin: 8px 6px 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  text-align: center;
}

/* "Preparing…" overlay */
.preparing {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(40, 28, 18, 0.5);
  backdrop-filter: blur(3px);
  padding: 24px;
}
.preparing__box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: 18px;
  padding: 26px 28px;
  max-width: 320px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.preparing__spin {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--bg-2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

/* ---------- Retry (waiting) status ---------- */
.file__status--waiting {
  color: var(--accent-deep);
}

/* ---------- Duplicate status ---------- */
.file__status--duplicate {
  color: var(--ink-soft);
}
.file.is-duplicate {
  opacity: 0.7;
}
.file.is-duplicate .file__bar > span {
  background: var(--ink-soft);
}

/* video first-frame thumbnail (older videos without a stored poster) */
.cell__video,
.cell__thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- Gallery header actions + selection ---------- */
/* wrap (never horizontal-scroll) so controls always stay within the screen */
.gallery__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.gallery__btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-deep);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  flex: 0 0 auto;
  white-space: nowrap;
  transition: transform 0.08s ease, background 0.12s ease;
}
.gallery__btn:active {
  transform: scale(0.95);
}

/* segmented sort toggle — fills the row, two balanced halves (iOS style) */
.seg {
  display: flex;
  flex: 1 1 240px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
}
.seg__btn {
  flex: 1 1 0;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 8px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.12s ease;
}
.seg__btn.is-on {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  box-shadow: 0 4px 10px -5px rgba(138, 100, 64, 0.7);
}
.seg__btn:active {
  transform: scale(0.96);
}

.selectbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.selectbar__link {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-deep);
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
}
.selectbar__count {
  font-size: 13px;
  color: var(--ink-soft);
  margin-right: auto;
}
.selectbar__dl {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  border: none;
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
}
.selectbar__dl:disabled {
  opacity: 0.4;
  cursor: default;
}
.selectbar__del {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--err);
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
}
.selectbar__del:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ---------- Admin ---------- */
.gallery__btn--admin.is-on {
  color: #fff;
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}
.adminbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 10px 14px;
  background: #fbf3ea;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.adminbar__tag {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-deep);
}
.adminbar__btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
}
.adminbar__btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.adminbar__status {
  font-size: 13px;
  color: var(--ink-soft);
  margin-right: auto;
}
.lb__delete {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: none;
  background: var(--err);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}
.lb__edittime {
  background: rgba(255, 255, 255, 0.16);
}
