:root {
  --navy: #0d2a4a;
  --navy-2: #14375f;
  --aqua: #3ec1c8;
  --aqua-2: #56d4d9;
  --cream: #f7f2e8;
  --paper: #fbf8f1;
  --ink: #0a1a2f;
  --ink-2: #435d7d;
  --muted: #7d8ea6;
  --stroke: rgba(13, 42, 74, 0.12);
  --stroke-2: rgba(13, 42, 74, 0.2);
  --shadow: 0 4px 24px rgba(13, 42, 74, 0.08);
  --shadow-lg: 0 12px 40px rgba(13, 42, 74, 0.14);
  --success: #2b8a3e;
  --warn: #c78210;
  --danger: #b03535;
  --serif: 'Fraunces', ui-serif, Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-size-adjust: 100%;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }

/* ============  TOP BAR  ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  padding: calc(var(--safe-t) + 12px) 20px 12px;
  background: rgba(251, 248, 241, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--stroke);
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--navy); }
.brand-name { font-family: var(--serif); font-size: 18px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.brand-tag { font-size: 11px; color: var(--muted); margin-top: 2px; letter-spacing: 0.02em; }
.beta {
  border: 1px solid var(--aqua); color: var(--aqua);
  font-size: 10px; font-weight: 700; letter-spacing: 0.14em;
  padding: 5px 10px; border-radius: 999px;
}

/* ============  SCREENS  ============ */
.screen { display: none; padding-bottom: calc(var(--safe-b) + 24px); }
.screen.active { display: block; }
.wrap { max-width: 640px; margin: 0 auto; padding: 24px 20px 32px; }
.wrap.center { text-align: center; padding-top: 48px; }

/* ============  WELCOME  ============ */
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.18em; color: var(--aqua); margin-bottom: 12px; }
.hero {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(34px, 8vw, 44px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--navy);
  margin-bottom: 14px;
}
.hero-sm {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(20px, 5vw, 24px);
  line-height: 1.15;
  color: var(--navy);
  letter-spacing: -0.01em;
}
.lede { color: var(--ink-2); font-size: 15px; line-height: 1.5; margin-bottom: 24px; max-width: 42ch; }

.steps { display: flex; flex-direction: column; gap: 8px; margin: 20px 0 24px; }
.step {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: white;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.step span {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--navy); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.step b { display: block; font-size: 14px; font-weight: 600; color: var(--navy); }
.step em { display: block; font-style: normal; font-size: 12px; color: var(--muted); margin-top: 2px; }

.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  background: var(--navy); color: white;
  padding: 16px 22px;
  border-radius: 12px;
  font-size: 15px; font-weight: 600;
  transition: transform 0.1s, background 0.2s;
}
.btn-primary:active { transform: scale(0.98); background: var(--navy-2); }
.btn-primary.big { padding: 18px 22px; font-size: 16px; }
.btn-primary:disabled { opacity: 0.4; }

.btn-ghost {
  display: block; margin: 12px auto 0;
  color: var(--navy); font-weight: 500; font-size: 14px;
  padding: 8px 14px; border-radius: 8px;
  text-decoration: underline; text-underline-offset: 4px;
}
.foot { font-size: 12px; color: var(--muted); text-align: center; margin-top: 14px; }

/* ============  CAPTURE  ============ */
#screen-capture.active {
  display: flex; flex-direction: column;
  min-height: 100vh; min-height: 100dvh;
  background: #0a1622;
  color: white;
  padding-bottom: calc(var(--safe-b) + 8px);
}
.capture-top {
  display: flex; align-items: center; gap: 12px;
  padding: calc(var(--safe-t) + 12px) 14px 12px;
  background: rgba(0,0,0,0.4);
}
.back-btn, .skip-btn {
  color: white;
  padding: 8px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.skip-btn {
  padding: 8px 14px;
  font-size: 13px; font-weight: 500;
  border: 1px solid rgba(255,255,255,0.3);
}
.capture-progress { flex: 1; text-align: center; }
.capture-title { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.7; }
.capture-sub { font-family: var(--serif); font-size: 16px; margin-top: 3px; font-weight: 500; }

.capture-guide {
  padding: 16px 20px;
  background: rgba(0,0,0,0.35);
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.guide-illus {
  width: 100%; max-width: 320px; height: 62px;
  margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px;
  color: var(--aqua);
}
.guide-text { font-size: 14px; line-height: 1.4; color: rgba(255,255,255,0.9); max-width: 340px; margin: 0 auto; }
.capture-dots {
  display: flex; justify-content: center; gap: 6px; margin-top: 12px;
}
.capture-dots span {
  width: 24px; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.25);
  transition: background 0.2s;
}
.capture-dots span.done { background: var(--aqua); }
.capture-dots span.active { background: white; }

.capture-cam {
  position: relative; flex: 1;
  background: black;
  overflow: hidden;
  min-height: 260px;
}
#video-feed { width: 100%; height: 100%; object-fit: cover; }
.cam-overlay {
  position: absolute; inset: 0;
  pointer-events: none;
  display: flex; align-items: center; justify-content: center;
}
.cam-frame {
  width: 80%; max-width: 380px; aspect-ratio: 4/3;
  border: 2px dashed rgba(62, 193, 200, 0.7);
  border-radius: 12px;
}

.capture-actions {
  display: flex; align-items: center; justify-content: space-around;
  padding: 16px 20px 8px;
  background: rgba(0,0,0,0.4);
}
.shutter {
  width: 74px; height: 74px; border-radius: 50%;
  background: white;
  border: 4px solid rgba(255,255,255,0.4);
  box-shadow: 0 0 0 4px rgba(0,0,0,0.3);
  transition: transform 0.1s;
}
.shutter:active { transform: scale(0.9); }
.btn-upload, .btn-flip, .btn-video {
  display: flex; align-items: center; flex-direction: column; gap: 4px;
  color: white; opacity: 0.85; font-size: 11px; font-weight: 500;
  padding: 8px;
  background: none; border: none; cursor: pointer;
}
.btn-upload span, .btn-video-label { font-size: 11px; letter-spacing: 0.05em; }
.btn-video.recording { opacity: 1; color: #ff4a4a; }
.btn-video.recording .btn-video-label { color: #ff4a4a; font-weight: 700; }

/* Recording indicator overlay on the camera feed */
.rec-indicator {
  position: absolute; top: 12px; left: 12px; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,0.55); color: white;
  padding: 6px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.02em;
}
.rec-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #ff2d2d;
  animation: rec-pulse 1.2s ease-in-out infinite;
}
@keyframes rec-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}
.rec-timer { font-variant-numeric: tabular-nums; }

/* Keyframe extraction progress bar (between actions and strip) */
.keyframe-progress {
  padding: 8px 20px;
  background: rgba(0,0,0,0.4);
  display: flex; flex-direction: column; gap: 6px;
}
.kf-bar {
  height: 4px; background: rgba(255,255,255,0.15); border-radius: 2px; overflow: hidden;
}
.kf-bar-fill {
  height: 100%; width: 0%; background: #4ac9ff;
  transition: width 0.15s ease-out;
  border-radius: 2px;
}
.kf-text { font-size: 12px; color: rgba(255,255,255,0.85); text-align: center; }

.capture-strip {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 8px 20px 4px;
  background: rgba(0,0,0,0.4);
  scrollbar-width: none;
  min-height: 68px;
}
.capture-strip::-webkit-scrollbar { display: none; }
.capture-strip .thumb {
  flex-shrink: 0;
  width: 60px; height: 60px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  border: 2px solid rgba(255,255,255,0.15);
}
.capture-strip .thumb img { width: 100%; height: 100%; object-fit: cover; }
.capture-strip .thumb button {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0,0,0,0.6); color: white;
  font-size: 12px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.capture-strip .placeholder {
  flex-shrink: 0; width: 60px; height: 60px;
  border: 2px dashed rgba(255,255,255,0.2);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.4); font-size: 11px; text-align: center;
  padding: 4px;
}

.capture-footer {
  padding: 8px 20px calc(var(--safe-b) + 12px);
  background: rgba(0,0,0,0.55);
}
.btn-analyze {
  width: 100%;
  background: var(--aqua); color: var(--navy);
  padding: 16px;
  border-radius: 12px;
  font-size: 15px; font-weight: 700;
  transition: opacity 0.2s;
}
.btn-analyze:disabled { opacity: 0.35; }
.btn-analyze:not(:disabled):active { background: var(--aqua-2); }
.capture-hint { text-align: center; font-size: 11px; color: rgba(255,255,255,0.6); margin-top: 8px; }

/* ============  ANALYZING  ============ */
.loader-pool {
  width: 120px; height: 120px;
  margin: 0 auto 30px;
  position: relative;
}
.loader-ring {
  width: 100%; height: 100%;
  border: 4px solid var(--stroke);
  border-top-color: var(--aqua);
  border-radius: 50%;
  animation: spin 1.2s linear infinite;
}
.loader-ring.small { width: 40px; height: 40px; border-width: 3px; margin: 0 auto 12px; }
.loader-water {
  position: absolute; inset: 20px; border-radius: 50%;
  background: linear-gradient(135deg, var(--aqua) 0%, var(--aqua-2) 100%);
  animation: pulse 2s ease-in-out infinite;
}
.loader-glint {
  position: absolute; top: 30%; left: 30%;
  width: 20px; height: 20px;
  background: white; border-radius: 50%;
  opacity: 0.6; filter: blur(2px);
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 0.9; } 50% { transform: scale(0.92); opacity: 1; } }

.loading-title { font-family: var(--serif); font-weight: 600; font-size: 26px; color: var(--navy); margin-bottom: 6px; }
.loading-sub { color: var(--muted); font-size: 14px; margin-bottom: 30px; }
.checklist { list-style: none; max-width: 380px; margin: 0 auto; text-align: left; }
.checklist li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  color: var(--ink-2);
  font-size: 14px;
  border-radius: 10px;
  margin-bottom: 4px;
  transition: background 0.3s;
}
.checklist li.active { background: rgba(62, 193, 200, 0.09); color: var(--navy); font-weight: 500; }
.checklist li.done { color: var(--navy); }
.checklist li .dot {
  width: 20px; height: 20px; border-radius: 50%;
  background: white; border: 2px solid var(--stroke-2);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  transition: all 0.3s;
}
.checklist li.done .dot { background: var(--success); border-color: var(--success); color: white; font-size: 10px; }
.checklist li.done .dot::after { content: "✓"; }
.checklist li.active .dot { border-color: var(--aqua); box-shadow: 0 0 0 4px rgba(62,193,200,0.15); }

/* ============  RESULTS  ============ */
#screen-results .results-hero {
  background: var(--navy);
  color: white;
  padding: 24px 20px 28px;
  border-radius: 0 0 24px 24px;
}
.results-thumbs {
  display: flex; gap: 6px; overflow-x: auto;
  padding-bottom: 12px; margin-bottom: 14px;
  scrollbar-width: none;
}
.results-thumbs::-webkit-scrollbar { display: none; }
.results-thumbs img {
  flex-shrink: 0;
  width: 68px; height: 68px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.15);
}
.results-thumbs img.hero { border-color: var(--aqua); box-shadow: 0 0 0 3px rgba(62,193,200,0.25); }
.results-hero-body .eyebrow { color: var(--aqua-2); }
.results-hero-body .hero-sm { color: white; }
.result-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.badge {
  padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.16);
}
.badge.good { background: rgba(43, 138, 62, 0.25); border-color: rgba(43, 138, 62, 0.4); }
.badge.warn { background: rgba(199, 130, 16, 0.25); border-color: rgba(199, 130, 16, 0.5); }
.badge.danger { background: rgba(176, 53, 53, 0.25); border-color: rgba(176, 53, 53, 0.5); }

.sec { padding: 22px 20px 8px; max-width: 640px; margin: 0 auto; }
.sec-title {
  font-family: var(--serif);
  font-weight: 600; font-size: 20px;
  color: var(--navy); margin-bottom: 12px;
  letter-spacing: -0.01em;
}
.sec-sub { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.sec-note { font-size: 12px; color: var(--muted); margin-top: 8px; font-style: italic; }

.measure-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.measure-cell {
  background: white;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 12px 14px;
}
.measure-cell .m-label { font-size: 11px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.measure-cell .m-value { font-family: var(--serif); font-weight: 600; font-size: 20px; color: var(--navy); margin-top: 2px; }
.measure-cell .m-unit { font-family: var(--sans); font-size: 12px; color: var(--ink-2); font-weight: 400; margin-left: 3px; }

.feat-list { display: flex; flex-direction: column; gap: 8px; }
.feat-item {
  background: white;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 12px 14px;
}
.feat-item .f-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.feat-item .f-name { font-weight: 600; color: var(--navy); font-size: 14px; }
.feat-item .f-dims { font-size: 12px; color: var(--aqua); font-weight: 600; }
.feat-item .f-notes { font-size: 12px; color: var(--ink-2); margin-top: 6px; line-height: 1.4; }
.feat-item .f-tags { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.feat-item .f-tag {
  font-size: 10px; padding: 2px 8px; border-radius: 999px;
  background: rgba(13,42,74,0.06); color: var(--ink-2); font-weight: 500;
}

.findings { display: flex; flex-direction: column; gap: 8px; }
.finding {
  background: white; border: 1px solid var(--stroke);
  border-radius: 12px; padding: 12px 14px;
  border-left: 4px solid var(--muted);
}
.finding.minor { border-left-color: var(--success); }
.finding.moderate { border-left-color: var(--warn); }
.finding.severe { border-left-color: var(--danger); }
.finding .f-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.finding .f-cat { font-weight: 600; color: var(--navy); font-size: 14px; }
.finding .f-sev { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.finding.minor .f-sev { color: var(--success); }
.finding.moderate .f-sev { color: var(--warn); }
.finding.severe .f-sev { color: var(--danger); }
.finding .f-loc { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.finding .f-desc { font-size: 13px; color: var(--ink-2); line-height: 1.45; }

.rec-card {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  color: white;
  border-radius: 16px; padding: 18px 18px 22px;
  box-shadow: var(--shadow-lg);
}
.rec-badge {
  display: inline-block;
  background: var(--aqua); color: var(--navy);
  padding: 4px 12px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.rec-body { font-size: 14px; line-height: 1.55; color: rgba(255,255,255,0.92); }

/* ============  MATERIALS  ============ */
.mat-block { margin-bottom: 18px; }
.mat-label {
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  letter-spacing: 0.04em; text-transform: uppercase;
  margin-bottom: 8px;
}
.mat-label span { color: var(--aqua); font-weight: 700; letter-spacing: 0.02em; text-transform: none; }
.mat-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.mat-card {
  background: white;
  border: 2px solid var(--stroke);
  border-radius: 12px;
  padding: 10px;
  text-align: left;
  transition: all 0.15s;
  display: flex; flex-direction: column;
  gap: 6px;
}
.mat-card:active { transform: scale(0.98); }
.mat-card.selected {
  border-color: var(--aqua);
  box-shadow: 0 0 0 3px rgba(62,193,200,0.15);
  background: rgba(62,193,200,0.04);
}
.mat-swatch {
  width: 100%; height: 44px;
  border-radius: 8px;
  background: var(--muted);
}
.mat-card .mat-name { font-size: 12px; font-weight: 600; color: var(--navy); line-height: 1.25; }
.mat-card .mat-price { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mat-card .mat-tier {
  font-size: 9px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--aqua);
}

/* ============  RENDER  ============ */
.render-sec { padding-top: 8px; }
.render-frame {
  background: white;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  overflow: hidden;
  min-height: 240px;
  position: relative;
  box-shadow: var(--shadow);
}
.render-placeholder, .render-loading {
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  min-height: 240px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.render-loading p { color: var(--ink-2); font-weight: 500; }
.render-loading small { color: var(--muted); font-weight: 400; font-size: 12px; }
.ba { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--stroke); }
.ba-side { position: relative; background: white; }
.ba-side img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.ba-label {
  position: absolute; top: 8px; left: 8px;
  background: rgba(13,42,74,0.85); color: white;
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  padding: 4px 10px; border-radius: 4px;
}

/* ============  DRAWINGS  ============ */
.drawing-actions { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.btn-secondary {
  flex: 1; min-width: 140px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 14px;
  background: white;
  border: 1px solid var(--stroke-2);
  border-radius: 10px;
  font-size: 13px; font-weight: 600;
  color: var(--navy);
  transition: all 0.15s;
}
.btn-secondary:active { transform: scale(0.97); background: rgba(62,193,200,0.06); border-color: var(--aqua); }
.drawing-frame {
  background: white;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  overflow: hidden;
  min-height: 200px;
  box-shadow: var(--shadow);
}
.drawing-frame img { width: 100%; }
.drawing-placeholder {
  padding: 40px 20px; text-align: center;
  color: var(--muted); font-size: 13px;
}
.drawing-loading { padding: 30px 20px; text-align: center; color: var(--ink-2); }

/* ============  ESTIMATE  ============ */
.estimate-sec .est-card {
  background: white;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.est-header { border-bottom: 1px solid var(--stroke); padding-bottom: 14px; margin-bottom: 14px; }
.est-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.est-price { font-family: var(--serif); font-weight: 700; font-size: 28px; color: var(--navy); margin-top: 4px; letter-spacing: -0.01em; }
.est-price small { font-family: var(--sans); font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 4px; letter-spacing: 0; }
.est-breakdown {
  display: flex; flex-direction: column; gap: 6px;
}
.est-line {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px; align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px dashed var(--stroke);
  font-size: 12px;
}
.est-line:last-child { border-bottom: none; }
.est-line .el-swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--muted); }
.est-line .el-cat { color: var(--navy); font-weight: 600; }
.est-line .el-mat { color: var(--muted); font-size: 11px; margin-top: 1px; }
.est-line .el-price { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; text-align: right; white-space: nowrap; }
.est-line .el-qty { font-size: 10px; color: var(--muted); }

.est-note { font-size: 11px; color: var(--muted); line-height: 1.5; margin-top: 12px; }
.est-note b { color: var(--navy); }

.results-cta { padding: 20px; max-width: 640px; margin: 0 auto; }

/* ============  ERROR  ============ */
.err-icon { color: var(--danger); margin: 20px auto; }

/* ============  DESKTOP  ============ */
@media (min-width: 720px) {
  .steps { display: grid; grid-template-columns: 1fr 1fr; }
  .measure-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 900px) {
  #screen-capture.active { padding: 0; }
  .cam-frame { max-width: 500px; }
}

/* ============  SCALE REFERENCE — CAPTURE GUIDE  ============ */
.scale-help {
  background: #fff7ed;
  border: 1.5px solid #f59e0b;
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 12px;
  text-align: left;
}
.scale-help-title {
  font-size: 12px;
  font-weight: 700;
  color: #92400e;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.scale-help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.scale-opt {
  background: white;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  color: #78350f;
}
.scale-opt b { font-size: 13px; }
.scale-opt span { color: #a16207; font-size: 11px; margin-top: 1px; }
.scale-help-link {
  display: block;
  margin-top: 10px;
  color: #0d2a4a;
  font-weight: 600;
  font-size: 12px;
  text-decoration: none;
  text-align: center;
  background: white;
  border: 1px dashed #0d2a4a;
  padding: 8px;
  border-radius: 8px;
}
.scale-help-link:hover { background: #f0f9ff; }

/* ============  SCALE CALIBRATION BANNER (RESULTS)  ============ */
.cal-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  margin: 16px 20px 0;
  font-size: 13px;
  line-height: 1.4;
}
.cal-banner.high { background: #ecfdf5; border-left: 4px solid #10b981; color: #064e3b; }
.cal-banner.medium { background: #fefce8; border-left: 4px solid #eab308; color: #713f12; }
.cal-banner.low { background: #fff7ed; border-left: 4px solid #f59e0b; color: #7c2d12; }
.cal-banner.none { background: #fef2f2; border-left: 4px solid #dc2626; color: #7f1d1d; }
.cal-banner .cal-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.08);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}
.cal-banner .cal-title { font-weight: 600; margin-bottom: 2px; }
.cal-banner .cal-sub { font-size: 12px; opacity: 0.85; }
.cal-banner .cal-badge {
  margin-left: auto;
  background: rgba(0,0,0,0.1);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.cal-banner .cal-add {
  margin-left: auto;
  background: #0d2a4a;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ============  MEASUREMENT CELLS — editable + confidence  ============ */
.sec-hint {
  font-size: 12px;
  color: #6b7d94;
  margin: -8px 0 12px;
  font-style: italic;
}
.measure-cell.editable { position: relative; cursor: pointer; transition: transform 0.15s, border-color 0.15s; }
.measure-cell.editable:hover { transform: translateY(-1px); border-color: #3ec1c8; }
.measure-cell.editable:hover .m-edit { opacity: 1; }
.measure-cell .m-edit {
  position: absolute;
  top: 6px; right: 8px;
  font-size: 9px;
  color: #3ec1c8;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.5;
  transition: opacity 0.15s;
}
.measure-cell.user-set { background: #ecfdf5; border-color: #10b981; }
.measure-cell.user-set .m-edit { color: #10b981; opacity: 1; }
.m-conf {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}
.m-conf.high { background: #d1fae5; color: #065f46; }
.m-conf.medium { background: #fef3c7; color: #92400e; }
.m-conf.low { background: #fee2e2; color: #991b1b; }

/* ============  FEATURE — confidence + override  ============ */
.feat-item.conf-low { border-left: 3px solid #f59e0b; }
.feat-item.conf-medium { border-left: 3px solid #eab308; }
.feat-item.conf-high { border-left: 3px solid #10b981; }
.f-conf {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.f-conf.high { background: #d1fae5; color: #065f46; }
.f-conf.medium { background: #fef3c7; color: #92400e; }
.f-conf.low { background: #fee2e2; color: #991b1b; }
.f-method {
  font-size: 11px;
  color: #6b7d94;
  margin: 6px 0 0;
  font-style: italic;
}
.f-edit {
  margin-top: 10px;
  background: white;
  border: 1px solid #cbd5e1;
  color: #0d2a4a;
  padding: 7px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.f-edit:hover { background: #0d2a4a; color: white; border-color: #0d2a4a; }
