:root {
  --ink: #14211d;
  --muted: #66736e;
  --paper: #f4f5f1;
  --card: #fff;
  --line: #dce1db;
  --accent: #174c3b;
  --accent2: #cce4d5;
  --warn: #8b3d26;
  --warnbg: #f8e0d7;
  --shadow: 0 18px 50px rgba(28, 47, 40, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(23, 76, 59, .23); outline-offset: 2px; }
.hidden { display: none !important; }
.shell { width: min(1180px, calc(100% - 36px)); margin: auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }

.hero { padding: 66px 0 36px; display: grid; grid-template-columns: 1fr auto; gap: 36px; align-items: end; }
.eyebrow { font-size: .72rem; letter-spacing: .16em; font-weight: 800; color: var(--accent); margin: 0 0 14px; }
.hero h1 { font: 600 clamp(2.4rem, 6vw, 5.2rem)/.94 Georgia, serif; max-width: 950px; letter-spacing: -.045em; margin: 0; }
.hero h1 em { font-weight: 400; color: var(--accent); }
.lede { max-width: 800px; color: var(--muted); font-size: 1.05rem; line-height: 1.7; margin: 24px 0 0; }
.status-card { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 11px 16px; white-space: nowrap; box-shadow: var(--shadow); font-size: .83rem; font-weight: 700; }
.dot { width: 9px; height: 9px; background: #d09a35; border-radius: 50%; display: inline-block; margin-right: 8px; }
.dot.ok { background: #32875f; }
.dot.bad { background: #b85239; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-top: 22px; }
.tab { border: 0; background: transparent; padding: 16px 20px; font-weight: 750; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; }
.tab.active { color: var(--accent); border-color: var(--accent); }
.panel { display: none; padding: 36px 0 70px; }
.panel.active { display: block; }
.panel-head { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; align-items: end; margin-bottom: 28px; }
.panel-head > div { display: flex; gap: 16px; align-items: center; }
.step { height: 38px; width: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: white; font-size: .75rem; font-weight: 800; flex: 0 0 auto; }
.panel h2, .guardrail h2 { font: 600 2rem/1.05 Georgia, serif; margin: 0; }
.panel-head p, .guardrail > p { color: var(--muted); line-height: 1.65; margin: 0; }

.workspace { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 22px; box-shadow: var(--shadow); display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 16px; align-items: stretch; }
.level2-grid { grid-template-columns: .75fr 1fr 1fr auto; }
.arrow { display: grid; place-items: center; color: #9ca7a2; }
.picker-block { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.dropzone { border: 1.5px dashed #bfc8c2; border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 5px; cursor: pointer; min-height: 112px; justify-content: center; transition: .2s; }
.dropzone:hover { border-color: var(--accent); background: #f7faf8; }
.dropzone span, .field { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; color: var(--accent); }
.dropzone strong { font-size: .98rem; }
.dropzone small { color: var(--muted); }
.dropzone input { margin-top: 8px; max-width: 100%; }
.picker-meta { min-height: 25px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 4px; }
.selected-name { color: var(--muted); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-name.has-file { color: var(--accent); font-weight: 750; }
.text-button { border: 0; background: transparent; color: var(--accent); padding: 4px 0; font-size: .78rem; font-weight: 800; cursor: pointer; }
.text-button:disabled { opacity: .4; cursor: default; }
.field { display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.field select { appearance: none; border: 1px solid var(--line); border-radius: 13px; background: white; padding: 15px; color: var(--ink); font-weight: 700; min-height: 50px; }
.primary, .secondary { border-radius: 15px; font-weight: 800; cursor: pointer; min-height: 56px; transition: transform .15s ease, opacity .15s ease, background .15s ease; }
.primary { border: 0; background: var(--accent); color: white; padding: 0 22px; }
.secondary { border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 0 18px; }
.primary:hover:not(:disabled), .secondary:hover:not(:disabled) { transform: translateY(-1px); }
.primary:disabled, .secondary:disabled { opacity: .45; cursor: default; transform: none; }
.compact { min-height: 48px; padding: 0 16px; }

.result { margin-top: 24px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 22px; box-shadow: var(--shadow); }
.decision { display: flex; gap: 14px; align-items: center; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.decision-pill { font-weight: 900; letter-spacing: .07em; border-radius: 999px; padding: 9px 12px; background: var(--accent2); color: var(--accent); }
.decision.retake .decision-pill { background: var(--warnbg); color: var(--warn); }
.decision h3 { margin: 0 0 3px; font-size: 1rem; }
.decision p { margin: 0; color: var(--muted); font-size: .9rem; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-top: 18px; }
.shot { margin: 0; }
.shot img { display: block; width: 100%; aspect-ratio: 3/4; object-fit: contain; background: #eceeea; border-radius: 14px; border: 1px solid var(--line); }
.shot figcaption { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; margin-top: 8px; color: var(--muted); }
details { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 15px; }
summary { cursor: pointer; font-weight: 750; }
.evidence { white-space: pre-wrap; word-break: break-word; font-size: .75rem; color: #42514a; background: #f5f7f4; border-radius: 12px; padding: 14px; max-height: 360px; overflow: auto; }
.error { padding: 16px; border-radius: 14px; background: var(--warnbg); color: var(--warn); font-weight: 700; }

.capture-toolbar { padding: 18px; display: grid; grid-template-columns: minmax(180px, .8fr) minmax(190px, 1fr) auto; align-items: end; gap: 14px; margin-bottom: 18px; }
.button-cluster { display: flex; gap: 8px; align-items: end; }
.capture-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .65fr); gap: 18px; align-items: start; }
.camera-card { overflow: hidden; }
.camera-stage { position: relative; aspect-ratio: 3/4; max-height: min(68vh, 820px); background: #101614; overflow: hidden; isolation: isolate; }
.camera-stage video, .ghost-overlay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera-stage video { z-index: 1; }
.ghost-overlay { z-index: 2; opacity: .35; pointer-events: none; mix-blend-mode: normal; transform: scale(1); transform-origin: 50% 50%; transition: opacity .12s ease, transform .12s ease; }
.framing-guide { position: absolute; inset: 0; z-index: 3; pointer-events: none; color: rgba(255, 255, 255, .86); }
.guide-axis { position: absolute; background: rgba(255, 255, 255, .22); }
.guide-axis-x { left: 10%; right: 10%; top: 46%; height: 1px; }
.guide-axis-y { top: 8%; bottom: 8%; left: 50%; width: 1px; }
.face-guide { position: absolute; width: 47%; aspect-ratio: .78; left: 50%; top: 43%; transform: translate(-50%, -50%); border: 2px solid rgba(255, 255, 255, .72); border-radius: 46% 46% 50% 50%; box-shadow: 0 0 0 999px rgba(9, 19, 15, .08); }
.face-guide::before, .face-guide::after { content: ''; position: absolute; width: 8px; height: 8px; border-color: rgba(255, 255, 255, .9); }
.face-guide::before { left: -2px; top: 48%; border-left: 2px solid; }
.face-guide::after { right: -2px; top: 48%; border-right: 2px solid; }
.face-guide .eye-line { position: absolute; left: 50%; top: 38%; width: 30%; height: 1px; transform: translateX(-50%); background: rgba(255, 255, 255, .55); }
.camera-stage[data-view="left_oblique"] .face-guide { transform: translate(-47%, -50%) rotate(-2deg); }
.camera-stage[data-view="right_oblique"] .face-guide { transform: translate(-53%, -50%) rotate(2deg); }
.camera-stage[data-view="left_profile"] .face-guide { width: 42%; transform: translate(-43%, -50%); border-radius: 44% 55% 50% 46%; }
.camera-stage[data-view="right_profile"] .face-guide { width: 42%; transform: translate(-57%, -50%); border-radius: 55% 44% 46% 50%; }
.view-guide-label { position: absolute; left: 18px; top: 18px; padding: 8px 11px; background: rgba(12, 24, 19, .56); border: 1px solid rgba(255, 255, 255, .2); border-radius: 999px; backdrop-filter: blur(8px); font-size: .76rem; font-weight: 850; letter-spacing: .05em; }
.camera-empty { position: absolute; inset: 0; z-index: 4; display: grid; place-content: center; text-align: center; gap: 7px; padding: 30px; color: #eef4f0; background: radial-gradient(circle at 50% 35%, #25362f, #111714 70%); }
.camera-empty strong { font: 600 1.55rem Georgia, serif; }
.camera-empty span { color: #abb9b2; max-width: 320px; line-height: 1.5; }
.live-badge { position: absolute; z-index: 5; top: 16px; right: 16px; padding: 8px 10px; border-radius: 999px; font-size: .67rem; font-weight: 900; letter-spacing: .08em; background: rgba(20, 33, 29, .78); color: white; backdrop-filter: blur(8px); }
.live-badge.pass { background: rgba(24, 103, 71, .9); }
.live-badge.retake, .live-badge.error { background: rgba(139, 61, 38, .92); }
.live-badge.checking { background: rgba(167, 112, 20, .9); }
.live-guidance { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 18px 20px; border-top: 1px solid var(--line); }
.live-guidance > div { min-width: 0; }
.live-guidance strong { display: block; margin-top: 3px; }
.live-guidance p { margin: 5px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.45; }
.mini-label { display: block; color: var(--accent); font-size: .66rem; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; }
.toggle { display: inline-flex; gap: 8px; align-items: center; font-size: .78rem; font-weight: 800; white-space: nowrap; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle span { width: 38px; height: 22px; border-radius: 999px; background: #c8ceca; position: relative; transition: .2s; }
.toggle span::after { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: white; box-shadow: 0 1px 4px rgba(0, 0, 0, .18); transition: .2s; }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { transform: translateX(16px); }
.toggle input:disabled + span { opacity: .4; }
.capture-actions { border-top: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 16px 20px 20px; }
.capture-actions > div { display: flex; flex-direction: column; gap: 3px; }
.capture-actions small { color: var(--muted); }
.shutter { width: 62px; height: 62px; border-radius: 50%; border: 3px solid var(--accent); background: transparent; padding: 5px; cursor: pointer; flex: 0 0 auto; }
.shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--accent); transition: transform .15s ease, opacity .15s ease; }
.shutter:hover:not(:disabled) span { transform: scale(.93); }
.shutter:disabled { opacity: .35; cursor: default; }
.shutter.working span { animation: pulse 1s infinite alternate; }
@keyframes pulse { to { transform: scale(.76); opacity: .58; } }


/* Live capture guidance is intentionally high-contrast on a phone screen. */
.camera-stage { transition: box-shadow .16s ease; }
.camera-stage.status-pass { box-shadow: inset 0 0 0 6px rgba(55, 198, 126, .95); }
.camera-stage.status-retake { box-shadow: inset 0 0 0 6px rgba(235, 86, 63, .95); }
.camera-stage.status-checking { box-shadow: inset 0 0 0 5px rgba(231, 177, 61, .9); }
.camera-stage.status-error { box-shadow: inset 0 0 0 6px rgba(235, 86, 63, .95); }
.guide-point { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.92); box-shadow: 0 0 0 3px rgba(10,20,16,.18); transform: translate(-50%, -50%); }
.guide-point-left-eye { left: 39%; top: 38%; }
.guide-point-right-eye { left: 61%; top: 38%; }
.guide-point-nose { left: 50%; top: 52%; }
.guide-point-chin { left: 50%; top: 77%; }
.target-center-marker { position: absolute; width: 12px; height: 12px; left: 50%; top: 45%; transform: translate(-50%, -50%); border: 2px solid rgba(255,255,255,.9); border-radius: 50%; box-shadow: 0 0 0 3px rgba(10,20,16,.22); }
.target-center-marker::before, .target-center-marker::after { content: ''; position: absolute; background: rgba(255,255,255,.75); }
.target-center-marker::before { width: 18px; height: 1px; left: -5px; top: 4px; }
.target-center-marker::after { width: 1px; height: 18px; left: 4px; top: -5px; }
.detected-face-marker { position: absolute; z-index: 4; left: 50%; top: 45%; width: 46%; aspect-ratio: .78; transform: translate(-50%, -50%); border: 2px dashed rgba(255,255,255,.8); border-radius: 48%; pointer-events: none; transition: left .16s linear, top .16s linear, width .16s linear, border-color .16s ease; }
.detected-face-marker span { position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; transform: translate(-50%, -50%); border-radius: 50%; background: white; box-shadow: 0 0 0 3px rgba(0,0,0,.18); }
.camera-stage.status-pass .detected-face-marker { border-color: rgba(91, 239, 157, .96); }
.camera-stage.status-retake .detected-face-marker, .camera-stage.status-error .detected-face-marker { border-color: rgba(255, 112, 91, .98); }
.screen-guidance { position: absolute; z-index: 6; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(90%, 560px); padding: 11px 14px; border-radius: 15px; text-align: center; color: white; background: rgba(20,33,29,.78); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.16); pointer-events: none; }
.screen-guidance strong { display: block; font-size: clamp(.9rem, 3.2vw, 1.18rem); letter-spacing: .07em; }
.screen-guidance.pass { background: rgba(24, 117, 75, .9); }
.screen-guidance.retake, .screen-guidance.error { background: rgba(160, 53, 35, .92); }
.screen-guidance.checking { background: rgba(153, 104, 19, .92); }
.screen-guidance-chips { display: flex; justify-content: center; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.screen-guidance-chips span { border: 1px solid rgba(255,255,255,.24); border-radius: 999px; padding: 3px 7px; font-size: .61rem; font-weight: 850; letter-spacing: .04em; background: rgba(0,0,0,.12); }
.live-refresh { display: block; margin-top: 7px; color: var(--muted); font-size: .68rem; font-variant-numeric: tabular-nums; }

.capture-sidebar { display: grid; gap: 14px; }
.side-section { padding: 18px; }
.side-heading { display: flex; align-items: start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.side-heading h3 { margin: 3px 0 0; font: 600 1.25rem Georgia, serif; }
.reference-picker { display: block; border: 1.5px dashed #bfc8c2; border-radius: 15px; padding: 16px; cursor: pointer; }
.reference-picker:hover { border-color: var(--accent); background: #f7faf8; }
.reference-picker input { width: 100%; margin-bottom: 10px; }
.reference-picker span { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.reference-picker strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reference-picker small { color: var(--muted); line-height: 1.4; }
.ghost-controls { display: grid; gap: 14px; padding-top: 15px; }
.slider-control { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; color: var(--muted); font-size: .75rem; font-weight: 750; }
.slider-control input { width: 100%; accent-color: var(--accent); }
.slider-control output { color: var(--ink); min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.ghost-reset { justify-self: start; }
.capture-preview { aspect-ratio: 3/4; border-radius: 14px; border: 1px solid var(--line); overflow: hidden; background: #eceeea; display: grid; place-items: center; }
.capture-preview img { width: 100%; height: 100%; object-fit: contain; }
.capture-preview span { color: var(--muted); font-size: .82rem; padding: 20px; text-align: center; }
.capture-preview.empty { background: #f4f5f1; border-style: dashed; }
.reset-button { width: 100%; }
.local-note { margin-top: 18px; color: var(--muted); font-size: .82rem; line-height: 1.55; padding: 14px 4px; }
.local-note strong { color: var(--ink); }

.guardrail { margin: 0 auto 70px; border-top: 1px solid var(--line); padding: 36px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 36px; }

@media (max-width: 1000px) {
  .capture-layout { grid-template-columns: 1fr; }
  .capture-sidebar { grid-template-columns: 1fr 1fr; }
  .reset-button { grid-column: 1 / -1; }
  .camera-stage { max-height: none; }
}

@media (max-width: 850px) {
  .hero, .panel-head, .guardrail { grid-template-columns: 1fr; }
  .status-card { justify-self: start; }
  .workspace, .level2-grid, .capture-toolbar { grid-template-columns: 1fr; }
  .button-cluster { flex-wrap: wrap; }
  .button-cluster > button { flex: 1; }
  .arrow { display: none; }
  .primary { padding: 16px; }
  .compact { padding: 0 14px; }
  .hero { padding-top: 38px; }
  .tabs { overflow: auto; }
  .tab { white-space: nowrap; padding-inline: 12px; }
  .shell { width: min(100% - 24px, 1180px); }
}

@media (max-width: 620px) {
  .capture-sidebar { grid-template-columns: 1fr; }
  .reset-button { grid-column: auto; }
  .live-guidance { align-items: flex-start; flex-direction: column; }
  .camera-stage { border-radius: 0; }
  .capture-toolbar { padding: 14px; }
  .capture-actions { padding-inline: 16px; }
  .capture-actions small { line-height: 1.35; }
}

/* v1.3 focused capture / mobile surface */
.capture-focus-head { display: none; }
.ghost-inline { border-top: 1px solid var(--line); background: #fbfcfa; }
.ghost-pick-row { padding: 10px 14px; }
.ghost-pick { display: flex; align-items: center; justify-content: center; min-height: 42px; border: 1px dashed #bac5bf; border-radius: 12px; cursor: pointer; background: white; }
.ghost-pick:hover { border-color: var(--accent); background: #f7faf8; }
.ghost-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ghost-pick span { display: flex; align-items: baseline; gap: 9px; padding: 8px 12px; min-width: 0; }
.ghost-pick strong { color: var(--accent); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ghost-pick small { color: var(--muted); font-size: .7rem; white-space: nowrap; }
.ghost-inline-controls { padding: 10px 14px 12px; }
.ghost-inline-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.ghost-inline-head > div { min-width: 0; }
.ghost-inline-head strong { display: block; margin-top: 2px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
.ghost-control-grid { display: grid; grid-template-columns: auto minmax(150px, 1fr) minmax(150px, 1fr) auto; gap: 12px; align-items: center; }
.compact-slider { gap: 7px; }
.compact-slider output { min-width: 36px; }
.capture-privacy { margin: 12px 0 0; padding: 9px 0; color: var(--muted); font-size: .75rem; }
.capture-privacy summary { display: inline-block; color: var(--muted); font-size: .72rem; }
.capture-privacy p { max-width: 820px; line-height: 1.55; margin: 8px 0 0; }

/* The target ring itself is the primary quality signal. */
.face-guide { border-width: 3px; transition: border-color .14s ease, box-shadow .14s ease, filter .14s ease; }
.camera-stage.status-idle .face-guide { border-color: rgba(255,255,255,.72); }
.camera-stage.status-checking .face-guide { border-color: #f2c253; box-shadow: 0 0 0 2px rgba(242,194,83,.18), 0 0 28px rgba(242,194,83,.22), 0 0 0 999px rgba(9,19,15,.08); }
.camera-stage.status-pass .face-guide { border-color: #50e391; box-shadow: 0 0 0 2px rgba(80,227,145,.2), 0 0 32px rgba(80,227,145,.3), 0 0 0 999px rgba(9,19,15,.06); }
.camera-stage.status-retake .face-guide,
.camera-stage.status-error .face-guide { border-color: #ff745d; box-shadow: 0 0 0 2px rgba(255,116,93,.18), 0 0 28px rgba(255,116,93,.24), 0 0 0 999px rgba(9,19,15,.1); }
.camera-stage.status-pass .guide-point { background: #69eea2; }
.camera-stage.status-retake .guide-point,
.camera-stage.status-error .guide-point { background: #ff876f; }
.camera-stage.status-checking .guide-point { background: #f6cd72; }
.camera-stage.status-pass .target-center-marker { border-color: #69eea2; }
.camera-stage.status-retake .target-center-marker,
.camera-stage.status-error .target-center-marker { border-color: #ff876f; }
.camera-stage.status-checking .target-center-marker { border-color: #f6cd72; }

/* Focus mode: entering Capture removes the feasibility-site chrome. */
body.capture-focus { background: #eef1ed; }
body.capture-focus .hero,
body.capture-focus .tabs,
body.capture-focus .guardrail { display: none; }
body.capture-focus main.shell { width: min(980px, calc(100% - 20px)); }
body.capture-focus #capture { padding: max(8px, env(safe-area-inset-top)) 0 calc(28px + env(safe-area-inset-bottom)); }
body.capture-focus .capture-intro { display: none; }
body.capture-focus .capture-focus-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 50px; margin-bottom: 8px; }
.focus-back, .focus-reset { min-height: 40px; border: 0; background: transparent; color: var(--accent); font-weight: 800; padding: 0 8px; cursor: pointer; }
.focus-back { justify-self: start; }
.focus-reset { justify-self: end; }
.focus-title { min-width: 0; text-align: center; display: flex; flex-direction: column; line-height: 1.15; }
.focus-title span { font-size: .62rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 900; }
.focus-title strong { margin-top: 2px; font-size: .9rem; }
body.capture-focus .capture-toolbar { margin-bottom: 8px; border-radius: 16px; padding: 10px; box-shadow: none; grid-template-columns: minmax(150px, .75fr) minmax(160px, 1fr) auto; gap: 8px; }
body.capture-focus .capture-toolbar .field { gap: 4px; font-size: .68rem; color: var(--muted); font-weight: 800; }
body.capture-focus .capture-toolbar .field select { min-height: 42px; padding: 9px 11px; border-radius: 10px; font-size: .82rem; }
body.capture-focus .capture-toolbar .compact { min-height: 42px; border-radius: 10px; padding: 0 12px; font-size: .78rem; }
body.capture-focus .capture-layout { grid-template-columns: minmax(0, 1fr) 220px; gap: 10px; }
body.capture-focus .camera-card { border-radius: 18px; box-shadow: 0 8px 28px rgba(28,47,40,.08); }
body.capture-focus .camera-stage { max-height: min(72vh, 760px); }
body.capture-focus .live-guidance { padding: 10px 14px; gap: 10px; }
body.capture-focus .live-guidance p { margin-top: 3px; font-size: .74rem; }
body.capture-focus .live-refresh { margin-top: 3px; font-size: .62rem; }
body.capture-focus .capture-actions { padding: 10px 14px 12px; }
body.capture-focus .capture-actions small { font-size: .7rem; }
body.capture-focus .shutter { width: 54px; height: 54px; }
body.capture-focus .capture-sidebar { gap: 8px; }
body.capture-focus .side-section { padding: 12px; border-radius: 16px; box-shadow: none; }
body.capture-focus .side-heading { margin-bottom: 9px; }
body.capture-focus .side-heading h3 { font-size: 1rem; }
body.capture-focus .reset-button { min-height: 44px; border-radius: 12px; font-size: .76rem; }
body.capture-focus #captureResult { margin-top: 10px; }

@media (max-width: 760px) {
  body.capture-focus main.shell { width: 100%; }
  body.capture-focus #capture { padding-top: max(4px, env(safe-area-inset-top)); }
  body.capture-focus .capture-focus-head { padding: 0 8px; margin-bottom: 4px; }
  .focus-back span { display: none; }
  body.capture-focus .capture-toolbar { margin: 0 8px 6px; grid-template-columns: minmax(0, 1fr) auto; border-radius: 13px; }
  body.capture-focus .capture-toolbar .camera-field { display: none; }
  body.capture-focus .capture-toolbar .button-cluster { flex-wrap: nowrap; }
  body.capture-focus #startCamera { min-width: 94px; }
  body.capture-focus #stopCamera { display: none; }
  body.capture-focus .capture-layout { grid-template-columns: 1fr; gap: 7px; }
  body.capture-focus .camera-card { border: 0; border-radius: 0; box-shadow: none; }
  body.capture-focus .camera-stage { width: 100%; max-height: none; border-radius: 0; }
  .screen-guidance { bottom: 10px; width: min(92%, 500px); padding: 8px 10px; border-radius: 12px; }
  .screen-guidance strong { font-size: .92rem; }
  .live-badge { top: 10px; right: 10px; padding: 6px 8px; font-size: .6rem; }
  .view-guide-label { top: 10px; left: 10px; padding: 6px 8px; font-size: .65rem; }
  .ghost-inline { border-bottom: 1px solid var(--line); }
  .ghost-pick-row { padding: 8px 10px; }
  .ghost-pick { min-height: 38px; }
  .ghost-pick span { padding: 6px 8px; }
  .ghost-pick small { display: none; }
  .ghost-inline-controls { padding: 8px 10px 10px; }
  .ghost-inline-head { margin-bottom: 7px; }
  .ghost-control-grid { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; }
  .ghost-control-grid .compact-slider:nth-of-type(3) { grid-column: 1 / 3; }
  .ghost-control-grid .ghost-reset { grid-column: 3; grid-row: 2; justify-self: end; }
  .compact-slider { font-size: .68rem; }
  body.capture-focus .live-guidance { padding: 8px 10px; flex-direction: row; align-items: center; }
  body.capture-focus .live-guidance p { display: none; }
  body.capture-focus .live-refresh { font-size: .58rem; }
  body.capture-focus .capture-actions { justify-content: center; padding: 9px 10px calc(10px + env(safe-area-inset-bottom)); background: white; }
  body.capture-focus .capture-actions > div { display: none; }
  body.capture-focus .shutter { width: 62px; height: 62px; }
  body.capture-focus .capture-sidebar { margin: 0 8px; }
  body.capture-focus .latest-capture-card { display: none; }
  body.capture-focus .reset-button { display: none; }
  body.capture-focus .capture-privacy { margin: 6px 12px; }
  body.capture-focus #captureResult { margin: 7px 8px 0; border-radius: 14px; padding: 12px; }
}

/* v1.4 focused capture: mobile-friendly refinement. */
.capture-hud {
  position: absolute;
  z-index: 8;
  top: 12px;
  left: 12px;
  width: 148px;
  padding: 8px 9px 9px;
  color: rgba(248,255,251,.96);
  background: rgba(9, 22, 17, .53);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px;
  backdrop-filter: blur(9px);
  box-shadow: 0 5px 20px rgba(0,0,0,.13);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  pointer-events: auto;
}
.hud-score { display: flex; align-items: flex-start; justify-content: space-between; gap: 7px; padding-bottom: 6px; margin-bottom: 5px; border-bottom: 1px solid rgba(255,255,255,.12); }
.hud-score > div { display: grid; grid-template-columns: auto auto; align-items: baseline; column-gap: 5px; min-width: 0; }
.hud-score span { grid-column: 1 / -1; color: rgba(242,255,248,.63); font-size: .43rem; font-weight: 900; letter-spacing: .12em; }
.hud-score strong { font-size: 1.45rem; line-height: 1; letter-spacing: -.07em; }
.hud-score small { color: rgba(217,255,232,.84); font-size: .43rem; font-weight: 900; letter-spacing: .06em; }
.hud-auto { position: relative; cursor: pointer; flex: 0 0 auto; }
.hud-auto input { position: absolute; opacity: 0; pointer-events: none; }
.hud-auto span { display: block; padding: 4px 5px 3px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; background: rgba(255,255,255,.06); color: rgba(255,255,255,.52); font-size: .39rem; letter-spacing: .08em; }
.hud-auto input:checked + span { color: #caffdc; border-color: rgba(107,243,158,.36); background: rgba(56,189,111,.17); }
.hud-grid { display: grid; gap: 3px; }
.hud-grid > div { display: grid; grid-template-columns: 31px 40px 1fr; align-items: center; gap: 4px; min-height: 11px; }
.hud-grid span { color: rgba(239,255,246,.56); font-size: .37rem; font-weight: 850; letter-spacing: .07em; }
.hud-grid strong { text-align: right; color: rgba(255,255,255,.93); font-size: .48rem; font-weight: 800; }
.hud-grid i { display: block; overflow: hidden; height: 2px; border-radius: 999px; background: rgba(255,255,255,.13); }
.hud-grid i b { display: block; width: 0; height: 100%; border-radius: inherit; background: rgba(255,255,255,.75); transition: width .15s linear, background .15s ease; }
.camera-stage.status-pass .hud-grid i b { background: #6ee7a4; }
.camera-stage.status-retake .hud-grid i b,
.camera-stage.status-error .hud-grid i b { background: #ff8b78; }
.camera-stage.status-checking .hud-grid i b { background: #f2c864; }

/* Keep the camera as the task, but preserve the cleaner card aesthetic. */
body.capture-focus { background: var(--paper); }
body.capture-focus main.shell { width: min(760px, calc(100% - 24px)); }
body.capture-focus #capture { padding: 8px 0 30px; }
body.capture-focus .capture-focus-head {
  min-height: 54px;
  margin: 0 0 8px;
  padding: 0 4px;
}
body.capture-focus .focus-back,
body.capture-focus .focus-reset { min-height: 40px; border-radius: 11px; padding-inline: 10px; }
.focus-view {
  justify-self: center;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  width: min(240px, 100%);
  color: var(--muted);
}
.focus-view span { font-size: .52rem; font-weight: 900; letter-spacing: .11em; }
.focus-view select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font-weight: 800;
  text-align: center;
  box-shadow: 0 3px 12px rgba(28,47,40,.04);
}
body.capture-focus .capture-toolbar {
  margin: 0 0 10px;
  padding: 8px;
  border-radius: 16px;
  box-shadow: 0 5px 20px rgba(28,47,40,.045);
  grid-template-columns: minmax(160px, 1fr) auto;
  gap: 8px;
}
body.capture-focus .capture-toolbar .camera-field { font-size: .64rem; }
body.capture-focus .capture-toolbar .field select { min-height: 42px; padding: 8px 11px; border-radius: 10px; }
body.capture-focus .capture-toolbar .button-cluster { display: flex; gap: 7px; }
body.capture-focus .capture-toolbar .compact { min-height: 42px; border-radius: 10px; padding-inline: 13px; font-size: .76rem; }
body.capture-focus .capture-layout { display: block; }
body.capture-focus .capture-sidebar { display: none; }
body.capture-focus .camera-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 12px 36px rgba(28,47,40,.08);
}
body.capture-focus .camera-stage {
  max-height: min(76vh, 820px);
  border-radius: 20px 20px 0 0;
  box-shadow: none;
}
body.capture-focus .capture-privacy,
body.capture-focus .live-guidance { display: none; }
body.capture-focus #captureResult { margin-top: 12px; }

/* PASS/RETAKE is carried by the face ring, not a thick frame around the entire screen. */
.camera-stage.status-pass,
.camera-stage.status-retake,
.camera-stage.status-checking,
.camera-stage.status-error { box-shadow: none; }
.face-guide { border-width: 2.5px; transition: border-color .14s ease, box-shadow .14s ease; }
.camera-stage.status-idle .face-guide { border-color: rgba(255,255,255,.72); }
.camera-stage.status-checking .face-guide { border-color: #f0c557; box-shadow: 0 0 0 1px rgba(240,197,87,.20), 0 0 18px rgba(240,197,87,.20), 0 0 0 999px rgba(9,19,15,.055); }
.camera-stage.status-pass .face-guide { border-color: #58e49a; box-shadow: 0 0 0 1px rgba(88,228,154,.22), 0 0 22px rgba(88,228,154,.27), 0 0 0 999px rgba(9,19,15,.045); }
.camera-stage.status-retake .face-guide,
.camera-stage.status-error .face-guide { border-color: #ff7966; box-shadow: 0 0 0 1px rgba(255,121,102,.20), 0 0 19px rgba(255,121,102,.22), 0 0 0 999px rgba(9,19,15,.065); }
.camera-stage.status-pass .guide-point { background: #69eea2; }
.camera-stage.status-retake .guide-point,
.camera-stage.status-error .guide-point { background: #ff8b78; }
.camera-stage.status-checking .guide-point { background: #f2cb6c; }
.camera-stage.status-pass .target-center-marker { border-color: #69eea2; }
.camera-stage.status-retake .target-center-marker,
.camera-stage.status-error .target-center-marker { border-color: #ff8b78; }
.camera-stage.status-checking .target-center-marker { border-color: #f2cb6c; }

.view-guide-label {
  left: 50%;
  right: auto;
  top: 12px;
  transform: translateX(-50%);
  padding: 6px 9px;
  background: rgba(10,22,17,.46);
  font-size: .59rem;
  border-color: rgba(255,255,255,.14);
}
.live-badge { top: 12px; right: 12px; padding: 6px 8px; font-size: .56rem; }
.screen-guidance {
  bottom: 98px;
  width: auto;
  max-width: min(78%, 430px);
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(12,25,19,.62);
  border-color: rgba(255,255,255,.14);
}
.screen-guidance strong { font-size: clamp(.7rem, 2.6vw, .88rem); line-height: 1.15; }
.screen-guidance.pass { background: rgba(23, 113, 72, .80); }
.screen-guidance.retake,
.screen-guidance.error { background: rgba(144, 55, 39, .83); }
.screen-guidance.checking { background: rgba(142, 101, 28, .82); }
.screen-guidance-chips { display: none; }

/* The shutter is always in reach and becomes unmistakably green only when capture is acceptable. */
.camera-action-dock {
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  pointer-events: auto;
}
.camera-action-dock.active { display: flex; }
.camera-action-dock strong {
  min-width: 94px;
  padding: 4px 8px;
  border-radius: 999px;
  color: rgba(255,255,255,.72);
  background: rgba(7,18,13,.55);
  border: 1px solid rgba(255,255,255,.13);
  text-align: center;
  font-size: .49rem;
  font-weight: 900;
  letter-spacing: .07em;
  backdrop-filter: blur(7px);
}
.shutter.in-view {
  width: 70px;
  height: 70px;
  padding: 5px;
  border: 3px solid rgba(255,255,255,.63);
  background: rgba(6,17,12,.25);
  box-shadow: 0 3px 16px rgba(0,0,0,.24);
  opacity: 1;
  transition: transform .12s ease, box-shadow .14s ease, border-color .14s ease;
}
.shutter.in-view span { background: #737f79; opacity: .82; }
.shutter.in-view:disabled { opacity: 1; cursor: default; }
.camera-action-dock.ready .shutter.in-view {
  border-color: rgba(225,255,236,.95);
  box-shadow: 0 0 0 5px rgba(75,224,140,.20), 0 0 24px rgba(75,224,140,.38), 0 4px 15px rgba(0,0,0,.25);
  cursor: pointer;
}
.camera-action-dock.ready .shutter.in-view span { background: #4adf8d; opacity: 1; }
.camera-action-dock.ready strong { color: #e5ffed; background: rgba(18,108,61,.72); border-color: rgba(94,237,158,.35); }

/* Ghost controls stay immediately beneath the preview, in the same card. */
body.capture-focus .ghost-inline { border-top: 1px solid var(--line); background: #fbfcfa; }
body.capture-focus .ghost-pick-row { padding: 9px 12px; }
body.capture-focus .ghost-pick { min-height: 40px; border-radius: 11px; background: white; }
body.capture-focus .ghost-pick span { padding: 7px 10px; }
body.capture-focus .ghost-inline-controls { padding: 10px 12px 12px; }
body.capture-focus .ghost-inline-head { margin-bottom: 8px; }
body.capture-focus .ghost-control-grid { grid-template-columns: auto minmax(130px,1fr) minmax(130px,1fr) auto; gap: 10px; }

@media (max-width: 760px) {
  body.capture-focus main.shell { width: 100%; }
  body.capture-focus #capture { padding: max(4px, env(safe-area-inset-top)) 0 calc(18px + env(safe-area-inset-bottom)); }
  body.capture-focus .capture-focus-head { grid-template-columns: 46px minmax(0, 1fr) 58px; padding: 0 10px; margin-bottom: 5px; }
  .focus-back span { display: none; }
  .focus-view { width: min(230px, 100%); }
  .focus-view select { min-height: 38px; border-radius: 11px; font-size: .76rem; }
  body.capture-focus .capture-toolbar { margin: 0 10px 8px; padding: 6px; border-radius: 14px; }
  body.capture-focus .capture-toolbar .camera-field { display: none; }
  body.capture-focus .capture-toolbar .button-cluster { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 6px; }
  body.capture-focus .capture-toolbar .compact { min-height: 42px; }
  body.capture-focus #stopCamera { display: none; }
  body.capture-focus .camera-card { margin: 0 10px; border-radius: 20px; }
  body.capture-focus .camera-stage { width: 100%; max-height: none; border-radius: 18px 18px 0 0; }
  .capture-hud { top: 9px; left: 9px; width: 132px; padding: 7px 8px 8px; border-radius: 10px; }
  .hud-score { padding-bottom: 5px; margin-bottom: 4px; }
  .hud-score strong { font-size: 1.25rem; }
  .hud-grid > div { grid-template-columns: 28px 35px 1fr; gap: 3px; }
  .hud-grid span { font-size: .34rem; }
  .hud-grid strong { font-size: .43rem; }
  .view-guide-label { top: 9px; max-width: 31%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .live-badge { top: 9px; right: 9px; }
  .screen-guidance { bottom: 96px; max-width: 80%; padding: 6px 10px; }
  .camera-action-dock { bottom: 13px; }
  .shutter.in-view { width: 72px; height: 72px; }
  body.capture-focus .ghost-pick-row { padding: 8px 10px; }
  body.capture-focus .ghost-pick small { display: none; }
  body.capture-focus .ghost-inline-controls { padding: 9px 10px 10px; }
  body.capture-focus .ghost-control-grid { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; }
  body.capture-focus .ghost-control-grid .compact-slider:nth-of-type(3) { grid-column: 1 / 3; }
  body.capture-focus .ghost-control-grid .ghost-reset { grid-column: 3; grid-row: 2; justify-self: end; }
  body.capture-focus #captureResult { margin: 9px 10px 0; border-radius: 16px; padding: 13px; }
}

@media (max-width: 390px) {
  .capture-hud { width: 124px; }
  .hud-grid > div { grid-template-columns: 26px 32px 1fr; }
  .hud-grid span { font-size: .32rem; }
  .hud-grid strong { font-size: .41rem; }
  .shutter.in-view { width: 68px; height: 68px; }
}
