:root {
  --paper: #efe6d6;
  --paper-2: #f7f1e6;
  --ink: #1c1612;
  --muted: #6e655c;
  --line: rgba(28, 22, 18, 0.14);
  --accent: #c4491d;
  --accent-ink: #fff7f2;
  --pine: #1d4a3a;
  --pine-soft: #e4f0ea;
  --night: #110e0c;
  --night-2: #1c1815;
  --cream: #f4ecdf;
  --shadow: 0 24px 60px rgba(48, 28, 12, 0.08);
  --serif: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html:has(body.night) {
  background: var(--night);
  overflow-x: clip;
}
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(196, 73, 29, 0.08), transparent 50%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}
body.night {
  background:
    radial-gradient(900px 420px at 80% -10%, rgba(196, 73, 29, 0.18), transparent 45%),
    var(--night);
  color: var(--cream);
  color-scheme: dark;
}
img { max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 560; letter-spacing: -0.03em; line-height: 1.05; }
h1 { font-size: clamp(2.6rem, 6vw, 5.2rem); margin: 0.15em 0 0.25em; }
h2 { font-size: 1.8rem; margin: 0 0 0.4em; }

.kicker {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}
.lede { font-size: 1.15rem; max-width: 38rem; color: var(--muted); }
.hint, .empty { color: var(--muted); }
.empty.light { color: rgba(244, 236, 223, 0.7); }
.wrap { width: min(1120px, calc(100% - 32px)); margin: 0 auto 4rem; }
.narrow { width: min(640px, calc(100% - 32px)); }
.site, .topbar {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.62rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.logo {
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  display: block;
  border-radius: 0.5rem;
  box-shadow: none;
}
.wordmark {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: -0.048em;
  line-height: 1;
  white-space: nowrap;
}
.wordmark .find {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 600;
  letter-spacing: inherit;
}
.wordmark .tld { color: var(--accent); }
.brand-light { color: var(--cream); }
.product {
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.03em;
}
.site-nav { display: flex; align-items: center; gap: 1rem; }
.site-nav a { text-decoration: none; }
.flash, .alert, .warnings {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto 1rem;
  padding: 0.8rem 1rem;
  background: var(--pine-soft);
  border-radius: 12px;
}
.alert { width: auto; background: #f8e4dc; color: #6d2412; }
.warnings { width: auto; margin: 1rem 0 0; }
.hero { width: min(1120px, calc(100% - 32px)); margin: 1rem auto 4rem; }
.hero-actions { display: flex; gap: 0.8rem; margin: 1.4rem 0 2rem; }
.steps {
  list-style: none;
  padding: 0;
  margin: 0 0 2.5rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.steps li {
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}
.steps span { color: var(--accent); font-size: 0.8rem; letter-spacing: 0.14em; }
.steps p { color: var(--muted); margin: 0.3rem 0 0; }
.stage {
  display: grid;
  grid-template-columns: 1.1fr 0.8fr 1fr;
  grid-template-rows: 140px 120px;
  gap: 12px;
  position: relative;
}
.stage-card {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background:
    linear-gradient(160deg, rgba(255,255,255,0.4), transparent 40%),
    linear-gradient(200deg, #d9c3a4, #8d5a3c 70%, #1d4a3a);
  min-height: 100px;
}
.stage-card.tall { grid-row: span 2; background: linear-gradient(180deg, #f1d2bf, #c4491d 55%, #1c1612); }
.stage-card.wide { background: linear-gradient(120deg, #efe6d6, #1d4a3a); }
.stage-ring {
  position: absolute;
  left: 34%;
  top: 16%;
  width: 32%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid rgba(244, 236, 223, 0.92);
  box-shadow: 0 0 0 9px rgba(28, 22, 18, 0.18);
}
.stage-ring::before,
.stage-ring::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}
.stage-ring::before {
  inset: -14px;
  border: 2px solid rgba(244, 236, 223, 0.55);
}
.stage-ring::after {
  inset: 27%;
  background: #f4ecdf;
}
.site-foot {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 2.5rem;
  color: var(--muted);
  font-size: 0.92rem;
  letter-spacing: -0.03em;
}
.stage-label {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  margin: 0;
  color: white;
  font-family: var(--serif);
  font-size: 1.4rem;
}
.auth, .desk-layout { width: min(1120px, calc(100% - 32px)); margin: 0 auto 4rem; }
.auth { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.auth:not(:has(.panel + .panel)) {
  grid-template-columns: minmax(0, 28rem);
  justify-content: center;
}
.panel, .share-card, .gate-card {
  background: rgba(247, 241, 230, 0.86);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1.2rem 1.25rem 1.4rem;
  box-shadow: var(--shadow);
}
.panel-quiet { background: transparent; box-shadow: none; }
.panel-head, .page-head, .your-frames header, .picked-frames header, .all-frames header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
}
.page-head { margin-bottom: 1rem; }
.page-head h1 { font-size: clamp(2.2rem, 4vw, 3.6rem); }
.stack { display: grid; gap: 0.8rem; }
label { display: grid; gap: 0.35rem; font-size: 0.92rem; }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="search"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 12px;
  padding: 0.75rem 0.8rem;
}
input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  padding: 0;
  border: 0;
  accent-color: var(--accent);
  justify-self: start;
}
textarea { resize: vertical; }
input:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.button, .file-button, .text-button {
  border: 0;
  cursor: pointer;
  text-decoration: none;
}
.button, .file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: var(--cream);
  border-radius: 999px;
  padding: 0.75rem 1.1rem;
  width: fit-content;
}
.button-pine { background: var(--pine); }
.button-ghost, .file-button-quiet {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.button-light { background: var(--cream); color: var(--night); }
.text-button {
  background: transparent;
  padding: 0;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.text-button.light { color: var(--cream); }
.danger { color: var(--accent); }
.button-row, .inline-form { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; }
.check { grid-template-columns: auto 1fr; align-items: center; }
.create-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: end;
}
.event-list { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 0.7rem; }
.event-list a {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  text-decoration: none;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: rgba(247, 241, 230, 0.7);
  border: 1px solid var(--line);
}
.event-list h2 { margin: 0; font-size: 1.7rem; }
.event-list p, .meta { margin: 0.2rem 0 0; color: var(--muted); }
.desk-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.8fr); gap: 1rem; align-items: start; }
.desk-main { display: grid; gap: 1rem; grid-column: 1; grid-row: 1; }
.share-card { display: grid; gap: 0.7rem; grid-column: 2; grid-row: 1; align-self: start; }
.share-card h2 { margin-bottom: 0; }
.dropzone {
  background:
    linear-gradient(180deg, rgba(196, 73, 29, 0.06), transparent 30%),
    rgba(247, 241, 230, 0.86);
  border-style: dashed;
}
.dropzone.hot { border-color: var(--accent); background: #fff4ee; }
.file-button { position: relative; }
.file-button input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}
.file-button:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.upload-meter, .meter {
  height: 8px;
  border-radius: 99px;
  background: rgba(28, 22, 18, 0.08);
  overflow: hidden;
}
.upload-meter span, .meter span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: inherit;
}
.meter-pine span { background: var(--pine); }
.meter-row { display: grid; gap: 0.9rem; }
.table-wrap { overflow-x: auto; margin-top: 1rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; vertical-align: top; padding: 0.7rem 0.5rem; border-top: 1px solid var(--line); }
td span, td strong { display: block; }
td span { color: var(--muted); font-size: 0.82rem; }
.truncate { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: grid; gap: 0.4rem; justify-items: start; }
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 200px);
  gap: 0.7rem;
}
.admin-grid > .dropzone { grid-column: span 2; min-width: 0; margin: 0; }
.admin-grid figure { margin: 0; min-width: 0; }
.admin-grid img, .pending {
  width: 200px;
  height: 200px;
  max-width: 200px;
  max-height: 200px;
  object-fit: cover;
  overflow: hidden;
  border-radius: 12px;
  background: #e7dccb;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.admin-grid figcaption { display: grid; gap: 0.15rem; font-size: 0.78rem; color: var(--muted); margin-top: 0.35rem; min-width: 0; }
.admin-grid .tile-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-grid .tile-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  white-space: nowrap;
}
.admin-grid .tile-meta form { margin: 0; }
.admin-grid .tile-open {
  display: block;
  width: 200px;
  height: 200px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 12px;
}
.gate { min-height: 100vh; display: grid; place-items: center; padding: 4.5rem 1rem 2rem; }
.gate .brand { position: absolute; top: 1.2rem; left: 1.2rem; }
.gate-card { width: min(440px, 100%); background: var(--night-2); color: var(--cream); border-color: transparent; }
.gate-card p { color: rgba(244, 236, 223, 0.75); }
.gate-card input { background: #100e0c; color: var(--cream); border-color: rgba(244, 236, 223, 0.16); }
.topbar {
  width: min(1280px, calc(100% - 28px));
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--night);
}
.topbar::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  bottom: 0;
  height: calc(100% + 100vh);
  background: var(--night);
  pointer-events: none;
}
.topbar .brand { flex: 0 1 auto; }
.topbar-title {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
}
.topbar-title h1 { font-size: clamp(1.6rem, 3vw, 2.4rem); margin: 0; }
.find-panel, .selfie-hero, .face-rail, .picked-frames, .your-frames, .all-frames, .privacy, .banner, .find-reset, .demo-gallery-banner {
  width: min(1280px, calc(100% - 28px));
  margin: 0 auto 1.5rem;
}
.find-panel, .selfie-hero {
  padding: 1.2rem;
  border-radius: 22px;
  background: var(--night-2);
}
.find-panel form, .selfie-hero form, .retry form { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: center; }
.banner {
  padding: 0.8rem 1rem;
  border-radius: 14px;
  background: rgba(196, 73, 29, 0.16);
}
.masonry {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  columns: auto;
  gap: 10px;
  align-items: start;
  margin-top: 0.8rem;
}
@media (min-width: 901px) and (max-width: 1100px) {
  .masonry { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.frame {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  margin: 0;
  min-width: 0;
  break-inside: auto;
}
.shot { position: relative; display: block; }
.frame img {
  width: 100%;
  height: auto;
  border-radius: 14px;
  display: block;
  background: #2a241f;
}
.retry { margin-top: 0.8rem; color: rgba(244, 236, 223, 0.8); }
.privacy { color: rgba(244, 236, 223, 0.75); font-size: 0.85rem; padding-bottom: 2rem; }
[hidden] { display: none !important; }
#lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: rgba(8, 6, 5, 0.94);
}
#lightbox[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}
#lightbox::backdrop { background: rgba(8, 6, 5, 0.94); }
#lightbox.is-loading .viewer-photo { visibility: hidden; }
.viewer-spin {
  display: none;
  position: fixed;
  left: 50%;
  top: 50%;
  width: 2.25rem;
  height: 2.25rem;
  margin: -1.125rem 0 0 -1.125rem;
  border-radius: 50%;
  border: 2px solid rgba(244, 236, 223, 0.35);
  border-top-color: var(--cream);
  animation: upload-spin 0.8s linear infinite;
  z-index: 3;
}
#lightbox.is-loading .viewer-spin { display: block; }
.viewer-photo {
  position: relative;
  margin: 0;
  line-height: 0;
  touch-action: auto;
}
#lightbox .viewer-photo img {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 96px);
  max-height: calc(100dvh - 80px);
  border-radius: 12px;
}
.lightbox-close, .lightbox-nav {
  position: fixed;
  border: 0;
  cursor: pointer;
  background: var(--cream);
  color: var(--night);
}
.lightbox-close {
  top: 0.85rem;
  right: 0.85rem;
  z-index: 7;
  border-radius: 999px;
  padding: 0.5rem 0.8rem;
}
.lightbox-nav {
  top: 50%;
  width: 2.6rem;
  height: 2.6rem;
  margin-top: -1.3rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding: 0;
}
.lightbox-nav.prev { left: 0.85rem; }
.lightbox-nav.next { right: 0.85rem; }
.lightbox-nav span {
  width: 0.5rem;
  height: 0.5rem;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  display: block;
}
.lightbox-nav.prev span { transform: rotate(-135deg); margin-left: 0.18rem; }
.lightbox-nav.next span { transform: rotate(45deg); margin-right: 0.18rem; }
.lightbox-caption {
  position: fixed;
  left: 50%;
  bottom: 0.85rem;
  transform: translateX(-50%);
  margin: 0;
  color: rgba(244, 236, 223, 0.82);
  font-size: 0.85rem;
  white-space: nowrap;
}
html:has(body.viewer-open) { overflow: hidden; }
body.viewer-open {
  overflow: hidden;
  overscroll-behavior: none;
}
pre.draft {
  white-space: pre-wrap;
  background: white;
  border-radius: 12px;
  padding: 0.8rem;
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
}
@media (max-width: 900px) {
  .steps, .auth, .desk-grid, .create-grid { grid-template-columns: 1fr; }
  .desk-main, .share-card, .desk-span { grid-column: 1; grid-row: auto; }
  .share-card { position: static; }
  .masonry { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage { grid-template-columns: 1fr 1fr; grid-template-rows: 120px 120px; }
  .stage-card.tall { grid-row: auto; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .meter span, .portrait-form.is-searching .upload-meter span, .upload-spin, .viewer-spin { animation: none; transition: none; }
  .button, .file-button, .text-button, .lightbox-close, .lightbox-nav, .event-list a, .frame img, .tile-open img { transition: none; }
  .button:hover, .file-button:hover, .lightbox-close:hover, .lightbox-nav:hover, .event-list a:hover, .frame:hover img, .tile-open:hover img {
    transform: none;
    box-shadow: none;
  }
}

/* --- desk visibility: one column until the share card is shown --- */
.desk-grid.desk-solo {
  grid-template-columns: minmax(0, 1fr);
}

.upload-status { min-height: 1.4em; margin: 0.7rem 0 0; }
.chosen-note { margin: 0; color: var(--muted); font-size: 0.85rem; }
.chosen-preview {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  gap: 0.55rem;
  align-items: center;
}
.chosen-preview img {
  width: 3rem;
  height: 3rem;
  object-fit: cover;
  border-radius: 8px;
}
.guest-portrait {
  display: grid;
  gap: 0.45rem;
  width: min(100%, 16rem);
  margin-top: 0.45rem;
}
.guest-portrait .file-button,
.guest-portrait .button { width: 100%; min-height: 2.75rem; }
td.row-actions { width: 1%; white-space: nowrap; }
.row-actions .text-button { white-space: nowrap; }
.guest-more { margin-top: 0.8rem; }
.desk-delete {
  margin-top: 0.8rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}
.desk-span { grid-column: 1 / -1; grid-row: 2; min-width: 0; }
.dropzone.compact {
  padding: 0.85rem 0.95rem;
  border-radius: 16px;
  border-width: 1.5px;
  border-color: rgba(196, 73, 29, 0.38);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(196, 73, 29, 0.08), rgba(196, 73, 29, 0.03)),
    rgba(255, 250, 243, 0.72);
}
.dropzone.compact h2 { font-size: 1.35rem; margin: 0.12rem 0 0; }
.dropzone.compact > p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.92rem; }
.dropzone.compact form:not(.agentic-form) {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-top: 0.75rem;
}
.dropzone.compact .file-button {
  width: 100%;
  min-height: 2.4rem;
  padding: 0.4rem 0.7rem;
  font-size: 0.9rem;
}
.dropzone.compact .upload-status { min-height: 0; margin: 0.45rem 0 0; font-size: 0.85rem; }
.dropzone.compact .upload-status:empty { display: none; }
.dropzone.compact .upload-meter { margin-top: 0.45rem; }
.dropzone.compact .upload-cancel { margin-top: 0.45rem; }
.agentic-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem 0.6rem;
  align-items: end;
  margin-top: 0.9rem;
}
.agentic-form .button { min-height: 2.9rem; }
.dropzone.compact .agentic-form { grid-template-columns: 1fr; margin-top: 0.65rem; }
@media (max-width: 720px) {
  .agentic-form { grid-template-columns: 1fr; }
}
.viewer-hint {
  margin: 0.15rem 0 0;
  color: rgba(244, 236, 223, 0.72);
  font-size: 0.95rem;
}
.portrait-card {
  width: min(1280px, calc(100% - 28px));
  margin: 0 auto 1.5rem;
  padding: 1.2rem;
  border-radius: 22px;
  background: var(--night-2);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(240px, 0.95fr);
  gap: 1rem 1.5rem;
  align-items: center;
}
.your-frames .portrait-card { width: auto; margin: 1rem 0 0; }
.portrait-card h2 { margin-bottom: 0.35rem; }
.portrait-card p { margin: 0.2rem 0 0; color: rgba(244, 236, 223, 0.78); }
.portrait-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 0.85rem;
}
.portrait-form .file-button,
.portrait-form .button { width: 100%; min-height: 3rem; }
.night-app .portrait-form .file-button {
  background: transparent;
  color: var(--cream);
  border: 1px solid rgba(244, 236, 223, 0.35);
}
.portrait-form.is-ready [data-portrait-go] {
  background: var(--accent);
  color: var(--accent-ink);
}
.portrait-picked {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.85rem;
  padding: 0.65rem;
  border-radius: 16px;
  background: rgba(244, 236, 223, 0.08);
  border: 1px solid rgba(244, 236, 223, 0.16);
}
.portrait-picked img {
  width: 4.5rem;
  height: 4.5rem;
  max-width: none;
  object-fit: cover;
  border-radius: 12px;
}
.portrait-picked p { margin: 0; }
.portrait-file { font-weight: 600; word-break: break-word; }
.portrait-file-note { color: rgba(244, 236, 223, 0.68); font-size: 0.85rem; }
.portrait-meter { margin-top: 0.75rem; }
.portrait-status { margin: 0.55rem 0 0; min-height: 1.4em; }
.night-app .upload-meter { background: rgba(244, 236, 223, 0.14); }
.portrait-form.is-searching .upload-meter span {
  width: 38%;
  animation: meter-slide 1.1s ease-in-out infinite;
}
@keyframes meter-slide {
  from { transform: translateX(-40%); }
  to { transform: translateX(230%); }
}
.face-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;
}
.frame .face-layer, .viewer-photo .face-layer { border-radius: 14px; }
.face-pulse {
  position: absolute;
  border: 0;
  background: transparent;
  box-shadow: none;
  container-type: size;
}
.face-pulse::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100cqw, 100cqh);
  height: max(100cqw, 100cqh);
  border-radius: 50%;
  border: 2px solid #c4491d;
  opacity: 0;
  transform: translate(-50%, -50%);
  animation: face-pulse 2s cubic-bezier(0, 0, 0.2, 1) 3 forwards;
}
html.ping-hold .face-pulse::after { animation: none; opacity: 0; }
@keyframes face-pulse {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 0.55; }
  75%, 100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}
.face-dock {
  position: fixed;
  z-index: 5;
  top: 0.85rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.7rem;
  max-width: calc(100vw - 8.5rem);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  padding: 0.15rem;
}
.face-dock::-webkit-scrollbar { display: none; }
.face-rail { margin-top: 0.85rem; margin-bottom: 0.85rem; }
.face-rail-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.9rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  padding: 0.15rem 0.1rem 0.35rem;
}
.face-chip {
  position: relative;
  flex: 0 0 auto;
  width: 3.5rem;
  height: 3.5rem;
  padding: 0;
  border: 2px solid rgba(244, 236, 223, 0.78);
  border-radius: 999px;
  overflow: hidden;
  background: #1c1814;
  cursor: pointer;
}
.face-chip.is-you { box-shadow: 0 0 0 3px #c4491d; }
.face-chip.is-inbound { opacity: 0; }
.face-chip img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  pointer-events: none;
}
.face-chip-x {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: inherit;
  background: rgba(17, 14, 12, 0.46);
  color: #ff3b30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
}
.face-chip:hover .face-chip-x,
.face-chip:focus-visible .face-chip-x { opacity: 1; }
@media (hover: none) {
  .face-chip-x { opacity: 1; }
}
.viewer-photo .face-hit {
  position: absolute;
  z-index: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}
.face-hit::before,
.face-hit::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.08);
}
.face-hit::before { border: 2px solid rgba(255, 255, 255, 0.96); }
.face-hit::after {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0.12) 34%, rgba(255, 255, 255, 0) 46%, rgba(255, 255, 255, 0.62) 58%, rgba(255, 255, 255, 0) 72%);
}
.face-hit.is-intro::before {
  animation: face-hit-ping 1.85s cubic-bezier(0, 0, 0.2, 1) 1 forwards;
}
.face-hit.is-intro::after {
  animation: face-hit-warp 1.85s cubic-bezier(0.16, 0.45, 0.2, 1) 1 forwards;
}
.face-hit:hover::before,
.face-hit:focus-visible::before {
  animation: face-hit-hover 1.35s cubic-bezier(0.45, 0, 0.2, 1) infinite alternate;
}
.face-hit:hover::after,
.face-hit:focus-visible::after {
  animation: face-hit-hover-warp 1.35s cubic-bezier(0.45, 0, 0.2, 1) infinite alternate;
}
@keyframes face-hit-ping {
  0% { transform: translate(-50%, -50%) scale(0.08); opacity: 0.95; }
  70% { opacity: 0.4; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}
@keyframes face-hit-warp {
  0% { transform: translate(-50%, -50%) scale(0.02); opacity: 0.9; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}
@keyframes face-hit-hover {
  0% { transform: translate(-50%, -50%) scale(0.16); opacity: 0.22; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0.08; }
}
@keyframes face-hit-hover-warp {
  0% { transform: translate(-50%, -50%) scale(0.08); opacity: 0.18; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0.05; }
}
.face-hit.is-chosen {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 68%);
}
.face-flight {
  position: fixed;
  z-index: 6;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  overflow: visible;
  pointer-events: none;
  background: transparent;
  transform-origin: 0 0;
  will-change: transform;
}
.face-flight-crop {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: #1c1814;
}
.face-flight img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.face-flight svg {
  position: absolute;
  inset: -3px;
  width: calc(100% + 6px);
  height: calc(100% + 6px);
  overflow: visible;
}
.face-flight circle {
  fill: none;
  stroke: rgba(244, 236, 223, 0.94);
  stroke-width: 3.5;
  stroke-linecap: round;
}
.face-hit:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 3px;
}
.your-frames header, .picked-frames header { align-items: center; }
.section-tools {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-left: auto;
}
.section-tools p { margin: 0; }
.pack-button {
  min-height: 2.15rem;
  padding: 0.28rem 0.9rem;
  border-radius: 999px;
}
@media (prefers-reduced-motion: reduce) {
  .face-pulse::after { animation: none; opacity: 0; }
  .face-hit::before,
  .face-hit::after,
  .face-hit.is-intro::before,
  .face-hit.is-intro::after,
  .face-hit:hover::before,
  .face-hit:hover::after,
  .face-hit:focus-visible::before,
  .face-hit:focus-visible::after { animation: none; opacity: 0; }
  .face-chip-x { transition: none; }
  .face-flight { display: none; }
  .face-chip.is-inbound { opacity: 1; }
}
.button, .file-button, .lightbox-close, .lightbox-nav, .event-list a {
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.button:hover, .file-button:hover, .lightbox-close:hover, .lightbox-nav:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(28, 22, 18, 0.12);
}
.button:active, .file-button:active, .lightbox-close:active, .lightbox-nav:active { transform: translateY(0); }
.button-ghost:hover, .file-button-quiet:hover {
  background: rgba(28, 22, 18, 0.05);
}
.button-light:hover { background: #fffaf3; }
.portrait-form.is-ready [data-portrait-go]:hover { background: #d4532a; }
.text-button { transition: color 160ms ease; }
.text-button:hover { color: var(--ink); }
.text-button.danger:hover { color: #8d3014; }
.text-button.light:hover { color: #fff; }
.event-list a:hover {
  transform: translateY(-1px);
  background: var(--paper-2);
  box-shadow: 0 8px 18px rgba(28, 22, 18, 0.08);
}
.frame img, .tile-open img { transition: transform 160ms ease, box-shadow 160ms ease; }
.frame:hover img, .tile-open:hover img {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}
.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.masonry-sentinel { height: 1px; }
.upload-cancel { margin-top: 0.75rem; }
.gallery-heading { margin-bottom: 0.95rem; }
.gallery-heading h2 { margin: 0; }
.gallery-count {
  margin: 0.15rem 0 0;
  color: var(--muted);
  opacity: 0.72;
  font-size: 0.95rem;
}
.guest-progress {
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.guest-progress h2 { font-size: 1.45rem; margin-bottom: 0.3rem; }
.guest-progress > p { margin: 0.15rem 0 0.75rem; color: var(--muted); }
.gallery-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}
.gallery-foot form { margin: 0 0 0 auto; }
.upload-stack { margin: 0; }
.upload-stack-frame {
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(160deg, #f6efe4, #e3d3bd);
}
.upload-stack-cards { position: absolute; inset: 0; }
.upload-stack-cards img,
.upload-stack-sheet {
  position: absolute;
  width: 128px;
  height: 128px;
  max-width: none;
  left: 36px;
  top: 30px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid rgba(255, 250, 243, 0.92);
  box-shadow: 0 10px 18px rgba(28, 22, 18, 0.22);
  background: #d9cbb8;
}
.upload-stack-cards img:nth-child(1) { transform: rotate(-8deg) translate(-12px, 8px); }
.upload-stack-cards img:nth-child(2) { transform: rotate(7deg) translate(12px, 0); }
.upload-stack-cards img:nth-child(3) { transform: rotate(-1deg) translate(0, -8px); }
.upload-stack-sheet {
  display: grid;
  place-items: center;
  padding: 0.6rem;
  text-align: center;
  color: var(--ink);
  font-size: 0.78rem;
}
.upload-veil {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: end;
  justify-items: center;
  gap: 0.35rem;
  padding: 0.7rem 0.55rem 0.65rem;
  background: linear-gradient(180deg, rgba(17, 14, 12, 0.02) 20%, rgba(17, 14, 12, 0.62));
  color: var(--cream);
}
.upload-veil p { margin: 0; font-size: 0.82rem; }
.upload-veil .button {
  min-height: 2rem;
  padding: 0.3rem 0.75rem;
  background: var(--cream);
  color: var(--ink);
}
.upload-spin {
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  border: 2px solid rgba(244, 236, 223, 0.4);
  border-top-color: var(--cream);
  animation: upload-spin 0.8s linear infinite;
}
@keyframes upload-spin { to { transform: rotate(360deg); } }
.confirm {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: calc(100vw - 2rem);
}
.confirm::backdrop { background: rgba(17, 14, 12, 0.52); }
.confirm-card {
  width: min(26rem, calc(100vw - 2rem));
  margin: 0;
  padding: 1.35rem 1.35rem 1.15rem;
  border-radius: 22px;
  background: var(--paper-2);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(17, 14, 12, 0.28);
}
.confirm-card h2 { font-size: 1.7rem; margin: 0 0 0.4rem; }
.confirm-card p { margin: 0; color: var(--muted); }
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.15rem;
}
.button-danger { background: var(--accent); color: var(--accent-ink); }
.button-danger:hover { background: #d4532a; }
body.night .confirm-card {
  background: var(--night-2);
  color: var(--cream);
}
body.night .confirm-card p { color: rgba(244, 236, 223, 0.75); }
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; }
  .topbar-title { flex: 1 0 100%; }
  .portrait-card, .portrait-actions { grid-template-columns: 1fr; }
  #lightbox .viewer-photo img {
    max-width: calc(100vw - 104px);
    max-height: calc(100dvh - 88px);
  }
  .lightbox-nav.prev { left: 0.35rem; }
  .lightbox-nav.next { right: 0.35rem; }
  .lightbox-caption { white-space: normal; text-align: center; width: min(18rem, calc(100% - 2rem)); }
}
@media (max-width: 480px) {
  .admin-grid > .dropzone { grid-column: span 1; }
  .dropzone.compact form { grid-template-columns: 1fr; }
  .logo { width: 1.7rem; height: 1.7rem; }
  .wordmark { font-size: 0.86rem; }
}

.demo-gallery-banner{display:flex;align-items:center;gap:20px;flex-wrap:wrap;padding:22px;margin:8px auto 24px;border:1px solid #ffffff30;border-radius:12px;background:#ffffff09}
.demo-gallery-banner>div{flex:1 1 220px;min-width:0}.demo-gallery-banner strong{font-weight:500}.demo-gallery-banner p{font-size:13px;color:#f4ecdfb8;margin:5px 0 0;max-width:600px}.demo-gallery-banner a{text-underline-offset:3px}.demo-gallery-banner .demo-gallery-status{width:100%;margin:0}.demo-gallery-status:empty{display:none}
@media(max-width:600px){.demo-gallery-banner{padding:17px;gap:14px}.demo-gallery-banner .button{width:100%}}
/* Keep gallery tiles in reading order without multi-column fragmentation. */
@media (max-width: 900px) {
  .masonry {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    columns: auto;
    gap: 10px;
    align-items: start;
  }
  .masonry > .frame {
    min-width: 0;
    margin: 0;
    break-inside: auto;
  }
  .your-frames header, .picked-frames header, .all-frames header {
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
  }
  .your-frames header > div:first-child, .picked-frames header > div:first-child {
    flex: 1 0 10rem;
  }
  .section-tools { flex-wrap: wrap; gap: 0.65rem; max-width: 100%; }
  .section-tools p, .all-frames header > p { white-space: nowrap; margin: 0; }
}
@media (hover: none) {
  .masonry .frame:hover img { transform: none; box-shadow: none; }
}
