:root {
  color-scheme: light;
  --ink: #101d29;
  --muted: #5d6871;
  --paper: #f7f5ef;
  --card: #fff;
  --line: #d7d3c9;
  --teal: #2f817f;
  --teal-dark: #236361;
  --yellow: #f2cf57;
  --green: #2e805e;
  --amber: #a97816;
  --red: #bd493e;
  --shadow: 0 18px 40px rgb(16 29 41 / 9%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, textarea { font: inherit; }
button, .file-button, .stepper a { -webkit-tap-highlight-color: transparent; }
.app-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  padding: max(14px, env(safe-area-inset-top)) clamp(18px, 4vw, 54px) 14px;
  background: var(--ink);
  color: white;
  box-shadow: 0 7px 22px rgb(0 0 0 / 18%);
}
.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 28px;
  font-weight: 900;
}
.brand strong { display: block; font-size: 21px; letter-spacing: .09em; }
.brand small { display: block; opacity: .62; }
.header-actions { display: flex; align-items: center; gap: 16px; }
.quiet-link { color: white; text-underline-offset: 4px; }
.status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #e8ecee;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
}
.status[data-tone="good"], .verdict[data-tone="good"] { background: #dcefe6; color: #215e47; }
.status[data-tone="bad"], .verdict[data-tone="bad"] { background: #f5dfdc; color: #8e312b; }
.status[data-tone="warn"], .verdict[data-tone="warn"] { background: #f8edc9; color: #77530d; }
main { width: min(1120px, 100%); margin: 0 auto; padding: 0 clamp(16px, 4vw, 44px) 80px; }
.hero { padding: 68px 0 34px; }
.eyebrow { margin: 0 0 8px; color: var(--teal); font-size: 13px; font-weight: 900; letter-spacing: .15em; }
.hero h1, h2 { margin: 0; line-height: .98; letter-spacing: -.045em; }
.hero h1 { max-width: 780px; font-size: clamp(50px, 9vw, 96px); }
.hero > p:not(.eyebrow) { max-width: 740px; margin: 24px 0; color: var(--muted); font-size: clamp(18px, 2.4vw, 24px); }
.privacy-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  padding: 12px 16px;
  border-radius: 12px;
  background: #e5f1ef;
  color: var(--teal-dark);
}
.stepper {
  position: sticky;
  z-index: 8;
  top: 82px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 0 0 24px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgb(247 245 239 / 94%);
  backdrop-filter: blur(12px);
}
.stepper a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}
.stepper a:hover { background: white; color: var(--ink); }
.stepper span {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-size: 12px;
}
.step-card {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 24px;
  margin: 22px 0;
  padding: clamp(24px, 5vw, 54px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
  scroll-margin-top: 160px;
}
.step-number {
  display: grid;
  place-items: center;
  align-self: start;
  width: 58px;
  height: 58px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  font-size: 24px;
  font-weight: 900;
}
.step-content h2 { max-width: 760px; font-size: clamp(34px, 5vw, 58px); }
.lead { max-width: 780px; color: var(--muted); font-size: 18px; }
.instruction-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 28px 0; }
.instruction {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #faf9f5;
}
.instruction h3 { margin: 18px 0 6px; }
.instruction p { margin: 0; color: var(--muted); font-size: 14px; }
.diagram { position: relative; display: grid; place-items: center; height: 150px; border-radius: 12px; overflow: hidden; background: #edf0ed; }
.board-diagram { grid-template-columns: 1fr auto; padding: 18px; }
.board-diagram .checkerboard {
  width: 100%;
  aspect-ratio: 10/7;
  border: 1px solid var(--ink);
  background-color: white;
  background-image:
    conic-gradient(#101d29 25%, white 0 50%, #101d29 0 75%, white 0);
  background-size: 20% 28.571%;
}
.board-diagram b { position: absolute; bottom: 1px; left: 44%; font-size: 12px; }
.board-diagram > span { position: absolute; right: 1px; transform: rotate(90deg); font-size: 12px; }
.camera-diagram .camera { position: absolute; top: 22px; left: 30px; font-size: 34px; }
.camera-diagram .ray { position: absolute; width: 65%; height: 80px; top: 50px; left: 43px; border: solid var(--teal); border-width: 2px 2px 0; clip-path: polygon(48% 0, 100% 100%, 0 100%); }
.camera-diagram .ground { position: absolute; right: 20px; bottom: 20px; left: 20px; border-bottom: 5px solid var(--ink); }
.clean-diagram { background: var(--yellow); align-content: center; }
.clean-diagram b { font-size: 56px; line-height: 1; }
.clean-diagram span { font-weight: 750; }
.mini-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--yellow); font-weight: 900; }
.safety-note, .warning {
  margin: 20px 0;
  padding: 16px 18px;
  border-radius: 14px;
  background: #f8edc9;
  color: #5f450f;
}
.safety-note summary { cursor: pointer; font-weight: 800; }
.locked-form, .controls-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 22px 0;
}
.locked-form button { grid-column: 1 / -1; }
label { color: var(--muted); font-size: 13px; font-weight: 750; }
input, textarea {
  width: 100%;
  margin-top: 7px;
  padding: 13px 14px;
  border: 1px solid #bfc4c6;
  border-radius: 11px;
  background: white;
  color: var(--ink);
}
select {
  width: 100%;
  margin-top: 7px;
  padding: 13px 14px;
  border: 1px solid #bfc4c6;
  border-radius: 11px;
  background: white;
  color: var(--ink);
}
input:focus, textarea:focus { outline: 3px solid rgb(47 129 127 / 20%); border-color: var(--teal); }
.unit-input { position: relative; display: block; }
.unit-input input { padding-right: 55px; }
.unit-input span { position: absolute; right: 14px; bottom: 13px; color: var(--muted); }
button {
  min-height: 50px;
  padding: 12px 18px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 850;
}
button:disabled { cursor: not-allowed; opacity: .42; }
.primary { width: 100%; margin: 8px 0; background: var(--teal); color: white; }
.primary:hover:not(:disabled) { background: var(--teal-dark); }
.secondary { background: var(--ink); color: white; }
.route-grid, .zone-map {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
.capture-contract {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 18px;
  margin: 24px 0 14px;
  padding: 22px;
  border-radius: 18px;
  background: var(--ink);
  color: white;
}
.capture-contract h3 { margin: 0; font-size: 24px; }
.capture-contract ul { margin: 14px 0 0; padding-left: 20px; color: #c8d2d8; }
.camera-control { display: grid; align-content: start; gap: 9px; }
.camera-control label { color: #d9e0e5; }
.camera-control strong { color: var(--yellow); font-size: 13px; }
.confirm-line { display: flex; align-items: flex-start; gap: 10px; color: var(--ink); font-size: 14px; }
.confirm-line input { width: 22px; height: 22px; margin: 0; flex: 0 0 auto; accent-color: var(--teal); }
.guide-card {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  gap: 20px;
  margin: 26px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #f3f1eb;
}
.guide-visual { position: relative; overflow: hidden; border-radius: 14px; background: #dfe4e4; }
.guide-visual img { display: block; width: 100%; aspect-ratio: 3/2; object-fit: cover; }
#paso-3 .guide-visual img { aspect-ratio: 1; }
.guide-visual span {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgb(16 29 41 / 90%);
  color: white;
  font-size: 13px;
  font-weight: 850;
}
.guide-copy { display: flex; flex-direction: column; padding: 12px 8px; }
.guide-copy h3 { margin: 0; font-size: clamp(24px, 3vw, 35px); line-height: 1.04; }
.guide-copy > p:not(.eyebrow) { color: var(--muted); }
.guide-copy dl { display: grid; gap: 7px; margin: 10px 0 18px; }
.guide-copy dl div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.guide-copy dt { color: var(--muted); }
.guide-copy dd { margin: 0; font-weight: 800; text-align: right; }
.guide-actions { display: grid; grid-template-columns: auto 1fr auto; gap: 7px; margin-top: auto; }
.guide-actions button { min-height: 44px; padding: 9px 12px; background: #dfe4e4; }
.guide-actions .capture { background: var(--red); color: white; }
.guide-copy small { display: block; margin-top: 10px; color: var(--muted); }
.route-grid { width: min(360px, 100%); margin: 24px 0; }
.route-grid span, .zone-map span {
  display: grid;
  place-items: center;
  aspect-ratio: 1.6;
  border: 2px dashed #bcc5c4;
  border-radius: 10px;
  color: var(--teal);
  font-size: 26px;
}
.zone-map span.covered { border-style: solid; background: #dcefe6; color: var(--green); }
.file-box {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 22px 0;
  padding: 16px;
  border: 2px dashed #bfc7c7;
  border-radius: 16px;
}
.file-button { flex: 0 0 auto; padding: 13px 17px; border-radius: 10px; background: var(--ink); color: white; cursor: pointer; }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-box strong, .file-box small { display: block; }
.file-box small { margin-top: 3px; color: var(--muted); }
.height-evidence {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(220px, .75fr);
  gap: 18px;
  align-items: center;
  margin: 22px 0;
  padding: 20px;
  border: 2px solid #d1a92c;
  border-radius: 16px;
  background: #fff7d8;
}
.height-evidence .eyebrow { margin: 0 0 5px; color: #74590a; }
.height-evidence h3 { margin: 0; font-size: 22px; }
.height-evidence p { margin: 8px 0 0; color: #51421b; }
.height-evidence label { color: var(--ink); }
.height-evidence small { display: block; margin-top: 7px; color: #74590a; font-weight: 650; }
.progress-panel, .results-panel { margin: 18px 0; padding: 18px; border-radius: 16px; background: #f1f3f1; }
.progress-panel > div { display: flex; justify-content: space-between; margin-bottom: 8px; }
progress { width: 100%; height: 14px; accent-color: var(--teal); }
.score-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 18px; }
.score-row > div { padding: 14px; border-radius: 12px; background: white; text-align: center; }
.score-row b, .score-row span { display: block; }
.score-row b { font-size: 27px; }
.score-row span { color: var(--muted); font-size: 12px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 8px; margin-top: 14px; }
.gallery figure { margin: 0; overflow: hidden; border-radius: 10px; background: var(--ink); color: white; }
.gallery img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.gallery figcaption { padding: 7px; font-size: 11px; }
.model-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.model-result { padding: 18px; border: 2px solid transparent; border-radius: 14px; background: white; }
.model-result span, .model-result b, .model-result small { display: block; }
.model-result b { margin: 5px 0; font-size: 30px; }
.model-result.selected { border-color: var(--green); background: #eef8f3; }
.verdict { margin-top: 12px; padding: 14px; border-radius: 12px; font-weight: 750; }
.mode-switch { display: flex; flex-wrap: wrap; gap: 7px; margin: 18px 0; }
.mode-switch button { background: #e8ebeb; color: var(--ink); }
.mode-switch button.active { background: var(--ink); color: white; }
.measurement-stage { width: 100%; overflow: auto; border-radius: 14px; background: #172431; }
.measurement-stage canvas { display: block; width: 100%; height: auto; touch-action: none; cursor: crosshair; }
.measurement-output { margin-top: 12px; padding: 18px; border-radius: 14px; background: var(--yellow); font-size: 18px; font-weight: 850; }
.final-step { background: var(--ink); color: white; }
.final-step .eyebrow { color: var(--yellow); }
.final-step input, .final-step textarea { border-color: #52606c; background: #172735; color: white; }
.final-verdict {
  display: grid;
  gap: 4px;
  margin: 18px 0;
  padding: 20px;
  border: 2px solid #52606c;
  border-radius: 15px;
  background: #172735;
}
.final-verdict small { letter-spacing: .16em; }
.final-verdict strong { font-size: 34px; line-height: 1; }
.final-verdict span { color: #b8c3ca; }
.final-verdict[data-status="pass"] { border-color: #67c49b; background: #173d34; }
.final-verdict[data-status="review"] { border-color: var(--yellow); background: #4d3c17; }
.final-verdict[data-status="fail"] { border-color: #ef8179; background: #512c2a; }
.checklist { display: grid; gap: 7px; margin: 22px 0; }
.checklist span { padding: 10px 12px; border-radius: 9px; background: #1e303e; }
.checklist span.done { background: #214c41; color: #d8f2e8; }
.text-field { display: block; margin: 14px 0; color: #ccd3d8; }
.fine-print { color: #aab5bd; font-size: 13px; }
.toast {
  position: fixed;
  z-index: 30;
  right: 18px;
  bottom: max(18px, env(safe-area-inset-bottom));
  width: min(440px, calc(100% - 36px));
  padding: 16px 18px;
  border-radius: 13px;
  background: var(--ink);
  color: white;
  box-shadow: 0 15px 45px rgb(0 0 0 / 25%);
}
footer { display: flex; justify-content: space-between; gap: 18px; padding: 22px clamp(18px, 4vw, 52px); background: #0a151f; color: #9eabb5; font-size: 13px; }

@media (max-width: 760px) {
  .app-header { min-height: 72px; }
  .brand-mark { width: 46px; height: 46px; }
  .brand strong { font-size: 18px; }
  .quiet-link { display: none; }
  .status { max-width: 145px; font-size: 11px; text-align: center; }
  .stepper { top: 72px; overflow-x: auto; grid-template-columns: repeat(6, minmax(86px, 1fr)); justify-content: start; }
  .stepper a { flex-direction: column; gap: 2px; }
  .step-card { grid-template-columns: 1fr; padding: 23px 18px; border-radius: 20px; }
  .step-number { width: 46px; height: 46px; font-size: 20px; }
  .instruction-grid, .locked-form, .controls-row { grid-template-columns: 1fr; }
  .capture-contract, .guide-card, .height-evidence { grid-template-columns: 1fr; }
  .guide-actions { grid-template-columns: 1fr 1fr; }
  .guide-actions .capture { grid-column: 1 / -1; grid-row: 1; }
  .instruction-grid.compact { grid-template-columns: 1fr; }
  .file-box { align-items: stretch; flex-direction: column; }
  .file-button { text-align: center; }
  .score-row { grid-template-columns: 1fr; }
  .model-grid { grid-template-columns: 1fr; }
  footer { flex-direction: column; padding-bottom: max(22px, env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
