/* Responder app — "Maximum Clarity" design language.
   The whole screen is the status: white = input needed, green = GO,
   amber = CODE, red = RETURN. Giant type, square corners, no decoration.
   Built for a panicked stranger outdoors: readable at arm's length in
   sunlight, one decision per screen, 64px+ targets. */
* { margin: 0; padding: 0; box-sizing: border-box; }
/* Author display rules (e.g. .screen{display:flex}) override the UA's
   [hidden]{display:none} — restore hidden's meaning unconditionally. */
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #ffffff;
  color: #0a0a0a;
  -webkit-text-size-adjust: 100%;
}

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  padding: calc(20px + env(safe-area-inset-top)) 22px calc(24px + env(safe-area-inset-bottom));
  text-align: left;
}

/* --- shared type ----------------------------------------------------------- */
.kicker {
  font-size: 14px; font-weight: 900; letter-spacing: 0.18em;
}
h1 {
  font-size: 30px; line-height: 1.1; font-weight: 900; letter-spacing: -0.02em;
  max-width: 24ch;
}
p { font-size: 16px; font-weight: 600; line-height: 1.4; max-width: 36ch; }
.small { font-size: 14px; font-weight: 700; color: #525252; }
.error { color: #b91c1c; font-weight: 800; font-size: 17px; }

button { font-family: inherit; cursor: pointer; touch-action: manipulation; }

/* Primary action: signage block button, colour set per screen below */
.mega {
  width: 100%;
  min-height: 76px;
  font-size: 19px; font-weight: 900; letter-spacing: 0.02em;
  border: 4px solid #0a0a0a;
  background: #0a0a0a; color: #fff;
  border-radius: 0;
}
.mega:active { transform: scale(0.985); }

.linklike {
  background: none; border: none;
  color: #1d4ed8; text-decoration: underline;
  font-size: 16px; font-weight: 700; min-height: 48px; padding: 8px 0;
  text-align: left;
}
a.linklike { display: inline-flex; align-items: center; }
.row { display: flex; flex-wrap: wrap; gap: 4px 20px; align-items: center; }

/* --- 1. JOIN (white) ------------------------------------------------------- */
#screen-join { background: #fff; }
#screen-join .brand { font-size: 14px; font-weight: 900; letter-spacing: 0.18em; color: #b91c1c; }
.code-boxes { display: flex; gap: 12px; }
.code-boxes input {
  width: 72px; height: 94px;
  font-size: 52px; text-align: center; font-weight: 900;
  border: 4px solid #0a0a0a; border-radius: 0;
  color: #0a0a0a; background: #fff;
  caret-color: #b91c1c;
}
.code-boxes input:focus { outline: 4px solid #b91c1c; outline-offset: -4px; border-color: #b91c1c; }

/* --- 2. CONSENT (white, giant green start) --------------------------------- */
#screen-consent { background: #fff; }
#screen-consent .mega { background: #15803d; border-color: #15803d; color: #fff; min-height: 92px; }

/* --- 3. OUTBOUND (solid green = GO) ---------------------------------------- */
#screen-outbound { background: #15803d; color: #fff; gap: 14px; justify-content: flex-start; }
#screen-outbound .linklike { color: #fff; }
.banner { background: none; padding: 0; }
.banner-title { font-size: 14px; font-weight: 900; letter-spacing: 0.18em; }
.banner-detail { font-size: 54px; font-weight: 900; line-height: 1; margin-top: 4px; }
.banner-sub { font-size: 20px; font-weight: 800; line-height: 1.25; margin-top: 8px; min-height: 25px; }
#screen-outbound .mega { background: #fff; border-color: #fff; color: #14532d; }

/* Map: white block inset on the colour field */
.map {
  width: calc(100% + 44px);
  margin: 0 -22px;
  flex: 1 1 auto;
  min-height: 190px;
  background: #f5f5f4;
  position: relative;
  z-index: 0; /* contain Leaflet's internal z-indexes below the fixed banners */
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.compass-card { display: flex; flex-direction: column; align-items: center; gap: 6px; color: #0a0a0a; }
.compass-arrow { font-size: 90px; line-height: 1; transition: transform 0.4s ease; }
.compass-label { font-size: 20px; font-weight: 900; color: #374151; }
.map .gmap { position: absolute; inset: 0; }

.dest { font-size: 15px; font-weight: 700; opacity: 0.95; max-width: 40ch; }

/* Phone capture: outlined strip on the colour field — never blocks navigation */
.phone-offer {
  width: 100%;
  border: 3px solid rgba(255,255,255,0.85);
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px;
  font-size: 14px; font-weight: 700; color: #fff;
}
.phone-offer-row { display: flex; gap: 8px; }
.phone-offer-row input {
  flex: 1; min-width: 0; min-height: 48px;
  font-size: 18px; font-weight: 700; padding: 0 10px;
  border: none; border-radius: 0; background: #fff; color: #0a0a0a;
}
.phone-offer-row button {
  min-height: 48px; padding: 0 16px;
  border: none; border-radius: 0; font-weight: 900; font-size: 15px;
  background: #0a0a0a; color: #fff;
}
.phone-offer-row button:last-child { background: none; border: 3px solid rgba(255,255,255,0.85); color: #fff; min-width: 48px; }
.phone-offer-error { color: #fecaca; font-weight: 800; }

/* --- 4. CODE (solid amber) ------------------------------------------------- */
#screen-code { background: #facc15; color: #0a0a0a; }
#screen-code .kicker { color: #0a0a0a; }
.access-code {
  font-size: clamp(64px, 24vw, 100px);
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1;
  overflow-wrap: anywhere;
}
.instructions { font-size: 17px; font-weight: 800; max-width: 30ch; }
#screen-code .mega { background: #0a0a0a; border-color: #0a0a0a; color: #facc15; }
#screen-code .linklike { color: #0a0a0a; }

/* --- 5. RETURN (solid red) ------------------------------------------------- */
#screen-return { background: #b91c1c; color: #fff; gap: 14px; justify-content: flex-start; }
#screen-return .linklike { color: #fff; }
#screen-return .mega { background: #fff; border-color: #fff; color: #7f1d1d; }

/* --- 6. DONE / ENDED (white, resolved) ------------------------------------- */
#screen-done, #screen-ended { background: #fff; align-items: flex-start; }
.big-tick {
  width: 110px; height: 110px;
  background: #15803d; color: #fff;
  font-size: 64px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
}
#screen-ended h1 { color: #0a0a0a; }
#screen-ended p { color: #525252; }

/* "What does a defib look like?" modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: #ffffff;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.modal-body {
  display: flex; flex-direction: column; gap: 14px;
  max-width: 460px; width: 100%;
}
.modal-body img {
  width: 100%; height: auto;
  border: 4px solid #0a0a0a;
}
.modal-body p { font-size: 17px; font-weight: 700; max-width: none; }

/* --- fixed overlays -------------------------------------------------------- */
.build-tag {
  position: fixed; bottom: 4px; right: 8px;
  font-size: 11px; font-weight: 700; color: rgba(0,0,0,0.35); z-index: 40;
  mix-blend-mode: multiply;
}
.offline-banner, .wake-banner {
  position: fixed; left: 0; right: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  text-align: center; font-size: 15px; font-weight: 900; letter-spacing: 0.02em;
  z-index: 50;
}
.offline-banner { bottom: 0; background: #0a0a0a; color: #facc15; }
.wake-banner { bottom: 0; background: #0a0a0a; color: #fff; }
.offline-banner:not([hidden]) ~ .wake-banner { bottom: 48px; }
