:root {
  color-scheme: dark;
  --bg: #0b0a08;
  --surface: #16130f;
  --surface-2: #211d17;
  --line: oklch(1 0 0 / 0.08);
  --gold: #c69d33;
  --gold-text: #dcb85f;
  --gold-grad: linear-gradient(180deg, #f6dd94 0%, #d4aa45 48%, #9c7420 100%);
  --red: #d3302f;
  --red-deep: #9e1f22;
  --cream: #f6f0e3;
  --muted: #b0a794;
  --ok: #7fd18b;
  --danger: #ff7a6b;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-icon: cubic-bezier(0.2, 0, 0, 1);
  --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1); /* easeOutBack, for celebratory pops only */

  --shadow-card: 0 0 0 1px oklch(1 0 0 / 0.06), 0 1px 2px oklch(0 0 0 / 0.4), 0 12px 32px -8px oklch(0 0 0 / 0.6);
  --shadow-float: 0 0 0 1px oklch(1 0 0 / 0.08), 0 8px 24px oklch(0 0 0 / 0.5), 0 24px 64px -12px oklch(0 0 0 / 0.7);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --gutter: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg);
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--cream);
  font: 400 16px/1.5 Montserrat, system-ui, sans-serif;
  overflow-x: clip;
}
img, video, svg { display: block; max-width: 100%; }
button, a, [role="button"], label { touch-action: manipulation; }
button, .action, .dock button, .icon-btn, .btn {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; font-size: 16px; }
:focus-visible { outline: 2px solid var(--gold-text); outline-offset: 3px; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Step-and-repeat backdrop, like the press wall */
.pattern {
  position: fixed; inset: 0; z-index: -2;
  background: url(pattern.svg) 0 0 / 360px 280px;
  opacity: 0.07;
}

/* ---------- Page: event cover + capture buttons first, album below (the Lense / Kululu / POV pattern) ---------- */
.page {
  max-width: 1240px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) var(--gutter) 0;
}
.top { display: grid; gap: 10px; max-width: 560px; margin: 0 auto; }
.cover {
  position: relative; isolation: isolate; overflow: hidden;
  border-radius: 28px;
  text-align: center;
  padding: 16px 12px 0;
  background: radial-gradient(120% 80% at 50% 0%, oklch(0.32 0.06 70 / 0.5), transparent 65%), var(--surface);
  box-shadow: var(--shadow-card);
}
.cover::before { /* step-and-repeat press wall */
  content: ""; position: absolute; inset: 0; z-index: -2;
  background: url(pattern.svg) 0 0 / 240px 187px;
  opacity: 0.1;
}
.cover-crown { width: clamp(52px, 14vw, 76px); height: auto; aspect-ratio: 120 / 72; margin: 0 auto -2px; }
.eyebrow {
  margin: 0 0 6px;
  font-size: 12px; font-weight: 600; letter-spacing: clamp(0.18em, 0.9vw, 0.32em); text-transform: uppercase;
  color: var(--gold-text);
  text-wrap: balance;
}
.title {
  margin: 0;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline;
  column-gap: 0.14em;
  line-height: 0.92;
  font-weight: 400;
}
.nadine {
  font-family: Oranienbaum, 'Playfair Display', Georgia, serif;
  font-size: clamp(54px, 15.5vw, 96px);
  text-transform: uppercase;
  letter-spacing: -0.005em;
  color: var(--red);
  text-shadow: 0 2px 0 var(--red-deep), 0 0 40px oklch(0.55 0.2 27 / 0.35);
}
.forty {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic; font-weight: 700;
  font-size: clamp(46px, 12.5vw, 80px);
  background: var(--gold-grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  padding-right: 0.05em;
}
.forty sup {
  font-family: 'Great Vibes', cursive; font-style: normal; font-weight: 400;
  font-size: 0.42em; vertical-align: top; position: relative; top: -0.2em; margin-left: -0.02em;
}
.party {
  margin: 4px 0 14px;
  font-weight: 300; text-transform: uppercase;
  font-size: clamp(28px, 7.6vw, 46px); letter-spacing: 0.04em; line-height: 1;
  color: var(--gold-text);
}

/* Searchlights sweeping behind the title, Hollywood premiere style */
.lights { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.beam {
  position: absolute; bottom: -10%;
  width: 34vmax; height: 130%;
  background: linear-gradient(to top, oklch(0.92 0.09 85 / 0.22), oklch(0.92 0.09 85 / 0.05) 60%, transparent);
  clip-path: polygon(46% 100%, 54% 100%, 100% 0, 0 0);
  filter: blur(6px);
  transform-origin: 50% 100%;
  will-change: transform;
}
.beam-l { left: -6vmax; animation: sweep-l 7s var(--ease-in-out) infinite alternate; }
.beam-r { right: -6vmax; animation: sweep-r 8s var(--ease-in-out) infinite alternate; }
@keyframes sweep-l { from { transform: rotate(-28deg); } to { transform: rotate(16deg); } }
@keyframes sweep-r { from { transform: rotate(26deg); } to { transform: rotate(-14deg); } }

.sparkles i {
  position: absolute; width: 6px; height: 6px;
  background: #f6dd94;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  opacity: 0;
  animation: twinkle 3.2s ease-in-out infinite;
}
.sparkles i:nth-child(1) { top: 18%; left: 14%; animation-delay: 0.2s; }
.sparkles i:nth-child(2) { top: 30%; left: 82%; animation-delay: 1.1s; width: 9px; height: 9px; }
.sparkles i:nth-child(3) { top: 62%; left: 9%; animation-delay: 2s; }
.sparkles i:nth-child(4) { top: 12%; left: 64%; animation-delay: 0.7s; }
.sparkles i:nth-child(5) { top: 74%; left: 88%; animation-delay: 1.6s; width: 8px; height: 8px; }
.sparkles i:nth-child(6) { top: 44%; left: 24%; animation-delay: 2.6s; width: 4px; height: 4px; }
.sparkles i:nth-child(7) { top: 22%; left: 40%; animation-delay: 1.4s; width: 5px; height: 5px; }
.sparkles i:nth-child(8) { top: 56%; left: 72%; animation-delay: 0.4s; width: 10px; height: 10px; }
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(0.4) rotate(0deg); }
  50% { opacity: 1; transform: scale(1) rotate(45deg); }
}

/* Staged entrance: runs once per visit */
/* Short delays: the buttons must be ready the moment the page opens */
.rise { animation: rise 600ms var(--ease-out) both; animation-delay: calc(var(--d, 0) * 70ms + 60ms); }
.drop { animation: drop 800ms var(--ease-back) 60ms both; }
.pop { animation: pop 700ms var(--ease-back) both; animation-delay: calc(var(--d, 0) * 70ms + 60ms); }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes drop { from { opacity: 0; transform: translateY(-28px) rotate(-8deg) scale(0.9); } }
@keyframes pop { from { opacity: 0; transform: scale(0.8) rotate(-6deg); } }

/* ---------- Ticker ---------- */
.ticker {
  margin: 0 -12px; /* full bleed inside the cover */
  overflow: hidden;
  border-block: 1px solid oklch(0.75 0.12 85 / 0.25);
  background: linear-gradient(90deg, var(--red-deep), var(--red) 50%, var(--red-deep));
  padding: 8px 0;
}
.ticker-track {
  display: flex; gap: 18px; width: max-content;
  animation: marquee 32s linear infinite;
  font-size: 12px; font-weight: 600; letter-spacing: 0.24em; text-transform: uppercase; white-space: nowrap;
}
.ticker b { color: #f6dd94; font-weight: 400; }
@keyframes marquee { to { transform: translateX(calc(-50% - 9px)); } }

/* ---------- Capture actions ---------- */
/* .name-field is used by the admin PIN form */
.name-field { display: grid; gap: 6px; padding: 4px 4px 14px; }
.name-field span { font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-text); }
.name-field input {
  width: 100%; min-height: 52px; padding: 0 16px;
  border-radius: 16px; border: 0;
  background: var(--surface-2); color: var(--cream);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow 150ms ease;
}
.name-field input::placeholder { color: #7d7566; }
.name-field input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--gold); }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.action {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 60px; padding: 0 14px;
  border: 0; border-radius: 18px;
  font-size: 15px; font-weight: 600; line-height: 1.2; text-align: left;
  transition: scale 160ms var(--ease-out), box-shadow 200ms ease;
}
.action .i { width: 24px; height: 24px; }
/* Big tiles: Take a photo and Upload get equal weight (many guests upload shots they already took) */
.action-big {
  flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 12px;
  min-height: 116px; padding: 16px;
  font-size: 19px; font-weight: 700;
}
.action-big .i { width: 30px; height: 30px; }
.action-big small { display: block; margin-top: 3px; font-size: 13px; font-weight: 500; line-height: 1.3; opacity: 0.75; }
.action-cream {
  background: linear-gradient(180deg, #fffaf0 0%, #efe4cc 100%); color: #1b1408;
  box-shadow: inset 0 1px 0 #fff, 0 8px 24px -8px oklch(0.92 0.03 85 / 0.45);
}
/* Phone: video runs full width under the two tiles */
.action-wide { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: flex-start; gap: 14px; min-height: 68px; padding: 0 16px; }
.action-wide .i { width: 28px; height: 28px; }

.name-chip {
  display: flex; align-items: center; gap: 6px;
  min-height: 52px; padding: 4px 4px 4px 16px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: box-shadow 150ms ease;
}
.name-chip:focus-within { box-shadow: var(--shadow-card), inset 0 0 0 2px var(--gold); }
.name-chip span { flex: none; font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-text); }
.name-chip input {
  flex: 1; min-width: 0; height: 44px; padding: 0 10px;
  border: 0; border-radius: 14px; background: transparent; color: var(--cream);
}
.name-chip input::placeholder { color: #7d7566; }
.name-chip input:focus { outline: none; }
.action:active { scale: 0.96; }
.action-gold { background: var(--gold-grad); color: #1b1408; box-shadow: 0 1px 0 oklch(1 0 0 / 0.4) inset, 0 8px 24px -8px oklch(0.75 0.13 85 / 0.6); }
.action-red { background: linear-gradient(180deg, #e2403b, #a8211f); color: #fff; box-shadow: 0 1px 0 oklch(1 0 0 / 0.25) inset, 0 8px 24px -8px oklch(0.55 0.2 27 / 0.6); }
/* Shine sweep on hover (mouse only) */
.action::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 35%, oklch(1 0 0 / 0.35) 50%, transparent 65%);
  transform: translateX(-120%);
  pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
  .action::after { transition: transform 600ms var(--ease-out); }
  .action:hover::after { transform: translateX(120%); }
}
.fine { margin: 0 8px; font-size: 12px; color: #8f8775; text-align: center; text-wrap: pretty; }

/* ---------- Reel ---------- */
.reel { margin-top: 28px; }
.reel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding: 0 2px; }
.reel-head h2 {
  margin: 0;
  font: 700 clamp(26px, 5vw, 36px)/1 'Playfair Display', Georgia, serif;
  color: var(--cream);
}
.count {
  display: inline-block;
  font-size: 13px; font-weight: 600; color: var(--gold-text);
  font-variant-numeric: tabular-nums;
  transition: scale 300ms var(--ease-back);
}
.count.bump { scale: 1.25; transition-duration: 120ms; }
.live {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted);
}
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 0 oklch(0.6 0.22 27 / 0.6); animation: live 2s ease-out infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 8px oklch(0.6 0.22 27 / 0); } 100% { box-shadow: 0 0 0 0 oklch(0.6 0.22 27 / 0); } }

/* Square grid like Photos: more shots per screen than a masonry wall */
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.tile {
  transition: opacity 500ms var(--ease-out), transform 500ms var(--ease-out);
  transition-delay: calc(var(--i, 0) * 50ms);
}
@starting-style { .tile { opacity: 0; transform: translateY(16px) scale(0.96); } }
.tile-btn {
  position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0;
  border-radius: 8px; overflow: hidden;
  background: var(--surface-2);
  transition: scale 160ms var(--ease-out);
}
.tile-btn:active { scale: 0.96; }
.tile img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0;
  transition: opacity 400ms var(--ease-out), scale 500ms var(--ease-out);
}
.tile img.loaded { opacity: 1; }
.tile-btn::after { /* image outline */
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 0 0 0 1px oklch(1 0 0 / 0.1); pointer-events: none;
}
.tile-by {
  display: none; /* too small to read on phone squares; the viewer shows who took it */
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 22px 10px 8px;
  background: linear-gradient(to top, oklch(0 0 0 / 0.7), transparent);
  font-size: 12px; font-weight: 600; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile-play {
  position: absolute; top: 6px; right: 6px;
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: oklch(0 0 0 / 0.55); backdrop-filter: blur(6px); color: #fff;
}
.tile-play .i { width: 14px; height: 14px; margin-left: 2px; }
.tile.noimg .tile-btn::before {
  content: attr(data-kind); position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--gold-text); font-size: 13px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
}
.tile.fresh .tile-btn { animation: fresh 1.6s var(--ease-out) 1; }
@keyframes fresh { from { box-shadow: 0 0 0 3px #f6dd94, 0 0 32px 4px oklch(0.85 0.13 85 / 0.6); } to { box-shadow: 0 0 0 0 transparent; } }
@media (hover: hover) and (pointer: fine) {
  .tile-btn:hover img { scale: 1.04; }
}

.empty { text-align: center; padding: 24px 0 8px; }
.star { width: 168px; height: auto; margin: 0 auto 12px; animation: float 4s ease-in-out infinite alternate; filter: drop-shadow(0 12px 24px oklch(0 0 0 / 0.5)); }
@keyframes float { from { transform: translateY(-5px) rotate(-3deg); } to { transform: translateY(5px) rotate(3deg); } }
.empty-title { margin: 0; font: 700 22px/1.2 'Playfair Display', Georgia, serif; }
.empty-copy { margin: 6px 0 0; color: var(--muted); text-wrap: pretty; }

/* ---------- Footer ---------- */
.sponsor {
  display: grid; justify-items: center; gap: 4px;
  padding: 48px var(--gutter) calc(110px + var(--safe-b));
}
.sponsor span { font: 700 15px 'Playfair Display', Georgia, serif; }
.sponsor img { width: 170px; height: auto; }

/* ---------- Dock (mobile thumb zone) ---------- */
.dock {
  position: fixed; left: 50%; bottom: calc(14px + var(--safe-b)); z-index: 20;
  display: flex; gap: 6px; padding: 6px;
  border-radius: 999px;
  background: oklch(0.2 0.01 70 / 0.82);
  backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: var(--shadow-float);
  transform: translate(-50%, calc(100% + 24px + var(--safe-b)));
  opacity: 0;
  transition: transform 400ms var(--ease-drawer), opacity 300ms var(--ease-out);
}
.dock.show { transform: translate(-50%, 0); opacity: 1; }
.dock button {
  display: grid; place-items: center; width: 56px; height: 56px;
  border: 0; border-radius: 999px;
  transition: scale 160ms var(--ease-out);
}
.dock button:active { scale: 0.96; }
.dock button:nth-child(1) { background: var(--gold-grad); color: #1b1408; }
.dock button:nth-child(2) { background: linear-gradient(180deg, #e2403b, #a8211f); color: #fff; }
.dock button:nth-child(3) { background: linear-gradient(180deg, #fffaf0, #efe4cc); color: #1b1408; }

/* ---------- Upload tray ---------- */
.tray {
  position: fixed; left: 50%; bottom: calc(86px + var(--safe-b)); z-index: 30;
  width: min(420px, calc(100% - 2 * var(--gutter)));
  max-height: 46dvh; display: flex; flex-direction: column;
  padding: 8px;
  border-radius: 22px;
  background: oklch(0.2 0.01 70 / 0.94);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-float);
  transform: translate(-50%, 24px);
  opacity: 0; visibility: hidden;
  transition: transform 400ms var(--ease-drawer), opacity 250ms var(--ease-out), visibility 0s 400ms;
}
.tray.open { transform: translate(-50%, 0); opacity: 1; visibility: visible; transition-delay: 0s; }
.tray-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 4px 10px; font-size: 14px; }
.tray-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; }
.up {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px;
  padding: 6px; border-radius: 14px;
  transition: opacity 250ms var(--ease-out), transform 250ms var(--ease-out);
}
@starting-style { .up { opacity: 0; transform: translateY(8px); } }
.up-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--surface-2); }
.up-body { min-width: 0; display: grid; gap: 6px; }
.up-label { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-bar { height: 4px; border-radius: 99px; background: oklch(1 0 0 / 0.1); overflow: hidden; }
.up-bar i { display: block; height: 100%; background: var(--gold-grad); transform-origin: left; transform: scaleX(0); transition: transform 150ms linear; }
.up[data-state="done"] .up-bar, .up[data-state="error"] .up-bar { opacity: 0; transition: opacity 200ms ease; }
.up[data-state="error"] .up-label { color: var(--danger); white-space: normal; overflow-wrap: anywhere; text-wrap: pretty; }
.up-icon { position: relative; width: 24px; height: 24px; }
.up-icon .i {
  position: absolute; inset: 0; width: 24px; height: 24px;
  opacity: 0; scale: 0.25; filter: blur(4px);
  transition: opacity 300ms var(--ease-icon), scale 300ms var(--ease-icon), filter 300ms var(--ease-icon);
}
.up[data-state="done"] .up-icon .ok, .up[data-state="error"] .up-icon .bad { opacity: 1; scale: 1; filter: blur(0); }
.up-icon .ok { color: var(--ok); }
.up-icon .bad { color: var(--danger); }
.up-retry {
  grid-column: 2 / -1; justify-self: start;
  min-height: 36px; padding: 0 14px; border: 0; border-radius: 10px;
  background: var(--surface-2); color: var(--gold-text); font-size: 13px; font-weight: 600;
}

.icon-btn {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  border: 0; border-radius: 999px; background: transparent; color: var(--cream);
  transition: scale 160ms var(--ease-out), background-color 150ms ease, opacity 150ms ease;
}
.icon-btn:active { scale: 0.96; }
.icon-btn:disabled { opacity: 0.3; pointer-events: none; }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { background: oklch(1 0 0 / 0.1); } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top, 0px)); z-index: 60;
  padding: 12px 20px; border-radius: 999px;
  background: var(--gold-grad); color: #1b1408; font-weight: 700; font-size: 14px;
  box-shadow: var(--shadow-float);
  transform: translate(-50%, -16px) scale(0.96); opacity: 0;
  transition: transform 300ms var(--ease-out), opacity 200ms var(--ease-out);
  pointer-events: none;
  width: max-content; max-width: calc(100vw - 2 * var(--gutter));
  text-align: center; text-wrap: balance;
}
.toast.show { transform: translate(-50%, 0) scale(1); opacity: 1; }

/* Camera flash + confetti */
.flash { position: fixed; inset: 0; z-index: 50; background: #fff8e6; opacity: 0; pointer-events: none; }
.flash.go { animation: flash 500ms var(--ease-out); }
@keyframes flash { from { opacity: 0.85; } to { opacity: 0; } }
.confetti { position: fixed; inset: 0; z-index: 55; width: 100%; height: 100%; pointer-events: none; }

/* ---------- Viewer ---------- */
/* Motion is driven by springs in app.js (transform/opacity on the frame and the dark layer). */
.viewer {
  width: 100%; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; overflow: hidden;
  background: transparent; color: var(--cream);
}
.viewer::backdrop { background: transparent; }
.viewer-bg { position: absolute; inset: 0; background: oklch(0.08 0.005 70); opacity: 0; }
.viewer-stage {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: calc(60px + env(safe-area-inset-top, 0px)) 12px calc(84px + var(--safe-b));
  touch-action: pinch-zoom; /* one finger is ours (swipe/dismiss), two fingers still zoom */
}
.viewer-frame {
  position: relative; overflow: hidden;
  border-radius: 14px;
  background: var(--surface-2) center / cover no-repeat;
  box-shadow: 0 0 0 1px oklch(1 0 0 / 0.1), 0 24px 64px -16px oklch(0 0 0 / 0.8);
  transform-origin: center;
  will-change: transform;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.viewer-media { display: block; width: 100%; height: 100%; object-fit: contain; }
.viewer-chrome { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 200ms var(--ease-out); }
.viewer-chrome > * { pointer-events: auto; }
.viewer.bare .viewer-chrome > * { pointer-events: none; }
.viewer.moving .viewer-chrome { transition: none; } /* follows the finger 1:1 while dragging */
.viewer-bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 12px var(--gutter) calc(12px + var(--safe-b));
  background: oklch(0.12 0.005 70 / 0.6);
  backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.08); /* light catching the top edge of the glass */
}
.viewer-meta { display: grid; min-width: 0; margin-right: auto; }
.viewer-meta strong { font: 700 18px/1.2 'Playfair Display', Georgia, serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-meta span { font-size: 13px; color: var(--muted); }
.viewer-bar .icon-btn { background: oklch(1 0 0 / 0.1); }
.viewer-close, .viewer-nav {
  position: absolute;
  background: oklch(0.2 0.01 70 / 0.55);
  backdrop-filter: blur(16px) saturate(1.6); -webkit-backdrop-filter: blur(16px) saturate(1.6);
}
.viewer-close { top: calc(10px + env(safe-area-inset-top, 0px)); right: 10px; }
.viewer-nav { top: 50%; translate: 0 -50%; }
.viewer-prev { left: 8px; }
.viewer-next { right: 8px; }
@media (pointer: coarse) { .viewer-nav { display: none; } } /* swipe instead */

/* Large serif display text reads better slightly tightened; small labels keep their positive tracking */
.reel-head h2, .empty-title, .viewer-meta strong, .admin-head h1, .panel h2, .lib-head h2, .login h2, .stat-num { letter-spacing: -0.01em; }

/* ---------- Tablet & desktop ---------- */
@media (min-width: 640px) {
  :root { --gutter: 24px; }
  .page { padding-top: 20px; }
  .cover { padding-top: 22px; }
  /* Tablet: full width, the three actions in one row */
  .top { max-width: none; }
  .actions { grid-template-columns: repeat(3, 1fr); }
  .action-wide { grid-column: auto; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 12px; min-height: 116px; padding: 16px; }
  .grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .tile-by { display: block; }
  .viewer-stage { padding-inline: 72px; }
}
/* Laptop / desktop: actions stay pinned on the left, the album scrolls on the right */
@media (min-width: 1024px) {
  .page { display: grid; grid-template-columns: 400px 1fr; gap: 32px; align-items: start; padding-top: 28px; }
  .top { position: sticky; top: 28px; margin: 0; }
  .actions { grid-template-columns: 1fr 1fr; } /* narrow column: back to the phone layout */
  .action-wide { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: flex-start; gap: 14px; min-height: 68px; padding: 0 16px; }
  .nadine { font-size: 76px; } .forty { font-size: 62px; } .party { font-size: 36px; } /* sized for the 400px column */
  .reel { margin-top: 4px; }
  .grid { gap: 8px; }
  .dock { display: none; }
  .tray { left: auto; right: 24px; bottom: 24px; transform: translateY(24px); }
  .tray.open { transform: none; }
  .sponsor { grid-column: 1 / -1; }
}
@media (min-width: 1280px) { .grid { grid-template-columns: repeat(5, 1fr); } }
@media (orientation: landscape) and (max-height: 500px) {
  .nadine { font-size: 52px; } .forty { font-size: 44px; } .party { font-size: 26px; }
}

/* ---------- Reduced motion: keep fades, drop movement ---------- */
@media (prefers-reduced-motion: reduce) {
  .beam, .sparkles, .ticker-track, .star, .live i { animation: none; }
  .sparkles { display: none; }
  .rise, .drop, .pop { animation-name: fade; animation-duration: 400ms; }
  @keyframes fade { from { opacity: 0; } }
  .tile, .up { transition-property: opacity; }
  @starting-style { .tile, .up { transform: none; } }
  .dock, .tray, .toast { transition-property: opacity, visibility; }
  .viewer { opacity: 0; transition: opacity 200ms ease, overlay 200ms allow-discrete, display 200ms allow-discrete; }
  .viewer[open] { opacity: 1; }
  @starting-style { .viewer[open] { opacity: 0; } }
  .flash.go { animation: none; }
}

/* Reduced transparency / more contrast: solid surfaces instead of glass */
@media (prefers-reduced-transparency: reduce) {
  .dock, .tray, .viewer-bar, .viewer-close, .viewer-nav, .tile-play, .admin-head {
    backdrop-filter: none; -webkit-backdrop-filter: none;
    background: var(--surface);
  }
}
@media (prefers-contrast: more) {
  .dock, .tray, .viewer-bar, .cover, .name-chip, .card { box-shadow: 0 0 0 1px oklch(1 0 0 / 0.5); }
  :root { --muted: #d9d2c3; }
}
