/* ==========================================================================
   InstaVitalScan AI — v19  ·  mobile-first responsive stylesheet
   --------------------------------------------------------------------------
   Layered breakpoints:
     base   — < 480px (small phones)
     ≥480   — large phones + small tablets portrait
     ≥640   — phablets / iPad mini portrait
     ≥768   — tablet portrait
     ≥1024  — tablet landscape / small laptop
     ≥1280  — desktop
   Tools: CSS variables, clamp() for fluid type, dvh for mobile chrome,
   safe-area-insets for notch handling, container-friendly grid templates.
   ========================================================================== */

:root {
  /* ---------- palette ---------- */
  --bg:          #f4f7fa;
  --bg-dark:     #0d2c3b;
  --bg-deep:     #07182a;
  --ink:         #0d2c3b;
  --ink-soft:    #4a6275;
  --line:        #e5ecf1;
  --primary:     #1b9aaa;
  --primary-2:   #62d9c8;
  --accent:      #ff5b6c;
  --warn:        #f39c12;
  --good:        #27ae60;
  --bad:         #e84545;
  --shadow-sm:   0 4px 12px rgba(13,44,59,.06);
  --shadow:      0 6px 20px rgba(13,44,59,.07);
  --shadow-lg:   0 16px 40px rgba(13,44,59,.14);
  --radius:      14px;
  --radius-lg:   20px;

  /* ---------- responsive scale ---------- */
  /* Page gutter scales from 14 → 28px */
  --gutter:      clamp(14px, 4vw, 28px);
  /* Card inner padding scales from 18 → 36px */
  --card-pad:    clamp(18px, 4vw, 36px);
  /* Section spacing */
  --gap-sm:      clamp(8px, 1.5vw, 12px);
  --gap:         clamp(12px, 2vw, 18px);
  --gap-lg:      clamp(18px, 3vw, 28px);

  /* ---------- fluid typography ---------- */
  --fs-xs:   clamp(.72rem, .65rem + .25vw, .82rem);
  --fs-sm:   clamp(.82rem, .75rem + .25vw, .9rem);
  --fs-base: clamp(.95rem, .9rem  + .2vw, 1.05rem);
  --fs-lg:   clamp(1.05rem, 1rem  + .3vw, 1.2rem);
  --fs-xl:   clamp(1.3rem,  1.1rem + .8vw, 1.6rem);
  --fs-2xl:  clamp(1.6rem,  1.3rem + 1.2vw, 2.2rem);
  --fs-3xl:  clamp(2rem,    1.5rem + 2.5vw, 3.4rem);
  --fs-mega: clamp(2.4rem,  2rem   + 4vw,   3.6rem);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }   /* keep iOS from auto-scaling */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--fs-base);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;                 /* belts-and-braces for accidental overflow */
}
img, svg, video, canvas { max-width: 100%; height: auto; }

/* ===========================================================================
   Topbar — sticky, safe-area-aware, collapses cleanly on small phones
   =========================================================================== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--gap-sm);
  padding: 12px var(--gutter);
  padding-top:    max(12px, env(safe-area-inset-top));
  padding-left:   max(var(--gutter), env(safe-area-inset-left));
  padding-right:  max(var(--gutter), env(safe-area-inset-right));
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  min-height: 56px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand-logo { height: clamp(28px, 6vw, 40px); width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand-product { font-size: clamp(14px, 3.4vw, 18px); font-weight: 700; color: #0d3b66; letter-spacing: -0.2px; white-space: nowrap; }
.brand-product-accent { color: var(--primary); }
.brand-parent { font-size: clamp(9px, 2.4vw, 11px); color: var(--ink-soft); font-weight: 600; letter-spacing: .3px; white-space: nowrap; }
.page-scan .brand-product { color: white; }
.page-scan .brand-parent  { color: rgba(255,255,255,0.6); }
.topbar-link {
  text-decoration: none; color: var(--ink-soft); font-weight: 600;
  font-size: var(--fs-sm); padding: 8px 12px; border-radius: 8px;
  white-space: nowrap;
}
.topbar-link:hover { background: rgba(0,0,0,.04); }
.topbar-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* On very narrow phones, hide the parent label so brand fits */
@media (max-width: 380px) {
  .brand-parent { display: none; }
}

/* ===========================================================================
   Buttons — minimum 44px touch target everywhere
   =========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; cursor: pointer;
  padding: 12px 22px;
  min-height: 44px;
  border-radius: 999px;
  font-weight: 700; font-size: var(--fs-base);
  background: white; color: var(--ink);
  text-decoration: none;
  transition: filter .15s, transform .12s, box-shadow .15s;
  font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  box-shadow: 0 6px 16px rgba(27,154,170,.3);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-sm { padding: 8px 14px; min-height: 36px; font-size: var(--fs-sm); }

/* ===========================================================================
   Landing — Hero
   =========================================================================== */
.page-landing .hero {
  background: radial-gradient(ellipse at 30% 30%, #11445e 0%, var(--bg-deep) 70%);
  color: white;
  padding: clamp(36px, 8vw, 80px) var(--gutter) clamp(56px, 10vw, 96px);
  position: relative;
}
.hero-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(28px, 5vw, 48px);
  align-items: center;
}
.hero-copy h1 {
  font-size: var(--fs-mega);
  line-height: 1.05;
  margin: 0 0 clamp(12px, 2vw, 20px);
  letter-spacing: -1px;
}
.hero-accent { color: var(--primary-2); }
.hero-timer {
  display: inline-block;
  background: var(--primary-2); color: var(--bg-deep);
  padding: 0 clamp(8px, 1.5vw, 14px);
  border-radius: 12px;
  margin: 0 4px; font-weight: 800;
}
.hero-timer-unit { font-size: .58em; vertical-align: super; color: var(--primary-2); margin-left: 4px; }
.hero-sub {
  font-size: clamp(.95rem, 1vw + .85rem, 1.15rem);
  max-width: 520px;
  opacity: .85;
  margin-bottom: clamp(18px, 3vw, 28px);
  line-height: 1.55;
}
.hero-disclaimer { margin-top: 14px; opacity: .55; font-size: var(--fs-xs); }

/* ---- The orbit visual scales fluidly via CSS variables ---- */
.hero-visual {
  display: flex;
  align-items: center;
  justify-content: center;
}
.orbit {
  --orbit-size: clamp(220px, 60vw, 360px);
  position: relative;
  width: var(--orbit-size);
  height: var(--orbit-size);
}
.orbit-ring {
  position: absolute;
  inset: calc(var(--orbit-size) * 0.085);
  border-radius: 50%;
  border: 1px dashed rgba(255,255,255,0.2);
}
.dot {
  --dot-size: calc(var(--orbit-size) * 0.36);
  position: absolute;
  width: var(--dot-size); height: var(--dot-size);
  border-radius: 50%;
  background: white; color: var(--ink);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.dot::before {
  content:""; position:absolute; inset:-6px; border-radius:50%;
  background: conic-gradient(from 0deg, var(--primary), var(--primary-2), var(--accent), var(--primary));
  z-index:-1; filter: blur(2px);
}
.dot-num {
  font-size: calc(var(--dot-size) * 0.28);
  font-weight: 800; color: var(--primary);
}
.dot-num i { font-size: 0.55em; font-style: normal; }
.dot-label {
  font-size: calc(var(--dot-size) * 0.09);
  font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  margin-top: 2px;
}
.dot-hr { top: 0;                                    right: calc(var(--orbit-size) * 0.085); }
.dot-hs { top: calc(var(--orbit-size) * 0.36);       right: calc(var(--orbit-size) * 0.36); transform: scale(1.1); }
.dot-hu { bottom: calc(var(--orbit-size) * 0.03);    right: 0; }

/* Two-column hero from tablet up */
@media (min-width: 768px) {
  .hero-inner { grid-template-columns: 1.1fr 1fr; }
}

/* ===========================================================================
   Cards / forms
   =========================================================================== */
.card {
  max-width: 1080px;
  margin: clamp(-30px, -4vw, -16px) auto var(--gap-lg);
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--card-pad);
  margin-left: var(--gutter);
  margin-right: var(--gutter);
}
@media (min-width: 1140px) {
  .card { margin-left: auto; margin-right: auto; }
}
.card h2 { margin: 0 0 12px; font-size: var(--fs-xl); }
.card .muted { color: var(--ink-soft); margin: 0 0 var(--gap); font-size: var(--fs-sm); line-height: 1.55; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}
.form-grid label {
  display: flex; flex-direction: column;
  font-size: var(--fs-xs); font-weight: 700; color: var(--ink-soft);
}
.form-grid input,
.form-grid select,
.form-grid textarea {
  margin-top: 6px; padding: 12px 14px;
  font-size: max(16px, var(--fs-sm)); /* 16px+ on mobile prevents iOS zoom-on-focus */
  border: 1px solid var(--line); border-radius: 10px;
  background: #fafcfd;
  color: var(--ink);
  font-family: inherit;
  min-height: 44px;
  width: 100%;
}
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  outline: 2px solid var(--primary-2);
  border-color: var(--primary);
  background: white;
}
.form-submit { grid-column: 1 / -1; margin-top: 8px; min-height: 48px; width: 100%; }
.form-grid-inner   { grid-column: 1/-1; display: grid; grid-template-columns: 1fr; gap: var(--gap); }
.fieldset-spans-2  { grid-column: 1/-1; }
.form-grid label.span-2 { grid-column: 1 / -1; }

/* Two-col form fields from tablet up */
@media (min-width: 640px) {
  .form-grid       { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ----- Phone country-code + local digits row ----- */
.phone-row { display: flex; gap: 8px; margin-top: 6px; flex-wrap: nowrap; }
.phone-row select {
  flex: 0 0 auto; max-width: 200px;
  padding: 12px 10px; font-size: max(14px, var(--fs-sm));
  border: 1px solid var(--line); border-radius: 10px;
  background: #fafcfd; color: var(--ink);
  cursor: pointer; margin-top: 0; min-height: 44px;
}
.phone-row input[type="tel"] { flex: 1 1 auto; min-width: 0; margin-top: 0; }
.phone-row select:focus,
.phone-row input[type="tel"]:focus {
  outline: 2px solid var(--primary-2);
  border-color: var(--primary); background: white;
}

/* ----- intl-tel-input integration (don't override padding-left) ----- */
.iti { width: 100%; display: block; margin-top: 6px; }
.iti__tel-input,
.iti input[type="tel"] {
  padding-top: 12px !important; padding-bottom: 12px !important;
  padding-right: 14px !important;
  font-size: max(16px, var(--fs-sm)) !important;  /* prevents iOS zoom */
  border: 1px solid var(--line) !important; border-radius: 10px !important;
  background: #fafcfd !important;
  color: var(--ink) !important;
  width: 100% !important;
  box-sizing: border-box !important;
  min-height: 44px;
}
.iti__tel-input:focus, .iti input[type="tel"]:focus {
  outline: 2px solid var(--primary-2) !important;
  border-color: var(--primary) !important;
  background: white !important;
}
.iti__country-list { border-radius: 10px; box-shadow: 0 8px 24px rgba(13, 44, 59, 0.15); font-size: 14px; max-height: min(280px, 50vh); }
.iti__selected-dial-code { font-weight: 600; }
.iti__flag-container     { z-index: 2; }

fieldset {
  border: 1px solid var(--line); border-radius: 14px;
  padding: clamp(14px, 3vw, 18px); margin: 0 0 14px;
  background: #fafcfd; min-width: 0;
}
fieldset legend {
  font-weight: 700; padding: 0 8px; color: var(--ink);
  font-size: var(--fs-sm);
}
details { border: 1px solid var(--line); border-radius: 14px; padding: 0; background: #fcfdfe; }
details > summary {
  padding: 14px 18px; cursor: pointer; font-weight: 700; color: var(--primary);
  list-style: none; font-size: var(--fs-sm); min-height: 48px;
  display: flex; align-items: center;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: '▸ '; transition: transform 0.2s; display: inline-block; margin-right: 4px; }
details[open] > summary::before { transform: rotate(90deg); }
details[open] > summary { border-bottom: 1px solid var(--line); }
details > fieldset { margin: 14px; border: none; background: transparent; padding: 0 0 14px; }

.how .steps {
  padding-left: 20px; line-height: 1.7;
  color: var(--ink-soft); font-size: var(--fs-sm);
}
.how strong { color: var(--ink); }
.footer {
  padding: clamp(20px, 4vw, 36px) var(--gutter);
  padding-bottom: max(clamp(20px, 4vw, 36px), env(safe-area-inset-bottom));
  text-align: center;
  color: var(--ink-soft);
  font-size: var(--fs-xs);
}

/* ===========================================================================
   Scan page — full-viewport camera with HUD
   =========================================================================== */
.page-scan {
  background: var(--bg-deep);
  color: white;
  min-height: 100vh;
  min-height: 100dvh;     /* dvh accounts for mobile browser chrome */
}
.page-scan .topbar { background: rgba(7,24,42,0.85); border-bottom-color: rgba(255,255,255,0.05); }
.page-scan .topbar-link { color: rgba(255,255,255,0.7); }
.page-scan .brand-name-accent { color: var(--primary-2); }

.scan-stage {
  max-width: 760px; margin: 0 auto;
  padding: var(--gutter);
  padding-bottom: max(var(--gutter), env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center;
  gap: 14px;
}
.scan-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: clamp(14px, 3vw, 24px);
  overflow: hidden;
  background: #000;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
/* On portrait phones the camera is portrait too; allow the frame to be
   taller (3:4) so the user's face fills more of it. */
@media (max-width: 640px) and (orientation: portrait) {
  .scan-frame { aspect-ratio: 3/4; }
}

#video, .scan-canvas, .scan-overlay {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.scan-canvas { display: none; }
#video { transform: scaleX(-1); }
.scan-overlay { transform: scaleX(-1); pointer-events: none; }
.overlay-oval { stroke-opacity: 0.7; }
.overlay-roi  { stroke-opacity: 0.9; }

.scan-hud {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: clamp(10px, 2vw, 16px) clamp(12px, 2.5vw, 18px);
  background: linear-gradient(0deg, rgba(0,0,0,0.78), rgba(0,0,0,0));
  color: white;
}
.hud-progress { width: 100%; height: 6px; background: rgba(255,255,255,0.2); border-radius: 999px; overflow: hidden; }
.hud-progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--primary-2)); transition: width 0.2s linear; }
.hud-row {
  display: flex; justify-content: space-between; gap: 8px;
  margin-top: 8px; font-size: var(--fs-xs); opacity: 0.9;
  flex-wrap: wrap;
}
.hud-pulse { margin-top: 8px; background: rgba(255,255,255,0.07); border-radius: 12px; padding: 6px 10px; }
#pulse-canvas { width: 100%; height: clamp(48px, 12vw, 80px); display: block; }
.pulse-meta {
  display: flex; justify-content: space-between;
  font-size: var(--fs-xs); opacity: 0.8; margin-top: 4px;
}
.scan-tip {
  color: rgba(255,255,255,0.7);
  margin-top: 10px;
  font-size: var(--fs-sm);
  text-align: center;
  line-height: 1.4;
  padding: 0 8px;
}
.hud-row-tags { font-size: 11px; opacity: 0.75; margin-top: 4px; gap: 6px; }
.hud-tag      { background: rgba(255,255,255,0.1); padding: 3px 8px; border-radius: 999px; white-space: nowrap; }

.scan-overlay-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; transform: scaleX(-1);
}

/* ===========================================================================
   Results / dashboard
   =========================================================================== */
.page-results { background: var(--bg); }
.report {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--gutter);
  padding-bottom: max(var(--gutter), env(safe-area-inset-bottom));
}

.hero-report {
  background: linear-gradient(135deg, #2c0810 0%, #4d1019 60%, #260307 100%);
  color: white;
  border-radius: var(--radius-lg);
  padding: clamp(20px, 4vw, 36px);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap-lg);
  margin-bottom: var(--gap-lg);
  box-shadow: var(--shadow);
}
@media (min-width: 768px) {
  .hero-report { grid-template-columns: 1fr 1fr; }
}
.hero-eyebrow {
  background: rgba(255,255,255,0.1);
  padding: 4px 10px; border-radius: 999px;
  display: inline-block;
  font-size: var(--fs-xs);
  letter-spacing: 1.5px; font-weight: 700;
}
.hero-report h1 {
  font-size: var(--fs-3xl);
  margin: 12px 0 16px;
  line-height: 1.1;
}
.meta-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.meta-chip {
  background: rgba(255,255,255,0.1);
  padding: 6px 12px; border-radius: 999px;
  font-size: var(--fs-xs);
}

.score-card {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: clamp(14px, 2.5vw, 22px);
}
.score-label {
  font-size: var(--fs-xs); opacity: 0.7;
  text-transform: uppercase; letter-spacing: 1.5px;
}
.score-value {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 800; line-height: 1;
}
.score-value small { font-size: 0.4em; opacity: 0.7; }
.score-band { font-weight: 700; opacity: 0.9; margin-bottom: 12px; }

/* Donut KPIs — single column on phone, 3 on desktop */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap-lg);
}
.donut {
  background: white;
  border-radius: var(--radius);
  padding: clamp(14px, 2.5vw, 22px);
  text-align: center;
  box-shadow: var(--shadow);
}
.donut-svg { width: clamp(110px, 22vw, 150px); height: clamp(110px, 22vw, 150px); }
.donut-label {
  font-weight: 700; margin-top: 6px;
  color: var(--ink); letter-spacing: 1px;
  font-size: var(--fs-sm);
}

.section-title {
  display: flex; align-items: center; gap: 12px;
  margin: clamp(12px, 2vw, 18px) 0 var(--gap);
  color: var(--ink-soft);
  font-size: var(--fs-xs); letter-spacing: 1.5px;
}
.section-title::before, .section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.section-title span {
  background: white; padding: 6px 14px; border-radius: 999px;
  box-shadow: var(--shadow); font-weight: 700; color: var(--ink);
}

.grid { display: grid; gap: var(--gap); }
.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: 1fr; }
@media (min-width: 640px)  { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.metric-card {
  background: white;
  border-radius: 18px;
  padding: clamp(14px, 2.5vw, 22px);
  box-shadow: var(--shadow);
  position: relative;
  min-width: 0;
}
.metric-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
}
.metric-card h3 {
  margin: 0 0 6px;
  font-size: var(--fs-lg);
  color: var(--bad);
  display: flex; align-items: center; gap: 8px;
  min-width: 0;
}
.metric-icon { font-size: 1.1em; flex-shrink: 0; }
.metric-desc {
  color: var(--ink-soft); font-size: var(--fs-xs);
  margin: 0 0 12px; line-height: 1.5;
}
.metric-value {
  font-size: var(--fs-2xl);
  font-weight: 800; color: var(--ink); line-height: 1;
}
.metric-value small {
  font-size: 0.45em; color: var(--ink-soft);
  margin-left: 4px; font-weight: 600;
}
.metric-badge {
  font-size: var(--fs-xs); font-weight: 700;
  padding: 6px 12px; border-radius: 999px;
  background: #e8f7ec; color: var(--good); white-space: nowrap;
}
.metric-badge.warn { background: #fff5e0; color: var(--warn); }
.metric-badge.bad  { background: #fde6e6; color: var(--bad); }
.metric-badge.ok   { background: #e8f7ec; color: var(--good); }

.metric-head-right { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.tier-badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.4px;
  border: 1px solid currentColor; white-space: nowrap;
}
.tier-measured   { color: #1b9aaa; background: #e8f8fa; border-color: #b6e6ec; }
.tier-calculated { color: #5b3fc7; background: #f0ecfb; border-color: #d2c8f0; }
.tier-estimated  { color: #b78103; background: #fff5e0; border-color: #f3dcaa; }

.metric-note {
  font-size: 11px; color: var(--ink-soft);
  margin: 10px 0 0; font-style: italic; line-height: 1.4;
}
.engine-line {
  margin-top: 14px; opacity: 0.85; font-size: var(--fs-xs);
  background: rgba(255,255,255,0.08); padding: 6px 12px; border-radius: 999px;
  display: inline-block;
}
.legend {
  background: white; border-radius: 12px;
  padding: 14px clamp(14px, 2.5vw, 18px);
  box-shadow: var(--shadow);
  font-size: var(--fs-xs); color: var(--ink-soft);
  margin-bottom: var(--gap); line-height: 1.8;
}
.legend strong { color: var(--ink); margin-right: 8px; }

/* ----- Dual score (Vitals + Skin) ----- */
.dual-score { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 480px) { .dual-score { grid-template-columns: 1fr 1fr; } }
.score-card-skin {
  background: linear-gradient(135deg, rgba(232,69,69,0.18), rgba(255,255,255,0.05));
  border-color: rgba(232,69,69,0.25);
}

/* ----- Tabs — horizontally scrollable on phone ----- */
.tab-strip {
  display: flex; gap: 4px;
  background: white; border-radius: 999px; padding: 4px;
  box-shadow: var(--shadow);
  margin-bottom: var(--gap);
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;            /* Firefox */
}
.tab-strip::-webkit-scrollbar { display: none; }
.tab-btn {
  border: 0; background: transparent; cursor: pointer;
  padding: 10px clamp(14px, 3vw, 22px);
  border-radius: 999px;
  font-weight: 700; color: var(--ink-soft);
  font-size: var(--fs-sm);
  transition: all 0.2s;
  white-space: nowrap;
  min-height: 40px;
  font-family: inherit;
}
.tab-btn:hover:not(.tab-active):not(:disabled) { color: var(--ink); }
.tab-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.tab-btn.tab-active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
}
.tab-pane { display: none; }
.tab-pane-active { display: block; }

/* ----- Skin Age card ----- */
.skin-age-card {
  background: linear-gradient(135deg, #fff 0%, #fff5f5 100%);
  border-radius: 18px;
  padding: clamp(16px, 3vw, 26px);
  box-shadow: var(--shadow);
  margin-bottom: var(--gap);
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: center;
}
@media (min-width: 480px) {
  .skin-age-card { grid-template-columns: 1fr auto; }
}
.skin-age-card h3 { margin: 0 0 6px; color: var(--accent); font-size: var(--fs-lg); }
.skin-age-card p  { margin: 0; color: var(--ink-soft); font-size: var(--fs-xs); }
.skin-age-value { font-size: clamp(2.4rem, 6vw, 3.6rem); font-weight: 800; color: var(--ink); line-height: 1; }
.skin-age-value small {
  display: block; font-size: 0.25em; color: var(--ink-soft);
  font-weight: 500; margin-top: 6px;
}
.recommend-card-skin { background: linear-gradient(135deg, #fff5f7 0%, #ffe9ec 100%); }

/* ----- Scan Verification card ----- */
.verification-card {
  background: white; border-radius: 18px;
  padding: clamp(14px, 3vw, 22px);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
  margin-bottom: var(--gap);
  align-items: center;
}
@media (min-width: 640px) {
  .verification-card { grid-template-columns: minmax(180px, 240px) 1fr; }
}
.verification-photo {
  position: relative; line-height: 0;
  border-radius: 12px; overflow: hidden;
  border: 2px solid #7fb800;
}
.verification-photo img { width: 100%; height: auto; display: block; }
.verified-badge {
  position: absolute; top: 8px; right: 8px;
  background: #7fb800; color: white;
  font-size: 11px; font-weight: 800; letter-spacing: 0.4px;
  padding: 4px 10px; border-radius: 999px;
}
.verification-meta h3 { margin: 0 0 6px; color: var(--brand-blue, #0d3b66); font-size: var(--fs-lg); }
.verification-meta p  { margin: 0 0 12px; color: var(--ink-soft); font-size: var(--fs-xs); line-height: 1.5; }
.verification-grid {
  display: grid; grid-template-columns: max-content 1fr;
  gap: 6px 12px; font-size: var(--fs-xs); margin: 0;
}
.verification-grid dt { color: var(--ink-soft); font-weight: 600; }
.verification-grid dd { margin: 0; color: var(--ink); word-break: break-word; }
.verification-grid code {
  background: #f4f7fa; padding: 2px 6px; border-radius: 4px;
  font-size: 11px; color: var(--ink); word-break: break-all;
}

/* ----- Consent block ----- */
.consent-block { background: #fafcfd; }
.consent-text  {
  margin: 0 0 12px; color: var(--ink-soft);
  font-size: var(--fs-xs); line-height: 1.55;
}
.consent-row {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: var(--fs-sm); color: var(--ink); cursor: pointer;
  line-height: 1.5;
}
.consent-row input[type=checkbox] { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }

/* ----- Range bar ----- */
.range-bar { margin-top: 14px; position: relative; }
.range-track { display: flex; height: 8px; border-radius: 999px; overflow: hidden; }
.range-track .seg { background: var(--fill, #ccc); display: block; font-size: 0; flex: 1; }
.range-marker {
  position: absolute; top: -4px; width: 4px; height: 16px;
  background: var(--ink); border-radius: 2px; transform: translateX(-50%);
  box-shadow: 0 0 0 3px white;
}
.range-axis {
  position: relative; height: 16px; margin-top: 4px;
  font-size: 11px; color: var(--ink-soft);
}
.range-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }

/* ----- Mini cards ----- */
.mini-cards {
  margin-top: var(--gap);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--gap-sm);
}
.mini-card {
  background: var(--bg-dark); color: white;
  border-radius: 14px; padding: 14px 16px;
}
.mini-card span { display: block; font-size: var(--fs-xs); opacity: 0.7; margin-bottom: 6px; }
.mini-card strong { font-size: var(--fs-xl); font-weight: 800; }
.mini-card small  { font-size: var(--fs-xs); opacity: 0.7; font-weight: 500; }

/* ----- Recommend / disclaimer cards ----- */
.recommend-card {
  background: linear-gradient(135deg, #fff5f7 0%, #ffe9ec 100%);
  border-radius: 18px;
  padding: clamp(20px, 4vw, 32px);
  margin-top: var(--gap-lg);
  box-shadow: var(--shadow);
}
.recommend-card h2 { margin: 0 0 16px; color: var(--accent); }
.rec-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}
@media (min-width: 640px) { .rec-grid { grid-template-columns: 1fr 1fr; } }
.rec-grid h4 { margin: 0 0 8px; }
.rec-grid ul { margin: 0; padding-left: 18px; line-height: 1.6; color: var(--ink); font-size: var(--fs-sm); }

.disclaimer {
  margin-top: var(--gap-lg);
  padding: clamp(16px, 3vw, 26px);
  background: white;
  border-radius: var(--radius);
  border-left: 4px solid var(--bad);
  box-shadow: var(--shadow);
}
.disclaimer h3 { margin: 0 0 8px; }
.disclaimer p { margin: 0; color: var(--ink-soft); line-height: 1.6; font-size: var(--fs-sm); }

/* ===========================================================================
   Accessibility helpers
   =========================================================================== */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ===========================================================================
   Print — clean PDF-friendly report when user uses browser Print
   =========================================================================== */
@media print {
  body { background: white; color: black; }
  .topbar, .footer, .btn, .tab-strip { display: none !important; }
  .card, .donut, .metric-card, .recommend-card, .disclaimer, .verification-card {
    box-shadow: none; border: 1px solid #ddd; break-inside: avoid;
  }
  .page-scan, .page-landing { display: none; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
