/* =========================================================================
   First Response — stylesheet
   -------------------------------------------------------------------------
   Design intent: this is read in a panic, often outdoors, often on a
   cheap or cracked screen, sometimes one-handed. So the visual language
   borrows from safety/rescue signage rather than a typical app: heavy
   weight, high contrast, a reserved hazard-stripe treatment for the one
   truly urgent action (calling for help), and no motion that could
   distract from the task.

   No external fonts or icon libraries are loaded — everything here is
   system fonts + hand-drawn SVG icons, so the very first paint doesn't
   wait on a network request. That's a deliberate trade for an app whose
   whole premise is "works with a bad or no connection".
   ========================================================================= */

:root {
  --ink: #14171a;
  --ink-soft: #3a4147;
  --slate: #5b6570;
  --paper: #ffffff;
  --paper-dim: #f3f5f4;
  --border: #dde2e0;

  --red: #d7263d;
  --red-dark: #a81930;
  --red-bg: #fdecee;

  --green: #0f7a5c;
  --green-dark: #0b5940;
  --green-bg: #e7f5f0;

  --amber: #b3760a;
  --amber-bg: #fff4e0;
  --amber-border: #f0c674;

  --focus: #1c6fd9;

  --radius: 14px;
  --radius-sm: 8px;
  --scale: 1;
  --shadow-sm: 0 1px 2px rgba(20, 23, 26, 0.08);
  --shadow-md: 0 6px 20px rgba(20, 23, 26, 0.12);

  font-size: calc(16px * var(--scale));
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper-dim);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, p, ul, figure {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

a {
  color: inherit;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Visible, generous focus ring everywhere — this app is used one-handed
   and sometimes with assistive tech, so focus must never be invisible. */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

.app-shell {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* -------------------------------------------------------------------- */
/* Utility bar                                                          */
/* -------------------------------------------------------------------- */
.utility-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  gap: 0.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  font-size: 1rem;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--green);
  display: grid;
  place-items: center;
  flex: none;
}

.brand-mark svg {
  width: 15px;
  height: 15px;
  stroke: white;
}

.utility-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.icon-btn {
  border: 1.5px solid var(--border);
  background: var(--paper);
  border-radius: var(--radius-sm);
  min-width: 40px;
  min-height: 40px;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--ink-soft);
}

.icon-btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* -------------------------------------------------------------------- */
/* Hazard stripe — the signature element                                */
/* Doubles as: a calm "here's the emergency number" strip on every      */
/* screen, and an urgent diagonal hazard pattern the moment you open a  */
/* time-critical topic. The stripe pattern is pure CSS, so it costs     */
/* nothing to load and can flip state instantly.                        */
/* -------------------------------------------------------------------- */
.hazard-strip {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0.6rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  background: var(--green-dark);
  color: white;
  transition: background 0.15s ease;
}

.hazard-strip.is-critical {
  background: repeating-linear-gradient(
    -45deg,
    var(--red) 0px,
    var(--red) 22px,
    var(--red-dark) 22px,
    var(--red-dark) 44px
  );
}

.hazard-strip .call-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--ink);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.1rem;
  font-weight: 900;
  font-size: 1rem;
  min-height: 48px;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  white-space: nowrap;
}

.hazard-strip .call-btn svg {
  width: 18px;
  height: 18px;
  stroke: white;
  flex: none;
}

.hazard-strip .strip-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.92;
  line-height: 1.25;
}

/* -------------------------------------------------------------------- */
/* Main content                                                         */
/* -------------------------------------------------------------------- */
main {
  flex: 1;
  padding: 1.1rem 0.9rem 2.5rem;
}

.home-heading {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
}

.home-tagline {
  color: var(--slate);
  font-size: 0.95rem;
  margin-bottom: 1.1rem;
}

.symptom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.symptom-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
  text-align: left;
  background: var(--paper);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 0.8rem;
  min-height: 128px;
  box-shadow: var(--shadow-sm);
}

.symptom-card.is-critical {
  border-color: var(--red);
  border-width: 2px;
}

.symptom-card .icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--green-bg);
  flex: none;
}

.symptom-card.is-critical .icon-wrap {
  background: var(--red-bg);
}

.symptom-card .icon-wrap svg {
  width: 24px;
  height: 24px;
  stroke: var(--green-dark);
}

.symptom-card.is-critical .icon-wrap svg {
  stroke: var(--red-dark);
}

.symptom-card .card-label {
  font-weight: 800;
  font-size: 1rem;
  line-height: 1.2;
}

.symptom-card .card-sub {
  font-size: 0.8rem;
  color: var(--slate);
  line-height: 1.3;
}

.critical-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--red-dark);
  background: var(--red-bg);
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
}

/* -------------------------------------------------------------------- */
/* Detail screen                                                        */
/* -------------------------------------------------------------------- */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: none;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.4rem 0;
  margin-bottom: 0.6rem;
}

.back-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.detail-header {
  margin-bottom: 1rem;
}

.detail-title {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin-bottom: 0.35rem;
}

.detail-sub {
  color: var(--slate);
  font-size: 0.95rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 1rem 0 1.3rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 999px;
  padding: 0.75rem 1.15rem;
  font-weight: 800;
  font-size: 0.95rem;
  min-height: 52px;
  border: 1.5px solid transparent;
  text-decoration: none;
}

.btn svg {
  width: 19px;
  height: 19px;
  flex: none;
}

.btn-call {
  background: var(--red);
  color: white;
}
.btn-call svg { stroke: white; }
.btn-call:hover { background: var(--red-dark); }

.btn-voice {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--border);
}
.btn-voice svg { stroke: var(--ink); }
.btn-voice.is-active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}
.btn-voice.is-active svg { stroke: white; }

section.block {
  margin-bottom: 1.5rem;
}

.block-heading {
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--slate);
  margin-bottom: 0.6rem;
}

.signs-list li {
  position: relative;
  padding-left: 1.1rem;
  margin-bottom: 0.5rem;
  line-height: 1.45;
}

.signs-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--slate);
}

.steps-list {
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.step-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.7rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--paper);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.step-item.is-speaking {
  background: var(--green-bg);
  border-color: var(--green);
}

.step-num {
  counter-increment: step;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 900;
  font-size: 0.9rem;
  display: grid;
  place-items: center;
}

.step-item.is-speaking .step-num {
  background: var(--green-dark);
}

.step-text {
  line-height: 1.5;
  padding-top: 0.15rem;
}

.donot-box {
  background: var(--amber-bg);
  border: 1.5px solid var(--amber-border);
  border-radius: var(--radius);
  padding: 0.9rem 0.95rem;
}

.donot-box .block-heading {
  color: var(--amber);
  margin-bottom: 0.5rem;
}

.donot-box li {
  position: relative;
  padding-left: 1.2rem;
  margin-bottom: 0.45rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

.donot-box li:last-child { margin-bottom: 0; }

.donot-box li::before {
  content: "✕";
  position: absolute;
  left: 0;
  top: 0.05em;
  font-size: 0.75rem;
  font-weight: 900;
  color: var(--amber);
}

.extra-box {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 0.95rem;
}

.extra-box .block-heading {
  margin-bottom: 0.4rem;
}

.extra-box p {
  line-height: 1.55;
}

/* -------------------------------------------------------------------- */
/* Footer / install / about                                             */
/* -------------------------------------------------------------------- */
.app-footer {
  border-top: 1px solid var(--border);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--slate);
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--slate);
  flex: none;
}

.status-dot.is-ready {
  background: var(--green);
}

.footer-links {
  display: flex;
  gap: 0.9rem;
  font-size: 0.8rem;
}

.footer-links button {
  background: none;
  border: none;
  color: var(--ink-soft);
  font-weight: 700;
  padding: 0.25rem 0;
  text-decoration: underline;
}

/* -------------------------------------------------------------------- */
/* Install banner                                                       */
/* -------------------------------------------------------------------- */
.install-banner {
  position: sticky;
  bottom: 0;
  z-index: 30;
  background: var(--ink);
  color: white;
  padding: 0.8rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.18);
}

.install-banner p {
  flex: 1;
  font-size: 0.82rem;
  line-height: 1.35;
}

.install-banner .btn {
  min-height: 42px;
  padding: 0.55rem 0.9rem;
  font-size: 0.85rem;
  background: var(--green);
  color: white;
}

.install-banner .dismiss {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: underline;
  padding: 0.3rem;
}

.install-banner[hidden] {
  display: none;
}

/* -------------------------------------------------------------------- */
/* Modal (about/safety note)                                            */
/* -------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 23, 26, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 40;
  padding: 0;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  background: var(--paper);
  width: 100%;
  max-width: 640px;
  border-radius: 18px 18px 0 0;
  padding: 1.2rem 1.1rem 1.6rem;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-card h2 {
  font-size: 1.15rem;
  font-weight: 900;
  margin-bottom: 0.8rem;
}

.modal-card p {
  line-height: 1.55;
  margin-bottom: 0.9rem;
  color: var(--ink-soft);
}

.modal-close {
  display: block;
  margin-left: auto;
  background: var(--paper-dim);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  font-weight: 800;
  font-size: 0.85rem;
}

@media (min-width: 520px) {
  .symptom-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
  }
  .modal-card {
    border-radius: 18px;
  }
}
