:root {
  color-scheme: light;
  --ink: #27171a;
  --ink-muted: #68535a;
  --accent: #8b1e2d;
  --accent-deep: #65131f;
  --accent-soft: #f8e6e9;
  --canvas: #f8f5f5;
  --surface: rgba(255, 255, 255, 0.78);
  --line: rgba(105, 54, 62, 0.18);
  --shadow-soft: 0 18px 60px rgba(74, 34, 42, 0.14);
  --shadow-float: 0 22px 70px rgba(63, 24, 33, 0.22);
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 28px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --page-pad: clamp(18px, 4vw, 64px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; overflow-x: clip; background: var(--canvas); }
body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse 65% 50% at 12% 16%, rgba(165, 45, 61, 0.12), transparent 65%),
    radial-gradient(ellipse 60% 42% at 92% 90%, rgba(216, 133, 145, 0.14), transparent 68%),
    var(--canvas);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.6), transparent 44%);
  pointer-events: none;
}

button, input, textarea { font: inherit; }
button, a, input, textarea, label[for="video"] { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
h1, h2, p { margin-top: 0; }
svg { display: block; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid #8b1e2d;
  outline-offset: 4px;
}

.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;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(96vw, 2400px);
  min-height: 76px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) var(--page-pad) 12px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 46% 54%;
  background: linear-gradient(145deg, #d77783 0%, #a72b3b 48%, #721623 100%);
  box-shadow: 0 5px 16px rgba(139, 30, 45, 0.28);
  transform: rotate(-12deg);
}

.brand-avatar {
  width: 34px;
  height: 34px;
  border: 2px solid rgba(139, 30, 45, 0.3);
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 57%;
  box-shadow: 0 5px 16px rgba(139, 30, 45, 0.2);
}

.header-note { display: none; }
.header-note, .private-badge {
  color: var(--ink-muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.header-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.logout-form { margin: 0; }
.logout-button { white-space: nowrap; }

.private-badge {
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
}

.glass-panel {
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  -webkit-backdrop-filter: blur(24px) saturate(130%);
  backdrop-filter: blur(24px) saturate(130%);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 22px;
  border: 0;
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 180ms var(--ease-out), background-color 180ms ease, box-shadow 180ms ease;
}

.button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.button-primary { color: #fff; background: var(--accent); box-shadow: 0 9px 24px rgba(139, 30, 45, 0.24); }
.button-secondary { color: var(--ink); background: #f0e8ea; }
.button-danger { color: #fff; background: #b02a37; box-shadow: 0 6px 18px rgba(176, 42, 55, 0.24); }
.button-danger:hover { background: #8a1f2b; }
.button-wide { width: 100%; }
.button-compact { min-height: 48px; padding: 0 16px; font-size: 0.9rem; }
.button:disabled { opacity: 0.55; cursor: wait; box-shadow: none; }
.button:active { transform: scale(0.98); }

.upload-shell {
  display: grid;
  gap: clamp(34px, 6vw, 92px);
  align-items: center;
  width: min(1480px, 100%);
  min-height: calc(100svh - 92px);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 80px) var(--page-pad) max(40px, env(safe-area-inset-bottom));
}

.upload-intro {
  position: relative;
  z-index: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: clamp(20px, 3vw, 36px);
  min-width: 0;
}
.home-portrait {
  flex-shrink: 0;
  width: clamp(190px, 20vw, 260px);
  aspect-ratio: 1;
  border: 5px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 40%;
  box-shadow: 
    0 16px 40px rgba(115, 30, 45, 0.18),
    0 4px 14px rgba(0, 0, 0, 0.04);
  animation: float-clean 4.2s ease-in-out infinite alternate;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

@keyframes float-clean {
  0% {
    transform: translate3d(0, 0, 0);
    box-shadow: 
      0 14px 32px rgba(115, 30, 45, 0.15),
      0 4px 10px rgba(0, 0, 0, 0.03);
  }
  100% {
    transform: translate3d(0, -16px, 0);
    box-shadow: 
      0 30px 62px rgba(115, 30, 45, 0.25),
      0 8px 18px rgba(0, 0, 0, 0.05);
  }
}.upload-intro-copy {
  flex: 1;
  min-width: 0;
}
.upload-intro h1 {
  margin-bottom: 20px;
  font-size: clamp(2rem, 3.2vw, 3.4rem);
  font-weight: 730;
  line-height: 1.02;
  letter-spacing: -0.04em;
  text-wrap: balance;
  overflow-wrap: break-word;
}
.upload-intro h1 span { color: var(--accent); }
.upload-intro-copy p { max-width: 36ch; color: var(--ink-muted); font-size: clamp(1rem, 2vw, 1.2rem); }

.upload-panel { padding: clamp(22px, 4vw, 38px); }
.stack-form { display: grid; gap: 22px; }
.field { display: grid; gap: 8px; }
.field > label:first-child { color: var(--ink); font-size: 0.91rem; font-weight: 700; }
.field input:not([type="checkbox"]):not([type="radio"]), .field textarea {
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
.field input.visually-hidden { width: 1px; min-height: 0; padding: 0; border: 0; }
.field textarea { min-height: 112px; resize: vertical; }
.field input:not([type="checkbox"]):not([type="radio"])::placeholder, .field textarea::placeholder { color: #765f65; opacity: 1; }
.field input:not([type="checkbox"]):not([type="radio"]):focus, .field textarea:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px rgba(139, 30, 45, 0.13); }

.checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
  margin-top: 4px;
  width: fit-content;
}
.checkbox-field input[type="checkbox"] {
  width: 19px !important;
  height: 19px !important;
  min-height: 19px !important;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
  padding: 0;
  border-radius: 4px;
}

.required-star {
  color: var(--accent);
  font-weight: 700;
}

.file-picker {
  display: flex;
  gap: 14px;
  align-items: center;
  min-height: 82px;
  padding: 14px;
  border: 1px dashed #9a737a;
  border-radius: var(--radius-md);
  background: rgba(253, 247, 248, 0.78);
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.file-picker.is-dragover {
  border-color: var(--accent);
  background: #fae6e9;
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(139, 30, 45, 0.16);
}
.file-icon { display: grid; flex: 0 0 48px; width: 48px; height: 48px; place-items: center; border-radius: var(--radius-sm); color: var(--accent); background: var(--accent-soft); }
.file-icon svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.file-copy { display: grid; min-width: 0; }
.file-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-copy small { color: var(--ink-muted); }
#video:focus-visible + .file-picker, .file-picker:has(+ #video:focus-visible) { outline: 3px solid #8b1e2d; outline-offset: 4px; }

.upload-progress { display: grid; gap: 8px; padding: 14px; border-radius: var(--radius-sm); background: var(--accent-soft); }
.progress-line { display: flex; gap: 12px; justify-content: space-between; color: var(--ink-muted); font-size: 0.82rem; }
progress { width: 100%; height: 8px; border: 0; border-radius: 999px; overflow: hidden; background: #e1cdd1; }
progress::-webkit-progress-bar { background: #e1cdd1; }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.form-actions .button-primary { flex: 1; }
.form-actions .button-secondary { flex: 1; }
.privacy-note { display: flex; gap: 9px; align-items: flex-start; margin: 22px 0 0; padding-top: 20px; border-top: 1px solid var(--line); color: var(--ink-muted); font-size: 0.8rem; }
.privacy-note svg { flex: 0 0 17px; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; }

.login-shell { display: grid; min-height: 100svh; padding: max(24px, env(safe-area-inset-top)) var(--page-pad) max(24px, env(safe-area-inset-bottom)); place-items: center; }
.login-panel { position: relative; width: min(460px, 100%); padding: clamp(24px, 6vw, 42px); overflow: hidden; }
.login-panel::before { position: absolute; z-index: -1; top: -30%; left: 43%; width: 340px; aspect-ratio: 1.7; border-radius: 50%; content: ""; background: rgba(180, 54, 70, 0.15); transform: rotate(-12deg); }
.login-copy { margin: 48px 0 28px; }
.login-copy h1 { margin-bottom: 10px; font-size: clamp(2rem, 7vw, 3.15rem); line-height: 1; letter-spacing: -0.04em; }
.login-copy p, .back-link { color: var(--ink-muted); }
.back-link { display: inline-flex; min-height: 48px; margin-top: 18px; align-items: center; font-size: 0.9rem; font-weight: 650; }
.alert, .conversion-error { padding: 10px 12px; border-radius: 10px; color: #76110c; background: #ffdedb; }

/* Layout & Admin Sidebar */
.admin-layout {
  display: grid;
  grid-template-columns: minmax(200px, 240px) minmax(0, 1fr);
  gap: clamp(24px, 3.5vw, 48px);
  width: min(96vw, 2400px);
  margin: 0 auto;
  padding: clamp(32px, 5vw, 72px) var(--page-pad) max(60px, env(safe-area-inset-bottom));
  align-items: start;
  animation: viewFadeIn 480ms var(--ease-out) both;
}
.admin-sidebar {
  position: sticky;
  top: 90px;
  padding: 12px 10px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
.admin-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  font-size: 0.92rem;
  font-weight: 650;
  text-decoration: none;
  transition: all 180ms ease;
}
.admin-sidebar-link svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  flex-shrink: 0;
}
.admin-sidebar-link:hover {
  color: var(--accent);
  background: rgba(139, 30, 45, 0.06);
  transform: translateX(3px);
}
.admin-sidebar-link.is-active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 6px 18px rgba(139, 30, 45, 0.22);
}
.admin-sidebar-link.is-active svg {
  stroke: #fff;
}
.admin-layout .admin-shell {
  width: 100%;
  margin: 0;
  padding: 0;
}

/* Live Preview */
.admin-settings-layout {
  display: grid;
  grid-template-columns: minmax(380px, 460px) minmax(480px, 1fr);
  gap: clamp(20px, 3vw, 36px);
  align-items: start;
}
.admin-preview-panel {
  padding: clamp(24px, 3vw, 36px);
  border-radius: var(--radius-lg);
  position: sticky;
  top: 90px;
}
.admin-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.admin-preview-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(139, 30, 45, 0.7);
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(139, 30, 45, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(139, 30, 45, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(139, 30, 45, 0); }
}
.preview-mockup-window {
  border: 1px solid rgba(139, 30, 45, 0.16);
  border-radius: var(--radius-lg);
  background: #fff;
  padding: clamp(24px, 3vw, 42px);
  min-height: clamp(520px, 62vh, 720px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 38px rgba(74, 34, 42, 0.08);
}
.preview-site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
}
.preview-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.95fr);
  gap: clamp(18px, 2.5vw, 32px);
  align-items: center;
  flex: 1;
}
.preview-intro-col {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 24px);
}
.preview-floating-img {
  width: clamp(100px, 9vw, 150px) !important;
  height: clamp(100px, 9vw, 150px) !important;
  flex-shrink: 0;
  border-radius: 50%;
}
.preview-title-el {
  font-size: clamp(1.4rem, 2vw, 2.2rem) !important;
  font-weight: 750;
  line-height: 1.05;
  margin-bottom: 8px;
  letter-spacing: -0.03em;
}
.preview-title-el span {
  color: var(--accent);
}
.preview-sub-el {
  font-size: clamp(0.85rem, 1vw, 1.05rem);
  color: var(--ink-muted);
  line-height: 1.35;
  margin: 0;
}
.preview-mockup-card {
  padding: clamp(16px, 2vw, 22px);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fdfafb;
}
.preview-mockup-field {
  margin-bottom: 12px;
}
.preview-field-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 5px;
}
.preview-field-input, .preview-field-textarea, .preview-field-picker {
  font-size: 0.82rem;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs, 8px);
  background: #fff;
  color: var(--ink-muted);
}
.preview-field-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  border-style: dashed;
}

/* Crop Dialog */
.crop-dialog {
  border: 0;
  border-radius: var(--radius-lg);
  padding: 0;
  background: #fff;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
  max-width: min(440px, 92vw);
  margin: auto;
}
.crop-dialog::backdrop {
  background: rgba(20, 10, 15, 0.68);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.crop-shell {
  padding: clamp(20px, 3vw, 28px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.crop-shell h3 {
  font-size: 1.25rem;
  margin-bottom: 6px;
  color: var(--ink);
}
.crop-subtitle {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-bottom: 18px;
}
.crop-viewport {
  position: relative;
  width: min(280px, 75vw);
  height: min(280px, 75vw);
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 4px var(--accent), 0 10px 30px rgba(0, 0, 0, 0.15);
  cursor: grab;
  touch-action: none;
  margin-bottom: 18px;
  background: #1a1a1a;
}
.crop-viewport:active {
  cursor: grabbing;
}
#crop-canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.crop-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 280px;
  margin-bottom: 20px;
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--ink);
}
.crop-controls input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
}
.crop-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}
.crop-actions button {
  flex: 1;
}

/* In-card Success & Confetti */
.upload-success-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: clamp(20px, 3vw, 32px) 8px;
  animation: viewFadeIn 420ms var(--ease-out) both;
}
.upload-success-content .success-icon-badge {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  margin-bottom: 18px;
  box-shadow: 0 10px 24px rgba(139, 30, 45, 0.28);
}
.upload-success-content .success-icon-badge svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.upload-success-content h2 {
  font-size: clamp(1.6rem, 2.5vw, 2.1rem);
  font-weight: 750;
  margin-bottom: 8px;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.upload-success-content p {
  font-size: 0.94rem;
  color: var(--ink-muted);
  line-height: 1.45;
  margin-bottom: 28px;
  max-width: 34ch;
}
.confetti-canvas-panel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
}

.gallery-shell, .admin-shell { width: min(96vw, 2400px); margin: 0 auto; padding: clamp(36px, 5vw, 80px) var(--page-pad) max(60px, env(safe-area-inset-bottom)); }
.gallery-heading { margin-bottom: clamp(34px, 6vw, 68px); }
.gallery-heading h1, .admin-heading h1 { margin-bottom: 14px; font-size: clamp(2.8rem, 8vw, 6rem); line-height: 0.96; letter-spacing: -0.04em; }
.gallery-heading p, .admin-heading p { max-width: 52ch; margin-bottom: 0; color: var(--ink-muted); font-size: clamp(1rem, 2vw, 1.2rem); }

.gallery-tools {
  display: grid;
  gap: 16px;
  margin-bottom: clamp(32px, 5vw, 54px);
  padding-bottom: 24px;
  padding-right: clamp(10px, 3vw, 48px);
  border-bottom: 1px solid var(--line);
}
.gallery-filters, .gallery-downloads { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-chip, .gallery-downloads a {
  display: inline-flex;
  min-height: 56px;
  padding: 0 16px;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  color: var(--ink-muted);
  background: rgba(255, 255, 255, 0.68);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  transition: color 180ms ease, background-color 180ms ease, transform 180ms var(--ease-out);
}
.filter-chip span { color: inherit; font-variant-numeric: tabular-nums; opacity: 0.7; }
.filter-chip { color: var(--ink); }
.filter-chip.is-active { color: var(--ink); background: #f4c8cf; box-shadow: 0 8px 22px rgba(139, 30, 45, 0.18); }
.filter-chip svg, .gallery-downloads a svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  flex-shrink: 0;
}
.gallery-search {
  display: flex;
  width: min(620px, 100%);
  min-height: 56px;
  padding: 0 16px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.78);
}
.gallery-search svg { flex: 0 0 21px; width: 21px; fill: none; stroke: var(--ink-muted); stroke-linecap: round; stroke-width: 1.8; }
.gallery-search input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; }
.gallery-search input::placeholder { color: #765f65; opacity: 1; }
.gallery-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(139, 30, 45, 0.13); }
.gallery-downloads a { border-radius: var(--radius-sm); background: #f0e8ea; }
.gallery-downloads .download-all { color: #fff; background: var(--accent); }

/* Gallery Density Controls */
.gallery-density {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.72);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  gap: 4px;
}
.density-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 160ms ease;
}
.density-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}
.density-btn:hover, .density-btn.is-active {
  background: var(--accent);
  color: #fff;
}

.gallery-grid { display: grid; grid-template-columns: 1fr; gap: clamp(22px, 3vw, 38px); }
.gallery-grid.grid-compact { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important; gap: 16px; }
.gallery-grid.grid-large { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)) !important; gap: 28px; }

.memory-card {
  position: relative;
  min-width: 0;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: 0 4px 18px rgba(74, 34, 42, 0.05);
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}
.memory-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 34px rgba(74, 34, 42, 0.12);
  border-color: rgba(139, 30, 45, 0.25);
}

.memory-open { display: grid; width: 100%; padding: 0; border: 0; color: inherit; text-align: left; background: transparent; cursor: pointer; }
.memory-frame { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius-md); background: linear-gradient(145deg, #f8e6e9, #e8bdc4); box-shadow: 0 12px 38px rgba(74, 34, 42, 0.14); transition: transform 260ms var(--ease-out), box-shadow 260ms ease; }
.memory-frame img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; transition: transform 420ms var(--ease-out); }
.memory-placeholder { display: block; width: 100%; height: 100%; background: radial-gradient(circle at 35% 30%, #fff7f8 0 8%, transparent 42%), linear-gradient(140deg, #f8e6e9, #dda9b1); }
.zoom-disc {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(20, 10, 15, 0.72);
  color: #fff;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(0.7);
  transition: all 220ms var(--ease-out);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 2;
}
.zoom-disc svg { width: 22px; height: 22px; stroke: #fff; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.memory-open:hover .zoom-disc { opacity: 1; transform: scale(1); }

.play-disc { position: absolute; right: 16px; bottom: 16px; display: grid; width: 52px; height: 52px; place-items: center; border-radius: 50%; color: var(--accent); background: rgba(255, 255, 255, 0.92); box-shadow: 0 7px 24px rgba(74, 34, 42, 0.2); }
.play-disc svg { width: 24px; height: 24px; fill: currentColor; }
.memory-copy { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; min-height: 64px; padding: 12px 4px 4px; }
.memory-details { flex: 1; min-width: 0; display: grid; gap: 3px; }
.memory-copy strong { font-size: 1.08rem; }
.memory-details span { display: -webkit-box; overflow: hidden; color: var(--ink-muted); -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 0.88rem; }
.memory-date { display: flex; align-items: center; gap: 5px; font-size: 0.74rem; color: var(--ink-muted); opacity: 0.82; margin-top: 4px; }
.memory-date svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }

.memory-download {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  background: #f0e8ea;
  text-decoration: none;
  flex-shrink: 0;
  transition: all 180ms ease;
}
.memory-download svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.memory-download:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
}

.media-dialog:not([open]) { display: none !important; }
.media-dialog[open] { display: block !important; position: fixed !important; inset: 0 !important; margin: auto !important; width: min(1100px, calc(100% - 24px)) !important; height: fit-content !important; max-height: min(92svh, 860px) !important; padding: 0 !important; border: 0 !important; border-radius: var(--radius-lg) !important; color: #fff !important; background: #1d1114 !important; box-shadow: var(--shadow-float) !important; overflow: hidden !important; z-index: 1000 !important; }
.media-dialog::backdrop { background: rgba(26, 11, 15, 0.76); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); animation: veil-enter 300ms ease both; }
.media-shell { position: relative; }
.media-stage { position: relative; display: grid; min-height: min(68svh, 720px); place-items: center; background: #0e090a; overflow: hidden; }
.media-stage video, .media-stage img { display: block; width: 100%; max-height: 72svh; object-fit: contain; }
.media-stage video { aspect-ratio: 16 / 9; }

/* Custom Video Player Controls */
.custom-player-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: 28px 18px 14px;
  background: linear-gradient(to top, rgba(14, 9, 10, 0.95) 0%, rgba(14, 9, 10, 0.7) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: opacity 280ms ease, transform 280ms ease;
}
.custom-player-controls.is-hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}
.player-timeline-bar {
  position: relative;
  height: 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: height 160ms ease;
}
.player-timeline-bar:hover {
  height: 9px;
}
.player-progress-buffered {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.35);
}
.player-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  border-radius: 4px;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(180, 54, 70, 0.7);
}
.player-timeline-hover-time {
  position: absolute;
  bottom: calc(100% + 9px);
  left: 0;
  transform: translateX(-50%);
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(20, 10, 15, 0.92);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.15);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 40;
  transition: opacity 120ms ease;
}
.player-timeline-hover-time::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: rgba(20, 10, 15, 0.92);
}
.player-scrubber {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.player-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.player-left-group, .player-right-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.player-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  transition: transform 160ms ease, background-color 160ms ease, color 160ms ease;
}
.player-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}
.player-skip-btn svg { width: 22px; height: 22px; }
.player-btn svg.icon-play,
.player-btn svg.icon-pause,
.player-btn svg.icon-play path,
.player-btn svg.icon-pause path,
.player-btn .icon-play *,
.player-btn .icon-pause *,
.player-big-center-btn svg.center-icon-play path,
.player-big-center-btn svg.center-icon-pause path,
.player-big-center-btn .center-icon-play *,
.player-big-center-btn .center-icon-pause * {
  fill: #fff !important;
  stroke: none !important;
}
#player-play-btn.is-playing .icon-play { display: none !important; }
#player-play-btn.is-playing .icon-pause { display: block !important; }
#player-play-btn:not(.is-playing) .icon-pause { display: none !important; }
#player-play-btn:not(.is-playing) .icon-play { display: block !important; }
.player-btn:hover, #player-play-btn:hover {
  background: var(--accent);
  transform: scale(1.08);
}
#player-play-btn {
  background: var(--accent);
  color: #fff;
}
.player-volume-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.player-vol-slider {
  width: 68px;
  height: 5px;
  accent-color: var(--accent);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}
.player-vol-pct {
  font-size: 0.76rem;
  font-weight: 700;
  color: #e4d5d8;
  font-variant-numeric: tabular-nums;
  min-width: 32px;
  text-align: left;
}
.player-time-display {
  font-size: 0.8rem;
  font-weight: 600;
  color: #e4d5d8;
  font-variant-numeric: tabular-nums;
  margin-left: 6px;
}
.player-big-center-btn {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 10px 34px rgba(139, 30, 45, 0.6);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: transform 180ms ease, background-color 180ms ease;
  z-index: 20;
  pointer-events: auto;
}
.player-big-center-btn svg {
  width: 38px;
  height: 38px;
  fill: none;
  stroke: #fff;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
  margin-left: 3px;
}
.player-big-center-btn .center-icon-play,
.player-big-center-btn .center-icon-pause,
.player-big-center-btn .center-icon-play polygon,
.player-big-center-btn .center-icon-pause rect {
  fill: #fff !important;
  stroke: none !important;
}
.player-big-center-btn:hover {
  transform: scale(1.1);
  background: var(--accent-deep);
}
.media-copy { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: clamp(20px, 3.5vw, 32px); min-height: 100px; }
.media-details-col { flex: 1; min-width: 0; }
.media-copy h2 { margin-bottom: 8px; font-size: clamp(1.6rem, 4vw, 2.5rem); letter-spacing: -0.03em; }
.media-copy p { max-width: 68ch; margin-bottom: 0; color: #e4d5d8; }
.media-dialog-date { display: block; font-size: 0.84rem; color: #d4bcc1; margin-top: 6px; }
.media-download { display: inline-flex; min-height: 48px; padding: 0 20px; align-items: center; gap: 8px; border-radius: var(--radius-sm); color: #fff; background: var(--accent); font-size: 0.9rem; font-weight: 700; text-decoration: none; flex-shrink: 0; box-shadow: 0 6px 20px rgba(139, 30, 45, 0.3); transition: all 180ms ease; }
.toast {
  position: fixed;
  z-index: 100;
  top: max(18px, env(safe-area-inset-top));
  right: 18px;
  display: flex;
  min-height: 50px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 10px 12px 10px 15px;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  color: #fff;
  background: #254a37;
  box-shadow: 0 12px 32px rgba(22, 32, 27, 0.28);
  font-size: 0.9rem;
  font-weight: 700;
}
.toast > svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.5; flex: 0 0 auto; }
.toast button { display: grid; width: 32px; height: 32px; margin-left: auto; padding: 0; place-items: center; border: 0; border-radius: 50%; color: inherit; background: transparent; cursor: pointer; }
.toast button:hover { background: rgba(255, 255, 255, 0.14); }
.toast button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 2; }
.media-download:hover { background: var(--accent-deep); transform: translateY(-2px); box-shadow: 0 10px 28px rgba(139, 30, 45, 0.45); }
.media-download svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.icon-button { display: grid; width: 56px; height: 56px; padding: 0; place-items: center; border: 0; border-radius: 50%; cursor: pointer; }
.media-close { position: absolute; z-index: 40; top: 16px; right: 16px; width: 44px; height: 44px; color: #fff; background: var(--accent); border-radius: var(--radius-sm, 10px); box-shadow: 0 4px 18px rgba(139, 30, 45, 0.45); transition: transform 180ms ease, background-color 180ms ease; display: grid; place-items: center; border: 0; cursor: pointer; }
.media-close:hover { background: var(--accent-deep); transform: scale(1.08); }
.media-close svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 2.2; }

@keyframes media-enter { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
@keyframes media-exit { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(0.96); } }
@keyframes veil-enter { from { background: rgba(26, 11, 15, 0); backdrop-filter: blur(0); } }

.admin-heading { display: flex; gap: 24px; align-items: flex-end; justify-content: space-between; margin-bottom: clamp(30px, 5vw, 56px); }
.admin-heading h1 { font-size: clamp(2.6rem, 7vw, 5rem); }
.admin-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.admin-actions:last-of-type { margin-bottom: 28px; }
.admin-actions input[type="search"] {
  flex: 1 1 220px;
  min-width: 180px;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  font: inherit;
  font-size: 0.9rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  transition: border-color 160ms ease, box-shadow 160ms ease;
  -webkit-appearance: none;
  appearance: none;
}
.admin-actions input[type="search"]:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(139, 30, 45, 0.14);
  outline: none;
}
.admin-actions select {
  min-height: 48px;
  padding: 10px 38px 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  background-color: rgba(255, 255, 255, 0.88);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234a1a24' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.admin-actions select:focus {
  border-color: var(--accent);
  background-color: #fff;
  outline: none;
  box-shadow: 0 0 0 4px rgba(139, 30, 45, 0.14);
}
.count-tile { display: grid; flex: 0 0 auto; min-width: 108px; padding: 15px 20px; border-radius: var(--radius-md); color: var(--accent-deep); background: var(--accent-soft); }
.count-tile strong { font-size: 2rem; line-height: 1; }
.count-tile span { color: var(--ink-muted); font-size: 0.82rem; }
.submission-list { border-top: 1px solid var(--line); }
.submission-row { display: grid; gap: 20px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.submission-person { display: flex; gap: 14px; min-width: 0; align-items: flex-start; }
.avatar { display: grid; flex: 0 0 48px; width: 48px; height: 48px; place-items: center; border-radius: 50%; color: var(--accent-deep); background: var(--accent-soft); font-weight: 750; }
.admin-row-thumb {
  display: block;
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--line);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.admin-row-thumb:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 22px rgba(139, 30, 45, 0.2);
}
.admin-row-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.submission-person h2 { margin-bottom: 3px; font-size: 1.1rem; }
.submission-person p { margin-bottom: 0; color: var(--ink-muted); overflow-wrap: anywhere; }
.submission-meta { display: grid; gap: 10px; margin: 0; }
.submission-meta div { min-width: 0; }
.submission-meta dt { color: var(--ink-muted); font-size: 0.72rem; font-weight: 700; }
.submission-meta dd { margin: 2px 0 0; overflow: hidden; font-size: 0.84rem; text-overflow: ellipsis; white-space: nowrap; }
.status { display: inline-flex; min-height: 32px; padding: 5px 11px; align-items: center; border-radius: 999px; font-size: 0.78rem; font-weight: 750; }
.status-ready { color: #0c5837; background: #d7f3e5; }
.status-queued, .status-processing { color: #714900; background: #fff0c9; }
.status-failed { color: #8c1912; background: #ffdedb; }
.conversion-error { margin: 10px 0 0; font-size: 0.78rem; overflow-wrap: anywhere; }
.download-actions { display: flex; gap: 8px; align-items: start; }
.empty-state { display: grid; min-height: 320px; padding: 40px; place-items: center; text-align: center; }
.empty-state h2 { margin: 12px 0 6px; }
.empty-state p { color: var(--ink-muted); }
.empty-orb { width: 76px; height: 54px; border: 1px solid rgba(255, 255, 255, 0.9); border-radius: 50%; background: rgba(180, 54, 70, 0.18); box-shadow: inset 0 0 24px #fff, 0 12px 40px rgba(139, 30, 45, 0.16); transform: rotate(-9deg); }
.admin-settings-panel { width: min(760px, 100%); padding: clamp(22px, 4vw, 38px); }
.admin-settings-panel h2 { margin-bottom: 24px; font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.03em; }
.avatar-setting { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 20px; align-items: center; }
.avatar-preview-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  flex-shrink: 0;
}
.avatar-preview-wrap img {
  width: 100%;
  height: 100%;
  border: 3px solid rgba(139, 30, 45, 0.24);
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 14px rgba(139, 30, 45, 0.12);
}
.avatar-edit-overlay {
  position: absolute;
  inset: 0;
  margin: auto;
  border-radius: 50%;
  background: rgba(20, 10, 15, 0.45);
  color: #fff;
  display: grid;
  place-items: center;
  opacity: 0;
  cursor: pointer;
  transition: opacity 180ms ease;
}
.avatar-edit-overlay svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
}
.avatar-preview-wrap:hover .avatar-edit-overlay {
  opacity: 1;
}

.custom-file-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  transition: all 180ms ease;
  width: fit-content;
}
.custom-file-button svg {
  width: 18px;
  height: 18px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 2;
}
.custom-file-button:hover {
  background: #fff;
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(139, 30, 45, 0.12);
}
.avatar-setting small { color: var(--ink-muted); }

@media (hover: hover) and (pointer: fine) {
  .button:not(:disabled):hover { transform: translateY(-2px); }
  .button-primary:hover { background: var(--accent-deep); box-shadow: 0 13px 30px rgba(139, 30, 45, 0.3); }
  .button-secondary:hover { background: #e7dadd; }
  .file-picker:hover { border-color: var(--accent); background: #fdf1f3; }
  .memory-open:hover .memory-frame { transform: translateY(-4px) scale(1.008); box-shadow: 0 20px 48px rgba(74, 34, 42, 0.22); }
  .memory-open:hover .memory-frame img { transform: scale(1.025); }
  .filter-chip:hover, .gallery-downloads a:hover { transform: translateY(-2px); }
  .memory-download:hover, .media-download:hover { color: #fff; background: var(--accent); }
}

@media (min-width: 720px) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .submission-row { grid-template-columns: minmax(230px, 1.4fr) minmax(220px, 1.1fr) minmax(120px, 0.6fr); align-items: center; }
  .download-actions { grid-column: 3; }
}

@media (min-width: 980px) {
  .upload-shell { grid-template-columns: minmax(0, 1.35fr) minmax(360px, 420px); gap: clamp(32px, 5vw, 64px); }
  .upload-intro { display: flex; flex-direction: row; align-items: center; gap: clamp(20px, 3vw, 36px); }
  .upload-intro h1 { font-size: clamp(2.2rem, 3.2vw, 3.4rem); }
  .gallery-tools { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .gallery-search { grid-column: 1; grid-row: 2; }
  .gallery-downloads { grid-column: 2; grid-row: 1 / span 2; justify-content: flex-end; }
  .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .submission-row { grid-template-columns: minmax(260px, 1.35fr) minmax(300px, 1.2fr) minmax(130px, 0.55fr) auto; }
  .download-actions { grid-column: auto; justify-content: flex-end; }
}

@media (min-width: 1440px) {
  .gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1900px) {
  :root { font-size: 19px; }
  .site-header, .gallery-shell, .admin-shell, .admin-layout { width: min(96vw, 2500px); }
  .gallery-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .memory-open, .button, .icon-button { min-height: 64px; }
  .play-disc { width: 64px; height: 64px; }
}

@media (max-width: 719px) {
  .header-note { display: none; }
  .site-header { align-items: flex-start; }
  .header-actions { width: 100%; justify-content: flex-start; gap: 8px; }
  .upload-shell { gap: 28px; }
  .upload-intro { flex-direction: column; align-items: center; text-align: center; gap: 22px; }
  .home-portrait { width: clamp(150px, 45vw, 190px); }
  .upload-intro-copy p { margin-bottom: 0; }
  .admin-heading { align-items: flex-start; }
  .admin-heading .admin-actions { align-items: flex-end; flex-direction: column; }
  form.admin-actions { flex-direction: column; align-items: stretch; }
  .count-tile { min-width: 86px; padding: 12px 15px; }
  .form-actions { display: grid; }
  .media-dialog { width: 100%; max-height: 100svh; border-radius: 0; }
  .media-stage { min-height: 56svh; }
  .media-copy { padding-right: 24px; padding-bottom: 82px; }
  .media-download { right: 20px; bottom: 20px; }
}

@media (max-width: 900px) {
  .admin-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .admin-sidebar {
    position: static;
    padding: 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }
  .admin-sidebar nav {
    flex-direction: row;
    flex-wrap: nowrap;
    width: max-content;
    min-width: 100%;
  }
  .admin-sidebar-link {
    flex: 0 0 auto;
    justify-content: center;
    white-space: nowrap;
  }
  .admin-settings-layout {
    grid-template-columns: 1fr;
  }
  .admin-preview-panel {
    position: static;
  }
}

@media (max-width: 600px) {
  .memory-copy { flex-direction: column; align-items: stretch; gap: 10px; min-height: auto; }
  .memory-card-actions { justify-content: flex-end; width: 100%; }
  .preview-content-grid {
    grid-template-columns: 1fr;
  }
  .preview-site-header { gap: 8px; align-items: flex-start; }
  .preview-site-header .brand { min-width: 0; font-size: 0.9rem; }
  .preview-site-header .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .glass-panel { background: rgba(255, 255, 255, 0.96); }
  .media-dialog::backdrop { background: rgba(26, 11, 15, 0.94); }
}
/* Memory Card Actions & Delete */
.memory-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.gallery-grid.grid-compact .memory-copy { flex-direction: column; align-items: stretch; gap: 8px; }
.gallery-grid.grid-compact .memory-card-actions { justify-content: flex-end; }
.memory-delete-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-sm);
  background: #fdf0f0;
  color: #b02a37;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 180ms ease;
}
.memory-delete-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.memory-delete-btn:hover {
  background: #b02a37;
  color: #fff;
  transform: translateY(-2px);
}
.media-dialog-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Floating Timeline Scrubber */
.timeline-scrubber-widget {
  position: fixed;
  right: 10px;
  top: calc(50% + 30px);
  transform: translateY(-50%);
  z-index: 50;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(139, 30, 45, 0.16);
  border-radius: 999px;
  box-shadow: 0 12px 34px rgba(74, 34, 42, 0.14);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  padding: 14px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 44px;
}
.timeline-icon-top {
  color: var(--accent);
  display: grid;
  place-items: center;
}
.timeline-icon-top svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
}
.timeline-track-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 150px;
}
.timeline-slider {
  -webkit-appearance: slider-vertical;
  appearance: slider-vertical;
  writing-mode: bt-lr;
  width: 8px;
  height: 140px;
  accent-color: var(--accent);
  cursor: pointer;
}
.timeline-time-tag {
  position: absolute;
  right: 42px;
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
.timeline-track-wrap:hover .timeline-time-tag,
.timeline-slider:active + .timeline-time-tag {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

@media (max-width: 1100px) {
  .timeline-scrubber-widget {
    display: none;
  }
}
