:root {
  color-scheme: light;
  color: #0f172a;
  background: radial-gradient(circle at top left, #e0f2fe, transparent 36%),
    radial-gradient(circle at bottom right, #fce7f3, transparent 30%),
    #f8fafc;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
}

main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 14px;
}

.hero-panel,
.gallery {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 32px;
  box-shadow: 0 32px 80px rgba(15, 23, 42, 0.08);
  padding: 34px;
  margin-bottom: 28px;
}

.hero-panel {
  display: grid;
  gap: 28px;
}

.hero-panel > div {
  max-width: 760px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.85rem;
  color: #2563eb;
  margin: 0 0 18px;
}

.hero-panel h1,
.gallery h2,
.slideshow-header h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3.4rem);
  line-height: 1.04;
}

.hero-panel p,
.gallery p,
.slideshow-header p,
.status-text {
  margin: 0;
  color: #475569;
  line-height: 1.75;
}

.hero-link {
  display: inline-flex;
  margin-top: 18px;
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
}

.hero-link::after {
  content: "→";
  margin-left: 10px;
}

.upload-form {
  display: grid;
  gap: 18px;
  max-width: 560px;
}

.file-picker {
  display: grid;
  gap: 8px;
  padding: 22px 24px;
  border: 1px dashed #94a3b8;
  border-radius: 22px;
  cursor: pointer;
  background: #f8fafc;
  color: #0f172a;
}

.file-picker span {
  font-weight: 600;
}

.file-picker input {
  display: none;
}

button {
  width: fit-content;
  padding: 16px 24px;
  border: none;
  border-radius: 18px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(37, 99, 235, 0.2);
}

.selected-files {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 18px;
}

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

.selected-files-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.selected-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: white;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  font-size: 0.95rem;
}

.selected-file-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 999px;
  background: #e2e8f0;
  color: #1f2937;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease;
}

.selected-file-remove:hover {
  background: #cbd5e1;
}

.submit-indicator {
  display: none;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  color: #2563eb;
  font-weight: 600;
  max-width: 560px;
  flex-wrap: wrap;
}

.submit-indicator.visible {
  display: inline-flex;
}

.submit-indicator .spinner {
  width: 16px;
  height: 16px;
  border: 3px solid rgba(37, 99, 235, 0.25);
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

.upload-progress {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border: none;
  border-radius: 999px;
  background: #dbeafe;
}

.upload-progress::-webkit-progress-bar {
  background: #dbeafe;
  border-radius: 999px;
}

.upload-progress::-webkit-progress-value {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-radius: 999px;
}

.upload-progress::-moz-progress-bar {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-radius: 999px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

button.submitting {
  opacity: 0.7;
}

.hint {
  color: #64748b;
  font-size: 0.95rem;
}

.messages {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  border-radius: 20px;
  padding: 18px 22px;
  margin-bottom: 18px;
}

.admin-hero {
  margin-bottom: 18px;
}

.admin-panel {
  overflow: hidden;
}

.admin-list {
  display: grid;
  gap: 12px;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.admin-media-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: #f8fafc;
}

.admin-preview {
  display: block;
  width: 112px;
  height: 84px;
  overflow: hidden;
  border-radius: 12px;
  background: #020617;
}

.admin-preview img,
.admin-preview video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.admin-media-main {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.admin-media-main strong,
.admin-media-main span {
  display: block;
}

.admin-media-main strong {
  overflow-wrap: anywhere;
}

.admin-media-main span {
  color: #64748b;
  font-size: 0.92rem;
  text-transform: capitalize;
}

.admin-check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #334155;
}

.admin-check input {
  width: 18px;
  height: 18px;
}

.admin-login-panel {
  max-width: 640px;
}

.admin-password {
  display: grid;
  gap: 8px;
  color: #334155;
  font-weight: 700;
}

.admin-password input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  font: inherit;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 22px;
}

.status-text {
  color: #64748b;
}

.media-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

figure {
  margin: 0;
  border-radius: 28px;
  overflow: hidden;
  background: white;
  border: 1px solid #e2e8f0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

figure:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
}

.media-preview {
  position: relative;
  display: block;
  text-decoration: none;
}

.media-preview img,
.media-preview video {
  width: 100%;
  max-width: 100%;
  display: block;
  height: 180px;
  min-height: 180px;
  object-fit: cover;
  transition: opacity 0.2s ease;
  background: #020617;
}

.media-preview:hover img,
.media-preview:hover video {
  opacity: 0.92;
}

.video-badge {
  position: absolute;
  right: 14px;
  bottom: 14px;
  background: rgba(15, 23, 42, 0.9);
  color: white;
  font-size: 0.78rem;
  border-radius: 999px;
  padding: 7px 12px;
}

figcaption {
  padding: 18px 20px;
  color: #0f172a;
  font-size: 0.98rem;
  background: #f8fafc;
}

.slideshow-page {
  background: radial-gradient(circle at top left, #2563eb22, transparent 35%),
    radial-gradient(circle at bottom right, #7c3aed22, transparent 27%),
    #020617;
  color: white;
}

.slideshow-shell {
  min-height: 100vh;
  display: grid;
  gap: 24px;
  padding: 36px 24px;
}

.slideshow-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  width: 100%;
}

.slideshow-title {
  text-align: center;
}

.slideshow-header-side {
  display: flex;
  align-items: center;
  min-width: 0;
}

.slideshow-controls {
  justify-content: flex-end;
}

.slideshow-layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1120px) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  width: 100%;
}

.slideshow-qr {
  grid-column: 3;
  display: grid;
  place-items: center;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  align-self: center;
}

.qr-image {
  width: 240px;
  min-width: 200px;
  border-radius: 12px;
  background: white;
  padding: 10px;
  box-shadow: none;
}

.slideshow-back {
  color: white;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 14px 18px;
  border-radius: 16px;
  transition: background 0.2s ease;
}

.slideshow-back:hover {
  background: rgba(255, 255, 255, 0.08);
}

.hide-slideshow-back .slideshow-back {
  visibility: hidden;
}

.hide-slideshow-controls .slideshow-controls {
  visibility: hidden;
}

.slideshow-toggle {
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: none;
}

.slideshow-toggle:hover {
  background: rgba(255, 255, 255, 0.14);
  box-shadow: none;
  transform: none;
}

.slideshow {
  position: relative;
  grid-column: 2;
  width: 100%;
  max-width: 100%;
  min-height: 620px;
  aspect-ratio: 16 / 9;
  background: #111827;
  border-radius: 32px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.slideshow-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 2s ease-in-out;
  will-change: opacity;
  z-index: 1;
}

.slideshow-media.visible {
  opacity: 1;
  z-index: 2;
}

.slideshow-media.leaving {
  opacity: 0;
  z-index: 1;
}

.slideshow video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #020617;
}

.slideshow-buffering {
  position: absolute;
  left: 50%;
  bottom: 24px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.76);
  color: white;
  font-size: 0.92rem;
  font-weight: 700;
  transform: translateX(-50%);
}

.slideshow-buffering[hidden] {
  display: none;
}

.slideshow-buffering .spinner {
  width: 16px;
  height: 16px;
  border: 3px solid rgba(255, 255, 255, 0.28);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

@media (max-width: 860px) {
  .slideshow-header {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .slideshow-header-side,
  .slideshow-controls {
    justify-content: center;
  }

  .slideshow-layout {
    grid-template-columns: 1fr;
  }

  .slideshow {
    grid-column: 1;
  }

  .slideshow-qr {
    grid-column: 1;
    order: 2;
    width: 100%;
  }

  main {
    padding: 24px 14px;
  }
}

.slideshow-image {
  width: 100%;
  height: 100%;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

@media (max-width: 600px) {
  .media-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .media-preview img,
  .media-preview video {
    height: 140px;
    min-height: 140px;
  }

  .admin-media-row {
    grid-template-columns: 1fr;
  }

  .admin-preview {
    width: 100%;
    height: 180px;
  }
}

.slideshow-info {
  display: flex;
  justify-content: center;
  gap: 18px;
  color: #cbd5e1;
  font-size: 0.95rem;
}

.empty,
#slideshow-empty {
  color: #94a3b8;
}
