:root {
  --bg: #f4efe8;
  --panel: rgba(255, 255, 255, 0.74);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --text: #171717;
  --muted: #67625a;
  --line: rgba(23, 23, 23, 0.08);
  --line-strong: rgba(23, 23, 23, 0.14);
  --shadow: 0 24px 60px rgba(49, 36, 25, 0.12);
  --radius-lg: 28px;
  --radius-md: 22px;
  --radius-sm: 999px;
}

* {
  box-sizing: border-box;
}

button,
a,
input,
select,
textarea,
summary {
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.8), transparent 30%),
    linear-gradient(180deg, #efe6dc 0%, #f9f6f1 36%, #efe8df 100%);
}

a {
  color: inherit;
}

button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus,
summary:focus {
  outline: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid rgba(23, 23, 23, 0.24);
  outline-offset: 2px;
}

img {
  display: block;
  width: 100%;
}

code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.95em;
}

.page-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.site-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  padding: 4px 2px;
}

.site-brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.05em;
  font-size: 1.15rem;
}

.site-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
}

.site-nav-form {
  margin: 0;
}

.site-nav-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.site-nav-form button:hover {
  background: rgba(255, 255, 255, 0.68);
  color: var(--text);
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

#manage-status {
  margin-top: 0;
  margin-bottom: 0;
}

#home-create-gallery[hidden] {
  display: none;
}

.home-create-panel {
  scroll-margin-top: 24px;
}

[data-create-gallery-status]:empty {
  display: none;
}

[data-gallery-grid][hidden] {
  display: none;
}

.flash {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.flash-success {
  border-color: rgba(34, 139, 34, 0.2);
}

.flash-error {
  border-color: rgba(180, 40, 40, 0.2);
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 24px;
  align-items: end;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero-home {
  min-height: 320px;
}

.hero-login {
  min-height: 280px;
}

.hero-gallery {
  align-items: stretch;
}

.hero-gallery-media {
  grid-column: 1 / -1;
  display: block;
  aspect-ratio: 16 / 5;
  min-height: 220px;
  overflow: hidden;
  border-radius: 20px;
  cursor: zoom-in;
  background: #d8c7b4;
}

.hero-gallery-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-meta {
  display: grid;
  gap: 12px;
}

.hero-meta-home {
  align-self: end;
}

.eyebrow,
.section-kicker,
.panel-kicker {
  margin: 0 0 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  font-weight: 700;
}

.hero h1,
.section-head h2,
.panel h2 {
  margin: 0;
  letter-spacing: -0.05em;
}

.hero h1 {
  font-size: clamp(2.1rem, 5vw, 4.4rem);
  line-height: 0.98;
  max-width: 10ch;
}

.intro,
.section-copy,
.panel p,
.folder-description {
  max-width: 58ch;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.meta-card {
  padding: 18px 20px;
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  border: 1px solid rgba(23, 23, 23, 0.06);
}

.meta-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.content-stack {
  display: grid;
  gap: 22px;
  margin-top: 26px;
}

.auth-layout {
  max-width: 840px;
  margin-inline: auto;
}

.auth-panel {
  padding: 28px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.section-head h2 {
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  align-items: center;
  margin: 26px 0 18px;
  padding: 10px 0;
  background: rgba(249, 246, 241, 0.88);
  backdrop-filter: blur(14px);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.share-box {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.56);
}

.share-label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.share-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.share-status {
  color: var(--muted);
  font-size: 0.92rem;
  min-height: 1.2em;
}

.download-all,
.ghost-link,
.card-action,
.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 700;
  border: 0;
  cursor: pointer;
}

.download-all,
.ghost-link,
.card-action,
.action-link,
.folder-link,
.upload-pick,
.upload-submit,
.upload-chip-remove,
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background-color 140ms ease,
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    opacity 140ms ease,
    filter 140ms ease;
}

.download-all:active,
.ghost-link:active,
.card-action:active,
.action-link:active,
.folder-link:active,
.upload-pick:active,
.upload-submit:active,
.upload-chip-remove:active,
.lightbox-close:active,
.lightbox-prev:active,
.lightbox-next:active {
  transform: translateY(1px) scale(0.99);
}

.download-all {
  gap: 10px;
  background: #171717;
  color: #fff;
}

.download-all-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.download-all-icon svg {
  width: 18px;
  height: 18px;
}

.download-all-label {
  white-space: nowrap;
}

.download-all,
.action-link {
  background: #171717;
  color: #fff;
}

.ghost-link,
.card-action {
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: rgba(255, 255, 255, 0.52);
}

.ghost-link:active,
.card-action:active,
.folder-link:active {
  background: rgba(255, 255, 255, 0.64);
  border-color: rgba(23, 23, 23, 0.18);
}

.card-action-download {
  background: rgba(23, 23, 23, 0.86);
  color: #fff;
}

.card-action-download:active {
  background: rgba(23, 23, 23, 0.94);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.card,
.folder-card,
.panel {
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: var(--shadow);
}

.card {
  position: relative;
  min-height: 310px;
}

.card-featured {
  grid-column: span 2;
  min-height: 420px;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 180ms ease, filter 180ms ease;
}

.card-image-link {
  display: block;
  height: 100%;
  cursor: zoom-in;
}

.card-image-link img {
  height: 100%;
}

.card:hover img {
  transform: scale(1.04);
  filter: brightness(1.02) saturate(1.02);
}

.card-overlay {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 78px;
  z-index: 1;
  display: grid;
  gap: 6px;
  color: #fff;
  text-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.card-actions {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  z-index: 1;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  line-height: 1.6;
  min-height: 240px;
}

.empty-state-large {
  display: grid;
  place-items: start;
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.folder-card-featured {
  grid-column: span 2;
}

.folder-preview {
  position: relative;
  min-height: 240px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: end;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(216, 199, 180, 0.8), transparent 35%),
    linear-gradient(135deg, #d6c6b5 0%, #b9a28d 100%);
  color: #fff;
}

.folder-preview::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.56));
  z-index: 0;
}

.folder-preview::after {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  z-index: 1;
}

.folder-preview-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.95) contrast(0.92);
  z-index: 0;
}

.folder-preview span,
.folder-label {
  position: relative;
  z-index: 1;
  display: block;
  margin-bottom: 6px;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.82;
}

.folder-preview strong {
  position: relative;
  z-index: 1;
  font-size: 1.2rem;
}

.folder-copy {
  display: grid;
  gap: 10px;
  padding: 22px;
}

.folder-copy h3 {
  margin: 0;
  font-size: 1.05rem;
  word-break: break-all;
}

.folder-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 0 22px 22px;
  flex-wrap: wrap;
}

.field {
  display: grid;
  gap: 8px;
  min-width: min(100%, 320px);
}

.field-label {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.input {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  font: inherit;
}

.create-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.create-field {
  display: grid;
  gap: 8px;
  min-width: 0;
  align-self: end;
}

.create-field .input {
  height: 46px;
  min-height: 46px;
}

.create-form .action-link {
  align-self: end;
  height: 46px;
  min-height: 46px;
  white-space: nowrap;
}

.auth-form {
  display: grid;
  gap: 16px;
  max-width: 520px;
  margin-top: 28px;
}

.auth-field {
  display: grid;
  gap: 8px;
}

.password-control {
  position: relative;
  display: block;
}

.password-input {
  padding-right: 54px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transform: translateY(-50%);
}

.password-toggle svg {
  width: 21px;
  height: 21px;
}

.password-toggle:hover {
  background: rgba(23, 23, 23, 0.06);
  color: var(--text);
}

.password-toggle:active {
  transform: translateY(-50%) scale(0.98);
}

.auth-submit {
  width: fit-content;
}

.auth-flash {
  margin-bottom: 0;
}

.row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.row-actions form {
  margin: 0;
}

.file-row .ghost-link {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.folder-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: #171717;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.folder-link-secondary {
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  border: 1px solid var(--line-strong);
}

.folder-link:active {
  filter: brightness(0.98);
}

.menu-link {
  color: inherit;
  text-decoration: none;
}

.danger-panel {
  border-color: rgba(184, 57, 57, 0.18);
}

.error-panel {
  display: grid;
  gap: 12px;
}

.danger,
.danger-action {
  border-color: rgba(184, 57, 57, 0.24);
  color: #8b2d2d;
}

.cover-action.is-cover {
  border-color: rgba(28, 120, 66, 0.24);
  background: rgba(28, 120, 66, 0.1);
  color: #1c7842;
}

.danger-action {
  background: rgba(184, 57, 57, 0.12);
}

.folder-meta,
.toolbar-note {
  color: var(--muted);
  font-size: 0.92rem;
}

.panel {
  padding: 24px;
}

.upload-panel {
  padding: 28px;
  background: rgba(255, 255, 255, 0.82);
  border-color: #eaeaea;
  box-shadow:
    0 12px 30px rgba(17, 24, 39, 0.06),
    0 1px 0 rgba(255, 255, 255, 0.78) inset;
  backdrop-filter: blur(18px);
}

.upload-box {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.rename-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  max-width: 640px;
}

.rename-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.rename-submit {
  min-height: 46px;
  border-radius: 16px;
}

.file-input {
  position: absolute;
  inset: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.upload-dropzone {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  text-align: center;
  overflow: hidden;
  gap: 14px;
  padding: 34px 28px 30px;
  border-radius: 16px;
  border: 1px solid #eaeaea;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 250, 250, 0.9));
  box-shadow:
    0 10px 24px rgba(17, 24, 39, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.upload-dropzone::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(17, 24, 39, 0.05), transparent 42%),
    radial-gradient(circle at 80% 18%, rgba(17, 24, 39, 0.03), transparent 24%);
  opacity: 0.8;
  pointer-events: none;
}

.upload-dropzone::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(234, 234, 234, 0.88);
  border-radius: 12px;
  pointer-events: none;
}

.upload-dropzone > * {
  position: relative;
  z-index: 1;
}

.upload-dropzone-center {
  justify-items: center;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: rgba(17, 24, 39, 0.04);
  color: #171717;
}

.upload-icon svg {
  width: 24px;
  height: 24px;
}

.upload-dropzone-copy {
  display: grid;
  gap: 10px;
  max-width: 52ch;
  justify-items: center;
}

.upload-dropzone-copy .panel-kicker {
  margin-bottom: 0;
}

.upload-dropzone-copy p {
  margin: 0;
  line-height: 1.6;
  color: var(--muted);
}

.upload-dropzone h3 {
  margin: 0;
  font-size: clamp(1.2rem, 2.2vw, 1.7rem);
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.upload-dropzone p {
  margin-top: 0;
}

.upload-dropzone-actions {
  display: grid;
  gap: 6px;
  justify-items: center;
  margin-top: 8px;
  max-width: 52ch;
}

.upload-pick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 20px;
  width: fit-content;
  border: 0;
  border-radius: 12px;
  background: #171717;
  color: #fff;
  font: inherit;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(17, 24, 39, 0.12);
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease, background 180ms ease;
}

.upload-pick:hover {
  transform: translateY(-1px);
  background: #111111;
  box-shadow: 0 12px 24px rgba(17, 24, 39, 0.15);
}

.upload-pick:active {
  transform: translateY(0);
  box-shadow: 0 8px 16px rgba(17, 24, 39, 0.12);
}

.dropzone-note {
  color: var(--muted);
  font-weight: 600;
  line-height: 1.45;
}

.dropzone-hint {
  color: rgba(23, 23, 23, 0.62);
  font-size: 0.92rem;
  line-height: 1.45;
}

.upload-dropzone.has-files {
  border-color: #dfdfdf;
}

.upload-dropzone.is-dragover {
  transform: translateY(-1px);
  border-color: #d4d4d4;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(247, 247, 247, 0.95));
  box-shadow:
    0 16px 36px rgba(17, 24, 39, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.upload-dropzone.is-uploading {
  border-style: solid;
  border-color: #e2e2e2;
}

.upload-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 6px;
}

.upload-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 10px 12px 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 24px rgba(49, 36, 25, 0.08);
  animation: chip-pop 180ms ease-out;
}

.upload-chip-name {
  max-width: 28ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.upload-chip-meta {
  color: var(--muted);
  font-size: 0.86rem;
  white-space: nowrap;
}

.upload-chip-remove {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(23, 23, 23, 0.08);
  color: var(--text);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.upload-progress {
  position: relative;
  overflow: hidden;
  padding: 16px 18px 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid #eaeaea;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.04);
}

.upload-progress.is-active::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.45) 45%, transparent 100%);
  transform: translateX(-100%);
  animation: progress-sheen 1.45s ease-in-out infinite;
  pointer-events: none;
}

.upload-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 6px;
}

.upload-progress-head strong {
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.upload-progress-head span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
}

.upload-progress-meta {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}

.upload-progress-track {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.06);
}

.upload-debug {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(184, 57, 57, 0.18);
  background: rgba(255, 255, 255, 0.86);
}

.upload-debug[hidden] {
  display: none;
}

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

.upload-debug-head strong {
  font-size: 0.92rem;
}

.upload-debug-head .ghost-link {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.78rem;
}

.upload-debug pre {
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #3d312b;
  font-size: 0.78rem;
  line-height: 1.45;
}

.upload-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #171717 0%, #383838 50%, #171717 100%);
  box-shadow: 0 0 18px rgba(17, 24, 39, 0.1);
  transition: width 180ms ease;
}

.upload-progress.is-indeterminate .upload-progress-bar {
  width: 34%;
  animation: progress-bar-sweep 1.05s ease-in-out infinite;
}

.upload-progress.is-complete {
  border-color: #dff2e7;
  background: rgba(246, 252, 248, 0.96);
}

.upload-progress.is-complete .upload-progress-bar {
  background: linear-gradient(90deg, #1c7842 0%, #40a468 50%, #1c7842 100%);
  box-shadow: 0 0 18px rgba(28, 120, 66, 0.14);
}

.upload-progress.is-complete .upload-progress-head strong {
  color: #1c7842;
}

.upload-submit {
  justify-self: start;
  min-width: 190px;
  min-height: 50px;
  padding-inline: 22px;
  border-radius: 16px;
  margin-top: 0;
  background: #171717;
  box-shadow: 0 10px 20px rgba(17, 24, 39, 0.12);
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease, background 180ms ease;
}

.upload-submit:hover {
  transform: translateY(-1px);
  background: #111111;
  box-shadow: 0 12px 24px rgba(17, 24, 39, 0.15);
}

.upload-submit:active {
  transform: translateY(0);
  box-shadow: 0 8px 16px rgba(17, 24, 39, 0.12);
}

.upload-chip-remove:active {
  transform: translateY(1px) scale(0.98);
  background: rgba(23, 23, 23, 0.12);
}

.upload-dropzone.is-uploading,
.upload-progress.is-active {
  cursor: progress;
}

.upload-box.is-uploading .upload-dropzone {
  pointer-events: none;
}

.upload-box.is-uploading .upload-submit {
  opacity: 0.9;
}

.upload-box.is-uploading .upload-chip-remove {
  pointer-events: none;
}

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

.file-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(23, 23, 23, 0.06);
}

.file-row form {
  margin: 0;
}

.file-row [data-file-name] {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  font-size: 0.92rem;
}

.file-row.is-removing {
  opacity: 0.45;
}

.file-row.is-new {
  outline: 2px solid rgba(23, 23, 23, 0.12);
}

@keyframes chip-pop {
  from {
    transform: translateY(4px) scale(0.98);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes progress-sheen {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

@keyframes progress-bar-sweep {
  0% {
    transform: translateX(-18%);
  }
  50% {
    transform: translateX(128%);
  }
  100% {
    transform: translateX(-18%);
  }
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 12, 0.82);
  backdrop-filter: blur(14px);
}

.lightbox-dialog {
  position: relative;
  z-index: 1;
  width: min(96vw, 1320px);
  max-height: 94vh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
}

.lightbox-image {
  width: 100%;
  max-height: calc(94vh - 82px);
  object-fit: contain;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 28px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.5);
}

.lightbox-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  color: rgba(255, 255, 255, 0.86);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lightbox-caption {
  min-width: 0;
  text-align: left;
}

.lightbox-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #171717;
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
}

.lightbox-close {
  top: -12px;
  right: -12px;
  transform: none;
}

.lightbox-prev {
  left: -64px;
}

.lightbox-next {
  right: -64px;
}

.lightbox-trigger {
  cursor: zoom-in;
}

.lightbox-close:active,
.lightbox-prev:active,
.lightbox-next:active {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev:active,
.lightbox-next:active {
  transform: translateY(-50%) scale(0.985);
}

.lightbox-close:active {
  transform: scale(0.985);
}

@media (max-width: 900px) {
  .hero,
  .gallery,
  .folder-grid {
    grid-template-columns: 1fr;
  }

  .card-featured,
  .folder-card-featured {
    grid-column: span 1;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .lightbox-prev {
    left: 10px;
  }

  .lightbox-next {
    right: 10px;
  }

  .lightbox-close {
    top: 10px;
    right: 10px;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 1240px);
    padding-top: 20px;
  }

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

  .card,
  .card-featured {
    grid-column: span 1;
    min-height: 240px;
    border-radius: 18px;
  }

  .card-overlay {
    left: 10px;
    right: 10px;
    bottom: 90px;
  }

  .card-overlay strong {
    font-size: 0.82rem;
    line-height: 1.15;
  }

  .card-actions {
    left: 8px;
    right: 8px;
    bottom: 8px;
    gap: 6px;
  }

  .card-action {
    flex: 1 1 100%;
    min-height: 34px;
    padding: 6px 8px;
    font-size: 0.72rem;
  }

  .hero {
    grid-template-columns: 1fr;
    padding: 22px;
  }

  .hero-gallery-media {
    aspect-ratio: 4 / 3;
    min-height: 180px;
    border-radius: 16px;
  }

  .file-row,
  .folder-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .file-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 10px;
    border-radius: 14px;
  }

  .file-row [data-file-name] {
    width: 100%;
    font-size: 0.84rem;
  }

  .file-row .row-actions {
    justify-content: flex-start;
    gap: 6px;
    width: 100%;
  }

  .file-row .ghost-link {
    min-height: 30px;
    padding: 5px 8px;
    font-size: 0.72rem;
  }

  .upload-panel {
    padding: 18px;
  }

  .upload-box {
    gap: 14px;
    margin-top: 18px;
  }

  .rename-form {
    grid-template-columns: 1fr;
    max-width: none;
  }

  .rename-submit {
    width: 100%;
  }

  .upload-dropzone {
    width: 100%;
    min-width: 0;
    gap: 12px;
    padding: 22px 14px 18px;
    border-radius: 14px;
  }

  .upload-dropzone > * {
    max-width: 100%;
    min-width: 0;
  }

  .upload-dropzone::after {
    inset: 8px;
  }

  .upload-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .upload-dropzone-copy {
    max-width: 100%;
    gap: 8px;
  }

  .upload-dropzone h3 {
    font-size: 1.12rem;
    line-height: 1.15;
  }

  .upload-dropzone-copy p:not(.panel-kicker) {
    font-size: 0.9rem;
    line-height: 1.45;
  }

  .upload-pick {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 0.92rem;
  }

  .upload-dropzone-actions {
    width: 100%;
    justify-items: stretch;
    text-align: left;
    gap: 4px;
  }

  .dropzone-note,
  .dropzone-hint {
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: 0.84rem;
  }

  .upload-preview {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
    gap: 8px;
  }

  .upload-chip {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "name remove"
      "meta remove";
    align-items: center;
    gap: 3px 8px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 9px 10px 9px 12px;
    border-radius: 14px;
  }

  .upload-chip-name {
    grid-area: name;
    max-width: none;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.84rem;
  }

  .upload-chip-meta {
    grid-area: meta;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.78rem;
  }

  .upload-chip-remove {
    grid-area: remove;
    width: 30px;
    height: 30px;
  }

  .upload-progress {
    padding: 14px;
  }

  .upload-progress-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .upload-progress-meta {
    overflow-wrap: anywhere;
    font-size: 0.78rem;
  }

  .upload-debug {
    padding: 12px;
  }

  .upload-debug-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .upload-submit {
    width: 100%;
    min-height: 44px;
  }

  .toolbar-actions {
    justify-content: flex-start;
  }

  .toolbar .download-all,
  .toolbar .ghost-link {
    min-height: 38px;
    width: auto;
    padding: 7px 10px;
    font-size: 0.78rem;
  }

  .toolbar .download-all {
    gap: 6px;
  }

  .download-all-icon,
  .download-all-icon svg {
    width: 15px;
    height: 15px;
  }

  .toolbar-note {
    display: none;
  }

  .create-form {
    grid-template-columns: 1fr;
  }

  .create-form .action-link {
    width: 100%;
  }
}
