/* ============ Worker Verify — portal styles ============ */
:root {
  --bg: #0b1220;
  --card: #131c2e;
  --card2: #1a2540;
  --line: #263149;
  --text: #e8edf6;
  --muted: #9aa7bd;
  --accent: #3b82f6;
  --accent2: #2563eb;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 16px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overscroll-behavior: none;
}
button { font: inherit; cursor: pointer; }
input, select { font: inherit; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px calc(14px);
  background: rgba(11, 18, 32, .85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: .2px; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.step-dots { display: flex; gap: 7px; }
.step-dots .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); transition: .25s; }
.step-dots .dot.on { background: var(--accent); transform: scale(1.25); }
.step-dots .dot.done { background: var(--ok); }

/* ---------- screens ---------- */
.screen { display: none; padding: 22px 16px 48px; }
.screen.active { display: block; animation: fadeUp .35s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.card {
  max-width: 560px; margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 22px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}
.card.center { text-align: center; }
h1 { font-size: 1.55rem; margin-bottom: 10px; letter-spacing: -.02em; }
h2 { font-size: 1.3rem; margin-bottom: 6px; letter-spacing: -.01em; }
.lead { color: var(--muted); margin-bottom: 16px; }
.sub { color: var(--muted); font-size: .92rem; margin-bottom: 16px; }
.sub.center { text-align: center; }
.hero-icon { font-size: 44px; margin-bottom: 10px; }
.step-tag { display: inline-block; font-size: .74rem; font-weight: 800; letter-spacing: .12em; color: var(--accent); background: rgba(59, 130, 246, .12); padding: 4px 10px; border-radius: 999px; margin-bottom: 10px; }
.fineprint { font-size: .78rem; color: var(--muted); margin-top: 14px; text-align: center; }

.checklist { list-style: none; margin: 0 0 18px; }
.checklist li { padding: 7px 0 7px 30px; position: relative; color: var(--text); font-size: .95rem; }
.checklist li::before { content: "✓"; position: absolute; left: 4px; color: var(--ok); font-weight: 800; }

.steps-preview { display: grid; gap: 8px; margin-bottom: 18px; }
.sp { display: flex; align-items: center; gap: 12px; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: .93rem; }
.sp span { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; min-width: 26px; border-radius: 50%; background: rgba(59, 130, 246, .15); color: var(--accent); font-weight: 800; font-size: .8rem; }

.consent { display: flex; gap: 11px; align-items: flex-start; font-size: .84rem; color: var(--muted); background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; margin-bottom: 18px; }
.consent input { width: 20px; height: 20px; min-width: 20px; margin-top: 1px; accent-color: var(--accent); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 12px;
  padding: 13px 20px; font-weight: 700; font-size: 1rem;
  transition: .18s; width: 100%;
}
.btn.primary { background: linear-gradient(180deg, var(--accent), var(--accent2)); color: #fff; box-shadow: 0 8px 22px rgba(37, 99, 235, .35); }
.btn.primary:active { transform: scale(.98); }
.btn.primary:disabled { opacity: .45; box-shadow: none; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.big { padding: 16px 20px; font-size: 1.05rem; }

/* ---------- form ---------- */
.form-part { display: none; }
.form-part.active { display: block; animation: fadeUp .3s ease; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .86rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field label em { font-style: normal; opacity: .65; font-weight: 400; }
.field input, .field select {
  width: 100%; padding: 13px 14px;
  background: var(--card2); color: var(--text);
  border: 1.5px solid var(--line); border-radius: 12px;
  outline: none; transition: border .15s;
  font-size: 1rem;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.field input.invalid { border-color: var(--danger); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.err { color: var(--danger); font-size: .86rem; min-height: 20px; margin: 4px 0 8px; font-weight: 600; }
.warn { color: #fbbf24; background: rgba(245, 158, 11, .1); border: 1px solid rgba(245, 158, 11, .35); border-radius: 10px; font-size: .86rem; padding: 10px 12px; margin-bottom: 12px; }

/* ---------- rotate / blocker overlays ---------- */
.rotate-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: none; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 32px; gap: 10px;
}
.rotate-overlay.show { display: flex; }
.rotate-overlay p { color: var(--muted); max-width: 320px; }
.rotate-icon { font-size: 54px; animation: tilt 1.6s ease-in-out infinite; }
@keyframes tilt { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(90deg); } }

/* ---------- capture stage (portrait 9:16) ---------- */
.screen.capture { padding: 0; }
.screen.capture.active { display: block; }
.cam-stage {
  position: fixed; inset: 0; z-index: 40; background: #000;
  display: flex; align-items: center; justify-content: center;
}
.cam-stage video#camPreview {
  height: 100dvh;
  aspect-ratio: 9 / 16;
  max-width: 100vw;
  object-fit: cover;
  background: #000;
}
.cam-stage video#camPreview.mirror { transform: scaleX(-1); }

/* guides */
.guide { position: absolute; pointer-events: none; }
.guide-card {
  top: 50%; left: 50%; transform: translate(-50%, -58%);
  width: min(88vw, 46dvh);
  aspect-ratio: 1.586;
  border: 3px solid rgba(59, 130, 246, .95);
  border-radius: 14px;
  box-shadow: 0 0 0 4000px rgba(0, 0, 0, .5);
}
.guide-card.rec { border-color: var(--danger); }
.guide-hint {
  position: absolute; left: 50%; bottom: -44px; transform: translateX(-50%);
  white-space: nowrap; font-size: .85rem; font-weight: 700; color: #fff; opacity: .9;
}
.guide-face {
  top: 47%; left: 50%; transform: translate(-50%, -50%);
  width: min(66vw, 40dvh);
  aspect-ratio: 3 / 4;
  border: 3px dashed rgba(59, 130, 246, .95);
  border-radius: 50%;
  box-shadow: 0 0 0 4000px rgba(0, 0, 0, .45);
}
.guide-face.rec { border-color: var(--danger); border-style: solid; }

/* top area */
.cam-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 10px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .65), transparent);
}
.cam-steplabel { font-weight: 800; font-size: .92rem; letter-spacing: .02em; }
.cam-quality { font-size: .72rem; font-weight: 700; color: #a7f3d0; background: rgba(16, 185, 129, .18); border: 1px solid rgba(16, 185, 129, .4); padding: 3px 9px; border-radius: 999px; }

/* live instruction */
.cam-instruction {
  position: absolute; top: 13%; left: 50%; transform: translateX(-50%);
  width: max-content; max-width: 88vw; text-align: center;
  font-size: 1.05rem; font-weight: 800; color: #fff;
  background: rgba(17, 24, 39, .78); border: 1px solid rgba(255, 255, 255, .14);
  padding: 10px 18px; border-radius: 999px;
  transition: .2s; z-index: 5;
}
.cam-instruction.pulse { animation: pulseIn .45s ease; }
@keyframes pulseIn { 0% { transform: translateX(-50%) scale(.85); opacity: .3; } 100% { transform: translateX(-50%) scale(1); opacity: 1; } }

/* countdown */
.cam-countdown {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 110px; font-weight: 900; color: #fff;
  text-shadow: 0 6px 40px rgba(0, 0, 0, .8); z-index: 6;
}

/* progress */
.cam-progress { position: absolute; left: 0; right: 0; bottom: 128px; padding: 0 22px; z-index: 5; }
.rec-pill { display: inline-flex; align-items: center; gap: 8px; background: rgba(0, 0, 0, .6); border-radius: 999px; padding: 6px 13px; font-weight: 800; font-size: .9rem; margin-bottom: 9px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.bar { height: 7px; background: rgba(255, 255, 255, .18); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 0%; background: var(--danger); border-radius: 999px; transition: width .1s linear; }
.bar-fill.blue { background: var(--accent); }

/* controls */
.cam-controls {
  position: absolute; left: 0; right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  display: flex; align-items: center; justify-content: center; gap: 34px;
  z-index: 6;
}
.record-btn {
  width: 78px; height: 78px; border-radius: 50%;
  border: 4px solid #fff; background: transparent;
  display: flex; align-items: center; justify-content: center;
}
.record-btn span { width: 58px; height: 58px; border-radius: 50%; background: var(--danger); transition: .2s; }
.record-btn:active span { transform: scale(.88); }
.record-btn:disabled { opacity: .4; }
.round-btn { width: 50px; height: 50px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .35); background: rgba(0, 0, 0, .5); color: #fff; font-size: 1.15rem; }
.round-btn.on { background: var(--warn); border-color: var(--warn); }

/* ---------- review ---------- */
.review-wrap { display: flex; justify-content: center; margin-bottom: 14px; }
.review-wrap video {
  width: min(100%, 300px);
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border-radius: 14px;
  background: #000;
  border: 1px solid var(--line);
}
.quality-row { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.qbadge { font-size: .76rem; font-weight: 800; padding: 4px 11px; border-radius: 999px; background: var(--card2); border: 1px solid var(--line); color: var(--muted); }
.qbadge.ok { color: #a7f3d0; background: rgba(16, 185, 129, .14); border-color: rgba(16, 185, 129, .4); }
.qbadge.bad { color: #fecaca; background: rgba(239, 68, 68, .14); border-color: rgba(239, 68, 68, .4); }
.upload-box { margin-top: 6px; }
.upload-label { font-size: .9rem; font-weight: 700; color: var(--muted); margin-bottom: 8px; text-align: center; }

/* ---------- done ---------- */
.success-ring {
  width: 92px; height: 92px; margin: 6px auto 18px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 46px; font-weight: 900; color: #fff;
  background: radial-gradient(circle at 30% 25%, #34d399, var(--ok));
  box-shadow: 0 14px 40px rgba(16, 185, 129, .4);
  animation: pop .5s cubic-bezier(.2, 1.6, .4, 1);
}
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.ref-box { background: var(--card2); border: 1px dashed var(--accent); border-radius: 14px; padding: 16px; margin: 18px 0 6px; }
.ref-label { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.ref-value { font-size: 1.5rem; font-weight: 900; letter-spacing: .06em; color: var(--accent); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(120%);
  background: #1f2937; color: #fff; border: 1px solid var(--line);
  padding: 12px 20px; border-radius: 12px; font-weight: 600; font-size: .92rem;
  transition: .3s; z-index: 200; max-width: 90vw; text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }

@media (min-width: 700px) {
  .screen { padding-top: 44px; }
}
