/* ───── basics ───── */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: #1d2b2a; background: #fff;
  -webkit-tap-highlight-color: transparent;
}
html[lang=ar] body { line-height: 1.7; }
#app { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
h1 { font-size: 40px; line-height: 1.15; margin: 0 0 16px; }
h2 { font-size: 22px; margin: 28px 0 12px; }
h3 { font-size: 18px; margin: 0 0 10px; }
p { line-height: 1.6; }
.small { font-size: 15px; color: #4c5d5b; }
.center { text-align: center; margin-top: 12px; }
.error { color: #b42318; font-weight: 600; display: block; margin-top: 6px; }

/* ───── top bar + progress rail ───── */
.bar { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px 0; }
.logo { border: 2px dashed #9fb2ad; padding: 6px 16px; border-radius: 8px; color: #6b807a; }
.lang { border: 1.5px solid #d6dfdc; background: none; border-radius: 999px; padding: 10px 18px; font-size: 16px; }

.rail { display: grid; grid-template-columns: repeat(6, 1fr); margin: 24px; position: relative; }
.rail::before { content: ''; position: absolute; top: 9px; inset-inline: 8%; height: 3px; background: #d6dfdc; }
.station { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; font-size: 13px; color: #4c5d5b; text-align: center; }
.station i { width: 20px; height: 20px; border-radius: 50%; border: 3px solid #d6dfdc; background: #fff; }
.station.done i { background: #0b6b62; border-color: #0b6b62; }
.station.now i { border-color: #0b6b62; transform: scale(1.3); }
.station.now span { font-weight: 600; color: #1d2b2a; }

/* ───── screen body + buttons ───── */
/* The middle scrolls; the top bar and the buttons stay fixed. */
.screen { flex: 1; overflow-y: auto; padding: 8px 24px 24px; max-width: 900px; width: 100%; margin-inline: auto; }
.actions { flex: none; display: flex; gap: 12px; padding: 16px 24px 24px; border-top: 1px solid #d6dfdc; background: #fff; }
.btn { min-height: 64px; padding: 0 28px; border-radius: 12px; font-size: 20px; font-weight: 600; border: 2px solid #0b6b62; }
.btn.primary { background: #0b6b62; color: #fff; flex: 1; }
.btn.secondary { background: #fff; color: #0b6b62; }
.btn[disabled] { opacity: .35; cursor: default; }
.link { background: none; border: 0; color: #4c5d5b; text-decoration: underline; font-size: 17px; padding: 12px; }

/* ───── attract ───── */
.attract { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 20px; background: #eef5f3; padding: 24px; text-align: center; }
.attract .titles { display: grid; gap: 28px; margin-bottom: 24px; }
.attract h1 { font-size: 48px; margin: 0; }
.attract p { color: #4c5d5b; font-size: 20px; margin: 8px 0 0; }
.attract .btn { width: min(100%, 420px); flex: none; }

/* ───── welcome / consent ───── */
.lede { font-size: 20px; color: #4c5d5b; max-width: 40em; }
.panel { border: 1.5px solid #d6dfdc; border-radius: 12px; padding: 20px; margin-top: 16px; }
.panel h2 { margin-top: 0; }
.check { display: flex; gap: 14px; align-items: flex-start; font-weight: 600; margin-top: 12px; }
.check input { width: 28px; height: 28px; flex: none; accent-color: #0b6b62; }

/* ───── form fields ───── */
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.wide { grid-column: 1 / -1; }
.field label, .field .label { font-weight: 600; font-size: 18px; }
.field input, .field textarea { min-height: 60px; padding: 0 16px; font-size: 22px; border: 2px solid #d6dfdc; border-radius: 12px; font-family: inherit; }
.field textarea { padding: 12px 16px; min-height: 100px; resize: none; }
.field input:focus, .field textarea:focus { outline: none; border-color: #0b6b62; }
.field.invalid input, .field.invalid textarea { border-color: #b42318; }
html[dir=rtl] .field input[type=email] { text-align: right; }
.hint { color: #4c5d5b; font-size: 15px; }

/* ───── option cards ───── */
.choices { display: grid; gap: 10px; }
.choices.cols-2 { grid-template-columns: 1fr 1fr; }
.choices.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.choice { min-height: 60px; padding: 10px 16px; font-size: 18px; text-align: start; line-height: 1.3; border: 2px solid #d6dfdc; border-radius: 12px; background: #fff; }
.choice.selected { border-color: #0b6b62; background: #eef5f3; font-weight: 600; }
.sub { margin-top: 16px; padding: 16px; background: #eef5f3; border-radius: 12px; }

/* ───── camera ───── */
.camera { position: relative; width: 100%; max-width: 520px; aspect-ratio: 3 / 4; max-height: 50vh; margin: 16px auto 0; border-radius: 16px; overflow: hidden; background: #e3e9e7; }
.camera video, .camera img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mirror, .camera video { transform: scaleX(-1); }
.camera .guide { position: absolute; inset: 12% 22% 25%; border: 3px dashed rgba(255,255,255,.9); border-radius: 50% / 45%; pointer-events: none; }
.camera .guide-text { position: absolute; top: 0; inset-inline: 0; padding: 10px; text-align: center; color: #fff; background: rgba(29,43,42,.55); font-size: 15px; }
.camera .shutter { position: absolute; bottom: 14px; inset-inline: 22%; flex: none; box-shadow: 0 0 0 4px rgba(255,255,255,.85); }
.camera.off { display: grid; place-items: center; text-align: center; padding: 24px; color: #4c5d5b; }

/* ───── results ───── */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pair figure { margin: 0; }
.frame-img { position: relative; aspect-ratio: 3 / 4; border-radius: 16px; overflow: hidden; background: #eef5f3; }
.frame-img img { width: 100%; height: 100%; object-fit: cover; animation: reveal 1s ease; }
@keyframes reveal { from { opacity: 0; } to { opacity: 1; } }
.generating { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 48px 0; text-align: center; }
.pulse { width: 90px; height: 90px; border-radius: 50%; border: 4px solid #0b6b62; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(.8); opacity: .5; } 50% { transform: scale(1); opacity: 1; } }
.pair figcaption { text-align: center; font-weight: 600; margin-top: 8px; }
.notice { background: #eef5f3; border-radius: 12px; padding: 14px 18px; margin-top: 16px; }
.followup { border: 2px solid #0b6b62; border-radius: 12px; padding: 4px 18px; margin-top: 16px; }
.followup h2 { margin: 12px 0 4px; }

/* ───── idle prompt ───── */
#overlay { position: fixed; inset: 0; background: rgba(29,43,42,.55); display: grid; place-items: center; padding: 24px; z-index: 10; }
#overlay[hidden] { display: none; }
.sheet { background: #fff; border-radius: 16px; padding: 28px; width: min(100%, 520px); }
.sheet h2 { margin-top: 0; font-size: 28px; }
.sheet .row { display: flex; gap: 12px; }
.sheet .row .btn { flex: 1; }
