:root {
  --bg: #0A0A0A; --bg-card: #111111; --bg-card2: #161616;
  --amber: #F59E0B; --amber-dim: rgba(245,158,11,.12); --amber-glow: rgba(245,158,11,.35); --border-amber: rgba(245,158,11,.3);
  --gold: #FFD700; --white: #FFFFFF; --muted: #888888;
  --border: rgba(255,255,255,.08); --glass: rgba(255,255,255,.04); --glass-hover: rgba(255,255,255,.07);
  --radius: 16px; --radius-lg: 24px;
  --font-head: 'Space Grotesk', system-ui, sans-serif; --font-body: 'DM Sans', system-ui, sans-serif; --font-mono: 'Space Mono', ui-monospace, monospace;
  --gap: 4px; --ease: cubic-bezier(.2,.8,.2,1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--white); font: 400 16px/1.5 var(--font-body); -webkit-font-smoothing: antialiased; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

/* header */
.top { position: fixed; inset: 0 0 auto; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px; transition: background .3s, backdrop-filter .3s, border-color .3s; border-bottom: 1px solid transparent; }
.top.solid { background: rgba(10,10,10,.78); backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%); border-color: var(--border); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--white); text-decoration: none; }
.brand img { filter: drop-shadow(0 0 10px var(--amber-glow)); }
.brand-lit { font: 600 18px/1 var(--font-head); letter-spacing: .14em; color: #F2C46D; }
.brand-bar { width: 1px; height: 18px; background: var(--border-amber); }
.brand-sub { font: 500 13px/1 var(--font-head); letter-spacing: .32em; color: rgba(255,255,255,.85); }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border);
  background: rgba(10,10,10,.45); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: var(--white); cursor: pointer; text-decoration: none;
  transition: background .2s, border-color .2s, transform .2s var(--ease); }
.icon-btn:hover { background: var(--glass-hover); border-color: var(--border-amber); }
.icon-btn:active { transform: scale(.94); }

/* hero */
.hero { position: relative; min-height: min(88svh, 760px); display: grid; align-items: end; overflow: hidden; isolation: isolate; }
.hero-bg { position: absolute; inset: 0; z-index: -2; background: radial-gradient(120% 80% at 50% 0%, #2a1a05 0%, var(--bg) 60%);
  background-size: cover; background-position: center 30%; transform: scale(1.06); opacity: 0; transition: opacity 1.2s var(--ease), transform 6s var(--ease); }
.hero-bg.on { opacity: 1; transform: scale(1); }
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(10,10,10,.55) 0%, rgba(10,10,10,0) 28%, rgba(10,10,10,.25) 52%, rgba(10,10,10,.92) 84%, var(--bg) 100%); }
.hero-inner { padding: 0 20px 44px; max-width: 760px; margin: 0 auto; width: 100%; text-align: center; }
.eyebrow { margin: 0 0 10px; font: 400 11px/1 var(--font-mono); letter-spacing: .28em; text-transform: uppercase; color: var(--amber); }
h1 { margin: 0; font: 600 clamp(40px, 11vw, 88px)/.98 var(--font-head); letter-spacing: -.035em; text-wrap: balance;
  background: linear-gradient(180deg, #fff 30%, #F7D58B 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 2px 30px rgba(0,0,0,.35); }
.meta { margin: 14px 0 26px; color: rgba(255,255,255,.72); font-size: 15px; display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; }
.meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--amber); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 400px; margin: 0 auto; }
.actions .btn { justify-content: center; padding: 0 14px; }
.btn { display: inline-flex; align-items: center; gap: 9px; height: 50px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent;
  font: 600 15px/1 var(--font-head); letter-spacing: .01em; text-decoration: none; cursor: pointer; transition: transform .2s var(--ease), box-shadow .2s, background .2s; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--amber); color: #120c02; box-shadow: 0 8px 30px -8px var(--amber-glow); }
.btn-primary:hover { box-shadow: 0 10px 40px -6px var(--amber-glow); background: #FBB022; }
.btn-glass { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); color: var(--white); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.btn-glass:hover { background: rgba(255,255,255,.14); }

/* festive sparks (Diwali): tiny drifting embers, off for reduced motion */
.sparks { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.sparks i { position: absolute; bottom: -10px; width: 4px; height: 4px; border-radius: 50%; background: var(--gold);
  box-shadow: 0 0 8px 2px rgba(255,200,80,.7); opacity: 0; animation: rise 9s linear infinite; }
.sparks i:nth-child(1) { left: 8%;  animation-delay: 0s; }
.sparks i:nth-child(2) { left: 22%; animation-delay: 3.2s; animation-duration: 11s; }
.sparks i:nth-child(3) { left: 37%; animation-delay: 6s; width: 3px; height: 3px; }
.sparks i:nth-child(4) { left: 51%; animation-delay: 1.5s; animation-duration: 12s; }
.sparks i:nth-child(5) { left: 64%; animation-delay: 4.6s; width: 3px; height: 3px; }
.sparks i:nth-child(6) { left: 76%; animation-delay: 7.4s; animation-duration: 10s; }
.sparks i:nth-child(7) { left: 88%; animation-delay: 2.4s; }
.sparks i:nth-child(8) { left: 95%; animation-delay: 5.5s; animation-duration: 13s; width: 3px; height: 3px; }
@keyframes rise { 0% { transform: translate(0,0); opacity: 0; } 12% { opacity: .9; } 70% { opacity: .6; } 100% { transform: translate(24px,-70vh); opacity: 0; } }

/* sticky bar */
.bar { position: sticky; top: calc(66px + env(safe-area-inset-top)); z-index: 10; display: flex; align-items: center; justify-content: space-between; max-width: 1600px; margin: 0 auto;
  padding: 14px 16px; background: linear-gradient(var(--bg) 70%, rgba(10,10,10,0)); scroll-margin-top: 66px; }
.bar h2 { margin: 0; font: 600 18px/1 var(--font-head); letter-spacing: -.01em; display: flex; align-items: baseline; gap: 10px; }
.count { font: 400 12px/1 var(--font-mono); color: var(--amber); padding: 5px 9px; border: 1px solid var(--border-amber); border-radius: 999px; background: var(--amber-dim); }
.count:empty { display: none; }
.density { display: flex; padding: 3px; border-radius: 999px; background: var(--glass); border: 1px solid var(--border); }
.density button { display: grid; place-items: center; width: 36px; height: 30px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.density button svg { width: 17px; height: 17px; }
.density button[aria-pressed="true"] { background: rgba(255,255,255,.1); color: var(--white); }

/* justified grid: rows are laid out in JS so upload order reads left-to-right */
.grid { max-width: 1600px; margin: 0 auto; padding: 0 6px; min-height: 50vh; }
.row { display: flex; gap: var(--gap); margin-bottom: var(--gap); }
.tile { position: relative; flex: none; overflow: hidden; border-radius: 6px; background: var(--bg-card2); cursor: zoom-in; border: 0; padding: 0;
  animation: tileIn .6s var(--ease) both; }
.tile img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.02); transition: opacity .5s var(--ease), transform .6s var(--ease); }
.tile img.ok { opacity: 1; transform: none; }
.tile::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); transition: box-shadow .25s; pointer-events: none; }
@media (hover: hover) { .tile:hover img.ok { transform: scale(1.035); } .tile:hover::after { box-shadow: inset 0 0 0 1px var(--border-amber); } }
.tile.fresh::before { content: "New"; position: absolute; z-index: 1; top: 8px; left: 8px; padding: 4px 8px; border-radius: 999px; background: var(--amber); color: #120c02; font: 600 10px/1 var(--font-head); letter-spacing: .08em; text-transform: uppercase; }
.skel { background: linear-gradient(100deg, var(--bg-card) 30%, #1c1c1c 50%, var(--bg-card) 70%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -150% 0; } }
@keyframes tileIn { from { opacity: 0; transform: translateY(10px); } }
.grid.still .tile { animation: none; }

.state { max-width: 420px; margin: 40px auto 80px; padding: 0 20px; text-align: center; color: var(--muted); }
.state h3 { margin: 0 0 8px; font: 600 20px/1.2 var(--font-head); color: var(--white); }
.state .btn { margin-top: 18px; }

.foot { display: grid; justify-items: center; gap: 6px; padding: 64px 16px calc(48px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 14px; text-align: center; }
.foot img { opacity: .9; filter: drop-shadow(0 0 12px var(--amber-glow)); margin-bottom: 6px; }
.foot p { margin: 0; }
.foot strong { color: var(--white); font-weight: 600; }
.foot a { color: var(--amber); text-decoration: none; font: 400 11px/1 var(--font-mono); letter-spacing: .2em; text-transform: uppercase; margin-top: 4px; }

.pill { position: fixed; z-index: 15; left: 50%; top: calc(72px + env(safe-area-inset-top)); transform: translateX(-50%); padding: 10px 18px; border-radius: 999px; border: 0;
  background: var(--amber); color: #120c02; font: 600 14px/1 var(--font-head); box-shadow: 0 10px 30px -6px var(--amber-glow); cursor: pointer; animation: tileIn .4s var(--ease); }
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); max-width: calc(100vw - 32px);
  padding: 12px 18px; border-radius: 14px; background: #1b1b1b; border: 1px solid var(--border); color: var(--white); font-size: 14px; opacity: 0; pointer-events: none; transition: .3s var(--ease); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* lightbox */
.lb:focus { outline: none; }
.lb { position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #050505; color: var(--white); overflow: hidden; overscroll-behavior: contain; }
.lb::backdrop { background: #050505; }
.lb[open] { animation: lbIn .28s var(--ease); }
@keyframes lbIn { from { opacity: 0; } }
.lb-top { position: absolute; z-index: 3; inset: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: max(12px, env(safe-area-inset-top)) 14px 24px;
  background: linear-gradient(rgba(5,5,5,.75), rgba(5,5,5,0)); transition: opacity .25s; }
.lb-count { font: 400 12px/1 var(--font-mono); letter-spacing: .12em; color: rgba(255,255,255,.75); padding-left: 4px; }
.lb-tools { display: flex; gap: 8px; }
.lb-stage { position: absolute; inset: 0; touch-action: none; }
.lb-track { display: flex; height: 100%; will-change: transform; }
.lb-track.anim { transition: transform .32s var(--ease); }
.lb-slide { flex: 0 0 100%; height: 100%; min-width: 0; display: flex; align-items: center; justify-content: center; padding: calc(64px + env(safe-area-inset-top)) 12px calc(28px + env(safe-area-inset-bottom)); }
.lb-slide img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; user-select: none; -webkit-user-drag: none; opacity: 0; transition: opacity .3s; }
.lb-slide img.ok { opacity: 1; }
.lb-nav { position: absolute; z-index: 3; top: 50%; translate: 0 -50%; width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--border); background: rgba(20,20,20,.55);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: grid; place-items: center; cursor: pointer; transition: opacity .25s, background .2s; }
.lb-nav:hover { background: rgba(40,40,40,.8); border-color: var(--border-amber); }
.lb-nav[disabled] { opacity: 0; pointer-events: none; }
.lb-prev { left: 18px; } .lb-next { right: 18px; }
.lb.idle .lb-top, .lb.idle .lb-nav { opacity: 0; }
@media (hover: none), (max-width: 640px) { .lb-nav { display: none; } }

@media (min-width: 900px) {
  .top { padding-inline: 28px; }
  .grid { padding: 0 28px; } .bar { padding-inline: 28px; }
  .hero-inner { padding-bottom: 64px; }
  :root { --gap: 8px; }
  .tile { border-radius: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .sparks { display: none; }
  html { scroll-behavior: auto; }
}

/* guest upload */
.fab { position: fixed; z-index: 30; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); }
.fab:active { transform: translateX(-50%) scale(.97); }
.fab svg, .wide svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.foot { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.sheet { width: 100%; max-width: 520px; max-height: 88dvh; margin: auto auto 0; padding: 20px 18px calc(22px + env(safe-area-inset-bottom));
  border: 1px solid var(--border); border-bottom: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; background: var(--bg-card); color: var(--white); overflow-y: auto; }
.sheet[open] { animation: sheet-up .32s var(--ease); }
.sheet::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h3 { margin: 0; font: 600 22px/1.1 var(--font-head); letter-spacing: -.02em; }
.sheet-sub { margin: 6px 0 18px; color: var(--muted); font-size: 14px; }
.field { display: grid; gap: 7px; margin-bottom: 14px; font: 400 11px/1 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.field em { font-style: normal; text-transform: none; letter-spacing: 0; }
.field input { height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); color: var(--white);
  font: 400 16px/1 var(--font-body); letter-spacing: 0; text-transform: none; }
.field input:focus { outline: none; border-color: var(--border-amber); box-shadow: 0 0 0 3px var(--amber-dim); }
.wide { width: 100%; justify-content: center; }
.up-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.up-list li { position: relative; display: flex; justify-content: space-between; gap: 12px; padding: 11px 12px 14px; border-radius: 12px; background: var(--glass); border: 1px solid var(--border); font-size: 14px; overflow: hidden; }
.up-list .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-list .s { flex: none; font: 400 12px/1.6 var(--font-mono); color: var(--muted); }
.up-list i { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; }
.up-list b { display: block; width: 0; height: 100%; background: var(--amber); transition: width .3s; }
.up-list li.ok .s { color: #4ADE80; } .up-list li.ok b { background: #4ADE80; }
.up-list li.err .s { color: #F87171; } .up-list li.err b { width: 0 !important; }
.sheet-note { margin: 14px 0 0; color: var(--muted); font-size: 13px; }
.lb-by { margin: 0 auto 0 10px; font: 400 12px/1 var(--font-mono); color: var(--amber); }
@media (prefers-reduced-motion: reduce) { .sheet[open] { animation: none; } }

/* find my photos */
.btn-find { grid-column: 1 / -1; justify-content: center; color: var(--white); border-color: var(--border-amber);
  background: linear-gradient(120deg, rgba(245,158,11,.22), rgba(255,215,0,.08)); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 0 0 1px rgba(245,158,11,.15) inset, 0 10px 34px -12px var(--amber-glow); }
.btn-find:hover { background: linear-gradient(120deg, rgba(245,158,11,.32), rgba(255,215,0,.12)); }
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#face-pick { display: grid; gap: 10px; }
.chip { margin-left: auto; margin-right: 10px; height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border-amber); background: var(--amber-dim);
  color: var(--amber); font: 600 13px/1 var(--font-head); cursor: pointer; }
.scan { display: grid; justify-items: center; gap: 14px; padding: 18px 0 8px; color: var(--muted); }
.scan p { margin: 0; font-size: 14px; }
.scan span { width: 84px; height: 84px; border-radius: 50%; border: 2px solid var(--amber-dim); border-top-color: var(--amber); animation: spin 1s linear infinite;
  box-shadow: 0 0 40px -6px var(--amber-glow); }
@keyframes spin { to { transform: rotate(360deg); } }
.sheet-err { margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.25); color: #FCA5A5; font-size: 14px; }
