/* ── reset & base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* School of Wood brand palette */
  --bg:      #ece4da;
  --surface: #f5f0e8;
  --border:  #d6cdc1;
  --text:    #36302a;
  --muted:   #7a6d62;
  --wood:    #b9a590;
  --btn-bg:  #36302a;
  --btn-txt: #b9a590;
  --green:   #4a7c59;
  --amber:   #c07828;
  --red:     #8b3a3a;
  --radius:  20px;
  --font:    'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* ── screens ────────────────────────────────────────────────────────────────── */
.screen {
  display: none;
  flex-direction: column;
  min-height: 100dvh;
  padding: 28px 24px 44px;
  background: var(--bg);
}
.screen.active { display: flex; }

/* ── cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

/* ── buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: block;
  width: 100%;
  padding: 18px;
  border: none;
  border-radius: 300px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.15s;
  text-align: center;
  text-decoration: none;
}
.btn:active { opacity: 0.75; }
.btn-primary  { background: var(--btn-bg); color: var(--btn-txt); }
.btn-secondary{ background: transparent;   color: var(--text);    border: 1.5px solid var(--border); }
.btn-ghost    { background: transparent;   color: var(--muted);   font-size: 13px; padding: 14px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── form inputs ────────────────────────────────────────────────────────────── */
.field { margin-bottom: 20px; }
.field label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.field input {
  width: 100%;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 300px;
  color: var(--text);
  font-family: var(--font);
  font-size: 20px;
  padding: 14px 20px;
  outline: none;
  -webkit-appearance: none;
}
.field input:focus { border-color: var(--btn-bg); }
.field input::placeholder { color: var(--border); }

/* ── header ─────────────────────────────────────────────────────────────────── */
.header {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 36px;
}
.header span { color: var(--text); font-weight: 500; }

/* ── headings ───────────────────────────────────────────────────────────────── */
h1 { font-size: 32px; font-weight: 400; line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 12px; color: var(--text); }
h2 { font-size: 20px; font-weight: 500; margin-bottom: 8px; color: var(--text); }
p.lead { font-size: 16px; color: var(--muted); margin-bottom: 28px; line-height: 1.6; }

/* ── step indicator ─────────────────────────────────────────────────────────── */
.steps {
  display: flex;
  gap: 6px;
  margin-bottom: 32px;
}
.step-dot {
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  flex: 1;
  transition: background 0.3s;
}
.step-dot.done   { background: var(--btn-bg); }
.step-dot.active { background: var(--wood); }

/* ── dimension diagram ──────────────────────────────────────────────────────── */
.dim-diagram { width: 100%; margin: 0 auto 28px; }

/* ── scan screen (dark — camera overlay) ────────────────────────────────────── */
#screen-scan {
  padding: 0;
  position: relative;
  background: #1c1915;
}

#video-container {
  position: relative;
  width: 100%;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

#camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#scan-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#scan-toolbar {
  background: rgba(28, 25, 21, 0.9);
  padding: 16px 20px 32px;
  backdrop-filter: blur(10px);
}

#progress-bar-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  margin-bottom: 14px;
  overflow: hidden;
}
#progress-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  transition: width 0.4s ease;
  width: 0%;
}
#scan-instruction {
  font-size: 16px;
  font-weight: 400;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  min-height: 26px;
}
#scan-face-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

#btn-done-scan {
  display: none;
  margin-top: 14px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 300px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 16px;
  width: 100%;
  cursor: pointer;
}

/* ── processing screen ──────────────────────────────────────────────────────── */
.spinner {
  width: 48px; height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--btn-bg);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 28px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── results ────────────────────────────────────────────────────────────────── */
.result-chip {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 300px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.chip-good { background: rgba(74, 124, 89, 0.12); color: var(--green); }
.chip-warn { background: rgba(192, 120, 40, 0.12); color: var(--amber); }
.chip-bad  { background: rgba(139, 58, 58, 0.12);  color: var(--red);  }

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.result-row:last-child { border-bottom: none; }
.result-label { font-size: 13px; color: var(--muted); flex-shrink: 0; text-transform: uppercase; letter-spacing: 0.06em; }
.result-value { font-size: 16px; font-weight: 500; text-align: right; color: var(--text); }

/* ── between-scans ──────────────────────────────────────────────────────────── */
.check-icon {
  width: 64px; height: 64px;
  background: rgba(74, 124, 89, 0.1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  margin: 0 auto 24px;
}

/* ── error banner ───────────────────────────────────────────────────────────── */
.error-banner {
  background: rgba(139, 58, 58, 0.08);
  border: 1px solid rgba(139, 58, 58, 0.2);
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 14px;
  color: var(--red);
  margin-bottom: 16px;
  display: none;
}
.error-banner.visible { display: block; }

/* ── utils ──────────────────────────────────────────────────────────────────── */
.spacer    { flex: 1; }
.mt-8      { margin-top: 8px; }
.mt-16     { margin-top: 16px; }
.mt-24     { margin-top: 24px; }
.text-center { text-align: center; }
.text-muted  { color: var(--muted); font-size: 14px; }
