/* ============================================================
   Shared map surface (Find + Dispatch)
   ============================================================ */
.map {
  position: absolute;
  inset: 0;
  background: var(--color-gray-bg);
  overflow: hidden;
  /* Contain the map's internal layers in their own stacking context at z-index 0
     so an opaque map can never render above the floating cards (z-index 10+). */
  z-index: 0;
  isolation: isolate;
}
.map__canvas { position: absolute; inset: 0; }

/* ---- Real map: Google Maps embed iframe ---- */
.epi-gmap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  z-index: 1;
}

/* Fallback stylized map grid when no tile layer loads */
.map__grid {
  position: absolute;
  inset: -20%;
  background-image:
    linear-gradient(var(--color-gray-divider) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-gray-divider) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.7;
}
.map__road {
  position: absolute;
  background: #fff;
  box-shadow: 0 0 0 1px var(--color-gray-divider);
}

/* Pulsing marker (nearest cabinet / patient) */
.marker {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 5;
}
.marker__dot {
  position: relative;
  z-index: 2;
  display: block;      /* span defaults to inline → width/height ignored, collapses to a sliver */
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-red);
  border: 4px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.28);
}
.marker__ring {
  position: absolute;
  top: 50%; left: 50%;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--color-red);
  transform: translate(-50%, -50%);
  animation: pulse-ring 2s var(--ease-out) infinite;
}
.marker__ring:nth-child(2) { animation-delay: 0.6s; }
@keyframes pulse-ring {
  0%   { opacity: 0.5; transform: translate(-50%,-50%) scale(1); }
  100% { opacity: 0;   transform: translate(-50%,-50%) scale(5); }
}
@media (prefers-reduced-motion: reduce) {
  .marker__ring { animation: none; opacity: 0.25; transform: translate(-50%,-50%) scale(3); }
}

.pin {
  position: absolute;
  transform: translate(-50%, -100%);
  z-index: 4;
  color: var(--color-gray-text);
}
.pin svg { width: 26px; height: 26px; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2)); }

.ambulance {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 5;
  transition: top 1s linear, left 1s linear;
}
.ambulance__badge {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: var(--color-green);
  color: #fff;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: var(--shadow-card);
}
.ambulance__badge svg { width: 18px; height: 18px; }

/* ============================================================
   Screen 1 — Find
   ============================================================ */
.find { position: relative; }
.find__top {
  position: absolute;
  top: max(var(--space-4), calc(env(safe-area-inset-top) + var(--space-2)));
  left: var(--space-4);
  right: var(--space-4);
  z-index: 10;
}
.find__bottom {
  position: absolute;
  left: var(--space-4);
  right: var(--space-4);
  bottom: calc(var(--tabbar-h) + var(--space-3));
  z-index: 10;
}
.find__route {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.find__route-icon {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: var(--radius-md);
  background: rgba(224,49,49,0.1);
  color: var(--color-red-dark);
}
/* Welcome / location pre-prompt: a calm, branded first screen rather than a
   dim overlay. One message, one action. */
.pre-prompt {
  position: absolute;
  inset: 0;
  z-index: 30;
  background:
    radial-gradient(130% 55% at 50% -8%, rgba(224, 49, 49, 0.09), transparent 65%),
    var(--color-white);
  padding: max(var(--space-5), calc(env(safe-area-inset-top) + var(--space-2))) var(--space-5)
           calc(var(--tabbar-h) + var(--space-3));
}
.welcome {
  height: 100%;
  max-width: 340px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}
.welcome__hero {
  margin: auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
}
.welcome__logo {
  width: 76px; height: 76px;
  border-radius: 22px;
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-2);
}
.welcome__brand { color: var(--color-red-dark); letter-spacing: 0.14em; }
.welcome__hero .display { font-size: 32px; }
.welcome__why {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  text-align: left;
  background: var(--color-gray-bg);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  color: var(--color-gray-text);
}
.welcome__why svg { flex: 0 0 auto; width: 18px; height: 18px; color: var(--color-red-dark); margin-top: 2px; }
.welcome__fine {
  margin-top: var(--space-3);
  font-size: 12px;
  text-align: center;
  color: var(--color-gray-text);
}
.welcome__error {
  margin-top: var(--space-3);
  font-size: 13px;
  text-align: center;
  color: var(--color-red);
}

.status-note {
  display: flex; align-items: center; gap: var(--space-2);
  margin-top: var(--space-3);
  color: var(--color-gray-text);
  font-size: 13px;
}

/* ============================================================
   Screen 2 — Recognize
   ============================================================ */
.recognize { position: relative; background: #000; }
.recognize__video, .recognize__overlay {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
.recognize__video { object-fit: cover; }
.recognize__overlay { z-index: 2; pointer-events: none; }

/* Front camera: mirror like a normal selfie view, not the raw "backwards"
   sensor feed. The overlay canvas mirrors right along with the video —
   its face-tracking box is drawn from un-mirrored landmark coordinates, so
   mirroring both together keeps them visually aligned without touching any
   of the detection math. */
.recognize--mirrored .recognize__video,
.recognize--mirrored .recognize__overlay {
  transform: scaleX(-1);
}

.recognize__toolbar {
  position: absolute;
  top: max(var(--space-4), calc(env(safe-area-inset-top) + var(--space-2)));
  left: 0; right: 0;
  z-index: 6;
  display: flex;
  justify-content: center;
}
.recognize__flip {
  position: absolute;
  top: max(var(--space-4), calc(env(safe-area-inset-top) + var(--space-2)));
  right: var(--space-4);
  z-index: 6;
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border: 1.5px solid rgba(255,255,255,0.5);
  border-radius: var(--radius-pill);
  background: rgba(0,0,0,0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
}
.recognize__flip svg { width: 24px; height: 24px; }
.recognize__flip:active { background: rgba(0,0,0,0.75); transform: scale(0.94); }
.recognize__flip[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }
.recognize__badges {
  position: absolute;
  top: 40%;
  left: 0; right: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  pointer-events: none;
}
.recognize__sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 7;
  background: rgba(20,20,22,0.72);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-6);
  /* Clear the floating tab bar so the ghost "use checklist" link stays tappable. */
  padding-bottom: calc(var(--tabbar-h) + var(--space-4));
  color: #fff;
}
.recognize__sheet .btn--ghost { color: #ff8787; display: block; margin: var(--space-4) auto 0; }
.recognize__result-head { font-weight: 700; font-size: 22px; line-height: 1.2; }
.recognize__result-sub { color: rgba(255,255,255,0.72); font-size: 14px; margin-top: 6px; margin-bottom: var(--space-5); }

/* Urgency pill at the top of the reveal sheet. */
.recognize__pill {
  display: inline-flex; align-items: center;
  padding: 4px 12px; margin-bottom: var(--space-3);
  border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
.recognize__pill--act { background: var(--color-red); color: #fff; }
.recognize__pill--caution { background: var(--color-amber); color: #fff; }
.recognize__pill--low { background: rgba(255,255,255,0.18); color: rgba(255,255,255,0.9); }

/* Persistent honesty line over the viewfinder (hidden behind the reveal sheet). */
.recognize__honesty {
  margin: 0;
  padding: 0 var(--space-4);
  text-align: center;
  font-size: 12px; line-height: 1.4;
  color: rgba(255,255,255,0.75);
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  pointer-events: none;
}

.recognize__scanline {
  position: absolute;
  left: 0; right: 0;
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  text-align: center;
}

.perm-dark {
  position: absolute; inset: 0; z-index: 8;
  display: flex; flex-direction: column; justify-content: center;
  gap: var(--space-4);
  padding: var(--space-8);
  background: #0d0d0f;
  color: #fff;
  text-align: center;
}
.perm-dark .pre-prompt__icon { margin: 0 auto var(--space-2); background: rgba(255,255,255,0.08); color: #fff; }

/* ============================================================
   Screen 3 — Guide
   ============================================================ */
.guide {
  background: var(--color-white);
  padding: max(var(--space-4), calc(env(safe-area-inset-top) + var(--space-2))) var(--space-5) 0;
}
.guide__head { padding-top: var(--space-2); }
.guide__eyebrow { display: flex; align-items: center; justify-content: space-between; }
.guide__progress { margin-top: var(--space-3); }
.guide__stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-4) 0;
  min-height: 0;
}
.guide__art {
  width: 100%;
  /* Shrink the square on short screens so the whole step (art + headline +
     button) fits without scrolling. 42vh caps height-driven overflow; 300px
     caps it on tall screens. */
  max-width: min(300px, 42vh);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  margin-bottom: var(--space-5);
  flex: 0 0 auto;
}
.guide__art svg { width: 100%; height: 100%; }
/* On the hold step the countdown ring + "Keep holding…" occupy the foot, so the
   illustration is shrunk to keep art + headline + subline + ring on one screen
   without scrolling. */
.guide--hold .guide__art { max-width: min(200px, 26vh); margin-bottom: var(--space-3); }
.guide--hold .guide__foot { padding-top: var(--space-2); }
.guide__art-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* The video's own white matte disappears into the screen background; round
     the corners so any sub-pixel edge doesn't read as a hard rectangle. */
  border-radius: var(--radius-lg);
  background: transparent;
}

/* ---- Guide illustration animations (ga-*) ----
   Each step's SVG loops a small scene acting out the instruction. All motion
   is gated behind prefers-reduced-motion; static frames remain fully legible. */
@media (prefers-reduced-motion: no-preference) {
  .ga-squeeze { animation: ga-squeeze 2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
  .ga-pop { animation: ga-pop 0.5s var(--ease-out) 0.3s both; transform-box: fill-box; transform-origin: center; }
  .ga-cap { animation: ga-cap-pull 2.4s linear infinite; }
  .ga-cap-arrow { animation: ga-fade-cycle 2.4s linear infinite; }
  .ga-approach { animation: ga-approach 2.6s linear infinite; }
  .ga-push-arrow { animation: ga-fade-cycle 1.8s linear infinite; }
  .ga-jab { animation: ga-jab 1.8s linear infinite; }
  .ga-burst { animation: ga-burst 1.8s linear infinite; transform-box: fill-box; transform-origin: center; }
  .ga-clock-hand { animation: ga-rotate 3s linear infinite; }
  .ga-lift { animation: ga-lift 2.6s linear infinite; }
  .ga-ring { animation: ga-ring 2.2s linear infinite; }
}
@keyframes ga-squeeze { 0%, 100% { transform: scale(1); } 50% { transform: scale(0.98); } }
@keyframes ga-pop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes ga-cap-pull {
  0%, 12% { transform: translateY(0); opacity: 1; }
  42% { transform: translateY(-30px); opacity: 1; }
  56% { transform: translateY(-42px); opacity: 0; }
  57% { transform: translateY(0); opacity: 0; }
  72%, 100% { transform: translateY(0); opacity: 1; }
}
@keyframes ga-fade-cycle { 0%, 8% { opacity: 0; } 24%, 55% { opacity: 1; } 68%, 100% { opacity: 0; } }
@keyframes ga-approach {
  0% { transform: translateX(-28px); }
  42%, 86% { transform: translateX(0); }
  100% { transform: translateX(-28px); }
}
@keyframes ga-jab {
  0%, 50% { transform: translateX(-6px); }
  62%, 78% { transform: translateX(4px); }
  90%, 100% { transform: translateX(-6px); }
}
@keyframes ga-burst {
  0%, 58% { opacity: 0; transform: scale(0.6); }
  66% { opacity: 1; transform: scale(1); }
  92%, 100% { opacity: 0; transform: scale(1.12); }
}
@keyframes ga-rotate { to { transform: rotate(360deg); } }
@keyframes ga-lift {
  0%, 14% { transform: translate(0, 0) rotate(0deg); }
  52% { transform: translate(-8px, -14px) rotate(-6deg); }
  78% { transform: translate(-8px, -14px) rotate(-6deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}
@keyframes ga-ring {
  0%, 68% { transform: rotate(0deg); }
  74% { transform: rotate(-3deg); }
  80% { transform: rotate(3deg); }
  86% { transform: rotate(-2deg); }
  92% { transform: rotate(1deg); }
  100% { transform: rotate(0deg); }
}
.guide__headline { margin-bottom: var(--space-2); }

/* Device chip + picker (per-device guides) */
.guide__head-actions { display: flex; align-items: center; gap: var(--space-2); }
.guide__device {
  border: 1px solid var(--color-gray-divider);
  background: var(--color-white);
  color: var(--color-ink);
  font-size: 12px; font-weight: 600;
  padding: 5px 10px; border-radius: 999px;
  white-space: nowrap; cursor: pointer;
}
.guide__picker { gap: var(--space-2); }
.guide__picker-list { display: flex; flex-direction: column; gap: var(--space-3); width: 100%; margin-top: var(--space-4); }
.guide__picker-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 18px var(--space-4);
  border: 1px solid var(--color-gray-divider); border-radius: var(--radius-lg);
  background: var(--color-white); color: var(--color-ink);
  font-size: 16px; font-weight: 600; cursor: pointer;
}
.guide__picker-btn:active { background: var(--color-gray-bg, #f4f4f4); }
.guide__picker-chevron { color: var(--color-gray-text); font-size: 20px; }
.guide__stage-inner {
  display: flex; flex-direction: column; align-items: center;
  animation: guide-step-in var(--duration-base) var(--ease-out);
}
@keyframes guide-step-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .guide__stage-inner { animation: guide-fade var(--duration-base) linear; }
  @keyframes guide-fade { from { opacity: 0; } to { opacity: 1; } }
}
.guide__foot {
  padding: var(--space-4) 0 max(var(--space-5), env(safe-area-inset-bottom));
}

/* Countdown ring (step 5) */
.countdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}
.countdown__ring { position: relative; width: 120px; height: 120px; }
.countdown__ring svg { width: 120px; height: 120px; transform: rotate(-90deg); }
.countdown__track { fill: none; stroke: var(--color-gray-divider); stroke-width: 8; }
.countdown__progress {
  fill: none;
  stroke: var(--color-red);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
}
.countdown__num {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-weight: 700; font-size: 44px; color: var(--color-ink);
}

/* ============================================================
   Screen 4 — Dispatch
   ============================================================ */
.dispatch { background: var(--color-gray-bg); }
.dispatch__call {
  padding: max(var(--space-4), calc(env(safe-area-inset-top) + var(--space-2))) var(--space-4) var(--space-3);
}
.dispatch__call-btn { height: 60px; font-size: 20px; box-shadow: var(--shadow-card); }
.dispatch__call-btn .icon { width: 24px; height: 24px; margin-right: 6px; }
.dispatch__call-note {
  margin: var(--space-2) 2px 0;
  font-size: 12px;
  color: var(--color-gray-text);
  text-align: center;
}
/* "I'm on the line with 911" — the ONLY control that can record a real call.
   Deliberately quiet: it sits under the dialer button mid-emergency and must
   never compete with it for attention. */
.dispatch__call-confirm {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%;
  margin-top: var(--space-2);
  padding: 9px 12px;
  border: 1px solid var(--color-gray-divider);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  color: var(--color-gray-text);
  font-size: 13px; font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.dispatch__call-confirm:active { background: var(--color-gray-bg); }
.dispatch__call-confirm .icon { width: 16px; height: 16px; flex: 0 0 auto; }
.dispatch__call-confirmed {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin: var(--space-2) 0 0;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: rgba(47, 158, 68, 0.10);
  color: var(--color-green);
  font-size: 13px; font-weight: 600;
}
.dispatch__call-confirmed .icon { width: 16px; height: 16px; flex: 0 0 auto; }

.dispatch__map {
  position: relative;
  height: 180px;
  margin: 0 var(--space-4);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.dispatch__body { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-4); }
.script-row {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-gray-divider);
  font-size: 15px; line-height: 1.4;
}
.script-row:last-child { border-bottom: none; }
.script-row .icon { color: var(--color-red-dark); width: 20px; height: 20px; flex: 0 0 auto; margin-top: 1px; }
.script-row a { color: var(--color-blue); font-weight: 600; }
.script-row em { color: var(--color-gray-text); font-style: normal; }
.dispatch__body .card > .eyebrow { display: block; margin-bottom: var(--space-2); }
.stopwatch {
  text-align: center;
  padding: var(--space-5) 0 var(--space-2);
}
.stopwatch__num {
  font-weight: 700;
  font-size: 52px;
  line-height: 1;
  color: var(--color-red);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* ============================================================
   Screen 5 — Checklist
   ============================================================ */
.checklist { background: var(--color-white); }
.checklist__head { padding: max(var(--space-6), calc(env(safe-area-inset-top) + var(--space-2))) var(--space-5) var(--space-4); }
.honesty-line { margin-top: var(--space-3); color: var(--color-gray-text); }
.checklist__body { padding: 0 var(--space-5) 200px; }
.checklist__group { margin-top: var(--space-5); }
.checklist__group-label { margin-bottom: var(--space-1); }
.checklist__group .check-row { border-bottom: 1px solid var(--color-gray-divider); }
.checklist__group .check-row:last-child { border-bottom: none; }

.checklist__result {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 10;
  padding: var(--space-4);
  padding-bottom: max(var(--space-5), env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--color-white) 70%, rgba(255,255,255,0));
}
.result-card {
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  animation: result-card-in var(--duration-base) var(--ease-out);
}
@keyframes result-card-in {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .result-card { animation: none; }
}
.result-card--urgent {
  background: var(--color-red);
  color: #fff;
  box-shadow: var(--shadow-elevated);
}
.result-card--urgent .btn { margin-top: var(--space-4); }
.result-card--caution {
  background: var(--color-amber-bg);
  color: var(--color-ink);
  border: 1px solid rgba(232,89,12,0.35);
  box-shadow: var(--shadow-card);
}
.result-card--caution .result-card__head .icon { color: var(--color-amber); }
.result-card--caution .result-card__title { color: var(--color-amber); }
.result-card--caution .btn { margin-top: var(--space-4); }
.result-card--calm {
  background: var(--color-gray-bg);
  color: var(--color-gray-text);
  border: 1px solid var(--color-gray-divider);
}
.result-card__head { display: flex; align-items: center; gap: var(--space-3); }
.result-card__head .icon { flex: 0 0 auto; }
.result-card__title { font-weight: 700; font-size: 18px; }
.result-card--calm .result-card__title { color: var(--color-ink); font-weight: 600; }
.result-card__sub { font-size: 14px; margin-top: 4px; opacity: 0.92; }

/* ============================================================
   Screen 6 — Responder Alert
   ============================================================ */
.responder {
  background: var(--color-white);
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-6);
}
.responder__inner { width: 100%; max-width: 360px; margin: auto; }
.alert-bell {
  position: relative;
  width: 120px; height: 120px;
  margin: 0 auto var(--space-6);
}
.alert-bell__core {
  position: absolute; inset: 0;
  margin: auto;
  width: 88px; height: 88px;
  border-radius: 50%;
  background: var(--color-red);
  color: #fff;
  display: grid; place-items: center;
  z-index: 2;
  box-shadow: var(--shadow-card);
}
.alert-bell__core svg { width: 40px; height: 40px; }
.alert-bell__ring {
  position: absolute; top: 50%; left: 50%;
  width: 88px; height: 88px;
  border-radius: 50%;
  background: var(--color-red);
  transform: translate(-50%,-50%);
  animation: pulse-ring 2s var(--ease-out) infinite;
}
.alert-bell__ring:nth-child(2) { animation-delay: 0.6s; }

.info-card { text-align: left; margin: var(--space-6) 0; }
.info-card .info-row {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-gray-divider);
}
.info-card .info-row:last-child { border-bottom: none; }
.info-card .info-row .icon { color: var(--color-gray-text); width: 22px; height: 22px; flex: 0 0 auto; }
.responder__actions { display: flex; flex-direction: column; gap: var(--space-3); }
.responder__caption { margin-top: var(--space-4); color: var(--color-gray-text); font-size: 13px; }

/* ============================================================
   Screen 7 — First-Responder View
   ============================================================ */
.fresponder { background: var(--color-gray-bg); }
.fresponder__strip {
  display: flex; align-items: center; justify-content: space-between;
  padding: max(var(--space-4), calc(env(safe-area-inset-top) + var(--space-2))) var(--space-4) var(--space-3);
  background: #fff;
  box-shadow: var(--shadow-card);
  z-index: 10;
}
.status-dot {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-weight: 700; font-size: 15px;
}
.status-dot::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: var(--color-green);
  box-shadow: 0 0 0 0 rgba(47,158,68,0.5);
  animation: dot-pulse 1.6s ease-out infinite;
}
@keyframes dot-pulse {
  0% { box-shadow: 0 0 0 0 rgba(47,158,68,0.5); }
  100% { box-shadow: 0 0 0 10px rgba(47,158,68,0); }
}
@media (prefers-reduced-motion: reduce) { .status-dot::before { animation: none; } }
.fresponder__map { position: relative; flex: 1; }
.fresponder__map .badge-glass { position: absolute; top: var(--space-3); left: 50%; transform: translateX(-50%); z-index: 6; }
.route-you { position: absolute; transform: translate(-50%,-50%); z-index: 5; }
.route-you__dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--color-blue); border: 3px solid #fff; box-shadow: var(--shadow-card);
}
.fresponder__foot {
  background: #fff;
  padding: var(--space-5) var(--space-4) max(var(--space-5), env(safe-area-inset-bottom));
  box-shadow: 0 -2px 12px rgba(0,0,0,0.05);
}
.fresponder__foot .row { display: flex; gap: var(--space-3); margin-top: var(--space-4); }
.fresponder__foot .row .btn { flex: 1; }

/* ============================================================
   Screen 8 — Medic Handoff
   ============================================================ */
.medic { background: var(--color-gray-bg); }
.medic__bar {
  background: var(--color-ink);
  color: #fff;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  padding: max(var(--space-4), calc(env(safe-area-inset-top) + var(--space-2))) var(--space-4) var(--space-4);
}
.medic__body { padding: var(--space-4); }
.medic__thumb {
  height: 130px;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  margin-top: var(--space-3);
  background: var(--color-gray-bg);
  box-shadow: inset 0 0 0 1px var(--color-gray-divider);
}
.medic__foot { padding: 0 var(--space-4) max(var(--space-5), env(safe-area-inset-bottom)); }

/* ============================================================
   Screen 9 — Incident Summary
   ============================================================ */
.incident { background: var(--color-gray-bg); }

.timeline__row {
  display: flex;
  gap: var(--space-3);
}
.timeline__rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 12px;
  flex-shrink: 0;
}
.timeline__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-blue);
  margin-top: 5px;
  flex-shrink: 0;
}
.timeline__row:not(:last-child) .timeline__rail::after {
  content: '';
  flex: 1;
  width: 2px;
  background: var(--color-gray-divider);
  margin-top: 2px;
}
.timeline__content { padding-bottom: var(--space-4); }
.timeline__time { font-size: 12px; font-weight: 600; color: var(--color-gray-text); }
.timeline__label { font-size: 15px; color: var(--color-ink); margin-top: 2px; }

/* ============================================================
   Generic app header with back button
   ============================================================ */
.appbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: max(var(--space-4), calc(env(safe-area-inset-top) + var(--space-2))) var(--space-3) var(--space-2);
}
.appbar__title { font-weight: 700; font-size: 17px; }

/* Small utility for stacking spacing */
.stack > * + * { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }

/* ── Responder network: Volunteer opt-in + live volunteer card ────────────── */
/* Blue accent (--color-blue) marks the responder network, distinct from the
   red patient-facing emergency flow. */

.optin { flex: 1; display: flex; flex-direction: column; background: var(--color-gray-bg); }
.optin__head { padding: max(20px, calc(env(safe-area-inset-top) + var(--space-2))) 20px 8px; }
.optin__body { flex: 1; overflow-y: auto; padding: 4px 20px 28px; display: flex; flex-direction: column; gap: 16px; }
.optin__error { margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--color-red-dark); }
.optin__note { font-size: 12px; color: var(--color-gray-text); line-height: 1.5; margin: 0 2px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--color-gray-text); }
.field input, .field select {
  font: inherit; padding: 12px 14px; border: 1px solid var(--color-gray-divider);
  border-radius: var(--radius-sm); background: var(--color-white); color: var(--color-ink);
  -webkit-appearance: none; appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px;
}
.field input:focus, .field select:focus { outline: 2px solid var(--color-blue); outline-offset: 1px; border-color: var(--color-blue); }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toggle-row__label { font-weight: 700; font-size: 16px; }

.switch { position: relative; width: 52px; height: 32px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__slider {
  position: absolute; inset: 0; cursor: pointer; background: var(--color-gray-divider);
  border-radius: var(--radius-pill); transition: background var(--duration-base) var(--ease-out);
}
.switch__slider::before {
  content: ""; position: absolute; left: 3px; top: 3px; width: 26px; height: 26px;
  background: #fff; border-radius: 50%; box-shadow: var(--shadow-card);
  transition: transform var(--duration-base) var(--ease-out);
}
.switch input:checked + .switch__slider { background: var(--color-green); }
.switch input:checked + .switch__slider::before { transform: translateX(20px); }
.switch input:focus-visible + .switch__slider { outline: 2px solid var(--color-blue); outline-offset: 2px; }

.oi-status { margin-top: 14px; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: var(--radius-pill); }
.status-pill .icon { width: 15px; height: 15px; }
.status-pill--on { background: rgba(47, 158, 68, 0.12); color: var(--color-green); }
.status-pill--off { background: var(--color-gray-divider); color: var(--color-gray-text); }

.pill--blue { background: rgba(28, 126, 214, 0.12); color: var(--color-blue); }

.vol-card { margin-top: 16px; border: 1px solid rgba(28, 126, 214, 0.20); }
.vol-card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.vol-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 0; }
.vol-list:empty { margin: 0; }
.vol-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--color-gray-bg); border-radius: var(--radius-sm); }
.vol-row__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-green); flex: 0 0 auto; }
/* "Nobody is coming — call 911". Must not read as ordinary muted body copy. */
.vol-status--urgent { color: var(--color-red-dark); font-weight: 600; }
/* Standing an alert down. Secondary to everything else on the card — it only
   matters once help has actually arrived. */
.vol-end:empty { display: none; }
.vol-end { margin-top: 12px; }
.vol-end__note { margin: 0; font-size: 13px; line-height: 1.4; color: var(--color-gray-text); }
.vol-end__row { display: flex; gap: 8px; margin-top: 10px; }
.vol-end__btn { flex: 1; height: 42px; font-size: 14px; }
.vol-end__error {
  margin: 10px 0 0; font-size: 13px; line-height: 1.4;
  font-weight: 600; color: var(--color-red-dark);
}

.btn--vol { margin-top: 14px; background: var(--color-blue); color: #fff; }
.btn--vol:active { background: #1971C2; }
.route-line path { animation: routeDash 1s linear infinite; }
@keyframes routeDash { to { stroke-dashoffset: -12; } }

/* Official "Sign in with Google" button (light theme), per Google's sign-in
   branding guidelines: 40px tall, #747775 stroke, white fill, 18px logo,
   medium-weight ~Roboto label in #1F1F1F. */
.gsi {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: 40px; padding: 0 12px;
  background: #FFFFFF; border: 1px solid #747775; border-radius: 20px;
  font-family: 'Roboto', -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px; font-weight: 500; letter-spacing: 0.25px; color: #1F1F1F;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background var(--duration-base) var(--ease-out), box-shadow var(--duration-base) var(--ease-out);
}
.gsi:hover { box-shadow: 0 1px 2px rgba(60, 64, 67, 0.30), 0 1px 3px 1px rgba(60, 64, 67, 0.15); }
.gsi:active { background: #F1F3F4; }
.gsi:focus-visible { outline: 2px solid var(--color-blue); outline-offset: 2px; }
.gsi[aria-disabled="true"] { opacity: 0.6; pointer-events: none; }
.gsi__logo { flex: 0 0 auto; }
.gsi__text { white-space: nowrap; }
/* Google Identity Services renders its own <div>/iframe button in here; centre
   it and give it the same footprint as the .gsi placeholder it replaces. */
.gsi-mount { display: flex; justify-content: center; min-height: 44px; }
.gsi-mount > div { max-width: 100%; }

/* ── Scroll fixes ──────────────────────────────────────────────────────────
   .screen is a flex column with overflow:hidden, and each screen's flex:1
   wrapper kept its content-height minimum (flex min-height:auto). Tall content
   grew past the screen bottom and was clipped, so the inner overflow-y regions
   never engaged. Cap the chain and let the designated regions scroll. */
.screen > * { min-height: 0; }
.scroll-y, .optin__body { min-height: 0; }

/* Fixed chrome must keep its size while the scroll region absorbs overflow. */
.dispatch__call, .dispatch__map,
.checklist__head, .medic__bar, .medic__foot,
.guide__head, .guide__foot,
.optin__head, .fresponder__strip, .fresponder__foot { flex: 0 0 auto; }

/* Screens with no dedicated scroll region scroll themselves when the viewport
   is short. margin:auto on the inner block centers when there is room and
   collapses to 0 when there is not, so the top stays reachable. */
.responder { display: flex; flex-direction: column; justify-content: flex-start; overflow-y: auto; -webkit-overflow-scrolling: touch; }
/* Clear the floating tab bar so the last action ("Can't make it") is never
   hidden behind it. The screen-level padding doesn't reach inside this
   centered, self-scrolling region, so pad it directly. */
.responder__inner { padding-bottom: var(--tabbar-h); }
.guide__stage { overflow-y: auto; justify-content: flex-start; -webkit-overflow-scrolling: touch; }
.guide__stage-inner { margin: auto 0; }
.recognize__sheet { max-height: 100%; overflow-y: auto; }
.pre-prompt { overflow-y: auto; }


/* ── Persistent tab bar ─────────────────────────────────────────────────────
   The floating tab bar shows on every screen. Its space is reserved
   STRUCTURALLY: each screen gets bottom padding equal to the bar's occupied
   height (bar + its inset from the bottom edge), so content sizes to the
   visible area and screens only scroll when content genuinely overflows —
   no phantom scroll into blank space (native-app feel). Full-bleed screens
   (find, recognize) keep content flowing under the glass bar and clear it
   with their own absolute offsets. */
:root { --tabbar-h: calc(62px + max(var(--space-4), env(safe-area-inset-bottom))); }
.screen { padding-bottom: calc(var(--tabbar-h) + var(--space-2)); }
.screen[data-screen="find"],
.screen[data-screen="recognize"] { padding-bottom: 0; }

/* No rubber-band chaining out of inner scroll regions — feels native. */
.scroll-y, .optin__body, .responder, .guide__stage,
.recognize__sheet, .pre-prompt { overscroll-behavior: contain; }

/* ── My EpiPens (Volunteer screen) ─────────────────────────────────────────── */
.epipens .eyebrow { display: block; }
.ep-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.ep-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; background: var(--color-gray-bg); border-radius: var(--radius-md);
}
.ep-row__main { flex: 1; min-width: 0; }
.ep-row__brand { font-weight: 700; font-size: 16px; }
.ep-row__actions { display: flex; gap: 6px; flex: 0 0 auto; }
.ep-icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--color-gray-divider); background: var(--color-white);
  border-radius: var(--radius-sm); color: var(--color-gray-text); font-size: 15px;
}
.ep-icon-btn svg { width: 18px; height: 18px; }
.ep-icon-btn--del { color: var(--color-red-dark); }
.ep-icon-btn:active { background: var(--color-gray-bg); }

.ep-pill {
  display: inline-flex; align-items: center; margin-top: 6px;
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: var(--radius-pill);
}
.ep-pill--green { background: rgba(47,158,68,0.12); color: var(--color-green); }
.ep-pill--amber { background: rgba(240,140,0,0.14); color: #B25B00; }
.ep-pill--red   { background: rgba(224,49,49,0.12); color: var(--color-red-dark); }

/* Scanner + confirm overlay */
.ep-overlay {
  position: absolute; inset: 0; z-index: 60;
  background: rgba(20,20,22,0.55);
  display: flex; flex-direction: column; justify-content: flex-end;
}
.ep-sheet {
  position: relative;
  background: var(--color-white);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-6) var(--space-5)
           calc(max(var(--space-6), env(safe-area-inset-bottom)));
  max-height: 92%; overflow-y: auto;
}
.ep-close {
  position: absolute; top: 12px; right: 12px;
  width: 34px; height: 34px; border-radius: 50%;
  border: none; background: var(--color-gray-bg); color: var(--color-ink);
  font-size: 16px; line-height: 1;
}
.ep-scan__cam {
  position: relative; width: 100%; aspect-ratio: 4 / 3;
  background: #000; border-radius: var(--radius-lg); overflow: hidden;
}
.ep-scan__cam video { width: 100%; height: 100%; object-fit: cover; }
.ep-scan__frame {
  position: absolute; inset: 14% 10%;
  border: 2px dashed rgba(255,255,255,0.85); border-radius: var(--radius-md);
  pointer-events: none;
}
.ep-scan__tip {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 14px 0 0; padding: 10px 12px;
  background: rgba(240,140,0,0.12); color: #B25B00;
  border-radius: var(--radius-sm); font-size: 13px; line-height: 1.4;
}
.ep-scan__tip svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; }
.ep-scan__hint { margin: 10px 2px 0; font-size: 13px; color: var(--color-gray-text); text-align: center; }
.ep-scan__actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.ep-scan__actions .btn--primary { flex: 1; }

.ep-form__photo {
  width: 100%; max-height: 180px; object-fit: contain;
  border-radius: var(--radius-md); background: var(--color-gray-bg);
  margin: 12px 0; border: 1px solid var(--color-gray-divider);
}
.ep-form .h2 { margin-right: 40px; }

/* EpiPen OCR scanning state */
.ep-scanning { text-align: center; padding: var(--space-8) var(--space-5) calc(max(var(--space-6), env(safe-area-inset-bottom))); }
.ep-spinner {
  width: 44px; height: 44px; margin: 0 auto var(--space-4);
  border: 4px solid var(--color-gray-divider); border-top-color: var(--color-blue);
  border-radius: 50%; animation: ep-spin 0.8s linear infinite;
}
@keyframes ep-spin { to { transform: rotate(360deg); } }
.ep-scanning__label { font-weight: 600; margin-bottom: var(--space-4); }
.ep-form__note {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 12px; padding: 10px 12px;
  background: rgba(28,126,214,0.08); color: var(--color-blue);
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
}
.ep-form__note svg { width: 16px; height: 16px; flex: 0 0 auto; }

/* EpiPens header + scanning sub-note */
.epipens__head { display: flex; align-items: center; justify-content: space-between; }
.ep-scanning__sub { font-size: 12px; color: var(--color-gray-text); margin: -8px 0 16px; }

/* EpiPen scan hint line (prompts manual entry when a scan can't fill the fields) */
.ep-form__diag { font-size: 12px; line-height: 1.4; color: var(--color-gray-text); margin: 0 0 12px; word-break: break-word; }

/* ============================================================
   Short-viewport screen overrides
   These must live here, at the end of the last-loaded stylesheet: rules like
   `.welcome__hero .display` outrank anything set in base.css, so equivalent
   overrides placed there silently never apply.
   Keyed on viewport height, not device — landscape phones, iPad Split View and
   small desktop windows all land here.
   ============================================================ */
@media (max-height: 560px) {
  /* The welcome hero is the tallest fixed block in the app (logo + display line
     + paragraph + privacy card + CTA). Unshrunk, it pushes "Allow location"
     behind the floating tab bar — the first screen a user sees, with its only
     action hidden. Shrink the decorative parts, never the CTA or the copy. */
  .welcome__logo { width: 44px; height: 44px; border-radius: 13px; margin-bottom: 0; }
  .welcome__hero .display { font-size: 24px; }
  .welcome__why { padding: var(--space-3); margin-bottom: var(--space-3); }
  .welcome__fine { margin-top: var(--space-2); }

  /* `.welcome` is height:100% with `margin:auto 0` centring on the hero. On a
     short viewport that combination overflows its own box INSTEAD of scrolling,
     which put "Allow location" — the only action on the first screen — behind
     the floating tab bar with no way to reach it. Letting the block grow past
     the viewport hands the overflow back to .pre-prompt, which already scrolls
     and already reserves --tabbar-h of bottom padding. */
  .welcome { height: auto; min-height: 100%; }
  .welcome__hero { margin: 0 0 var(--space-3); gap: var(--space-2); }

  /* Guide: the illustration is the flexible part — let it give up height so the
     step heading and "Next Step" stay visible together. */
  .guide__stage-inner img, .guide__stage-inner svg { max-height: 34svh; margin-inline: auto; }

  /* Checklist: tighten the header so more rows fit above the verdict card. */
  .checklist__head { padding-top: max(var(--space-3), calc(env(safe-area-inset-top) + var(--space-1))); }
}

/* ── Find: action-first triage (pre-location) ───────────────────────────────
   Replaces the old permission-gate hero. Every row is reachable with no
   permission granted; only the third one asks for location, and it says why
   inline rather than behind a separate explainer card. */
/* The hero used to be centred alone via `margin: auto 0`, which left a large
   hole between the title and the first action. Centring the hero + actions as
   one group instead keeps the pair optically centred while the gap between them
   stays a fixed, designed distance. */
.pre-prompt .welcome__hero { margin: auto 0 var(--space-5); }
.triage { display: flex; flex-direction: column; gap: var(--space-3); width: 100%; margin-bottom: auto; }
.triage__act {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  text-align: left;
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  /* The pre-prompt background is white, so a white fill with a hairline border
     made this read as plain text rather than a control. A raised card — real
     border, shadow, chevron — is what makes it look pressable. */
  border: 1px solid var(--color-gray-divider);
  background: var(--color-white);
  box-shadow: var(--shadow-card);
  color: var(--color-ink);
  text-decoration: none;
  transition: transform var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out);
}
.triage__act:active { box-shadow: 0 1px 3px rgba(17, 24, 39, 0.12); }
/* Pushes the chevron to the trailing edge. */
.triage__act span { flex: 1 1 auto; }
.triage__chevron {
  flex: 0 0 auto;
  font-size: 22px;
  line-height: 1;
  color: var(--color-gray-text);
}
.triage__act--urgent .triage__chevron { color: rgba(255,255,255,0.75); }
.triage__act--call .triage__chevron { color: var(--color-red-dark); }
.triage__act:active { transform: scale(0.985); }
@media (prefers-reduced-motion: reduce) { .triage__act:active { transform: none; } }
.triage__act .icon { flex: 0 0 auto; width: 24px; height: 24px; margin-top: 1px; }
.triage__act span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.triage__act strong { font-size: 17px; font-weight: 700; line-height: 1.25; }
.triage__act small { font-size: 13px; line-height: 1.4; color: var(--color-gray-text); }

/* The emergency path is the visual priority; calling 911 is the second. */
.triage__act--urgent {
  background: var(--color-red);
  border-color: var(--color-red);
  color: #fff;
  box-shadow: var(--shadow-card);
}
.triage__act--urgent small { color: rgba(255,255,255,0.82); }
.triage__act--call { border-color: rgba(224,49,49,0.35); color: var(--color-red-dark); }
.triage__act--call small { color: var(--color-gray-text); }


/* ============================================================
   Scan HUD (Recognize)

   Instrumentation, not decoration. Every row is bound to state the
   vision loop actually produces, so if a model fails to load its row
   says so and stays there. Reports progress only — never findings.
   ============================================================ */
/* HUD and disclaimer share one bottom-anchored column. They were both absolutely
   positioned at first, which meant the gap between them was a magic number that
   had to be re-guessed for every screen width, and got it wrong by 4px at 390.
   Stacking them makes overlap structurally impossible: the disclaimer is not
   decoration and must never end up underneath the panel. */
.recognize__bottom {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(var(--tabbar-h) + var(--space-2));
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 var(--space-3);
  pointer-events: none;
}

.scanhud {
  padding: 12px 14px;
  border-radius: var(--radius-lg, 16px);
  background: rgba(12, 14, 18, 0.62);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  pointer-events: none;
}
.scanhud[hidden] { display: none; }

.scanhud__rows { display: flex; flex-direction: column; gap: 6px; }

.scanhud__row {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  line-height: 1.2;
}
.scanhud__label { color: rgba(255, 255, 255, 0.92); font-weight: 550; }
.scanhud__value {
  color: rgba(255, 255, 255, 0.62);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.scanhud__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
}
/* Calm and clinical: white for working, amber only for a genuine failure.
   No green ticks, and nothing red — red on this screen must mean a finding. */
.scanhud__row[data-state="active"]  .scanhud__dot {
  background: #fff;
  animation: scanhud-pulse 1.6s var(--ease-out, ease-out) infinite;
}
.scanhud__row[data-state="loading"] .scanhud__dot {
  background: rgba(255, 255, 255, 0.55);
  animation: scanhud-pulse 1s var(--ease-out, ease-out) infinite;
}
.scanhud__row[data-state="waiting"] .scanhud__dot { background: rgba(255, 255, 255, 0.32); }
.scanhud__row[data-state="failed"]  .scanhud__dot { background: #ffa8a8; }
.scanhud__row[data-state="failed"]  .scanhud__value { color: #ffa8a8; }

@keyframes scanhud-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

.scanhud__track {
  height: 3px;
  margin-top: 11px;
  border-radius: var(--radius-pill, 99px);
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}
.scanhud__fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: #fff;
  /* Eased, but short: the bar must visibly stop when analysis stops. A long
     transition would keep it gliding after tracking is lost, which is the
     kind of detail that makes a real process look simulated. */
  transition: width 180ms linear;
}
.scanhud--stalled .scanhud__fill { background: rgba(255, 255, 255, 0.45); }

.scanhud__meta {
  margin-top: 7px;
  font-size: 11.5px;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.58);
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  .scanhud__dot { animation: none !important; }
  .scanhud__fill { transition: none; }
}

/* ── Volunteer: terms / disclaimer gate ─────────────────────────────────────
   Shown once per user right after Google sign-in. Deliberately readable rather
   than a scroll-box of legalese nobody reads — each row is one plain-English
   claim with an icon, so the important ones (not medical advice, help is not
   guaranteed, call 911) are actually seen. */
.terms__title { margin: 0; }
.terms__lede { margin: 4px 0 var(--space-4); }
.terms__list { list-style: none; margin: 0 0 var(--space-5); padding: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.terms__row { display: flex; align-items: flex-start; gap: var(--space-3); }
.terms__row .icon { flex: 0 0 auto; width: 20px; height: 20px; margin-top: 2px; color: var(--color-red-dark); }
.terms__head { font-size: 15px; font-weight: 700; line-height: 1.3; }
.terms__body { margin: 2px 0 0; font-size: 13px; line-height: 1.5; color: var(--color-gray-text); }
