:root {
  --bg: #0f1720;
  --panel: rgba(255, 252, 246, 0.82);
  --panel-border: rgba(255, 255, 255, 0.28);
  --text: #17212b;
  --muted: #5c6772;
  --accent: #ff7a18;
  --success: #14804a;
  --danger: #b42318;
  --pending: #667085;
  --shadow: 0 24px 80px rgba(5, 16, 27, 0.32);
  --font-display: "Avenir Next", "Segoe UI Variable Display", "Helvetica Neue", sans-serif;
  --font-body: "Avenir Next", "Segoe UI Variable Text", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(255, 122, 24, 0.18), transparent 34%),
    linear-gradient(135deg, #111924 0%, #0c121a 100%);
}

button,
input,
textarea,
select {
  font: inherit;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

.slideshow {
  position: absolute;
  inset: 0;
  cursor: zoom-in;
}

.slideshow__layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  background-position: center;
  background-size: cover;
  transition: opacity 420ms ease;
  will-change: opacity;
}

.slideshow__layer.is-visible {
  opacity: 1;
}

.slideshow__veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 14, 20, 0.2), rgba(8, 14, 20, 0.52)),
    radial-gradient(circle at 20% 20%, rgba(255, 248, 238, 0.12), transparent 30%),
    linear-gradient(160deg, rgba(255, 122, 24, 0.1), rgba(255, 255, 255, 0));
}

.upload-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  gap: 0.85rem;
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.page-shell.is-expanded .slideshow {
  cursor: zoom-out;
}

.page-shell.is-expanded .slideshow__layer {
  background-size: contain;
  background-repeat: no-repeat;
  background-color: rgba(7, 10, 14, 0.94);
}

.page-shell.is-expanded .slideshow__veil {
  background: rgba(4, 8, 12, 0.18);
}

.page-shell.is-expanded .upload-panel {
  opacity: 0;
  transform: translateY(24px);
  pointer-events: none;
}

.page-shell.is-gallery-open .upload-panel {
  justify-content: flex-start;
  width: min(100%, 1100px);
  max-width: calc(100vw - 2rem);
}

.page-shell.is-lightbox-open .upload-panel {
  opacity: 0;
  pointer-events: none;
}

.gallery-button {
  align-self: flex-end;
  min-height: 42px;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  background: rgba(15, 23, 32, 0.44);
  color: white;
  font-size: 0.92rem;
  font-weight: 700;
  backdrop-filter: blur(14px);
  cursor: pointer;
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.gallery-button:hover {
  transform: translateY(-1px);
  background: rgba(15, 23, 32, 0.62);
  border-color: rgba(255, 255, 255, 0.44);
}

.gallery-panel {
  width: 100%;
  max-height: min(72vh, 900px);
  min-height: min(48vh, 520px);
  padding: 1rem;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.46);
  backdrop-filter: blur(18px);
  overflow: auto;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.gallery-thumb {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(23, 33, 43, 0.08);
  cursor: pointer;
}

.gallery-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.gallery-empty {
  color: var(--muted);
  font-size: 0.92rem;
  text-align: center;
  padding: 0.5rem 0;
}

.upload-button {
  width: 100%;
  min-height: 72px;
  padding: 1rem 1.35rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 24px;
  background: linear-gradient(135deg, #ff7a18, #ffb056);
  color: white;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  cursor: pointer;
  box-shadow: 0 18px 40px rgba(255, 122, 24, 0.28);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    filter 180ms ease;
}

.upload-button:hover,
.upload-button.is-dragover {
  transform: translateY(-2px);
  box-shadow: 0 22px 55px rgba(255, 122, 24, 0.34);
  filter: saturate(1.04);
}

.queue-card {
  width: 100%;
  padding: 1rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.46);
}

.queue-card__header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 0.5rem;
}

.queue-card__header span {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
}

.status-pill {
  padding: 0.34rem 0.72rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill[data-status="queued"],
.status-pill[data-status="uploading"] {
  background: rgba(102, 112, 133, 0.12);
  color: var(--pending);
}

.status-pill[data-status="success"] {
  background: rgba(20, 128, 74, 0.12);
  color: var(--success);
}

.status-pill[data-status="error"] {
  background: rgba(180, 35, 24, 0.12);
  color: var(--danger);
}

.progress-track {
  height: 9px;
  border-radius: 999px;
  background: rgba(23, 33, 43, 0.08);
  overflow: hidden;
}

.progress-track--overall {
  margin-top: 0.2rem;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff7a18, #ffb56b);
  transition: width 160ms linear;
}

.queue-detail {
  margin-top: 0.7rem;
  color: var(--muted);
  font-size: 0.88rem;
  min-height: 1.2rem;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(4, 8, 12, 0.94);
  cursor: zoom-out;
}

.lightbox[hidden] {
  display: none;
}

.lightbox__image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 20px;
}

@media (max-width: 767px) {
  .upload-panel {
    width: 100%;
    margin: 0;
    padding: 1rem;
    justify-content: flex-end;
  }

  .page-shell.is-gallery-open .upload-panel {
    width: 100%;
    max-width: 100%;
    padding: 0.75rem;
  }

  .gallery-panel {
    max-height: 70vh;
    min-height: 44vh;
    padding: 0.75rem;
    border-radius: 24px;
    backdrop-filter: none;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
  }

  .gallery-button {
    backdrop-filter: none;
  }

  .slideshow__layer {
    transition-duration: 260ms;
  }

  .slideshow__veil {
    background: linear-gradient(180deg, rgba(8, 14, 20, 0.16), rgba(8, 14, 20, 0.44));
  }

}

@media (min-width: 768px) and (max-width: 1100px) {
  .page-shell.is-gallery-open .upload-panel {
    width: min(100%, 900px);
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

@media (min-width: 768px) {
  .upload-panel {
    padding: 2rem;
  }
}
