/* v1 public page — one step per screen, the action always in view, no needless scroll.
   Layout: body is a full-height column; each step is a flex column whose action bar
   sits at the bottom (sticky if the content ever gets taller than the screen). */
body.v1 { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.v1 .topbar { flex: none; }
.wizard { flex: 1 0 auto; display: flex; flex-direction: column; width: 100%; max-width: 520px;
  padding-top: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.screen { flex: 1 0 auto; display: flex; flex-direction: column; gap: 12px; }
.screen[hidden] { display: none !important; }
.screen > * { margin: 0; }
.screen h1 { font-size: clamp(1.5rem, 6.4vw, 2.05rem); }
.screen h2 { font-size: 1.1rem; }
.lead { font-size: 1.06rem; }
.btn.big { min-height: 54px; font-size: 1.06rem; }

/* action bar: bottom of the step, sticky if the step scrolls */
.cta-bar { margin-top: auto; position: sticky; bottom: 0; z-index: 5; display: grid; gap: 10px;
  padding: 10px 0 max(2px, env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 78%, color-mix(in srgb, var(--bg) 0%, transparent)); }
.cta-bar.two { grid-template-columns: 1fr 1fr; }
.cta-bar.two .btn { padding: 0 10px; white-space: nowrap; }

/* step header: back + progress */
.stepbar { display: flex; align-items: center; gap: 8px; margin: -4px 0 10px; }
.stepbar[hidden] { display: none; }
.back { flex: none; width: 44px; height: 44px; margin-left: -10px; border: 0; border-radius: 12px; background: transparent; color: var(--ink);
  font: 400 2rem/1 var(--font); cursor: pointer; display: grid; place-items: center; padding-bottom: 4px; }
.back:active { background: var(--surface-2); }
.back[hidden] { visibility: hidden; display: grid !important; }
.progress { flex: 1; list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0; margin: 0; }
.progress li { font-size: .74rem; font-weight: 600; color: var(--muted); border-top: 4px solid var(--line); padding-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress li.done, .progress li.now { border-top-color: var(--accent); color: var(--ink); }

/* 1. start */
.start-fig { width: min(200px, 56vw); align-self: center; }
.start-fig svg { width: 100%; height: auto; border-radius: 14px; }
.points { list-style: none; padding: 0; display: grid; gap: 6px; }
.points li { position: relative; padding-left: 28px; color: var(--muted); font-size: .96rem; }
.points li::before { content: ""; position: absolute; left: 4px; top: .42em; width: 13px; height: 7px; border-left: 2.5px solid var(--accent); border-bottom: 2.5px solid var(--accent); transform: rotate(-45deg); }
.urgent { font-size: .9rem; color: var(--danger); background: var(--danger-bg); border-radius: var(--radius-sm); padding: 10px 12px; }
details.more { border-top: 1px solid var(--line); }
details.more summary { cursor: pointer; font-weight: 600; color: var(--accent); list-style: none; min-height: 48px; display: flex; align-items: center; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "+"; width: 1.2em; font-weight: 700; }
details.more[open] summary::before { content: "−"; }
details.more > div { padding-bottom: 8px; font-size: .95rem; }
.v1 footer.site { margin: 8px 0 0; padding: 16px 0 4px; }

/* 2. questions */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choices.three { grid-template-columns: repeat(3, 1fr); }
.choices button { min-height: 54px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  font: 600 1rem/1.2 var(--font); cursor: pointer; padding: 6px; }
.choices button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
#s-q h2 + .choices { margin-top: -2px; }
#s-q .choices + h2 { margin-top: 8px; }

/* 3. photo — full-screen capture like an ID/KYC selfie screen */
body.v1[data-screen="s-photo"] { height: 100vh; height: 100dvh; overflow: hidden; background: #000; }
body.v1[data-screen="s-photo"] .topbar,
body.v1[data-screen="s-photo"] .stepbar { display: none !important; }
.camscreen { position: fixed; inset: 0; z-index: 40; background: #000; color: #fff; }
.camfull { position: absolute; inset: 0; overflow: hidden; background: #000; }
.camfull video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s; }
.camfull.live video { opacity: 1; }
.camfull.mirror video { transform: scaleX(-1); }
/* dimmed surround with an oval cut-out */
.mask { position: absolute; inset: 0; pointer-events: none; }
.oval { position: absolute; left: 50%; top: 47%; width: min(72vw, 45dvh, 360px); aspect-ratio: 3 / 4; transform: translate(-50%, -50%);
  border-radius: 50%; border: 3px dashed rgb(255 255 255 / 85%); box-shadow: 0 0 0 200vmax rgb(0 0 0 / 52%); transition: border-color .2s; }
/* guide tones: searching (white) → adjusting (amber) → holding still (green, dashed) → ready (green, solid) */
.camfull[data-guide="adjust"] .oval { border-color: #ffc24b; }
.camfull[data-guide="hold"] .oval { border-color: #3ddc84; }
.camfull.ready .oval { border-style: solid; border-color: #3ddc84; }
/* distance arrows (inside #oval): "out" sit inside the border and point at it — the face must grow;
   "in" sit outside and point at it — the face must shrink */
.oval-arrows { position: absolute; inset: 0; pointer-events: none; }
.oval-arrows[hidden] { display: none; }
.oval-arrows i { position: absolute; width: 26px; height: 26px; display: grid; place-items: center; animation: 1s ease-in-out infinite; }
.oval-arrows b { width: 15px; height: 15px; border: solid #ffc24b; border-width: 5px 5px 0 0; border-radius: 2px; filter: drop-shadow(0 1px 2px rgb(0 0 0 / 60%)); }
.oval-arrows.strong b { border-color: #ff8a00; width: 18px; height: 18px; }
.oval-arrows .ar-t, .oval-arrows .ar-b { left: calc(50% - 13px); }
.oval-arrows .ar-l, .oval-arrows .ar-r { top: calc(50% - 13px); }
.oval-arrows[data-dir="out"] .ar-t { top: 8px; }
.oval-arrows[data-dir="out"] .ar-b { bottom: 8px; }
.oval-arrows[data-dir="out"] .ar-l { left: 8px; }
.oval-arrows[data-dir="out"] .ar-r { right: 8px; }
.oval-arrows[data-dir="in"] .ar-t { top: -36px; display: none; } /* would sit on the guide text / red dot */
.oval-arrows[data-dir="in"] .ar-b { bottom: -36px; }
.oval-arrows[data-dir="in"] .ar-l { left: -36px; }
.oval-arrows[data-dir="in"] .ar-r { right: -36px; }
.oval-arrows[data-dir="out"] .ar-t, .oval-arrows[data-dir="in"] .ar-b { animation-name: nudge-up; }
.oval-arrows[data-dir="out"] .ar-b, .oval-arrows[data-dir="in"] .ar-t { animation-name: nudge-down; }
.oval-arrows[data-dir="out"] .ar-l, .oval-arrows[data-dir="in"] .ar-r { animation-name: nudge-left; }
.oval-arrows[data-dir="out"] .ar-r, .oval-arrows[data-dir="in"] .ar-l { animation-name: nudge-right; }
.oval-arrows[data-dir="out"] .ar-t b, .oval-arrows[data-dir="in"] .ar-b b { transform: translateY(3px) rotate(-45deg); }
.oval-arrows[data-dir="out"] .ar-b b, .oval-arrows[data-dir="in"] .ar-t b { transform: translateY(-3px) rotate(135deg); }
.oval-arrows[data-dir="out"] .ar-l b, .oval-arrows[data-dir="in"] .ar-r b { transform: translateX(3px) rotate(-135deg); }
.oval-arrows[data-dir="out"] .ar-r b, .oval-arrows[data-dir="in"] .ar-l b { transform: translateX(-3px) rotate(45deg); }
@keyframes nudge-up { 50% { transform: translateY(-7px); } }
@keyframes nudge-down { 50% { transform: translateY(7px); } }
@keyframes nudge-left { 50% { transform: translateX(-7px); } }
@keyframes nudge-right { 50% { transform: translateX(7px); } }
.camfull:not(.live) .oval { border-color: rgb(255 255 255 / 35%); }
/* failed / analysing: only the centre panel matters */
.camfull:is([data-state="failed"], [data-state="analysing"]) :is(.oval, .fix, .cam-guide, .shutter) { visibility: hidden; }
/* top bar: back · look-here dot (front camera sits right above it) · flip */
.cam-top { position: absolute; top: 0; left: 0; right: 0; z-index: 6; display: grid; grid-template-columns: 56px 1fr 56px; align-items: center;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left)); }
.icon-btn { width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgb(0 0 0 / 42%); color: #fff; display: grid; place-items: center; cursor: pointer;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.icon-btn:active { background: rgb(255 255 255 / 22%); }
.icon-btn[hidden] { display: grid !important; visibility: hidden; }
#flipBtn { justify-self: end; }
/* front camera only: blinking red dot right under the camera = where to look */
.fix { justify-self: center; position: relative; display: grid; place-items: center; width: 44px; height: 44px; }
.fix span { width: 18px; height: 18px; border-radius: 50%; background: #ff2a2a;
  box-shadow: 0 0 0 4px rgb(255 42 42 / 30%), 0 0 16px 6px rgb(255 42 42 / 55%); animation: fixblink 1s ease-in-out infinite; }
.fix::after { content: ""; position: absolute; inset: 10px; border: 2px solid rgb(255 60 60 / 80%); border-radius: 50%; animation: fixring 1s ease-out infinite; }
.camfull[data-issue="look"] .fix span, .camfull[data-issue="look"] .fix::after { animation-duration: .55s; } /* asked to look: blink faster */
.camfull[data-mode="environment"] .fix { visibility: hidden; } /* rear camera: the person cannot see the screen */
@keyframes fixblink { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .15; transform: scale(.7); } }
@keyframes fixring { from { transform: scale(.6); opacity: .9; } to { transform: scale(1.9); opacity: 0; } }
.cam-guide { position: absolute; z-index: 5; left: 16px; right: 16px; top: calc(max(8px, env(safe-area-inset-top)) + 56px); margin: 0 auto; max-width: 440px;
  text-align: center; font-weight: 600; font-size: .98rem; line-height: 1.35; text-shadow: 0 1px 4px rgb(0 0 0 / 70%); }
.topprog { position: absolute; z-index: 7; top: 0; left: 0; right: 0; height: 4px; background: rgb(255 255 255 / 18%); }
.topprog i { display: block; height: 100%; width: 0; background: #3ddc84; transition: width .3s; }
/* front "flash": the screen turns white for the shot; the look-here dot stays on top */
.flash { position: absolute; inset: 0; z-index: 5; background: #fff; opacity: 0; pointer-events: none; transition: opacity .12s; }
.flash.on { opacity: 1; }
.camfull.flashing .fix span { animation: none; opacity: 1; background: #e00000; box-shadow: 0 0 0 5px rgb(224 0 0 / 25%); } /* steady while shooting */
.camfull.flashing .fix::after { display: none; }
.camfull.flashing .cam-guide { color: #111; text-shadow: none; }
.camfull.flashing .icon-btn, .camfull.flashing .cam-bottom { visibility: hidden; }
/* centre panels */
.cam-panel { position: absolute; z-index: 8; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(340px, calc(100vw - 40px));
  background: rgb(20 24 26 / 88%); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-radius: 20px; padding: 22px 20px;
  display: grid; gap: 12px; text-align: center; box-shadow: 0 10px 40px rgb(0 0 0 / 45%); }
.cam-panel[hidden] { display: none; }
.cam-panel > * { margin: 0; }
.cp-title { font-weight: 700; font-size: 1.1rem; }
.cp-sub { color: rgb(255 255 255 / 78%); font-size: .92rem; line-height: 1.4; }
.cp-icon { justify-self: center; color: rgb(255 255 255 / 85%); }
.cp-link { color: #9fe6c0; font-size: .92rem; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 44px; display: grid; place-items: center; }
.cp-link[hidden] { display: none; }
.bar { height: 8px; border-radius: 99px; background: rgb(255 255 255 / 16%); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: #3ddc84; transition: width .3s; }
.bar.indeterminate i { width: 35% !important; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-110%); } to { transform: translateX(310%); } }
@media (prefers-reduced-motion: reduce) {
  .bar.indeterminate i { animation-duration: 3s; }
  .fix span { animation: fixfade 1.6s ease-in-out infinite; } /* still blinks (colour only), no movement */
  .fix::after, .oval-arrows i { animation: none; }
}
@keyframes fixfade { 50% { opacity: .3; } }
.btn.light { background: rgb(255 255 255 / 12%); border-color: transparent; color: #fff; }
.spinner.light { justify-self: center; border-color: rgb(255 255 255 / 20%); border-top-color: #fff; width: 32px; height: 32px; }
/* bottom: hint + shutter, inside the camera */
.cam-bottom { position: absolute; z-index: 6; left: 0; right: 0; bottom: 0; display: grid; justify-items: center; gap: 14px;
  padding: 0 16px max(22px, calc(env(safe-area-inset-bottom) + 12px)); }
.cam-bottom .hint { position: static; background: rgb(0 0 0 / 60%); color: #fff; border-radius: 999px; padding: 9px 16px; font-weight: 600; font-size: .95rem;
  text-align: center; max-width: 100%; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.cam-bottom .hint.good { background: rgb(18 120 66 / 92%); }
.camfull[data-guide="adjust"] .cam-bottom .hint { box-shadow: inset 4px 0 0 #ffc24b; }
.camfull[data-guide="hold"] .cam-bottom .hint { background: rgb(18 120 66 / 70%); }
.camfull.ready .shutter { border-color: #3ddc84; box-shadow: inset 0 0 0 4px #000, inset 0 0 0 40px #fff, 0 0 0 5px rgb(61 220 132 / 45%); }
.cam-alt { background: #fff; color: #10302f; border-radius: 999px; padding: 0 18px; min-height: 44px; display: grid; place-items: center;
  font-weight: 700; font-size: .95rem; cursor: pointer; }
.cam-alt[hidden] { display: none; }
/* distance meter: Far ——[green zone]—— Close, live marker */
.dist { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; width: min(300px, calc(100vw - 48px));
  font-size: .8rem; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgb(0 0 0 / 80%); }
.dist[hidden] { display: none; }
.dist-track { position: relative; height: 8px; border-radius: 99px; background: rgb(255 255 255 / 28%); box-shadow: 0 1px 3px rgb(0 0 0 / 40%); }
.dist-zone { position: absolute; top: 0; bottom: 0; border-radius: 99px; background: rgb(61 220 132 / 80%); }
.dist-dot { position: absolute; top: 50%; left: 0; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%;
  background: #ffc24b; border: 3px solid #fff; box-shadow: 0 1px 5px rgb(0 0 0 / 55%); transition: left .2s ease-out, background-color .2s; }
.dist.ok .dist-dot { background: #3ddc84; }
@media (max-height: 560px) { .dist { display: none !important; } }
.cam-bottom .hint[hidden] { display: none; }
.camscreen .shutter { width: 78px; height: 78px; border-radius: 50%; border: 4px solid #fff; background: transparent; box-shadow: inset 0 0 0 4px #000, inset 0 0 0 40px #fff; cursor: pointer; }
.camscreen .shutter:active { transform: scale(.95); }
.camscreen .shutter[disabled] { opacity: .35; }
.file-btn { position: relative; }
@media (max-height: 560px) {
  .cam-guide { font-size: .9rem; top: calc(max(6px, env(safe-area-inset-top)) + 50px); }
  .oval { top: 50%; width: min(60vw, 42dvh, 300px); }
  .camscreen .shutter { width: 66px; height: 66px; }
  .cam-bottom { gap: 10px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}
@media (orientation: landscape) and (max-height: 500px) {
  .oval { width: min(30vw, 58dvh); top: 52%; }
  .cam-bottom { left: auto; right: max(12px, env(safe-area-inset-right)); top: 0; bottom: 0; align-content: center; padding: 0; width: 120px; }
}

/* 4. result */
.advice { border-radius: 18px; padding: 18px; border: 1.5px solid var(--line); background: var(--surface); }
.advice h2 { margin: 0 0 8px; font-size: 1.3rem; }
.advice p { margin: 0 0 .55em; }
.advice .note { margin: 10px 0 0; font-size: .82rem; color: var(--muted); }
.advice[data-tone="refer"] { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.advice[data-tone="refer"] h2 { color: var(--warn); }
.advice[data-tone="neutral"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.advice[data-tone="retake"] { background: var(--surface-2); }
.strip canvas { width: 100%; height: clamp(56px, 18vw, 96px); object-fit: cover; border-radius: var(--radius-sm); background: #000; }
.strip figcaption { margin-top: 4px; }

/* short screens: tighten, drop decoration first */
@media (max-height: 640px) {
  .start-fig { display: none; }
  .screen { gap: 10px; }
  .choices button { min-height: 48px; }
  .btn.big { min-height: 50px; }
}
@media (max-height: 600px) {
  .strip { display: none; }
  .advice { padding: 14px; }
  .advice h2 { font-size: 1.15rem; }
}
@media (max-height: 520px) {
  .lead { font-size: 1rem; }
  .screen { gap: 8px; }
  .stepbar { margin-bottom: 4px; }
  .screen h2 { font-size: 1rem; }
  .choices button { min-height: 46px; }
  .advice { padding: 12px 14px; }
  .advice h2 { font-size: 1.05rem; margin-bottom: 6px; }
  .advice p { font-size: .93rem; line-height: 1.42; margin-bottom: .4em; }
  .advice .note { margin-top: 6px; font-size: .78rem; }
  .cta-bar { padding-top: 6px; }
}
/* phone in landscape */
@media (max-height: 430px) and (orientation: landscape) {
  .topbar .container { height: 48px; }
  .wizard { padding-top: 6px; }
  .stepbar { margin-bottom: 2px; }
  .choices { grid-template-columns: repeat(4, 1fr); }
}
