:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #5d6773;
  --paper: #f7f8f6;
  --panel: #ffffff;
  --line: #d9ded8;
  --danger: #b42318;
  --danger-dark: #7a271a;
  --teal: #0f766e;
  --teal-soft: #e3f4f1;
  --blue: #1d4ed8;
  --green: #177245;
  --amber: #a15c07;
  --shadow: 0 18px 48px rgba(23, 32, 42, 0.12);
}

* {
  box-sizing: border-box;
}

img,
iframe,
svg,
canvas {
  max-width: 100%;
}

html {
  min-height: 100%;
  background: var(--paper);
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 18px;
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
textarea,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
  min-width: 0;
  overflow-wrap: anywhere;
}

.app-shell {
  width: min(100%, 720px);
  max-width: 100vw;
  margin: 0 auto;
  background: var(--paper);
  min-height: 100vh;
  overflow-x: hidden;
}

main {
  display: grid;
  gap: 14px;
  padding: 14px 14px 32px;
}

.emergency-banner {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 14px;
  background: var(--danger);
  color: #fff;
  box-shadow: 0 10px 28px rgba(122, 39, 26, 0.28);
}

.emergency-banner > div {
  min-width: 0;
}

.emergency-banner h1 {
  margin: 2px 0 4px;
  font-size: clamp(1.28rem, 5vw, 1.65rem);
  line-height: 1.08;
}

.emergency-banner p {
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.emergency-banner .eyebrow {
  color: rgba(255, 255, 255, 0.74);
}

.call-button,
.primary-button,
.secondary-button,
.text-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  line-height: 1.15;
  white-space: normal;
}

.call-button {
  display: inline-grid;
  place-items: center;
  min-width: 74px;
  padding: 0 18px;
  background: #fff;
  color: var(--danger-dark);
}

.primary-button {
  width: 100%;
  min-height: 58px;
  padding: 13px 16px;
  background: var(--teal);
  color: #fff;
  font-size: 1.1rem;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.secondary-button {
  padding: 12px 14px;
  background: var(--ink);
  color: #fff;
}

.text-button {
  min-height: 36px;
  padding: 8px 10px;
  background: transparent;
  color: var(--blue);
}

.notice-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 0;
  color: var(--danger-dark);
  font-size: 0.98rem;
}

.notice-strip span,
.notice-strip strong {
  padding: 6px 8px;
  border: 1px solid #f3b5ad;
  border-radius: 8px;
  background: #fff5f3;
}

.brand-panel,
.input-section,
.results-section,
.map-section,
.fine-print {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(23, 32, 42, 0.06);
}

.brand-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
  min-width: 0;
}

.brand-panel h2,
.section-heading h2 {
  margin: 0;
  line-height: 1.12;
}

.brand-panel h2 {
  display: grid;
  gap: 4px;
  font-size: 1.55rem;
  min-width: 0;
}

.brand-name {
  color: var(--green);
  font-size: 1.7rem;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.brand-panel p:not(.eyebrow),
.fine-print p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.location-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 1rem;
  box-shadow: 0 8px 28px rgba(23, 32, 42, 0.06);
}

.location-button {
  display: grid;
  gap: 2px;
  width: 100%;
  max-width: 100%;
  min-height: 104px;
  padding: 14px 12px;
  border: 0;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(15, 118, 110, 0.24);
}

.location-button:disabled {
  cursor: wait;
  opacity: 0.9;
}

.location-button[aria-busy="true"] {
  background: var(--amber);
  box-shadow: 0 14px 30px rgba(161, 92, 7, 0.24);
}

.location-button span {
  max-width: 100%;
  font-size: clamp(1.1rem, 7vw, 1.52rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.05;
  overflow-wrap: anywhere;
  white-space: normal;
}

.loc-line {
  display: block;
}

.location-button small {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 700;
  line-height: 1.2;
}

.origin-entry {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-weight: 800;
}

.origin-entry input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
}

.input-section,
.results-section,
.map-section,
.fine-print,
.hospital-card {
  min-width: 0;
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--amber);
}

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

.status-dot.locating {
  background: var(--amber);
  animation: pulse-location 1s ease-in-out infinite;
}

.status-dot.error {
  background: var(--danger);
}

@keyframes pulse-location {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.7;
  }

  50% {
    transform: scale(1.35);
    opacity: 1;
  }
}

.input-section,
.results-section,
.map-section {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.section-heading {
  display: grid;
  gap: 2px;
}

.section-heading h2 {
  font-size: 1.5rem;
}

.symptom-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.segmented-field {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.segmented-field legend {
  padding: 0;
  color: var(--muted);
  font-size: 1.08rem;
  font-weight: 800;
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3f1;
}

.segmented-control label {
  position: relative;
  min-width: 0;
}

.segmented-control input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.segmented-control span {
  display: grid;
  place-items: center;
  min-height: 54px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 1.08rem;
  font-weight: 900;
}

.segmented-control input:checked + span {
  background: #fff;
  color: var(--teal);
  box-shadow: 0 6px 18px rgba(23, 32, 42, 0.1);
}

.segmented-control input:focus-visible + span {
  outline: 3px solid rgba(15, 118, 110, 0.3);
  outline-offset: 2px;
}

.symptom-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 66px;
  padding: 14px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
  font-size: 1.14rem;
  font-weight: 850;
  line-height: 1.18;
  min-width: 0;
  max-width: 100%;
}

.symptom-option input {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  accent-color: var(--teal);
}

.symptom-option span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 1.06rem;
  font-weight: 800;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-size: 1.06rem;
  color: var(--ink);
  background: #fbfcfb;
  line-height: 1.45;
}

textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.3);
  outline-offset: 2px;
}

.triage-output {
  display: grid;
  gap: 12px;
  color: var(--muted);
}

.empty-state {
  padding: 14px;
  border: 1px dashed #b9c3bd;
  border-radius: 8px;
  background: #fbfcfb;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 8px;
  border-radius: 8px;
  background: var(--teal-soft);
  color: #075e58;
  font-size: 0.9rem;
  font-weight: 800;
}

.badge.missing {
  background: #fff1d6;
  color: #7a3f05;
}

.badge.unknown {
  background: #f1f5f9;
  color: #334155;
}

.badge.sample {
  background: #eef2ff;
  color: #3730a3;
}

#map {
  width: 100%;
  min-height: 310px;
  height: 310px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.map-fallback {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(23, 32, 42, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(23, 32, 42, 0.06) 1px, transparent 1px),
    #eef5f2;
  background-size: 34px 34px;
  color: var(--muted);
  text-align: center;
}

.static-map,
.google-embed-map,
.fallback-map-detail {
  position: relative;
  width: 100%;
  min-height: 310px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.google-embed-map,
.static-map {
  height: 360px;
}

.static-map {
  background:
    linear-gradient(90deg, rgba(23, 32, 42, 0.07) 1px, transparent 1px),
    linear-gradient(rgba(23, 32, 42, 0.07) 1px, transparent 1px),
    #e8f2ef;
  background-size: 36px 36px;
}

.static-map::before {
  content: "Map preview - add browser map key for full Google map";
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  color: rgba(23, 32, 42, 0.66);
  font-size: 0.9rem;
  font-weight: 800;
  text-align: center;
}

.map-legend {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  max-width: calc(100% - 20px);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 900;
  text-align: left;
  box-shadow: 0 8px 18px rgba(23, 32, 42, 0.1);
}

.map-pin {
  position: absolute;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(23, 32, 42, 0.26);
}

.map-pin.user {
  width: 38px;
  height: 38px;
  background: var(--danger);
  font-size: 0.72rem;
}

.map-pin.child-focused {
  background: #7c3aed;
}

.map-fallback strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.hospital-list {
  display: grid;
  gap: 12px;
}

.list-summary {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef5f2;
  color: var(--ink);
  font-weight: 850;
}

.google-embed-map {
  background: #e8f2ef;
}

.google-embed-map iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.fallback-map-detail {
  display: grid;
  height: auto;
  min-height: 0;
  overflow: visible;
  background: #eef5f2;
}

#map.fallback-map-detail {
  height: auto;
  min-height: 0;
  overflow: visible;
}

.fallback-map-frame {
  width: 100%;
  height: 320px;
  min-height: 280px;
  border: 0;
  background: #dfe8e4;
}

.map-detail-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.map-detail-card h3 {
  margin: 0;
  font-size: 1.2rem;
}

.map-detail-card p {
  margin: 0;
  color: var(--muted);
}

.metrics.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.map-link-row,
.map-result-list {
  display: grid;
  gap: 8px;
}

.map-link-row {
  grid-template-columns: 1fr;
}

.map-result-list {
  padding: 12px;
  border-top: 1px solid var(--line);
  background: #fbfcfb;
}

.map-result-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.map-result-row strong,
.map-result-row span {
  display: block;
}

.map-result-row span {
  color: var(--muted);
  font-size: 0.94rem;
}

.map-result-row a {
  font-weight: 900;
  color: var(--teal);
  text-decoration: none;
}

.hospital-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.hospital-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.hospital-card h3 {
  margin: 0 0 5px;
  font-size: 1.18rem;
}

.hospital-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.rank-pill {
  flex: 0 0 auto;
  min-width: 46px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  text-align: center;
  font-weight: 900;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.metric {
  min-height: 58px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 3px;
  font-size: 1rem;
}

.hospital-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.action-link,
.action-button {
  display: grid;
  place-items: center;
  min-height: 42px;
  min-width: 0;
  padding: 9px 8px;
  border: 0;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
  text-align: center;
  line-height: 1.15;
  white-space: normal;
}

.action-link.secondary,
.action-button.secondary {
  background: #eaf1ef;
  color: var(--teal);
}

.phone-line {
  color: var(--ink);
  font-weight: 800;
}

.fine-print {
  padding: 14px;
  font-size: 0.98rem;
}

.anonamed-link {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
}

.toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  left: 14px;
  z-index: 20;
  max-width: 680px;
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
}

@media (min-width: 620px) {
  .brand-panel {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .symptom-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .hospital-actions {
    grid-template-columns: 1fr;
  }

  .map-result-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .map-result-row a {
    grid-column: 1 / -1;
    display: grid;
    place-items: center;
    min-height: 42px;
    border-radius: 8px;
    background: #eaf1ef;
  }
}

@media (max-width: 420px) {
  * {
    max-width: 100%;
  }

  body {
    font-size: 17px;
  }

  main {
    padding: 8px 8px 28px;
  }

  .emergency-banner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 14px 10px;
    gap: 8px;
  }

  .call-button {
    min-width: 58px;
    padding: 0 12px;
  }

  .brand-panel,
  .location-panel,
  .input-section,
  .results-section,
  .map-section {
    padding: 12px;
  }

  .brand-name {
    font-size: 1.35rem;
  }

  .brand-panel h2,
  .section-heading h2 {
    font-size: 1.32rem;
  }

  .loc-line {
    display: block;
  }

  .location-button {
    min-height: 92px;
    padding: 12px 10px;
  }

  .location-button span {
    font-size: 1.28rem;
  }

  .origin-entry input,
  textarea {
    font-size: 1rem;
  }

  .symptom-grid {
    gap: 10px;
  }

  .symptom-option {
    min-height: 70px;
    padding: 13px 12px;
    gap: 12px;
    font-size: 1.12rem;
  }

  .symptom-option input {
    width: 32px;
    height: 32px;
  }

  .segmented-control span {
    min-height: 56px;
    font-size: 1.08rem;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .metrics.compact {
    grid-template-columns: 1fr;
  }

  .hospital-card header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .action-link,
  .action-button,
  .primary-button {
    min-height: 48px;
    padding: 10px 12px;
    font-size: 1rem;
  }

  #map,
  .google-embed-map,
  .static-map,
  .fallback-map-detail {
    width: 100%;
  }

  .fallback-map-frame {
    height: 300px;
  }
}
