/* That’s Me: clean and premium. White space, big type, one electric blue.
   The one moment that moves: face boxes appearing on the photos, one turning blue as "You". */
:root {
  --bg: #FFFFFF;
  --panel: #F5F5F7;
  --ink: #16181D;
  --muted: #6E6E73;      /* 4.9:1 on white */
  --line: #D2D2D7;
  --blue: #1F5BFF;       /* white text on it 5.3:1 */
  --blue-press: #1747CC;
  --danger: #C4271B;
  --danger-bg: #FFF1EF;
  --radius-panel: 24px;
  --radius-control: 14px;
  --font: "Geist", "Noto Sans Hebrew", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}
html[lang="he"] { --font: "Noto Sans Hebrew", "Geist", system-ui, -apple-system, "Segoe UI", Arial, sans-serif; }
html.i18n-pending body { visibility: hidden; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
a, button, label, input { touch-action: manipulation; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.5 var(--font);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------- Frame ---------- */
.topbar {
  max-width: 1080px; margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 20px 0;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 19px; letter-spacing: -0.02em; color: var(--ink);
}
.brand:hover { text-decoration: none; }
main { max-width: 1080px; margin: 0 auto; padding: 0 20px 40px; }
.footer {
  max-width: 1080px; margin: 0 auto;
  padding: 18px 20px max(24px, env(safe-area-inset-bottom));
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px;
  color: var(--muted); font-size: 14px; border-top: 1px solid #EDEDF0;
}
.footer #lang-switch { margin-inline-start: auto; }

/* ---------- Type ---------- */
h1 {
  font-size: clamp(2.5rem, 10.5vw, 4.25rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
  font-weight: 700;
  margin: 28px 0 14px;
  text-wrap: balance;
}
html[lang="he"] h1 { letter-spacing: -0.01em; line-height: 1.08; }
h1.title { font-size: clamp(2rem, 8vw, 2.75rem); letter-spacing: -0.035em; margin: 32px 0 8px; }
html[lang="he"] h1.title { letter-spacing: 0; }
.lede { font-size: clamp(1.06rem, 4.4vw, 1.3rem); color: var(--muted); margin: 0; max-width: 34ch; text-wrap: pretty; }
.label { display: block; font-weight: 600; font-size: 16px; margin: 0 0 8px; }
.hint { color: var(--muted); font-size: 15px; margin: 8px 0 0; }
.hint.ready { color: var(--ink); font-weight: 500; }
.center { text-align: center; }

/* ---------- Home layout ---------- */
.screen-home { display: grid; gap: 26px; }
.screen-narrow { max-width: 560px; }
@media (min-width: 900px) {
  .screen-home {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "text scan" "form scan" "last scan";
    column-gap: 56px; row-gap: 22px; align-items: start; padding-top: 24px;
  }
  .home-text { grid-area: text; }
  #search-form { grid-area: form; }
  #last-search { grid-area: last; }
}

/* ---------- Form panel ---------- */
.panel { background: var(--panel); border-radius: var(--radius-panel); padding: 22px 20px; }
.field + .field { margin-top: 22px; }
.link-row { position: relative; }
#link {
  width: 100%; min-height: 54px; padding: 0 84px 0 16px; /* the link reads left to right; Paste sits on the right */
  font: 400 16px var(--font); color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-control);
}
#link::placeholder { color: #9A9AA0; }
html[dir="rtl"] #link { padding: 0 16px 0 84px; } /* Hebrew: Paste sits on the left, at the end of the line */
html[dir="rtl"] .btn-chip { right: auto; left: 8px; }
html[dir="rtl"] #link:placeholder-shown, html[dir="rtl"] #guests-link:placeholder-shown { direction: rtl; }
#link:focus-visible { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(31, 91, 255, .18); }
.btn-chip {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  min-height: 38px; padding: 0 14px; border: 0; border-radius: 10px;
  background: var(--panel); color: var(--ink); font: 600 14px var(--font); cursor: pointer;
}
.selfies { list-style: none; display: flex; flex-wrap: wrap; gap: 12px; margin: 0; padding: 0; }
.selfies:not(:empty) { margin-bottom: 14px; }
.selfie { position: relative; width: 68px; height: 68px; }
.selfie img {
  display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  background: var(--line); box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--blue);
}
.selfie button {
  position: absolute; top: -6px; inset-inline-end: -6px;
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--panel);
  background: var(--ink); color: #fff; font-size: 13px; line-height: 1; cursor: pointer;
}
.selfie-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
#search-form > .btn-primary { margin-top: 22px; }
.trust { margin: 12px 0 0; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- Buttons ---------- */
.btn-primary, .btn-secondary, .btn-glass {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 54px; padding: 0 24px; border-radius: 999px;
  font: 600 17px var(--font); text-decoration: none; text-align: center; cursor: pointer;
  transition: background-color .15s ease, transform .1s ease;
}
.btn-primary { width: 100%; border: 0; background: var(--blue); color: #fff; }
.btn-primary:active { background: var(--blue-press); transform: scale(.985); }
.btn-primary:disabled { opacity: .6; cursor: progress; transform: none; }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-secondary:active { transform: scale(.985); }
.btn-text {
  min-height: 44px; padding: 8px 2px; border: 0; background: none; cursor: pointer;
  font: 600 16px var(--font); color: var(--blue);
}
.btn-text.small { font-size: 14px; min-height: 36px; }
.btn-primary:hover, .btn-secondary:hover, .btn-text:hover { text-decoration: none; }

/* ---------- Problems: what went wrong, what to do ---------- */
.problem {
  margin-top: 16px; padding: 14px 16px; border-radius: var(--radius-control);
  background: var(--danger-bg); color: #5A1712;
}
.problem p { margin: 0 0 10px; }
.problem p:last-child { margin-bottom: 0; }
.problem strong { color: var(--danger); }
.problem .btn-secondary { margin-top: 4px; }
#screen-error .btn-secondary { margin-top: 20px; }

/* ---------- Progress ---------- */
.progress-count {
  margin: 26px 0 10px; font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.bar { height: 8px; border-radius: 999px; background: var(--panel); overflow: hidden; }
.bar .fill {
  height: 100%; background: var(--blue); border-radius: inherit;
  transform: scaleX(0); transform-origin: left center; transition: transform .5s ease-out;
}
html[dir="rtl"] .bar .fill { transform-origin: right center; }
.progress-text { font-size: 18px; font-weight: 600; margin: 14px 0 0; font-variant-numeric: tabular-nums; }

/* ---------- Results ---------- */
.results-head { margin-bottom: 18px; }
.actions { display: grid; gap: 10px; }
.gallery {
  list-style: none; margin: 20px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px;
  border-radius: 12px; overflow: hidden;
}
.gallery li { content-visibility: auto; contain-intrinsic-size: auto 120px; }
.gallery button {
  display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0;
  background: var(--panel); cursor: zoom-in;
}
.gallery img { display: block; width: 100%; height: 100%; object-fit: cover; }
.empty ul { margin: 4px 0 0; padding-inline-start: 20px; }
.empty li { margin: 6px 0; }
#new-search { margin-top: 16px; }

@media (max-width: 899px) {
  /* Phones: the save button stays in reach at the bottom while browsing the photos */
  #screen-results:not([hidden]) .actions {
    position: sticky; bottom: 0; z-index: 2;
    margin: 0 -20px; padding: 12px 20px max(12px, env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .86); -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px);
    grid-template-columns: 1fr auto auto; order: 3;
  }
  #screen-results:not([hidden]) { display: flex; flex-direction: column; }
  #screen-results .results-head { order: 1; }
  #save-status { order: 2; }
  #gallery { order: 2; }
  #no-results { order: 2; }
  #new-search { order: 4; align-self: center; }
  #share-guests span, #make-story span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  #share-guests, #make-story { width: 54px; padding: 0; }
}
@media (min-width: 900px) {
  .actions { grid-template-columns: auto auto auto; justify-content: start; }
  .actions .btn-primary { width: auto; min-width: 260px; }
  .gallery { grid-template-columns: repeat(5, 1fr); gap: 4px; }
}

/* ---------- Full-size viewer ---------- */
#viewer {
  overscroll-behavior: contain;
  width: 100vw; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: #000; color: #fff;
}
#viewer::backdrop { background: #000; }
.viewer { display: grid; grid-template-rows: auto 1fr auto; height: 100%; }
.viewer-top {
  display: flex; justify-content: space-between; align-items: center;
  padding: max(8px, env(safe-area-inset-top)) 12px 8px; font-variant-numeric: tabular-nums; color: #D1D1D6;
}
.viewer-icon, .viewer-nav {
  border: 0; color: #fff; cursor: pointer; display: grid; place-items: center;
  background: rgba(255, 255, 255, .12); border-radius: 999px;
}
.viewer-icon { width: 40px; height: 40px; font-size: 16px; }
.viewer-stage { position: relative; min-height: 0; display: flex; align-items: center; justify-content: center; }
.viewer-photo { position: relative; max-width: 100%; max-height: 100%; cursor: pointer; }
.viewer-photo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; }
.viewer-prev { inset-inline-start: 12px; }
.viewer-next { inset-inline-end: 12px; }
html[dir="rtl"] .viewer-nav svg { transform: scaleX(-1); }
.viewer-nav:disabled { visibility: hidden; }
.viewer-bottom { display: flex; gap: 10px; padding: 10px 16px max(14px, env(safe-area-inset-bottom)); }
.viewer-bottom > * { flex: 1; }
.btn-glass { color: #fff; background: rgba(255, 255, 255, .14); border: 0; }
#viewer :focus-visible { outline-color: #fff; }

@media (hover: hover) {
  .btn-primary:hover { background: var(--blue-press); }
  .btn-secondary:hover { border-color: #A1A1A6; }
  .btn-text:hover { color: var(--blue-press); }
  .btn-chip:hover { background: #E8E8ED; }
  .gallery button:hover img { opacity: .88; }
  .viewer-nav:hover, .viewer-icon:hover, .btn-glass:hover { background: rgba(255, 255, 255, .24); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 0s !important; animation-delay: 0s !important; }
}

/* ---------- Webcam selfie (computers) ---------- */
.camera-dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  padding: 0; border: 0; border-radius: var(--radius-panel);
  background: var(--bg); color: var(--ink); overscroll-behavior: contain;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .28);
}
.camera-dialog::backdrop { background: rgba(22, 24, 29, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.camera { padding: 20px; }
.camera-title { margin: 0 0 14px; font-weight: 600; font-size: 19px; }
.camera-frame {
  position: relative; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden;
  background: #111317; display: grid; place-items: center;
}
.camera-frame video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transform: scaleX(-1); /* a mirror, the way people expect to see themselves */
}
.camera-status { position: relative; margin: 0; padding: 0 24px; color: #E5E5EA; text-align: center; }
.camera-actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 16px; }
/* The file inputs are visually hidden; show their focus on the visible label */
.selfie-buttons label:has(+ input:focus-visible) { outline: 3px solid var(--blue); outline-offset: 2px; }

/* ---------- Home: a live demo of a search (assets/demo.js) ---------- */
.demo { min-width: 0; }
.demo-top { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin-bottom: 12px; }
.demo-label { font-size: 14px; font-weight: 500; color: var(--muted); }
.demo-people { display: flex; flex-wrap: wrap; gap: 6px; }
.demo-people button {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 3px 13px 3px 3px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer;
  font: 600 14px var(--font); color: var(--ink); transition: border-color .2s, box-shadow .2s, color .2s;
}
html[dir="rtl"] .demo-people button { padding: 3px 3px 3px 13px; }
.demo-people button svg { width: 28px; height: 28px; border-radius: 50%; display: block; }
.demo-people button[aria-pressed="true"] { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); color: var(--blue); }
.demo-people button:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.demo-stage { position: relative; overflow: hidden; padding: 5px; margin: -5px; border-radius: 20px; } /* room for the blue rings */
.demo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.demo-tile {
  position: relative; margin: 0; aspect-ratio: 4 / 5; border-radius: 12px; overflow: hidden;
  transition: opacity .6s ease, filter .6s ease, box-shadow .3s ease, transform .35s cubic-bezier(.2, .8, .2, 1);
}
.demo-tile svg { display: block; width: 100%; height: 100%; }
.demo-tile .fb { fill: none; stroke: #fff; stroke-width: 3; opacity: 0; transition: opacity .25s ease, stroke .3s ease; }
.demo-tile.seen .fb { opacity: .95; }
.demo.done .demo-tile .fb { opacity: 0; }
.demo.done .demo-tile.match .fb.hit { opacity: 1; stroke: var(--blue); stroke-width: 4.5; }
.demo-tile.dim { opacity: .38; filter: saturate(.4); }
.demo-tile.match { box-shadow: 0 0 0 3px var(--blue); transform: scale(1.025); z-index: 1; }
.demo-badge {
  position: absolute; inset-inline-start: 6px; bottom: 6px; max-width: calc(100% - 12px);
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px;
  background: var(--blue); color: #fff; font: 600 11px/1.2 var(--font); white-space: nowrap; overflow: hidden;
  opacity: 0; transform: translateY(6px) scale(.9); transition: opacity .3s ease, transform .3s cubic-bezier(.2, .8, .2, 1);
}
.demo-badge::before { content: "✓"; font-size: 10px; }
.demo-tile.match .demo-badge { opacity: 1; transform: none; }
/* The scan: a band of light with a blue leading edge, crossing in the reading direction */
.demo-sweep {
  position: absolute; top: 0; bottom: 0; left: 0; width: 28%; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .5) 88%, var(--blue) 88%, var(--blue) 91%, rgba(31, 91, 255, 0));
}
html[dir="rtl"] .demo-sweep { left: auto; right: 0; transform: scaleX(-1); }
.demo.scanning .demo-sweep { animation: demo-sweep 1.6s cubic-bezier(.45, .05, .35, 1) forwards; }
html[dir="rtl"] .demo.scanning .demo-sweep { animation-name: demo-sweep-rtl; }
@keyframes demo-sweep { 0% { opacity: 1; transform: translateX(-100%); } 92% { opacity: 1; } 100% { opacity: 0; transform: translateX(360%); } }
@keyframes demo-sweep-rtl { 0% { opacity: 1; transform: translateX(100%) scaleX(-1); } 92% { opacity: 1; } 100% { opacity: 0; transform: translateX(-360%) scaleX(-1); } }
.demo-count { margin: 12px 2px 0; min-height: 1.5em; font-size: 15px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
@media (min-width: 900px) {
  .demo { grid-area: scan; position: sticky; top: 24px; }
  .demo-grid { gap: 8px; }
  .demo-tile { border-radius: 14px; }
  .demo-badge { font-size: 12px; inset-inline-start: 8px; bottom: 8px; }
}
@media (max-width: 899px) {
  .demo-tile:nth-child(n + 9) { display: none; } /* phones: two rows of four */
  .demo-badge { font-size: 0; padding: 4px 6px; gap: 0; } /* the tick only */
  .demo-badge::before { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .demo-tile, .demo-tile .fb, .demo-badge { transition: none; }
  .demo-tile.match { transform: none; }
}

/* ---------- Home: how it works, privacy, questions ---------- */
.block { margin-top: 64px; }
.block h2 {
  font-size: clamp(1.6rem, 6vw, 2.25rem); line-height: 1.1; letter-spacing: -0.03em;
  font-weight: 700; margin: 0 0 20px;
}
html[lang="he"] .block h2 { letter-spacing: 0; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px; counter-reset: step; }
.steps li { counter-increment: step; position: relative; display: grid; grid-template-columns: 1fr; row-gap: 8px; align-content: start; }
/* A drawn picture of the step, with its number in the corner */
.step-art { aspect-ratio: 16 / 10; border-radius: 18px; background: var(--panel); overflow: hidden; margin-bottom: 6px; }
.step-art svg { display: block; width: 100%; height: 100%; font-family: var(--font); }
.step-art .fb-on { fill: none; stroke: var(--blue); stroke-width: 4.5; }
.steps li::before {
  content: counter(step); position: absolute; top: 12px; inset-inline-start: 12px; z-index: 1;
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: var(--blue); font-weight: 700; font-size: 15px; box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
.steps b { font-size: 18px; font-weight: 600; }
.steps span { color: var(--muted); }
.privacy { background: var(--panel); border-radius: var(--radius-panel); padding: 28px 22px; }
.facts { margin: 0 0 16px; padding: 0; list-style: none; display: grid; gap: 12px; }
.facts li { position: relative; padding-inline-start: 30px; }
.facts li::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 4px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.more { font-weight: 600; }
.faq details { border-top: 1px solid #EDEDF0; }
.faq details:last-of-type { border-bottom: 1px solid #EDEDF0; }
.faq summary {
  list-style: none; cursor: pointer; padding: 18px 0; font-weight: 600; font-size: 17px;
  display: flex; justify-content: space-between; gap: 16px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--muted); font-weight: 400; font-size: 22px; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0 0 18px; color: var(--muted); max-width: 62ch; }
@media (min-width: 900px) {
  .block { margin-top: 96px; }
  .steps { grid-template-columns: repeat(3, 1fr); gap: 32px; }

  .privacy { padding: 40px; display: grid; grid-template-columns: 1fr 1.4fr; column-gap: 48px; align-items: start; }
  .privacy h2 { grid-row: span 2; }
  .faq { max-width: 760px; }
}
@media (max-width: 899px) {
  /* Phones: headline, the demo, then the form. Someone whose link is already filled in (a guest
     sent it) sees the form first. */
  .screen-home .demo { order: 1; }
  #search-form { order: 2; }
  #last-search, #my-album { order: 3; }
  .prefilled .screen-home .demo { order: 4; }
}

/* ---------- Consent ---------- */
.consent {
  display: flex; align-items: flex-start; gap: 12px; margin-top: 22px;
  font-size: 14px; line-height: 1.45; color: var(--muted); cursor: pointer;
}
.consent input {
  flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--blue); cursor: pointer;
}
.consent a { font-weight: 600; }

/* ---------- Link feedback while pasting ---------- */
.link-status { margin: 8px 0 0; font-size: 15px; display: flex; align-items: flex-start; gap: 8px; }
.link-status::before { flex: none; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%; content: ""; }
.link-status.checking { color: var(--muted); }
.link-status.checking::before { border: 2px solid var(--line); border-top-color: var(--blue); animation: spin .8s linear infinite; box-sizing: border-box; }
.link-status.good { color: var(--ink); font-weight: 500; }
.link-status.good::before {
  background: var(--blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.link-status.bad { color: var(--danger); }
.link-status.bad::before { background: var(--danger) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 4.5v4.5M8 11.6v.1' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / 14px no-repeat; }

/* Buttons that are working */
.btn-primary.loading { position: relative; color: transparent; }
.btn-primary.loading::after {
  content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Waiting: your selfie in a scanning ring, the count, the stages ---------- */
.progress-screen { margin: 0 auto; text-align: center; }
.viewfinder { position: relative; width: 132px; height: 132px; margin: 40px auto 8px; color: var(--blue); }
.viewfinder img, .vf-icon {
  position: absolute; inset: 14px; width: calc(100% - 28px); height: calc(100% - 28px);
  border-radius: 20px; object-fit: cover; background: var(--panel);
}
.vf-icon { padding: 18px; box-sizing: border-box; color: #B8C6E8; }
.viewfinder img:not([hidden]) + .vf-icon { display: none; }
.vf-corners {
  position: absolute; inset: 0; width: 100%; height: 100%;
  fill: none; stroke: var(--blue); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round;
  animation: vf-breathe 1.8s ease-in-out infinite;
}
.vf-line {
  position: absolute; left: 18px; right: 18px; top: 16px; height: 3px; border-radius: 2px;
  background: var(--blue); box-shadow: 0 0 14px 3px rgba(31, 91, 255, .45);
  animation: vf-scan 1.6s ease-in-out infinite alternate;
}
@keyframes vf-breathe { 50% { transform: scale(.94); } }
@keyframes vf-scan { to { transform: translateY(97px); } }
.progress-screen h1.title { margin-top: 18px; }
.progress-big {
  margin: 6px 0 16px; min-height: 1.2em; font-size: clamp(2.6rem, 11vw, 3.5rem); font-weight: 700;
  letter-spacing: -0.04em; line-height: 1.1; font-variant-numeric: tabular-nums;
}
.progress-big #progress-of { color: var(--muted); font-weight: 500; font-size: .5em; letter-spacing: 0; }
.progress-screen .bar { max-width: 420px; margin: 0 auto; }
.stages {
  list-style: none; margin: 26px auto 0; padding: 18px 20px; max-width: 420px;
  background: var(--panel); border-radius: 18px; text-align: start; display: grid; gap: 14px;
}
.stages li { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 12px; color: var(--muted); }
.stages li i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); box-sizing: border-box; }
.stages li.active { color: var(--ink); font-weight: 600; }
.stages li.active i { border-color: var(--line); border-top-color: var(--blue); animation: spin .8s linear infinite; }
.stages li.done { color: var(--ink); }
.stages li.done i {
  border: 0; background: var(--blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.stages small { font-size: 14px; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.progress-eta { min-height: 1.5em; margin: 16px 0 0; font-weight: 600; color: var(--blue); }
.leave-note { margin: 28px auto 0; max-width: 420px; color: var(--muted); font-size: 14px; }
.leave-note p { margin: 0 0 4px; }

/* ---------- Results: reveal, select ---------- */
.results-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.btn-chip-outline {
  flex: none; min-height: 40px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font: 600 15px var(--font);
}
.btn-chip-outline[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.gallery li { animation: tile-in .45s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 40ms); }
@keyframes tile-in { from { opacity: 0; transform: scale(.94); } }
.gallery:not(.no-reveal) button::before {
  content: ""; position: absolute; inset: 10%; z-index: 1; pointer-events: none; opacity: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M3 25V3h22M75 3h22v22M97 75v22H75M25 97H3V75' fill='none' stroke='%231F5BFF' stroke-width='5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  animation: lock-on .8s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 40ms + 120ms);
}
@keyframes lock-on { 0% { opacity: 0; transform: scale(1.35); } 45% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1); } }
.gallery button { position: relative; overflow: hidden; }
.gallery img { transition: transform .18s ease, border-radius .18s ease; }
.gallery.selecting button { cursor: pointer; }
.gallery.selecting button::after {
  content: ""; position: absolute; top: 8px; inset-inline-end: 8px; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(0, 0, 0, .28); box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}
.gallery.selecting li.selected button { background: #DDE6FF; }
.gallery.selecting li.selected img { transform: scale(.88); border-radius: 10px; }
.gallery.selecting li.selected button::after {
  background: var(--blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 15px no-repeat;
}
.btn-primary:disabled:not(.loading) { cursor: default; }

/* Found so far: the first matches appear while the scan goes on */
.found-so-far { margin: 22px auto 0; max-width: 420px; }
.found-so-far p { margin: 0 0 10px; font-weight: 700; color: var(--blue); font-size: 18px; }
.found-so-far ul { list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.found-so-far li { position: relative; width: 52px; height: 52px; border-radius: 12px; background: var(--panel);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--blue); animation: lock-in .55s cubic-bezier(.2, .8, .2, 1) both; }
.found-so-far li img { border-radius: inherit; }
/* Each photo found locks on, like in the demo: a tick in the corner */
.found-so-far li::after {
  content: ""; position: absolute; inset-inline-end: -6px; bottom: -6px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 13px no-repeat;
  box-shadow: 0 0 0 2px #fff;
}
@keyframes lock-in { 0% { opacity: 0; transform: scale(1.3); } 60% { opacity: 1; transform: scale(.95); } 100% { transform: none; } }
.found-so-far img { display: block; width: 100%; height: 100%; object-fit: cover; }
@keyframes pop-in { from { opacity: 0; transform: scale(.5); } }

/* The matched face, boxed on the full-size photo */
.viewer-faces { position: absolute; inset: 0; pointer-events: none; transition: opacity .2s ease; }
.viewer-faces.off { opacity: 0; }
.face-box {
  position: absolute; min-width: 16px; min-height: 16px; border-radius: 10px;
  border: 2.5px solid var(--blue); box-shadow: 0 0 0 3px rgba(31, 91, 255, .3), 0 0 0 1px rgba(255, 255, 255, .6) inset;
  animation: box-pop .35s ease-out both;
}
.face-box em {
  position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%);
  padding: 2px 10px; border-radius: 999px; background: var(--blue); color: #fff;
  font: 600 12px/1.5 var(--font); font-style: normal; white-space: nowrap;
}
@keyframes box-pop { from { opacity: 0; transform: scale(1.35); } }

/* Order of the results */
.order { display: inline-flex; margin-top: 12px; padding: 3px; border-radius: 999px; background: var(--panel); }
.order button {
  min-height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: none; cursor: pointer;
  font: 600 14px var(--font); color: var(--muted);
}
.order button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.gallery.no-reveal li { animation: none; }

/* "Not me" in the viewer, and the undo message */
.viewer-top { gap: 8px; }
.viewer-top #viewer-count { margin-inline-end: auto; }
.viewer-text {
  min-height: 40px; padding: 0 14px; border: 0; border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, .12); color: #fff; font: 600 14px var(--font);
}
.toast {
  position: fixed; left: 50%; bottom: max(96px, calc(env(safe-area-inset-bottom) + 96px)); transform: translateX(-50%);
  z-index: 10; display: flex; align-items: center; gap: 16px; max-width: calc(100vw - 32px);
  padding: 10px 10px 10px 18px; border-radius: 14px; background: #16181D; color: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3); font-size: 15px; animation: toast-in .25s ease-out both;
}
html[dir="rtl"] .toast { padding: 10px 18px 10px 10px; }
.toast button {
  min-height: 36px; padding: 0 14px; border: 0; border-radius: 10px; cursor: pointer;
  background: rgba(255, 255, 255, .14); color: #fff; font: 600 14px var(--font);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
@media (hover: hover) { .viewer-text:hover, .toast button:hover { background: rgba(255, 255, 255, .24); } .order button:hover { color: var(--ink); } }

/* ---------- Family search ---------- */
.add-person { margin-top: 14px; }
.more-people { display: grid; gap: 12px; }
.more-people:not(:empty) { margin-top: 18px; }
.person-block { background: #fff; border-radius: 18px; padding: 14px 14px 10px; border-inline-start: 4px solid var(--c); }
.person-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.person-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.person-name {
  flex: 1; min-width: 0; min-height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px;
  font: 500 16px var(--font); color: var(--ink); background: #fff;
}
.person-name:focus-visible { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31, 91, 255, .18); }
.person-block .selfie img { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--c); }
.people-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.people-filter button {
  min-height: 36px; padding: 0 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font: 600 14px var(--font);
}
.people-filter button[aria-pressed="true"] { background: var(--c, var(--ink)); border-color: var(--c, var(--ink)); color: #fff; }
.gallery .tags { position: absolute; left: 6px; bottom: 6px; display: flex; gap: 3px; direction: ltr; }
.gallery .tags i {
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--c); color: #fff; font: 700 11px/1 var(--font); font-style: normal; box-shadow: 0 0 0 2px #fff;
}
.face-box { border-color: var(--c, var(--blue)); }
.face-box em { background: var(--c, var(--blue)); }

/* Story preview */
.story-frame {
  display: grid; place-items: center; height: min(62vh, 640px); border-radius: 16px; background: var(--panel); overflow: hidden;
}
.story-frame img { max-height: 100%; max-width: 100%; border-radius: 12px; box-shadow: 0 8px 30px rgba(0, 0, 0, .18); }
.story-status { margin: 0; color: var(--muted); }

/* ---------- A link and QR code for guests ---------- */
.hosts p { margin: 0 0 20px; max-width: 60ch; color: var(--muted); font-size: 17px; }
.text-input {
  width: 100%; min-height: 54px; padding: 0 16px;
  font: 400 16px var(--font); color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-control);
}
.text-input::placeholder { color: #9A9AA0; }
.text-input:focus-visible { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(31, 91, 255, .18); }
.guests-actions { display: grid; gap: 10px; margin-top: 16px; }
.guests-actions .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.guests-actions .pair > * { padding: 0 12px; }
.guests-ready { display: grid; justify-items: center; text-align: center; }
.guests-ready .hint { margin: 14px 0 12px; max-width: 40ch; }
.guests-qr {
  display: block; width: min(240px, 62vw); height: auto; aspect-ratio: 1; box-sizing: content-box;
  padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 20px;
}
.guests-url {
  width: 100%; min-height: 46px; padding: 0 14px; text-overflow: ellipsis;
  font: 400 15px var(--font); color: var(--muted); background: var(--panel);
  border: 0; border-radius: var(--radius-control);
}
.guests-url:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.guests-ready .guests-actions { width: 100%; }
.guests-close { display: block; margin: 8px auto 0; }

/* ---------- Upload the photos, and the owner's album page ---------- */
.hosts-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; }
.guests-upload { display: block; text-align: center; }
.screen-lede { margin: 0 0 22px; color: var(--muted); font-size: 17px; line-height: 1.5; }
.upload-choose { width: 100%; }
.upload-choose:has(+ input:focus-visible) { outline: 3px solid var(--blue); outline-offset: 2px; }
#upload-start { margin-top: 18px; }
#upload-progress .progress-text { margin: 0 0 12px; }
#upload-progress .hint { margin-top: 12px; }
.album-share { margin: 6px 0 0; }
.owner-panel { margin-top: 28px; }
.owner-panel h2 { margin: 0 0 4px; font-size: 19px; }
.owner-panel .hint { margin: 0 0 12px; }
.owner-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.owner-row .btn-secondary { min-height: 46px; padding: 0 16px; font-size: 15px; }
.owner-actions { display: flex; flex-wrap: wrap; gap: 4px 22px; margin-top: 10px; }
.owner-actions label:has(+ input:focus-visible) { outline: 3px solid var(--blue); outline-offset: 2px; }
.btn-text.danger { color: var(--danger); }
#album-more { margin-top: 10px; }
#album-more .bar { margin-top: 8px; }
body[data-screen="upload"] .footer [data-i18n="footerPrivacy"], body[data-screen="album"] .footer [data-i18n="footerPrivacy"] { display: none; }
@media (prefers-reduced-motion: reduce) {
  .vf-corners, .vf-line, .found-so-far li { animation: none; }
  .vf-line { display: none; }
  .gallery button::before { display: none; }
}

/* ---------- Organizers: a QR on the table, and a guest's phone with their photos ---------- */
.hosts-art { margin: 4px 0 0; }
@media (min-width: 900px) {
  .hosts { display: grid; grid-template-columns: 1fr 1fr; grid-template-areas: "title art" "body art" "actions art"; column-gap: 56px; align-items: start; }
  .hosts h2 { grid-area: title; } .hosts > p { grid-area: body; } .hosts-actions { grid-area: actions; }
  .hosts-art { grid-area: art; align-self: center; margin: 0; }
}
