/* ============================================================
   FBS Beauty Design System + AI Diagnostics Page
   Fonts: Playfair Display (headings) · Poppins (body)
   Source: extracted from fbs.beauty (Kadence theme)
   ============================================================ */

/* ── Google Fonts ──────────────────────────────────────────── */
/* Google Fonts loaded via <link> in HTML */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Brand palette — fbs.beauty */
  --c-primary:    #2c3e50;
  --c-sage:       #b6cdb1;
  --c-sage-dark:  #9caf88;
  --c-taupe:      #af9483;
  --c-sand:       #d2ab80;
  --c-beige:      #e6d2b9;
  --c-brown:      #735c3a;
  --c-white:      #ffffff;
  --c-bg:         #faf7f4;   /* warm off-white page background */
  --c-surface:    #ffffff;
  --c-border:     #e8ddd4;
  --c-text:       #2c3e50;
  --c-text-muted: #8a7a6e;

  /* Severity */
  --c-high:   #c0392b;
  --c-medium: #d2ab80;
  --c-low:    #9caf88;

  /* Typography */
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body:    'Poppins', system-ui, sans-serif;

  /* Spacing (from Kadence) */
  --space-xs:  0.5rem;
  --space-sm:  1rem;
  --space-md:  1.5rem;
  --space-lg:  2rem;
  --space-xl:  3rem;
  --space-xxl: 5rem;

  /* Layout */
  --content-max: 860px;
  --radius-sm:   3px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --radius-xl:   32px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(44,62,80,.08);
  --shadow-md: 0 8px 30px rgba(44,62,80,.12);
  --shadow-lg: 0 15px 50px rgba(44,62,80,.18);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

/* ── Typography ────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.25;
  color: var(--c-primary);
}

h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); }
h2 { font-size: clamp(1.3rem, 3.5vw, 1.9rem); }
h3 { font-size: 1.1rem; }

p { line-height: 1.7; }

/* ── Layout wrapper ────────────────────────────────────────── */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* ── Step System ───────────────────────────────────────────── */
.step {
  display: none;
  min-height: 100vh;
  flex-direction: column;
}
.step.active { display: flex; }

/* Results step doesn't need full-height */
#step-results.active {
  min-height: unset;
  display: block;
}

/* ── Step Header ───────────────────────────────────────────── */
.step-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
.step-header h2 { font-size: 1.1rem; margin: 0; flex: 1; text-align: center; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  padding: 0.75em 1.6em;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
  transition: all .2s ease;
  text-align: center;
}

.btn-primary {
  background: var(--c-primary);
  color: var(--c-white);
}
.btn-primary:hover {
  background: #1a2836;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--c-beige);
  color: var(--c-brown);
}
.btn-secondary:hover {
  background: var(--c-sand);
  box-shadow: var(--shadow-sm);
}

.btn-outline {
  background: transparent;
  color: var(--c-primary);
  border: 2px solid var(--c-primary);
}
.btn-outline:hover {
  background: var(--c-primary);
  color: var(--c-white);
}

.btn-large {
  padding: 1em 2.2em;
  min-height: 48px;
  font-size: 1.05rem;
  border-radius: var(--radius-md);
  width: 100%;
}

.btn-back {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--c-taupe);
  padding: 0.6em 0.9em;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  gap: 0.3em;
  transition: color .2s;
}
.btn-back:hover { color: var(--c-primary); }

/* ── ══════════════════════════════════════════════════════════
   STEP 1 — HERO
   ══════════════════════════════════════════════════════════ */
#step-hero {
  background: linear-gradient(160deg, var(--c-primary) 0%, #3d5a4a 50%, #2c4a3e 100%);
  color: var(--c-white);
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) var(--space-md);
  text-align: center;
  position: relative;
  overflow: hidden;
}

#step-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(182,205,177,.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(210,171,128,.1) 0%, transparent 50%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.hero-brand {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--c-sage);
  opacity: 0.9;
}

#step-hero h1 {
  color: var(--c-white);
  font-style: italic;
  font-size: clamp(2rem, 6vw, 3rem);
}

#step-hero h1 span {
  font-style: normal;
  color: var(--c-sage);
}

.hero-subtitle {
  color: rgba(255,255,255,.8);
  font-size: 1rem;
  max-width: 380px;
  line-height: 1.7;
}

.hero-features {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  justify-content: center;
}

.hero-feature {
  background: rgba(255,255,255,.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--radius-xl);
  padding: 0.4em 1em;
  font-size: 0.85rem;
  color: rgba(255,255,255,.9);
}

.hero-cta-wrap {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

#step-hero .btn-primary {
  background: var(--c-sage);
  color: var(--c-primary);
  font-weight: 600;
  font-size: 1.1rem;
}
#step-hero .btn-primary:hover {
  background: #c8ddc3;
}

.hero-disclaimer {
  font-size: 0.75rem;
  color: rgba(255,255,255,.45);
  text-align: center;
}

/* ── ══════════════════════════════════════════════════════════
   STEP 2 — CAMERA
   ══════════════════════════════════════════════════════════ */
#step-camera {
  background: var(--c-surface);
  flex-direction: column;
}

.camera-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  gap: var(--space-md);
}

/* Live video container */
.video-container {
  position: relative;
  width: 100%;
  max-width: 340px;
  max-height: 60vh;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 3/4;
}

#camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* mirror for selfie */
}

.oval-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.oval-overlay svg {
  width: 100%;
  height: 100%;
}

.btn-capture {
  position: absolute;
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--c-white);
  border: 4px solid var(--c-sage);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: var(--shadow-md);
  transition: transform .15s, box-shadow .15s;
}
.btn-capture:hover { transform: translateX(-50%) scale(1.08); }
.btn-capture:active { transform: translateX(-50%) scale(0.95); }

/* Upload fallback */
.upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  max-width: 340px;
}

.upload-card {
  width: 100%;
  background: var(--c-bg);
  border: 2px dashed var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-md);
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  position: relative;
}
.upload-card:hover {
  border-color: var(--c-sage-dark);
  background: #f2ede8;
}
.upload-card input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.upload-card p { color: var(--c-text-muted); font-size: 0.9rem; margin-top: 0.3em; }

.upload-divider {
  color: var(--c-text-muted);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
}
.upload-divider::before, .upload-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--c-border);
}

.camera-tip {
  text-align: center;
  color: var(--c-text-muted);
  font-size: 0.85rem;
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid var(--c-border);
}

/* ── ══════════════════════════════════════════════════════════
   STEP 3 — PREVIEW
   ══════════════════════════════════════════════════════════ */
#step-preview {
  background: var(--c-surface);
  flex-direction: column;
}

.preview-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg) var(--space-md);
  gap: var(--space-md);
}

.preview-img-wrap {
  width: 100%;
  max-width: 340px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  aspect-ratio: 3/4;
  background: #000;
}

#preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-actions {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

/* ── ══════════════════════════════════════════════════════════
   STEP 4 — PROCESSING / SCANNING
   ══════════════════════════════════════════════════════════ */
#step-processing {
  background: var(--c-primary);
  color: var(--c-white);
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) var(--space-md);
  gap: var(--space-lg);
}

.scan-wrapper {
  position: relative;
  width: 240px;
  height: 320px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

#scan-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-overlay {
  position: absolute;
  inset: 0;
  background: rgba(44,62,80,.25);
}

.scan-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent 0%, var(--c-sage) 30%, #fff 50%, var(--c-sage) 70%, transparent 100%);
  box-shadow: 0 0 16px var(--c-sage), 0 0 40px rgba(182,205,177,.5);
  animation: scanLine 2.4s ease-in-out infinite;
  top: 0;
}

@keyframes scanLine {
  0%   { top: 2%;  opacity: 0; }
  8%   { opacity: 1; }
  92%  { opacity: 1; }
  100% { top: 98%; opacity: 0; }
}

.scan-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-sage);
  transform: translate(-50%, -50%);
  animation: pulseDot 1.5s ease-in-out infinite;
  box-shadow: 0 0 10px var(--c-sage);
}
.scan-dot:nth-child(2) { animation-delay: .3s; }
.scan-dot:nth-child(3) { animation-delay: .6s; }
.scan-dot:nth-child(4) { animation-delay: .9s; }

@keyframes pulseDot {
  0%, 100% { opacity: .3; transform: translate(-50%, -50%) scale(1); }
  50%       { opacity: 1;  transform: translate(-50%, -50%) scale(1.6); }
}

.processing-text {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  max-width: 340px;
}

.processing-text h2 {
  color: var(--c-white);
  font-size: 1.3rem;
}

.processing-hint {
  color: var(--c-sage);
  font-size: 0.9rem;
  min-height: 1.4em;
  transition: opacity .3s;
}

.progress-track {
  width: 240px;
  height: 4px;
  background: rgba(255,255,255,.15);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--c-sage);
  border-radius: 99px;
  width: 0%;
  transition: width .4s ease;
}

/* ── ══════════════════════════════════════════════════════════
   STEP 5 — RESULTS
   ══════════════════════════════════════════════════════════ */
#step-results {
  background: var(--c-bg);
}

.results-top {
  background: linear-gradient(160deg, var(--c-primary) 0%, #3d5a4a 100%);
  color: var(--c-white);
  padding: var(--space-xl) var(--space-md) var(--space-xxl);
  text-align: center;
}

.results-brand {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--c-sage);
  margin-bottom: var(--space-xs);
}

.results-top h1 {
  color: var(--c-white);
  margin-bottom: var(--space-xs);
}

.results-date {
  color: rgba(255,255,255,.5);
  font-size: 0.8rem;
}

/* Summary card (overlaps hero) */
.summary-card {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-lg);
  margin: calc(-1 * var(--space-xl)) var(--space-md) 0;
  position: relative;
  z-index: 1;
}

.summary-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-md);
  align-items: start;
}

.score-ring {
  width: 90px;
  height: 90px;
  position: relative;
  flex-shrink: 0;
}

.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }

.score-ring-track {
  fill: none;
  stroke: var(--c-beige);
  stroke-width: 6;
}
.score-ring-fill {
  fill: none;
  stroke: var(--c-sage-dark);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 283;
  stroke-dashoffset: 283; /* set by JS */
  transition: stroke-dashoffset 1.2s ease;
}

.score-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.score-num  { font-size: 1.6rem; font-weight: 700; color: var(--c-primary); font-family: var(--font-heading); }
.score-unit { font-size: 0.65rem; color: var(--c-text-muted); }

.summary-info { display: flex; flex-direction: column; gap: 0.4em; }

.skin-type-badge {
  display: inline-block;
  background: var(--c-beige);
  color: var(--c-brown);
  border-radius: var(--radius-xl);
  padding: 0.2em 0.9em;
  font-size: 0.8rem;
  font-weight: 500;
  align-self: flex-start;
}

.skin-age-label {
  font-size: 0.8rem;
  color: var(--c-text-muted);
}

.summary-text {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--c-text);
  margin-top: 0.3em;
}

.skin-badges { display: flex; flex-wrap: wrap; gap: 0.4em; margin-bottom: 0.3em; }

.aging-badge { background: var(--c-primary); color: #fff; }

.photo-note {
  font-size: 0.8rem;
  color: var(--c-taupe);
  background: #fdf6ec;
  border: 1px solid var(--c-sand);
  border-radius: var(--radius-sm);
  padding: 0.4em 0.7em;
  margin: 0.3em 0;
}

.obs-zone {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-taupe);
  margin-bottom: 0.15em;
}

.proc-course {
  font-size: 0.8rem;
  color: var(--c-text-muted);
  margin-top: 0.4em;
}

.plan-card {
  background: var(--c-surface);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--c-sage-dark);
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--c-text);
  white-space: pre-line;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

/* Results sections */
.results-body {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.result-section h2 {
  margin-bottom: var(--space-md);
  padding-bottom: 0.5em;
  border-bottom: 2px solid var(--c-beige);
}

/* Metrics grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
}

.metric-card {
  background: var(--c-surface);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  text-align: center;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4em;
}

.metric-icon { font-size: 1.3rem; }

.metric-ring-wrap {
  position: relative;
  width: 64px;
  height: 64px;
}
.metric-ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.metric-track { fill: none; stroke: var(--c-beige); stroke-width: 5; }
.metric-fill  { fill: none; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 100; transition: stroke-dashoffset 1s ease .3s; }
.metric-value-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--c-primary);
}

.metric-label { font-size: 0.75rem; color: var(--c-text-muted); text-align: center; line-height: 1.3; }

/* Observations */
.observations-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.obs-card {
  background: var(--c-surface);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-sm);
  align-items: start;
  border-left: 4px solid var(--c-border);
}
.obs-card.severity-high   { border-left-color: var(--c-high); }
.obs-card.severity-medium { border-left-color: var(--c-medium); }
.obs-card.severity-low    { border-left-color: var(--c-low); }

.obs-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}
.severity-high   .obs-dot { background: var(--c-high); }
.severity-medium .obs-dot { background: var(--c-medium); }
.severity-low    .obs-dot { background: var(--c-low); }

.obs-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.2em; }
.obs-desc  { font-size: 0.875rem; color: var(--c-text-muted); line-height: 1.6; }

/* Care routine */
.care-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.care-card {
  background: var(--c-surface);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
}

.care-card h3 {
  margin-bottom: var(--space-sm);
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4em;
}

.care-list { list-style: none; display: flex; flex-direction: column; gap: 0.75em; }

.care-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 0.6em;
  align-items: start;
}

.care-step {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--c-beige);
  color: var(--c-brown);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.care-product { font-size: 0.875rem; font-weight: 500; }
.care-why     { font-size: 0.78rem; color: var(--c-text-muted); margin-top: 0.1em; line-height: 1.4; }

/* Procedures */
.procedures-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.proc-card {
  background: var(--c-surface);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-sm);
  align-items: start;
}

.proc-main {}
.proc-name { font-weight: 600; font-size: 1rem; margin-bottom: 0.3em; }
.proc-desc { font-size: 0.85rem; color: var(--c-text-muted); margin-bottom: 0.4em; }
.proc-benefit {
  font-size: 0.82rem;
  color: var(--c-taupe);
  background: var(--c-beige);
  border-radius: var(--radius-xl);
  padding: 0.25em 0.8em;
  display: inline-block;
}

.proc-badge {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.3em 0.8em;
  border-radius: var(--radius-xl);
  text-transform: uppercase;
  white-space: nowrap;
}
.priority-high   .proc-badge { background: var(--c-primary); color: #fff; }
.priority-medium .proc-badge { background: var(--c-taupe);   color: #fff; }
.priority-low    .proc-badge { background: var(--c-beige);   color: var(--c-brown); }

/* Results CTA */
.results-cta {
  background: var(--c-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.results-cta h3 {
  color: var(--c-white);
  font-size: 1.2rem;
}
.results-cta p {
  color: rgba(255,255,255,.7);
  font-size: 0.9rem;
  max-width: 360px;
}

.results-cta .btn-primary {
  background: var(--c-sage);
  color: var(--c-primary);
  font-weight: 600;
  max-width: 320px;
}
.results-cta .btn-primary:hover { background: #c8ddc3; }

.results-cta .btn-secondary {
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.8);
  border: 1px solid rgba(255,255,255,.2);
  max-width: 320px;
}
.results-cta .btn-secondary:hover { background: rgba(255,255,255,.18); }

.results-disclaimer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--c-text-muted);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Error state */
.results-error {
  background: #fff5f5;
  border: 1px solid #fed7d7;
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  text-align: center;
  color: var(--c-high);
}

/* ── ══════════════════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44,62,80,.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 0;
}

@media (min-width: 600px) {
  .modal-overlay { align-items: center; padding: var(--space-md); }
}

.modal {
  background: var(--c-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-md) var(--space-lg) max(var(--space-lg), env(safe-area-inset-bottom, 0px));
  width: 100%;
  max-width: 480px;
  position: relative;
  animation: slideUp .3s ease;
  will-change: transform;
}

@media (min-width: 600px) {
  .modal { border-radius: var(--radius-lg); }
}

@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: var(--c-beige);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-brown);
  transition: background .2s;
}
.modal-close:hover { background: var(--c-sand); }

.modal h2 {
  margin-bottom: 0.3em;
  font-size: 1.3rem;
}
.modal > p {
  color: var(--c-text-muted);
  font-size: 0.9rem;
  margin-bottom: var(--space-md);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.3em;
}

.form-field label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--c-text);
}

.form-field input {
  padding: 0.9em 1em;
  min-height: 44px;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--c-text);
  background: var(--c-bg);
  transition: border-color .2s;
  outline: none;
}
.form-field input:focus { border-color: var(--c-sage-dark); }

.modal-footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--c-text-muted);
  margin-top: var(--space-sm);
}
.modal-footer a { color: var(--c-taupe); text-decoration: underline; }

.modal-success { text-align: center; padding: var(--space-xl) var(--space-lg); }
.success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--c-sage);
  color: var(--c-primary);
  font-size: 1.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-md);
}
.modal-success h2 { margin-bottom: 0.4em; }
.modal-success p  { color: var(--c-text-muted); margin-bottom: var(--space-lg); }

/* ── ══════════════════════════════════════════════════════════
   DESKTOP — Responsive Adjustments (≥ 768px)
   ══════════════════════════════════════════════════════════ */
@media (min-width: 768px) {

  /* Hero */
  #step-hero { padding: var(--space-xxl) var(--space-md); }

  /* Camera — show video on desktop too */
  .camera-area { flex-direction: row; gap: var(--space-xl); justify-content: center; align-items: center; }
  .video-container { max-width: 340px; }
  .upload-area { max-width: 260px; }

  /* Metrics — 4 columns always */
  .metrics-grid { grid-template-columns: repeat(4, 1fr); }

  /* Care — 2 columns */
  .care-grid { grid-template-columns: 1fr 1fr; }

  /* Summary card */
  .summary-card { margin: calc(-1 * var(--space-xl)) auto 0; max-width: calc(var(--content-max) - 2 * var(--space-md)); }

  /* Results top has more padding */
  .results-top { padding: var(--space-xxl) var(--space-md) calc(var(--space-xxl) + 20px); }
}

@media (max-width: 480px) {
  /* Smaller screens — care grid stacks */
  .care-grid { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .summary-inner { grid-template-columns: 1fr; }
  .score-ring { margin: 0 auto; }
}

/* ── ══════════════════════════════════════════════════════════
   PRINT / PDF STYLES
   ══════════════════════════════════════════════════════════ */
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* Hide non-result elements */
  #step-hero, #step-camera, #step-preview, #step-processing,
  .step-header, .btn-back, .results-cta, .modal-overlay,
  .results-disclaimer { display: none !important; }

  #step-results { display: block !important; }
  body { background: white; font-size: 11pt; }

  .results-top { padding: 1.5rem 1rem 3rem; page-break-inside: avoid; }
  .summary-card { margin: -2rem 1rem 0; box-shadow: none; border: 1px solid #e8ddd4; }
  .results-body { padding: 1rem; gap: 1.5rem; }

  .metric-card, .obs-card, .care-card, .proc-card {
    box-shadow: none;
    border: 1px solid #e8ddd4;
    page-break-inside: avoid;
  }
}


/* ── Mobile-specific fixes ──────────────────────────────────── */
@media (max-width: 480px) {
  .results-top {
    padding: var(--space-lg) var(--space-md) var(--space-xl);
  }
  .results-body {
    gap: var(--space-lg);
    padding: var(--space-md) var(--space-sm);
  }
  .proc-card {
    grid-template-columns: 1fr;
  }
  .proc-badge {
    align-self: flex-start;
    margin-top: 0.3em;
  }
  .upload-card {
    padding: var(--space-md) var(--space-sm);
  }
}

/* Tablets 481-767px — metrics 2 columns */
@media (min-width: 481px) and (max-width: 767px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Utility ────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-muted { color: var(--c-text-muted); }
.text-center { text-align: center; }
