/* ─────────────────────────────────────────────────────────────
   Tour Upload Hub — shared stylesheet (mobile-first travel theme)

   Motion policy: movement is used to show what changed — a file
   arriving, bytes moving, an upload finishing, a photo opening.
   One orchestrated entrance per page, then the interface holds
   still. Everything here is switched off under
   `prefers-reduced-motion`.
   ───────────────────────────────────────────────────────────── */

:root {
  --bg: #f2f7fb;
  --surface: #ffffff;
  --surface-2: #f6fafc;
  --text: #0b253b;
  --muted: #5c7289;
  --line: #e3edf4;
  --brand-1: #0ea5e9;
  --brand-2: #6366f1;
  --brand-ink: #ffffff;
  --brand-grad: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
  --ok: #10b981;
  --ok-bg: #e7f9f1;
  --danger: #ef4444;
  --danger-bg: #fdecec;
  --warn: #f59e0b;
  --warn-bg: #fef4e2;
  --shadow: 0 10px 30px rgba(11, 37, 59, 0.08);
  --shadow-lg: 0 24px 60px rgba(11, 37, 59, 0.16);
  --radius: 20px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --font: 'Hind Siliguri', 'Noto Sans Bengali', 'Bangla Sangam MN', system-ui, -apple-system,
    'Segoe UI', Roboto, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1522;
    --surface: #12202f;
    --surface-2: #0e1a26;
    --text: #e8f0f7;
    --muted: #8fa6ba;
    --line: #1e3042;
    --ok-bg: #123324;
    --danger-bg: #3a1a1c;
    --warn-bg: #3a2b10;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

:focus-visible {
  outline: 3px solid var(--brand-1);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ── Keyframes ──────────────────────────────────────────────── */
@keyframes riseIn      { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes rowIn       { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes rowOut      { to { opacity: 0; transform: translateX(28px); } }
@keyframes fadeIn      { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop         { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
@keyframes tileIn      { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes lbIn        { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes drift       { 0%, 100% { transform: none; } 50% { transform: translate3d(24px, 26px, 0) scale(1.08); } }
@keyframes sheen       { from { transform: translateX(-120%); } to { transform: translateX(320%); } }
@keyframes shimmer     { from { background-position: -420px 0; } to { background-position: 420px 0; } }
@keyframes stripes     { from { background-position: 0 0; } to { background-position: 34px 0; } }
@keyframes heartBeat   { 0%, 100% { transform: scale(1); } 25% { transform: scale(1.25); } 40% { transform: scale(1); } }
@keyframes spin        { to { transform: rotate(360deg); } }
@keyframes drawCheck   { to { stroke-dashoffset: 0; } }
@keyframes ringPop     { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes confettiFall {
  0%   { opacity: 1; transform: translate3d(0, 0, 0) rotate(0deg); }
  100% { opacity: 0; transform: translate3d(var(--dx, 0), 62vh, 0) rotate(var(--rot, 540deg)); }
}
@keyframes bounceArrow { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ── Decorative blobs ───────────────────────────────────────── */
.hero-blob {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
  animation: drift 26s ease-in-out infinite;
}
.hero-blob-a { background: #a5e3ff; top: -140px; right: -120px; }
.hero-blob-b { background: #e0dcff; top: 180px; left: -180px; animation-duration: 34s; animation-direction: reverse; }
@media (prefers-color-scheme: dark) {
  .hero-blob-a { background: #123a56; }
  .hero-blob-b { background: #2a2350; }
}

/* ── Layout ─────────────────────────────────────────────────── */
.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 48px;
}
/* Room for the fixed bottom dock (name + Upload button). */
body.page-home .container { padding-bottom: 180px; }
.center { text-align: center; }
.muted-text { color: var(--muted); }
.note { font-size: 0.85rem; margin-top: 10px; }

/* Page-load sequence: hero, then the card beneath it. */
.hero-inner   { animation: riseIn 0.6s var(--ease-out) both; }
.upload-wrap  { animation: riseIn 0.6s var(--ease-out) 0.1s both; }

/* ── Hero ───────────────────────────────────────────────────── */
.hero {
  position: relative;
  z-index: 1;
  padding: 46px 16px 26px;
  text-align: center;
  overflow: hidden;
}
.hero-inner { max-width: 640px; margin: 0 auto; }
.hero-eyebrow {
  display: inline-block;
  font-weight: 600;
  font-size: 0.92rem;
  color: #0c7fb8;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(14, 165, 233, 0.25);
  padding: 6px 14px;
  border-radius: 999px;
  margin: 0 0 12px;
  backdrop-filter: blur(6px);
}
@media (prefers-color-scheme: dark) {
  .hero-eyebrow { color: #7cd2ff; background: rgba(10, 25, 40, 0.7); border-color: rgba(124, 210, 255, 0.25); }
}
.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, #0284c7, #4f46e5, #0284c7);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 9s linear infinite;
}
.hero-sub { margin: 8px auto 0; font-size: clamp(1.05rem, 3.4vw, 1.3rem); font-weight: 500; color: var(--muted); max-width: 34ch; }
.hero-cover {
  display: block;
  width: min(480px, 100%);
  aspect-ratio: 16 / 8;
  object-fit: cover;
  border-radius: 24px;
  margin: 0 auto 18px;
  box-shadow: var(--shadow-lg);
  animation: pop 0.5s var(--ease-spring) both;
}

/* ── Cards & buttons ────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin: 18px 0;
}
.warn-card { border-color: var(--warn); background: var(--warn-bg); }

.btn {
  position: relative;
  overflow: hidden;
  font-family: var(--font);
  font-weight: 600;
  font-size: 1rem;
  border: 0;
  border-radius: 999px;
  padding: 12px 22px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s var(--ease-out), box-shadow 0.2s ease, filter 0.2s ease,
    background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-lg { padding: 16px 26px; font-size: 1.15rem; }
.btn-xs { padding: 6px 12px; font-size: 0.82rem; border-radius: 999px; }
.btn-block { width: 100%; }
.banner-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }

.btn-primary {
  background: var(--brand-grad);
  color: var(--brand-ink);
  box-shadow: 0 8px 20px rgba(14, 165, 233, 0.35);
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 10px 26px rgba(14, 165, 233, 0.42); }
/* A slow sheen travels across the main call to action. */
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  animation: sheen 4.5s ease-in-out infinite;
  pointer-events: none;
}
.btn-primary:disabled::after { animation: none; opacity: 0; }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--brand-1); color: var(--brand-1); }
.btn-outline { background: transparent; color: var(--brand-1); border: 2px solid var(--brand-1); }
.btn-outline:hover { background: rgba(14, 165, 233, 0.1); }

.input {
  font-family: var(--font);
  font-size: 1rem;
  width: 100%;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input:focus { border-color: var(--brand-1); box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.15); }
.input-lg { padding: 15px 18px; font-size: 1.1rem; border-radius: 16px; }

/* ── Gate & upload panel ────────────────────────────────────── */
.gate-card { text-align: center; max-width: 440px; margin-left: auto; margin-right: auto; animation: pop 0.4s var(--ease-spring) both; }
.gate-card h2 { margin: 6px 0 4px; }
.gate-icon { font-size: 2.4rem; }
.gate-card form { display: grid; gap: 12px; margin-top: 14px; }

.form-error { color: var(--danger); font-weight: 600; margin: 10px 0 0; animation: pop 0.25s ease both; }
.upload-disabled { text-align: center; }

.dropzone-card { padding: 18px; transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s var(--ease-out); }
#emptyState { text-align: center; padding: 14px 6px; }
.drop-icon { font-size: 3rem; margin-bottom: 4px; animation: bounceArrow 2.6s ease-in-out infinite; }
.pick-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.top-row { justify-content: space-between; align-items: center; margin-top: 0; }
.drop-hint { color: var(--muted); font-size: 0.9rem; margin-top: 14px; }
.dropzone-card.dragover {
  border-color: var(--brand-1);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.18);
  transform: scale(1.01);
}

/* ── File list ──────────────────────────────────────────────── */
.file-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 10px; }
.file-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 12px;
  animation: rowIn 0.32s var(--ease-out) both;
  transition: border-color 0.3s ease, background 0.3s ease;
}
.file-row.is-leaving { animation: rowOut 0.22s ease forwards; }
.file-row.is-done { border-color: rgba(16, 185, 129, 0.45); background: var(--ok-bg); }
.file-row.is-error { border-color: rgba(239, 68, 68, 0.45); }

.file-thumb {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  flex: 0 0 56px;
  background: #cbdde9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  overflow: hidden;
  color: #33536b;
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-row.is-uploading .file-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.55) 50%, transparent 70%);
  background-size: 420px 100%;
  animation: shimmer 1.1s linear infinite;
}
.file-kind {
  position: absolute;
  left: 3px;
  bottom: 3px;
  font-size: 0.62rem;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-weight: 700;
}

.file-info { flex: 1; min-width: 0; }
.file-name { font-weight: 600; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { color: var(--muted); font-size: 0.8rem; }

/* The status column holds a word, a percentage, or a whole error sentence
   plus a retry button — so it stacks and wraps instead of running over the
   file name next to it. */
.file-status {
  font-size: 0.82rem;
  font-weight: 600;
  flex: 0 1 auto;
  min-width: 74px;
  max-width: 46%;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  overflow-wrap: anywhere;
  line-height: 1.35;
}
.st-done { color: var(--ok); }
.st-error { color: var(--danger); }
.st-wait { color: var(--muted); }
.st-uploading { color: var(--brand-1); font-variant-numeric: tabular-nums; }

.file-remove {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.05rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  line-height: 1;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.file-remove:hover { color: var(--danger); background: var(--danger-bg); transform: rotate(90deg); }

.mini-progress { height: 5px; border-radius: 999px; background: var(--line); margin-top: 6px; overflow: hidden; }
.mini-progress > i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--brand-grad);
  border-radius: 999px;
  transition: width 0.25s var(--ease-out);
}

/* A small check that draws itself when Drive confirms the file. */
.tick { width: 15px; height: 15px; vertical-align: -2px; margin-right: 3px; }
.tick path {
  fill: none;
  stroke: var(--ok);
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 26;
  stroke-dashoffset: 26;
  animation: drawCheck 0.45s var(--ease-out) forwards;
}

/* ── Progress / banner / toast ──────────────────────────────── */
.progress-track { height: 14px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 18px; }
.progress-fill {
  position: relative;
  height: 100%;
  width: 0%;
  background: var(--brand-grad);
  border-radius: 999px;
  transition: width 0.35s var(--ease-out);
  overflow: hidden;
}
.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(115deg, rgba(255, 255, 255, 0.35) 25%, transparent 25%,
    transparent 50%, rgba(255, 255, 255, 0.35) 50%, rgba(255, 255, 255, 0.35) 75%, transparent 75%);
  background-size: 34px 34px;
  animation: stripes 0.8s linear infinite;
}
.progress-caption { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.9rem; margin-top: 8px; }
#batchPct { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--brand-1); }

.banner {
  border-radius: var(--radius);
  padding: 18px 20px;
  font-weight: 600;
  text-align: center;
  animation: pop 0.4s var(--ease-spring) both;
}
.banner.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid rgba(16, 185, 129, 0.3); }
.banner.bad { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }
.banner.big { font-size: 1.15rem; padding: 24px; }
.banner .heart { display: inline-block; animation: heartBeat 1s ease infinite; }
.banner-check {
  width: 58px; height: 58px; margin: 0 auto 8px; border-radius: 50%;
  background: rgba(16, 185, 129, 0.16); display: flex; align-items: center; justify-content: center;
  animation: ringPop 0.45s var(--ease-spring) both;
}
.banner-check svg { width: 30px; height: 30px; }
.banner-check path {
  fill: none; stroke: var(--ok); stroke-width: 3.6; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 26; stroke-dashoffset: 26; animation: drawCheck 0.5s var(--ease-out) 0.18s forwards;
}

/* Confetti: one short burst when a batch finishes. */
.confetti-root { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti-bit {
  position: absolute;
  top: 22%;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  animation: confettiFall 1.5s var(--ease-out) forwards;
}

.toast-root { position: fixed; bottom: 96px; left: 0; right: 0; display: grid; gap: 8px; justify-items: center; padding: 0 16px; z-index: 60; pointer-events: none; }
.toast {
  background: var(--text);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: var(--shadow-lg);
  animation: rowIn 0.25s var(--ease-out);
  max-width: 100%;
  pointer-events: auto;
}
.toast.bad { background: var(--danger); color: #fff; }

/* ── Footer / bottom dock ───────────────────────────────────── */
.footer { text-align: center; padding: 8px 16px 40px; color: var(--muted); position: relative; z-index: 1; }
.privacy-note { font-size: 0.9rem; margin: 0 0 4px; }
.footer-brand { font-size: 0.8rem; opacity: 0.7; margin: 0; }

/* Name + the Upload button always stay within thumb reach. */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 42%);
  z-index: 30;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.dock-inner {
  pointer-events: auto;
  width: 100%;
  max-width: 460px;
  display: grid;
  gap: 8px;
}
.dock .input { box-shadow: var(--shadow); }
#btnStart { transition: transform 0.25s var(--ease-spring), opacity 0.25s ease, box-shadow 0.2s ease; }
#btnStart[hidden] { display: none; }
#btnStart.is-new { animation: pop 0.35s var(--ease-spring) both; }
#btnStart .count { font-variant-numeric: tabular-nums; }
.spinner {
  width: 17px; height: 17px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

/* ── Gallery link row ───────────────────────────────────────── */
.gallery-link-row { text-align: center; margin: 10px 0 6px; }

/* ── Sub header (gallery/admin) ─────────────────────────────── */
.sub-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 18px 16px 4px; max-width: 960px; margin: 0 auto; }
.sub-header h1 { margin: 0; font-size: 1.3rem; }

/* ── Gallery toolbar ────────────────────────────────────────── */
.gallery-container { max-width: 980px; }
.gallery-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
  animation: riseIn 0.45s var(--ease-out) both;
}
.chip {
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.15s var(--ease-out);
}
.chip:active { transform: scale(0.96); }
.chip.is-on { color: var(--brand-ink); background: var(--brand-grad); border-color: transparent; box-shadow: 0 6px 16px rgba(14, 165, 233, 0.3); }
.chip .chip-n { opacity: 0.7; font-weight: 500; }
.bar-spacer { flex: 1 1 auto; }

/* ── Gallery grid ───────────────────────────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.g-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
  cursor: pointer;
  animation: tileIn 0.4s var(--ease-out) both;
  transition: box-shadow 0.25s ease, border-color 0.2s ease, transform 0.25s var(--ease-out);
}
.g-item:hover { box-shadow: var(--shadow); }
.g-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s var(--ease-out); }
.g-item:hover img { transform: scale(1.06); }
.g-item .g-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; color: var(--muted);
}
.g-item img.lazy { opacity: 0; transition: opacity 0.4s ease; }
.g-item img.lazy.loaded { opacity: 1; }
.g-video-badge {
  position: absolute; bottom: 8px; left: 8px; background: rgba(0, 0, 0, 0.55);
  color: #fff; font-size: 0.75rem; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  display: flex; align-items: center; gap: 4px;
}
/* Per-tile download: always reachable on touch, revealed on hover on desktop. */
.g-dl {
  position: absolute; top: 8px; right: 8px; width: 34px; height: 34px;
  border: 0; border-radius: 50%; background: rgba(9, 16, 26, 0.6); color: #fff;
  font-size: 0.95rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
  text-decoration: none; transition: background 0.2s ease, transform 0.2s var(--ease-spring), opacity 0.2s ease;
}
.g-dl:hover { background: var(--brand-1); transform: scale(1.1); }
@media (hover: hover) {
  .g-dl { opacity: 0; }
  .g-item:hover .g-dl, .g-dl:focus-visible { opacity: 1; }
}
/* Selection mode */
.g-check {
  position: absolute; top: 8px; left: 8px; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(9, 16, 26, 0.45); display: none;
  align-items: center; justify-content: center; color: #fff; font-size: 0.8rem; font-weight: 700;
  transition: background 0.2s ease, transform 0.2s var(--ease-spring);
}
.gallery-grid.is-selecting .g-check { display: flex; }
.gallery-grid.is-selecting .g-dl { display: none; }
.g-item.is-picked { border-color: var(--brand-1); box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.35); }
.g-item.is-picked .g-check { background: var(--brand-1); transform: scale(1.08); }

/* Loading skeletons */
.skeleton {
  border-radius: 14px;
  aspect-ratio: 1;
  background: var(--surface-2);
  background-image: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.6) 50%, transparent 70%);
  background-size: 420px 100%;
  animation: shimmer 1.2s linear infinite;
  border: 1px solid var(--line);
}
@media (prefers-color-scheme: dark) {
  .skeleton { background-image: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.08) 50%, transparent 70%); }
}

/* ── Lightbox ───────────────────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0; background: rgba(5, 10, 18, 0.96); z-index: 80;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px; animation: fadeIn 0.2s ease;
}
.lb-stage { display: flex; align-items: center; justify-content: center; max-width: 100%; max-height: 76vh; width: 100%; }
.lb-stage img, .lb-stage video {
  max-width: 100%; max-height: 76vh; border-radius: 12px; box-shadow: var(--shadow-lg); background: #000;
  animation: lbIn 0.28s var(--ease-out) both;
}
.lb-stage video { width: auto; }
.lb-caption { color: #cbd5e1; margin-top: 14px; font-size: 0.95rem; text-align: center; max-width: 90%; }
.lb-bar { margin-top: 12px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.lb-close, .lb-nav {
  position: fixed; z-index: 5; background: rgba(255, 255, 255, 0.12); color: #fff;
  border: 0; border-radius: 50%; cursor: pointer; font-size: 1.4rem;
  width: 46px; height: 46px; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s ease, transform 0.2s var(--ease-out);
}
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 10px; top: 50%; transform: translateY(-50%); }
.lb-close:hover { background: rgba(255, 255, 255, 0.25); transform: rotate(90deg); }
.lb-prev:hover { background: rgba(255, 255, 255, 0.25); transform: translateY(-50%) scale(1.1); }
.lb-next:hover { background: rgba(255, 255, 255, 0.25); transform: translateY(-50%) scale(1.1); }

/* ── Admin ──────────────────────────────────────────────────── */
.admin-container { max-width: 980px; }
.login-card { max-width: 420px; margin-left: auto; margin-right: auto; text-align: center; animation: pop 0.4s var(--ease-spring) both; }
.login-card form { display: grid; gap: 12px; margin-top: 12px; }

.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 0 6px; }
.stat-card { text-align: center; margin: 0; animation: riseIn 0.45s var(--ease-out) both; }
.stat-card:nth-child(2) { animation-delay: 0.06s; }
.stat-card:nth-child(3) { animation-delay: 0.12s; }
.stat-card:nth-child(4) { animation-delay: 0.18s; }
.stat-num { font-size: 1.9rem; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat-num.small { font-size: 1.05rem; -webkit-text-fill-color: var(--text); }
.stat-label { color: var(--muted); font-size: 0.9rem; }
.top-label { margin-bottom: 8px; }

.admin-grid { display: grid; grid-template-columns: 1fr; gap: 4px; }
@media (min-width: 820px) { .admin-grid { grid-template-columns: 1fr 1fr; gap: 12px; } }
.admin-section h2 { margin-top: 0; font-size: 1.15rem; }
.admin-section { margin: 12px 0; }
.folder-links { display: grid; gap: 8px; margin-top: 10px; }

.drive-status { display: grid; gap: 6px; margin: 4px 0 12px; }
.drive-pill {
  display: inline-flex; align-items: center; gap: 8px; align-self: start;
  font-weight: 700; font-size: 0.88rem; padding: 6px 14px; border-radius: 999px;
  background: var(--ok-bg); color: var(--ok);
}
.drive-pill.bad { background: var(--danger-bg); color: var(--danger); }
.drive-pill.busy { background: var(--warn-bg); color: var(--warn); }
.drive-detail { font-size: 0.86rem; color: var(--muted); overflow-wrap: anywhere; }
.drive-fix { font-size: 0.88rem; background: var(--warn-bg); border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 12px; padding: 10px 12px; color: var(--text); }
.drive-fix ol { margin: 6px 0 0; padding-left: 20px; }
.drive-fix li { margin: 3px 0; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; cursor: pointer; border-bottom: 1px dashed var(--line); }
.toggle-row small { display: block; color: var(--muted); font-weight: 400; }
.toggle-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle {
  flex: 0 0 auto;
  width: 52px; height: 30px; border-radius: 999px; background: #c3d2de;
  position: relative; transition: background 0.25s ease;
}
.toggle::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px;
  border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.25);
  transition: transform 0.25s var(--ease-spring);
}
.toggle-row input:checked + .toggle { background: var(--ok); }
.toggle-row input:checked + .toggle::after { transform: translateX(22px); }
.toggle-row input:focus-visible + .toggle { outline: 3px solid var(--brand-1); outline-offset: 2px; }

.qr-wrap { display: flex; justify-content: center; margin: 10px 0; }
.qr-wrap img { width: 220px; height: 220px; border-radius: 12px; border: 1px solid var(--line); }
.qr-url { text-align: center; color: var(--muted); font-size: 0.85rem; word-break: break-all; margin: 6px 0 12px; }

.table-scroll { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 640px; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; letter-spacing: 0.02em; white-space: nowrap; }
.admin-table tbody tr { transition: background 0.2s ease; }
.admin-table tbody tr:hover { background: var(--surface-2); }
.type-badge {
  display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 3px 10px;
  border-radius: 999px; background: #e0f2fe; color: #0369a1;
}
.type-badge.video { background: #ede9fe; color: #6d28d9; }
@media (prefers-color-scheme: dark) {
  .type-badge { background: #0c3a55; color: #7dd3fc; }
  .type-badge.video { background: #2e2a4d; color: #c4b5fd; }
}
.drive-link { color: var(--brand-1); font-weight: 600; text-decoration: none; white-space: nowrap; }
.drive-link:hover { text-decoration: underline; }

body.page-gallery, body.page-admin { padding-bottom: 40px; }

@media (max-width: 480px) {
  .card { padding: 16px; }
  .file-row { padding: 8px 10px; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }
}

/* ── Motion off ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .hero h1 { background-size: 100% 100%; }
}
