:root {
  --bg: #12110f;
  --surface: #1c1a17;
  --surface-2: #262320;
  --line: #3a3530;
  --text: #f3eee6;
  --muted: #a9a094;
  --accent: #d9b77e;
  --accent-ink: #1b150c;
  --ok: #8fc79a;
  --warn: #e8b86a;
  --bad: #e48a7a;
  --radius: 14px;
  --font: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }

.screen { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.panel { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: clamp(20px, 4vw, 40px); }
.panel.narrow { max-width: 560px; }
.panel.wide { max-width: 1180px; }

.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; color: var(--accent); margin: 0 0 10px; }
h1 { font-size: clamp(32px, 6vw, 48px); line-height: 1.05; margin: 0 0 14px; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: clamp(24px, 4vw, 32px); margin: 0 0 8px; font-weight: 600; }
h3 { font-size: 15px; margin: 0 0 12px; letter-spacing: .02em; color: var(--muted); font-weight: 600; text-transform: uppercase; }
h3.mt { margin-top: 22px; }
h4 { margin: 0 0 6px; }
.lede { font-size: 18px; line-height: 1.5; color: #ddd5c9; margin: 0 0 18px; }
.muted { color: var(--muted); font-size: 14px; line-height: 1.5; }
.note { color: var(--muted); font-size: 12.5px; margin-top: 14px; }
.facts { list-style: none; padding: 0; margin: 0 0 26px; display: grid; gap: 12px; }
.facts li { padding: 12px 14px; background: var(--surface-2); border-radius: 10px; line-height: 1.45; font-size: 15px; color: #d5ccc0; }
.facts strong { color: var(--text); }

.btn { border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 14px 24px; cursor: pointer; font-weight: 600; min-height: 48px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.small { padding: 8px 14px; min-height: 36px; font-size: 14px; }
.btn:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; }

form .row { display: grid; gap: 8px; margin: 0 0 18px; border: 0; padding: 0; font-weight: 600; font-size: 15px; }
form .row small { font-weight: 400; color: var(--muted); }
legend { padding: 0; margin-bottom: 8px; }
.inputs { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--muted); }
input[type=number], select { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; min-height: 48px; width: 100%; max-width: 220px; }
select { max-width: none; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px; width: fit-content; }
.seg label { padding: 6px 14px; border-radius: 999px; cursor: pointer; font-weight: 500; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--surface-2); }
details summary { cursor: pointer; color: var(--muted); }
.error { color: var(--bad); }

/* Capture stage */
.screen.capture { padding: 0; }
.stage { position: relative; width: 100vw; height: 100dvh; background: #000; overflow: hidden; }
.stage video, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transform: scaleX(-1); }
.hud { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 16px; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.step { background: rgba(18,17,15,.72); padding: 8px 14px; border-radius: 999px; font-size: 14px; }
.spacer { flex: 1; }
.prompt { margin: 14px auto 0; max-width: 640px; text-align: center; font-size: clamp(18px, 2.6vw, 26px); font-weight: 600; background: rgba(18,17,15,.72); padding: 12px 20px; border-radius: 16px; line-height: 1.25; }
.progress { margin: 0 auto 14px; width: min(420px, 80%); height: 8px; background: rgba(255,255,255,.15); border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .1s linear; }
.checks { list-style: none; padding: 0; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 820px; }
.checks li { background: rgba(18,17,15,.72); padding: 6px 12px; border-radius: 999px; font-size: 13.5px; color: var(--warn); }
.checks li.ok { color: var(--ok); }
.hud-bottom { display: flex; justify-content: center; margin-top: 12px; min-height: 36px; }

/* Results */
.results-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.results-head .actions { margin: 0; }
.headline { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0; }
.headline .pill { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; min-width: 150px; }
.headline .pill b { display: block; font-size: 28px; }
.headline .pill span { color: var(--muted); font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.card { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.mtable { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.mtable td { padding: 8px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.mtable td.v { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mtable td.v small { color: var(--muted); display: block; }
.mtable .why { color: var(--muted); font-size: 12px; margin-top: 2px; }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.badge.measured { color: #9cc3e8; border-color: #3b5168; }
.badge.estimated { color: var(--warn); border-color: #6a5432; }
.badge.entered { color: var(--ok); border-color: #3e5e45; }
.badge.unavailable { color: var(--bad); }
.conf { font-size: 11px; margin-left: 4px; }
.conf.high { color: var(--ok); } .conf.medium { color: var(--warn); } .conf.low, .conf.none { color: var(--bad); }
.legend { font-size: 12px; color: var(--muted); line-height: 1.8; }
.rec { padding: 12px 0; border-bottom: 1px solid var(--line); }
.rec:last-child { border-bottom: 0; }
.rec .size { font-size: 26px; font-weight: 700; }
.rec .size small { display: inline-block; font-size: 14px; font-weight: 500; color: var(--warn); margin-left: 8px; }
.rec .name { font-weight: 600; }
.rec .why { color: var(--muted); font-size: 13px; line-height: 1.45; }
.desig { margin-bottom: 16px; }
.desig dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 6px 0; font-size: 14.5px; }
.desig dt { color: var(--muted); } .desig dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.desig p { color: var(--muted); font-size: 12px; margin: 0; }
.staff { margin-top: 16px; }
.staff-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 20px; margin-top: 14px; }
.calib { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; font-size: 14px; }
.calib input { max-width: 120px; min-height: 40px; padding: 8px 10px; }
#profile { width: 100%; height: auto; background: var(--bg); border-radius: 10px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--line); padding: 12px 18px; border-radius: 12px; }

@media (max-width: 640px) {
  .actions { justify-content: stretch; } .actions .btn { flex: 1; }
  .prompt { font-size: 20px; }
}
