/* Face Rating Lab flow: upload wizard (start.html), processing screen and failure screen.
   Face Rating Lab studio design system: read DESIGN.md. Tokens and shared components come from base.css;
   this file only lays out the flow pages, and every rule is scoped to the flow's own classes. */

/* ---------- shared flow chrome ---------- */
.page-flow .site-header .header-actions .btn.show-mobile { display: none; } /* already in the flow */
.page-flow main { display: block; }
.flow {
  padding-block: clamp(20px, 4vw, 48px) clamp(48px, 7vw, 96px);
  min-height: calc(100vh - var(--header-h) - 70px);
  background: linear-gradient(180deg, var(--mist) 0, var(--mist-2) 420px, var(--mist-2) 100%);
}
.flow-footer { border-top: 1px solid var(--line-2); background: var(--white); padding-block: 22px; font-size: .8rem; color: var(--muted); }
.flow-footer .container { display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between; align-items: center; }
.flow-footer span { text-wrap: pretty; } /* no lone last word ("worth.") on narrow phones */
.flow-footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.flow-footer a { color: var(--muted); text-decoration: none; }
.flow-footer a:hover { color: var(--teal-700); }

.flow-error {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-top: 16px; padding: 12px 14px;
  border-radius: var(--r-md); background: var(--danger-bg); border: 1px solid var(--danger-line); color: var(--danger-ink);
  font-weight: 600; font-size: .9rem; line-height: 1.4;
}
.flow-error::before {
  content: ""; flex: none; width: 18px; height: 18px; background: var(--danger);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='8.2' fill='none' stroke='%23000' stroke-width='1.7'/%3E%3Cpath d='M10 5.8v5' stroke='%23000' stroke-width='1.9' stroke-linecap='round'/%3E%3Ccircle cx='10' cy='13.9' r='1.15'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='8.2' fill='none' stroke='%23000' stroke-width='1.7'/%3E%3Cpath d='M10 5.8v5' stroke='%23000' stroke-width='1.9' stroke-linecap='round'/%3E%3Ccircle cx='10' cy='13.9' r='1.15'/%3E%3C/svg%3E") center / contain no-repeat;
}
.flow-error > span { flex: 1 1 200px; }
.flow-error .btn { flex: none; }
.field-help { font-size: .8rem; color: var(--muted); line-height: 1.45; }

/* ---------- start: layout ---------- */
.flow-start { padding-top: clamp(16px, 3vw, 40px); }
.flow-layout { display: grid; gap: 40px; }
.flow-main { min-width: 0; }
.flow-aside { display: none; }
@media (min-width: 1024px) {
  .flow-layout { grid-template-columns: minmax(0, 680px) 320px; justify-content: center; align-items: start; gap: 48px; }
  .flow-aside { display: block; position: sticky; top: calc(var(--header-h) + 28px); }
}

/* ---------- start: stepper ---------- */
.stepper ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; }
.stepper li { flex: 1; min-width: 0; }
.stepper-btn {
  appearance: none; border: 0; background: none; padding: 10px 0; margin: 0; width: 100%; display: block;
  font: inherit; color: inherit; text-align: left; cursor: pointer; border-radius: var(--r-sm);
}
.stepper-btn:disabled { cursor: default; }
.stepper-btn:focus-visible { outline: 3px solid rgba(0, 162, 173, .5); outline-offset: 2px; }
.stepper-bar { display: block; height: 4px; border-radius: var(--r-pill); background: var(--line); transition: background var(--t-base) ease; }
.stepper li.is-done .stepper-bar { background: var(--teal-700); }
.stepper li.is-current .stepper-bar { background: var(--grad-brand); }
.stepper-num, .stepper-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stepper-num svg { display: none; }

@media (min-width: 760px) {
  .stepper ol { gap: 0; }
  .stepper li { flex: 1 1 auto; display: flex; align-items: center; }
  .stepper li:last-child { flex: 0 0 auto; }
  .stepper li:not(:last-child)::after { content: ""; flex: 1; height: 1.5px; margin-inline: 12px; background: var(--line-strong); border-radius: 2px; min-width: 16px; }
  .stepper li.is-done:not(:last-child)::after { background: var(--teal); }
  .stepper-btn { width: auto; display: inline-flex; align-items: center; gap: 10px; padding: 6px 4px; }
  .stepper-bar { display: none; }
  .stepper-num, .stepper-name { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .stepper-num {
    flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
    font: 700 .8rem/1 var(--font-sans); font-variant-numeric: tabular-nums; border: 1.5px solid var(--line-strong); background: var(--white); color: var(--muted);
    transition: background var(--t-base), border-color var(--t-base), color var(--t-base), box-shadow var(--t-base);
  }
  .stepper-num svg { width: 15px; height: 15px; }
  .stepper-name { font-weight: 600; font-size: .88rem; color: var(--muted); white-space: nowrap; }
  .stepper li.is-current .stepper-num { background: var(--teal-700); border-color: var(--teal-700); color: #fff; box-shadow: 0 0 0 4px rgba(0, 162, 173, .14); }
  .stepper li.is-current .stepper-name { color: var(--ink); }
  .stepper li.is-done .stepper-num { background: var(--teal-50); border-color: var(--teal-100); color: var(--teal-700); }
  .stepper li.is-done .stepper-num span { display: none; }
  .stepper li.is-done .stepper-num svg { display: block; }
  .stepper li.is-done .stepper-name { color: var(--ink); }
  .stepper li.is-done .stepper-btn:hover .stepper-name { color: var(--teal-700); }
}
@media (min-width: 760px) and (max-width: 900px) { .stepper-name { font-size: .8rem; } .stepper li:not(:last-child)::after { margin-inline: 8px; } }

/* ---------- start: wizard ---------- */
.wizard { margin-top: 14px; }
@media (min-width: 760px) {
  .wizard { margin-top: 20px; background: var(--white); border: 1px solid rgba(14, 35, 41, .07); border-radius: var(--r-xl); box-shadow: var(--shadow-card); padding: 36px 40px 30px; }
}
.step-title { margin-top: 14px; font-size: clamp(1.9rem, 5.6vw, 2.5rem); font-weight: 650; letter-spacing: -.035em; }
.step-title:focus { outline: none; }
.step-sub { margin-top: 10px; color: var(--muted); max-width: 56ch; font-size: 1rem; line-height: 1.55; }

/* step 1: ranges and heritage, then the two confirmations */
.about-grid { display: grid; gap: 22px; margin-top: 26px; }
@media (min-width: 760px) { .about-grid { grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; } }
.choice { margin: 0; padding: 0; border: 0; min-width: 0; }
.choice legend { padding: 0; margin-bottom: 8px; }
.choice .field-help { margin-top: 8px; }
.page-start .field { gap: 8px; }
.choice-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-card {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--white); cursor: pointer;
  font: 650 1rem/1.2 var(--font-sans); color: var(--ink);
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.choice-card:hover { border-color: var(--faint); }
.choice-card input { position: absolute; left: 16px; top: 50%; width: 20px; height: 20px; margin: -10px 0 0; opacity: 0; pointer-events: none; }
.choice-mark { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--faint); background: var(--white); transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast); }
.choice-card input:checked + .choice-mark { border-color: var(--teal-700); background: var(--teal-700); box-shadow: inset 0 0 0 4px var(--white); }
.choice-card input:focus-visible + .choice-mark { outline: 3px solid rgba(0, 162, 173, .45); outline-offset: 2px; }
.choice-card:has(input:checked) { border-color: var(--teal); background: var(--teal-50); box-shadow: var(--ring); }
.choice.is-invalid .choice-card { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(180, 55, 42, .1); }
.choice .flow-error, .page-start .field .flow-error { margin-top: 8px; }
.page-start .select.is-empty { color: var(--muted); }
.page-start .select option { color: var(--ink); }

.consents { margin: 26px 0 0; padding: 0; border: 0; min-width: 0; }
.consents legend { padding: 0; margin-bottom: 8px; }
.consent-box { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--white); box-shadow: var(--shadow-xs); overflow: hidden; }
.consents .check { padding: 15px 16px; min-height: 56px; align-items: flex-start; transition: background var(--t-fast); }
.consents .check input { margin-top: 0; }
.consents .check + .check { border-top: 1px solid var(--line-2); }
.consents .check:hover { background: var(--mist-2); }
.consents .check input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(180, 55, 42, .14); }
.consents + .flow-error { margin-top: 12px; }

.flow-assure { list-style: none; margin: 20px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.flow-assure li {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px 6px 9px; border-radius: var(--r-pill);
  background: var(--white); border: 1px solid var(--line); font: 600 .75rem/1.1 var(--font-sans); color: var(--ink-2);
}
.flow-assure .icon { width: 14px; height: 14px; color: var(--teal); }
@media (min-width: 1024px) { .flow-assure { display: none; } }

/* ---------- start: photo guide (real example photos, never drawings) ---------- */
.guide { display: grid; grid-template-columns: 108px 1fr; gap: 16px; align-items: center; margin-top: 22px; }
.guide-main { position: relative; margin: 0; }
.guide-shot { display: block; aspect-ratio: 3 / 4; border-radius: var(--r-md); box-shadow: var(--shadow-soft); }
.guide-shot img { object-position: 50% 30%; }
.guide-ok {
  position: absolute; right: -7px; bottom: -7px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; background: var(--teal-700); color: #fff; border: 2px solid var(--white); box-shadow: var(--shadow-xs);
}
.guide-ok .icon { width: 15px; height: 15px; }
.guide-label { font: 750 var(--fs-label)/1 var(--font-sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.tick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: .92rem; line-height: 1.35; color: var(--ink-2); }
.tick-list li { display: grid; grid-template-columns: 16px 1fr; gap: 9px; align-items: start; }
.tick-list li::before {
  content: ""; width: 16px; height: 16px; margin-top: 1px; background: var(--teal-700);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.avoid { margin-top: 22px; }
.avoid ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.avoid li { position: relative; display: grid; gap: 7px; text-align: center; font-size: .75rem; line-height: 1.25; color: var(--ink-2); font-weight: 600; }
.avoid-shot { display: block; aspect-ratio: 3 / 4; border-radius: var(--r-sm); box-shadow: var(--shadow-xs); }
/* each "avoid" example is the same real photo with the mistake applied: rotated, cropped, shadowed, blurred, dark */
.avoid-shot img { transform-origin: 50% 42%; transform: scale(1.4); }
.avoid-shot.fx-tilt img { transform: rotate(-14deg) scale(1.55); }
.avoid-shot.fx-close img { transform: scale(2.6); transform-origin: 50% 40%; }
.avoid-shot.fx-shadow img { filter: contrast(1.1) brightness(.95); }
.avoid-shot.fx-shadow::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(100deg, rgba(6, 12, 16, .86) 0%, rgba(6, 12, 16, .62) 36%, rgba(6, 12, 16, 0) 60%); }
.avoid-shot.fx-blur img { filter: blur(2.6px); transform: scale(1.48); }
[data-photo="side"] .avoid-shot img { transform-origin: 63% 42%; }
.avoid-shot.fx-up img { transform: rotate(-16deg) scale(1.5); }
.avoid-shot.fx-down img { transform: rotate(14deg) scale(1.5); }
[data-photo="side"] .avoid-shot.fx-close img { transform: scale(2.5); transform-origin: 68% 42%; }
.avoid-shot.fx-dark img { filter: brightness(.36) contrast(.92) saturate(.8); }
.avoid-x {
  position: absolute; right: -5px; top: -5px; z-index: 4; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; background: var(--danger); color: #fff; border: 2px solid var(--white);
}
.avoid-x .icon { width: 11px; height: 11px; }
@media (max-width: 759px) {
  .photo .guide { grid-template-columns: 100px 1fr; gap: 14px; margin-top: 18px; }
  .photo .tick-list { font-size: .88rem; gap: 6px; }
  .avoid { margin-top: 18px; }
  .avoid ul { gap: 9px; }
  .photo .drop { margin-top: 20px; min-height: 152px; padding: 24px 40px; }
}
@media (min-width: 760px) {
  .guide { grid-template-columns: 136px 1fr; gap: 22px; }
  .tick-list { font-size: .94rem; }
  .avoid li { font-size: .78rem; }
  .avoid ul { max-width: 440px; gap: 14px; }
}

/* ---------- start: picker, preview ---------- */
.photo { position: relative; }
.drop {
  --sc-size: 24px; --sc-inset: 12px;
  appearance: none; width: 100%; margin-top: 22px; display: grid; justify-items: center; gap: 12px; text-align: center;
  padding: 28px 20px 26px; min-height: 176px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg);
  background: var(--white); color: var(--ink); font: inherit; cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.drop:hover { background: var(--teal-50); border-color: var(--teal); }
.drop:active { transform: scale(.995); }
.drop:focus-visible { outline: 3px solid rgba(0, 162, 173, .5); outline-offset: 3px; }
.drop.is-over { background: var(--teal-50); border-color: var(--teal); border-style: solid; }
.drop-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--teal-50); color: var(--teal-700); box-shadow: inset 0 0 0 1px rgba(0, 122, 131, .12); }
.drop-icon .icon { width: 26px; height: 26px; }
.drop-title { display: block; font: 650 1.15rem/1.2 var(--font-sans); letter-spacing: -.02em; color: var(--ink); }
.drop-hint { display: block; margin-top: 4px; color: var(--muted); font-size: .88rem; }
.drop-busy { display: none; }
.photo.is-busy .drop .drop-icon, .photo.is-busy .drop .drop-text { display: none; }
.photo.is-busy .drop .drop-busy { display: grid; justify-items: center; gap: 12px; font-weight: 600; color: var(--ink-2); }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--teal-100); border-top-color: var(--teal-700); animation: fm-spin .8s linear infinite; }
@keyframes fm-spin { to { transform: rotate(360deg); } }

.shot { margin-top: 22px; display: grid; gap: 18px; }
.shot-frame {
  --maxh: min(50vh, 440px); --sc-size: 26px; --sc-inset: 12px;
  position: relative; justify-self: center; width: min(100%, calc(var(--maxh) * var(--ar, .75))); aspect-ratio: var(--ar, .75);
  border-radius: var(--r-lg);
}
/* the person's own photo: only the scan corners, no guide or measurement lines (they would not fit their face) */
.shot-frame img { width: 100%; height: 100%; object-fit: cover; }
.shot-frame > .shot-tag { position: absolute; right: 12px; top: 12px; z-index: 3; }
.shot-busy { position: absolute; inset: 0; z-index: 3; display: none; place-items: center; background: rgba(14, 35, 41, .4); }
.photo.is-busy .shot-busy { display: grid; }
.shot-status {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md);
  font-size: .9rem; font-weight: 600; line-height: 1.4;
}
.shot-status .icon { flex: none; width: 20px; height: 20px; margin-top: 0; }
.shot-status.is-ok { background: var(--mint-50); color: var(--mint-700); border: 1px solid rgba(17, 122, 100, .18); --icon-bg: var(--mint-700); --icon-fg: #fff; }
.shot-status.is-warn { background: var(--focus-bg); color: var(--focus-fg); border: 1px solid rgba(138, 85, 19, .2); }
.shot-side .guide-label { margin-top: 16px; }
/* "Quick check" after a photo is added: things for the person to check, so small teal dots, not ticks or empty rings. */
.ask-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: .9rem; line-height: 1.35; color: var(--ink-2); }
.ask-list li { display: grid; grid-template-columns: 16px 1fr; gap: 9px; align-items: start; }
.ask-list li::before { content: ""; width: 6px; height: 6px; margin: calc(.675em - 3px) 0 0 5px; border-radius: 50%; background: var(--teal-700); }
.shot-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.shot-actions .icon { width: 16px; height: 16px; color: var(--teal-700); }
@media (min-width: 760px) {
  .shot { grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 26px; }
  .shot-frame { --maxh: 400px; width: min(300px, calc(var(--maxh) * var(--ar, .75))); justify-self: start; }
}

/* ---------- start: review ---------- */
.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.review-shot { margin: 0; }
.review-frame { aspect-ratio: 3 / 4; border-radius: var(--r-md); }
.review-frame img { width: 100%; height: 100%; object-fit: cover; }
.review-shot figcaption { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; font-weight: 650; font-size: .9rem; color: var(--ink); }
.link-btn {
  appearance: none; background: none; border: 0; padding: 4px 2px; font: 600 .88rem/1 var(--font-sans); color: var(--teal-700); cursor: pointer;
  text-decoration: underline; text-decoration-color: rgba(0, 162, 173, .4); text-decoration-thickness: 1.5px; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--teal-800); text-decoration-color: currentColor; }
.link-btn:focus-visible { outline: 3px solid rgba(0, 162, 173, .5); outline-offset: 2px; border-radius: 4px; }
.review-meta {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-top: 16px; padding: 14px 16px;
  border-radius: var(--r-md); background: var(--white); border: 1px solid var(--line);
}
.review-meta dl { flex: 1; min-width: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px 24px; }
.review-meta dt { font: 750 var(--fs-label)/1 var(--font-sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.review-meta dd { margin: 0; font-weight: 650; font-size: .94rem; color: var(--ink); }
.next-card { margin-top: 18px; padding: 20px; border-radius: var(--r-lg); background: var(--mist-2); border: 1px solid var(--line-2); }
.next-card h3 { font-size: 1.05rem; letter-spacing: -.015em; }
.next-list { list-style: none; counter-reset: nx; margin: 16px 0 0; padding: 0; display: grid; gap: 14px; }
.next-list li { counter-increment: nx; display: grid; grid-template-columns: 28px 1fr; gap: 12px; color: var(--ink-2); font-size: .92rem; line-height: 1.45; }
.next-list li::before {
  content: counter(nx); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font: 700 .8rem/1 var(--font-sans); font-variant-numeric: tabular-nums; color: var(--teal-700); background: var(--white); box-shadow: inset 0 0 0 1px var(--teal-100);
}
.next-list strong { display: block; color: var(--ink); font-weight: 650; }
.next-privacy { display: flex; gap: 10px; align-items: center; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .86rem; text-wrap: pretty; }
.next-privacy .icon { width: 16px; height: 16px; color: var(--teal); }
.upload-state { margin-top: 18px; }
.upload-bar { height: 8px; border-radius: var(--r-pill); background: var(--line-2); overflow: hidden; }
.upload-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--grad-brand); transition: width .2s ease; }
.upload-text { margin-top: 8px; font: 600 .84rem/1.3 var(--font-sans); font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* ---------- start: nav ---------- */
.wizard-nav { margin-top: 30px; }
.wizard-btns { display: flex; gap: 12px; }
.wizard-btns .btn { min-height: 56px; }
.wizard-btns [data-next], .wizard-btns [data-submit] { flex: 1; }
.wizard-btns [data-back] { flex: none; min-width: 108px; }
.wizard-nav .guarantee-line { margin-top: 12px; }
.btn-progress { position: relative; overflow: hidden; isolation: isolate; }
.btn-progress::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: rgba(255, 255, 255, .2); opacity: 0;
  transform-origin: left center; transform: scaleX(var(--p, 0)); transition: transform .2s ease, opacity .2s;
}
.btn-progress.is-uploading { cursor: progress; opacity: 1; }
.btn-progress.is-uploading::before { opacity: 1; }
.btn-progress.is-uploading:hover, .btn-progress.is-uploading:active { transform: none; filter: none; }
@media (max-width: 759px) {
  .page-start { padding-bottom: calc(108px + env(safe-area-inset-bottom)); }
  .wizard-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; margin: 0;
    padding: 10px var(--gutter) calc(8px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .94); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
    border-top: 1px solid var(--line-2); box-shadow: 0 -10px 30px -20px rgba(14, 35, 41, .35);
  }
  .wizard-btns .btn { min-height: 52px; }
  .wizard-nav .guarantee-line { margin-top: 7px; font-size: .72rem; gap: 4px 14px; }
  .page-start .dev-ribbon { bottom: calc(112px + env(safe-area-inset-bottom)); }
}

/* ---------- start: aside (desktop) ---------- */
.aside-card { margin: 0; border-radius: var(--r-xl); overflow: hidden; background: var(--white); border: 1px solid rgba(14, 35, 41, .07); box-shadow: var(--shadow-card); }
.aside-visual { aspect-ratio: 4 / 5; border-radius: 0; box-shadow: none; }
.aside-svg { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; }
.aside-pill, .aside-ideal { position: absolute; left: 50%; z-index: 3; transform: translateX(-50%); }
.aside-pill { bottom: 48px; }
.aside-ideal { bottom: 16px; font-size: .66rem; padding: 5px 10px; }
.aside-cap { padding: 14px 18px 16px; color: var(--muted); font-size: .86rem; line-height: 1.45; }
.aside-cap strong { color: var(--ink); font-weight: 650; }
.aside-list { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 14px; }
.aside-list li { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: center; font-size: .9rem; line-height: 1.35; }
.aside-list li strong { display: block; font-weight: 650; color: var(--ink); }
.aside-list li span span { color: var(--muted); font-size: .82rem; }
.aside-proof { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.aside-proof .stars { flex-basis: 100%; }

/* ---------- processing ---------- */
.flow-processing .proc-layout { display: grid; gap: 26px; grid-template-areas: "head" "visual" "body"; }
.proc-head { grid-area: head; }
.proc-visual { grid-area: visual; }
.proc-body { grid-area: body; }
.proc-head h1 { font-size: clamp(2.1rem, 6vw, 3.2rem); margin-top: 14px; }
.proc-head .lead { margin-top: 12px; }
.proc-head .lead.is-slow { color: var(--ink); }
@media (min-width: 900px) {
  .flow-processing .proc-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "visual head" "visual body"; grid-template-rows: auto 1fr; column-gap: clamp(40px, 6vw, 80px); row-gap: 0; align-items: start; max-width: 1080px; margin-inline: auto; }
  .flow-processing .proc-visual { position: sticky; top: calc(var(--header-h) + 28px); }
  .proc-body { margin-top: 30px; }
}

/* the scan card: a real face on the studio backdrop with the Face Rating Lab line style (DESIGN.md section 6) */
.proc-card { --sc-size: 30px; --sc-inset: 16px; margin: 0 auto; width: min(100%, calc(46vh * .8), 440px); aspect-ratio: 4 / 5; }
@media (min-width: 900px) { .proc-card { width: min(100%, 460px); } }
.proc-svg { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; }
.proc-photo { transition: opacity var(--t-slow) var(--ease-out); }
.proc-photo.is-out { opacity: 0; }
.proc-mesh { opacity: .5; }
.proc-draw, .proc-pills { transition: opacity 220ms ease; }
.proc-draw.is-leaving, .proc-pills.is-leaving { opacity: 0; }
.proc-sec, .proc-arcs { opacity: 0; transition: opacity 300ms var(--ease-out); }
.proc-sec.is-on, .proc-arcs.is-on { opacity: 1; }
.proc-pop { transform-box: fill-box; transform-origin: center; animation: m-pop var(--t-base) var(--ease-pop) both; }
.proc-svg .m-head { transition: opacity 200ms ease; }
.proc-svg .m-head.is-gone { opacity: 0; }
.proc-pills { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.proc-pill {
  position: absolute; left: 0; top: 0; font-size: .64rem; padding: 5px 10px; gap: 7px;
  opacity: 0; transform: translate(var(--x, 0), calc(var(--y, 0) + 6px)); transition: opacity 300ms var(--ease-out), transform 300ms var(--ease-out);
}
.proc-pill.is-on { opacity: 1; transform: translate(var(--x, 0), var(--y, 0)); }
.proc-pill .pill-sep { height: 10px; }
.proc-pill.no-name .pill-name, .proc-pill.no-name .pill-sep, .proc-pill.no-name .dot { display: none; }
/* the person's own photo: no landmarks yet, so a calm scan line instead of lines that would not fit their face */
.proc-sweep {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2; height: 30%; pointer-events: none; display: none;
  background: linear-gradient(180deg, rgba(0, 162, 173, 0) 0%, rgba(0, 162, 173, .08) 65%, rgba(0, 162, 173, .2) 100%);
  transform: translateY(-100%); animation: proc-sweep 3.4s cubic-bezier(.45, .05, .55, .95) infinite;
}
.proc-sweep::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--teal); box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .9), 0 0 14px 2px rgba(0, 162, 173, .55); }
.proc-card.is-own .proc-sweep { display: block; }
/* the line is the band's bottom edge: it travels from the top of the photo to the bottom, then fades */
@keyframes proc-sweep {
  0% { transform: translateY(-100%); opacity: 0; }
  6% { opacity: 1; }
  74% { opacity: 1; }
  80% { transform: translateY(233%); opacity: 0; }
  100% { transform: translateY(233%); opacity: 0; }
}
.proc-live { display: flex; justify-content: center; margin-top: 16px; }
.proc-live > span {
  display: inline-flex; align-items: center; gap: 9px; max-width: 100%; padding: 9px 15px; border-radius: var(--r-pill);
  background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow-xs);
  font: 650 .84rem/1.2 var(--font-sans); color: var(--ink);
}
.proc-live [data-stage-caption] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proc-visual-note { margin: 10px auto 0; max-width: 42ch; text-align: center; font-size: .8rem; line-height: 1.45; color: var(--muted); }
.is-lost .proc-sweep, .is-lost .proc-pills, .is-lost .proc-draw, .is-finished .proc-sweep { display: none; }
.is-lost .live-dot { background: var(--focus-fg); animation: none; }
.is-lost .proc-bar span::after, .is-lost .proc-stage.is-current .proc-ico { animation: none; }
.is-finished .live-dot { animation: none; box-shadow: 0 0 0 3px rgba(49, 198, 166, .25); }

.proc-progress { margin-top: 4px; }
.proc-progress-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.proc-progress-row strong { color: var(--ink); font-size: .95rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.proc-bar { height: 8px; border-radius: var(--r-pill); background: var(--line-2); overflow: hidden; }
.proc-bar span { position: relative; display: block; height: 100%; width: 0; border-radius: inherit; overflow: hidden; background: var(--grad-brand); transition: width .45s ease; }
.proc-bar span::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .4), transparent); transform: translateX(-100%); animation: pm-shimmer 2.2s ease-in-out infinite; }
@keyframes pm-shimmer { to { transform: translateX(100%); } }

.proc-stages { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 4px; }
.proc-stage {
  display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: center; padding: 11px 14px; border-radius: var(--r-md);
  color: var(--muted); border: 1px solid transparent; transition: background var(--t-base), color var(--t-base), border-color var(--t-base);
}
.proc-ico { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: var(--white); display: grid; place-items: center; color: #fff; transition: background var(--t-base), border-color var(--t-base); }
.proc-ico .icon { width: 13px; height: 13px; opacity: 0; transition: opacity var(--t-fast); }
.proc-stage-name { display: block; font-weight: 600; line-height: 1.3; }
.proc-stage-detail { display: none; margin-top: 2px; font-size: .82rem; color: var(--muted); line-height: 1.35; }
.proc-stage.is-current { background: var(--white); color: var(--ink); border-color: var(--line); box-shadow: var(--shadow-xs); }
.proc-stage.is-current .proc-ico { border: 2px solid var(--teal-100); border-top-color: var(--teal-700); animation: fm-spin .8s linear infinite; }
.proc-stage.is-current .proc-stage-detail { display: block; }
.proc-stage.is-done { color: var(--ink); }
.proc-stage.is-done .proc-ico { background: var(--teal-700); border-color: var(--teal-700); }
.proc-stage.is-done .proc-ico .icon { opacity: 1; }

.proc-notice { display: flex; gap: 10px; align-items: center; margin-top: 16px; padding: 11px 14px; border-radius: var(--r-md); background: var(--focus-bg); border: 1px solid rgba(138, 85, 19, .2); color: var(--focus-fg); font-size: .9rem; font-weight: 600; }
.proc-notice .spinner { width: 18px; height: 18px; border-width: 2px; border-color: rgba(138, 85, 19, .25); border-top-color: var(--focus-fg); }

.proc-fact { margin-top: 22px; padding: 18px 20px 16px; border-radius: var(--r-lg); background: var(--white); border: 1px solid rgba(14, 35, 41, .07); box-shadow: var(--shadow-soft); }
.proc-facts { list-style: none; margin: 14px 0 0; padding: 0; display: grid; }
.proc-facts li { grid-area: 1 / 1; opacity: 0; transform: translateY(6px); transition: opacity .25s ease, transform .25s ease; font-size: .94rem; line-height: 1.5; color: var(--ink-2); }
.proc-facts li.is-on { opacity: 1; transform: none; transition-delay: .25s; } /* the old fact fades out first, then the new one fades in */
.proc-facts strong { color: var(--ink); font-weight: 650; }
.proc-dots { display: flex; gap: 6px; margin-top: 14px; }
.proc-dots span { width: 6px; height: 6px; border-radius: var(--r-pill); background: var(--line-strong); transition: background var(--t-slow), width var(--t-slow); }
.proc-dots span.is-on { width: 18px; background: var(--teal); }
.proc-next { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; font-size: .88rem; color: var(--muted); line-height: 1.45; text-wrap: pretty; }
.proc-next .icon { flex: none; width: 20px; height: 20px; margin-top: 0; color: var(--teal-700); }
.proc-next strong { color: var(--ink); }
.proc-lost { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 10px; }
.proc-lost p { flex-basis: 100%; margin-bottom: 4px; }
.proc-lost .guarantee-line { margin: 2px 0 0; }

/* ---------- failed ---------- */
.fail-hero { text-align: center; }
.fail-icon {
  width: 64px; height: 64px; margin: 0 auto 22px; border-radius: 20px; display: grid; place-items: center;
  background: var(--white); color: var(--teal-700); border: 1px solid var(--line); box-shadow: var(--shadow-soft);
}
.fail-icon .icon { width: 30px; height: 30px; }
.fail-hero h1 { font-size: clamp(2.1rem, 6vw, 3.2rem); }
.fail-hero .lead { margin: 14px auto 0; }
.fail-reason {
  margin-top: 30px; display: grid; grid-template-columns: 40px 1fr; gap: 14px; align-items: start;
  padding: 18px 20px; border-radius: var(--r-lg); background: var(--white); border: 1px solid var(--line); border-left: 3px solid var(--danger); box-shadow: var(--shadow-soft);
}
.fail-reason-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--danger-bg); color: var(--danger); display: grid; place-items: center; }
.fail-reason-ico .icon { width: 22px; height: 22px; }
.fail-reason .label { margin-bottom: 8px; color: var(--danger-ink); }
.fail-reason p.fail-text { font-size: 1.02rem; font-weight: 650; line-height: 1.45; color: var(--ink); }
.fail-quick { margin-top: 16px; }
@media (min-width: 720px) { .fail-quick { display: none; } }
.fail-fixes { margin-top: 40px; }
.fail-fixes h2 { font-size: clamp(1.55rem, 4vw, 2rem); }
.fail-fixes > p { margin-top: 8px; color: var(--muted); }
.fix-list { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 12px; }
.fix-item { display: grid; grid-template-columns: 64px 1fr; gap: 16px; align-items: center; padding: 10px 16px 10px 10px; border-radius: var(--r-md); background: var(--white); border: 1px solid var(--line); }
.fix-shot { display: block; width: 64px; aspect-ratio: 4 / 5; border-radius: var(--r-sm); box-shadow: var(--shadow-xs); }
.fix-shot img { transform: scale(1.3); transform-origin: 55% 36%; }
.fix-item strong { display: block; font-weight: 650; line-height: 1.3; color: var(--ink); }
.fix-item span { display: block; margin-top: 4px; font-size: .88rem; color: var(--muted); line-height: 1.45; }
@media (min-width: 720px) { .fix-list { grid-template-columns: 1fr 1fr; } .fix-item:last-child:nth-child(odd) { grid-column: 1 / -1; } }
.fail-cta { margin-top: 36px; padding: 28px 22px 24px; border-radius: var(--r-xl); text-align: center; box-shadow: var(--shadow-card); }
.fail-cta .btn { width: 100%; max-width: 420px; }
.fail-cta-note { margin-top: 14px; font-size: .86rem; color: var(--muted); }
.fail-help { margin-top: 18px; text-align: center; font-size: .9rem; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .proc-sweep { display: none !important; }
  .proc-pill, .proc-sec, .proc-arcs, .proc-photo { transition: none; }
  .proc-bar span::after { display: none; }
  .proc-facts li { transition: none; }
}
