:root {
  --ink: #13211d;
  --text: #26352f;
  --muted: #4f5e58;
  --paper: #f6f3eb;
  --card: #fffdf8;
  --soft: #eeeee7;
  --line: #ccd2c9;
  --line-strong: #aeb8af;
  --green: #103a32;
  --green-hover: #0b302a;
  --green-soft: #e5f1ec;
  --red: #992b2b;
  --red-hover: #7d2020;
  --red-soft: #fff0ed;
  --amber: #855006;
  --amber-soft: #fff3d8;
  --blue: #155276;
  --blue-soft: #e8f2f8;
  --visited: #5c3a70;
  --focus: #0874b9;
  --shadow-sm: 0 1px 2px rgba(16, 40, 33, .06), 0 5px 16px rgba(16, 40, 33, .05);
  --shadow-panel: 0 12px 32px rgba(16, 40, 33, .08);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --duration: 160ms;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background: var(--paper);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  overflow-wrap: break-word;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--green);
  text-decoration-thickness: .08em;
  text-underline-offset: .18em;
}
a:visited { color: var(--visited); }
button, input, select, textarea { font: inherit; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  left: -9999px;
  top: calc(.5rem + env(safe-area-inset-top));
  z-index: 200;
  min-height: 48px;
  padding: .7rem 1rem;
  border-radius: var(--radius-sm);
  color: white;
  background: var(--green);
}
.skip-link:focus { left: max(.5rem, env(safe-area-inset-left)); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-height: calc(56px + env(safe-area-inset-top));
  padding: max(.4rem, env(safe-area-inset-top)) max(.75rem, env(safe-area-inset-right)) .4rem max(.75rem, env(safe-area-inset-left));
  background: rgba(246, 243, 235, .985);
  border-bottom: 1px solid var(--line);
}
.brand {
  min-width: 90px;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.08;
}
.brand:visited { color: var(--ink); }
.brand strong { font-size: 1rem; letter-spacing: -.01em; }
.brand span { margin-top: .22rem; color: var(--muted); font-size: .7rem; }
.top-actions { display: flex; align-items: center; gap: .4rem; }
.quiet-button,
.header-emergency {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .5rem .7rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: .78rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}
.quiet-button { color: var(--green); background: var(--card); }
.quiet-button:visited { color: var(--green); }
.quiet-button:hover { background: var(--soft); }
.header-emergency { color: white; background: var(--red); border-color: var(--red); }
.header-emergency:visited { color: white; }
.header-emergency:hover { background: var(--red-hover); border-color: var(--red-hover); }
.header-emergency strong { font-size: 1rem; font-variant-numeric: tabular-nums; }
.network {
  border-radius: 999px;
  padding: .28rem .55rem;
  color: #245b47;
  background: var(--green-soft);
  font-size: .7rem;
  font-weight: 800;
}
.network.offline { color: #6f4200; background: var(--amber-soft); }
.offline-banner {
  width: 100%;
  padding: .6rem max(.75rem, env(safe-area-inset-right)) .6rem max(.75rem, env(safe-area-inset-left));
  color: #5f3b05;
  background: var(--amber-soft);
  border-bottom: 1px solid #d9bb82;
  font-size: .82rem;
  text-align: center;
}
.offline-banner strong { margin-right: .35rem; }

main, footer { width: min(720px, calc(100% - 24px)); margin-inline: auto; }
.hero { padding: 1.5rem 0 .55rem; }
.kicker {
  margin: 0 0 .5rem;
  color: var(--red);
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .11em;
  line-height: 1.35;
  text-transform: uppercase;
}
h1, h2 {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -.035em;
  text-wrap: balance;
}
h1 { max-width: 16ch; font-size: clamp(2.15rem, 9vw, 3.8rem); line-height: 1.01; }
h2 { font-size: clamp(1.75rem, 6.5vw, 2.8rem); line-height: 1.06; }
h3 { margin: 1.75rem 0 .65rem; color: var(--ink); font-size: 1.05rem; line-height: 1.3; }
html[lang="hi"] h1,
html[lang="hi"] h2 {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 750;
  letter-spacing: -.015em;
  line-height: 1.15;
}
.intro { margin: .75rem 0 0; color: var(--muted); font-size: 1rem; }

.city-select { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-top: 1rem; }
.city-label { color: var(--ink); font-size: .85rem; font-weight: 800; }
.city-chip {
  min-height: 44px;
  padding: .5rem .85rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--green);
  background: var(--card);
  font-size: .85rem;
  font-weight: 800;
  transition: background-color var(--duration) ease-out, border-color var(--duration) ease-out, color var(--duration) ease-out;
}
.city-chip:hover { background: var(--soft); border-color: var(--green); }
.city-chip[aria-pressed="true"] { color: white; background: var(--green); border-color: var(--green); }
.city-note { flex-basis: 100%; margin-top: .1rem; color: var(--muted); font-size: .8rem; }

.hospital-list { margin: 1rem 0 0; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--soft); font-size: .88rem; }
.hospital-list strong { display: block; margin-bottom: .25rem; color: var(--ink); }
.hospital-list span { color: var(--muted); }
.first-aid { padding-left: 1.2rem; }
.first-aid li { margin: .7rem 0; color: var(--muted); }

.routes { display: grid; gap: .55rem; padding: .65rem 0 2rem; }
.route {
  width: 100%;
  min-height: 74px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 24px;
  gap: .75rem;
  align-items: center;
  padding: .72rem .8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: background-color var(--duration) ease-out, border-color var(--duration) ease-out, box-shadow var(--duration) ease-out, transform 90ms ease-out;
}
.route:hover { border-color: var(--line-strong); background: #fff; box-shadow: 0 7px 20px rgba(16, 40, 33, .09); }
.route:active { transform: translateY(1px); box-shadow: none; }
.route[aria-expanded="true"] { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.route-number {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  background: var(--soft);
}
.route.danger .route-number { color: var(--red); background: var(--red-soft); }
.route.custody .route-number { color: var(--amber); background: var(--amber-soft); }
.route.lawyer .route-number { color: var(--blue); background: var(--blue-soft); }
.route.record .route-number { color: var(--green); background: var(--green-soft); }
.route strong, .route small { display: block; }
.route strong { font-size: 1rem; line-height: 1.25; }
.route small { margin-top: .18rem; color: var(--muted); font-size: .81rem; line-height: 1.35; }
.route-arrow { color: var(--muted); font-size: 1.7rem; font-weight: 400; line-height: 1; text-align: center; }

.help-panel {
  margin: 0 0 2rem;
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-top: 4px solid var(--green);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-panel);
  scroll-margin-top: calc(70px + env(safe-area-inset-top));
}
.danger-panel { border-top-color: var(--red); }
.custody-panel { border-top-color: var(--amber); }
.lawyer-panel { border-top-color: var(--blue); }
.record-panel { border-top-color: var(--green); }
.panel-heading > p:not(.kicker), .form-note { color: var(--muted); }
.form-note { margin: 1rem 0 0; font-size: .88rem; }

.call-grid, .decision-grid { display: grid; gap: .65rem; margin: 1.25rem 0; }
.call-card {
  min-height: 76px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: .85rem;
  align-items: center;
  padding: .75rem .9rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--green);
  background: var(--soft);
  text-decoration: none;
  transition: background-color var(--duration) ease-out, border-color var(--duration) ease-out, transform 90ms ease-out;
}
.call-card:visited { color: var(--green); }
.call-card:hover { background: var(--green-soft); border-color: var(--green); }
.call-card:active { transform: translateY(1px); }
.call-card.primary { color: white; background: var(--green); border-color: var(--green); }
.call-card.primary:visited { color: white; }
.call-card.primary:hover { background: var(--green-hover); border-color: var(--green-hover); }
.call-card span { grid-row: 1 / 3; font-family: Georgia, serif; font-size: clamp(1.35rem, 7vw, 1.75rem); line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.call-card strong { align-self: end; font-size: .9rem; line-height: 1.25; }
.call-card small { align-self: start; margin-top: .15rem; font-size: .78rem; opacity: .82; }

.decision-grid article { padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--soft); }
.decision-grid article > strong { display: block; color: var(--ink); }
.decision-grid article > p { margin: .45rem 0 1rem; color: var(--muted); font-size: .92rem; }
.decision-grid .call-card { background: var(--card); }
.decision-grid .call-card.primary { background: var(--green); }
.emergency-line { margin: .75rem 0 1.25rem; padding: .7rem .85rem; border: 1px solid #e7b5ad; border-radius: var(--radius-sm); background: var(--red-soft); }
.emergency-line a { min-height: 44px; display: inline-flex; align-items: center; padding-inline: .45rem; color: var(--red); font-weight: 850; }

.steps { padding-left: 1.3rem; }
.steps li { margin: .8rem 0; padding-left: .2rem; }
.steps li span, .steps.compact li { color: var(--muted); }
.checklist { list-style: none; padding: 0; }
.checklist li { position: relative; margin: .55rem 0; padding: .65rem .65rem .65rem 2.15rem; border-radius: var(--radius-sm); background: var(--soft); }
.checklist li::before { content: "□"; position: absolute; left: .72rem; color: var(--green); font-weight: 900; }
details { margin: 1rem 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--soft); }
summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: .7rem .85rem;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  line-height: 1.35;
}
details > :not(summary) { margin-inline: .9rem; }
details > :last-child { margin-bottom: .9rem; }
details p { color: var(--muted); }
.say-this { margin: 1rem 0; padding: 1rem; border: 1px solid #bad4e4; border-radius: var(--radius); background: var(--blue-soft); }
.say-this p { margin-bottom: 0; }
.small-note { color: var(--muted); font-size: .86rem; }
.text-link { min-height: 44px; display: inline-flex; align-items: center; margin: .15rem 0; font-weight: 800; overflow-wrap: anywhere; }

.copy-button, .secondary-button, .generate-button, .back-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  padding: .7rem 1rem;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  transition: background-color var(--duration) ease-out, border-color var(--duration) ease-out, transform 90ms ease-out;
}
.copy-button, .generate-button { border: 1px solid var(--green); color: white; background: var(--green); }
.copy-button:visited { color: white; }
.copy-button:hover, .generate-button:hover { background: var(--green-hover); border-color: var(--green-hover); }
.secondary-button, .back-button { border: 1px solid var(--line-strong); color: var(--green); background: var(--card); }
.secondary-button:hover, .back-button:hover { background: var(--soft); border-color: var(--green); }
.copy-button:active, .secondary-button:active, .generate-button:active, .back-button:active { transform: translateY(1px); }
.back-button { width: 100%; margin: 1rem 0 0; }

form { display: grid; gap: .9rem; margin-top: 1.25rem; }
label { display: flex; flex-direction: column; gap: .4rem; color: var(--ink); font-size: .92rem; font-weight: 800; }
label:has(input[required], select[required], textarea[required]) > span:first-child::after { content: " *"; color: var(--red); }
label small { color: var(--muted); font-size: .82rem; font-weight: 500; }
input, select, textarea {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: .72rem .78rem;
  color: var(--ink);
  background: white;
  font-size: 16px;
}
textarea { min-height: 7.5rem; resize: vertical; line-height: 1.5; }
input:hover, select:hover, textarea:hover { border-color: #7e8e84; }
input:user-invalid, select:user-invalid, textarea:user-invalid { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.confirm { min-height: 52px; flex-direction: row; align-items: flex-start; gap: .7rem; padding: .75rem; border-radius: var(--radius-sm); background: var(--soft); }
.confirm input { width: 22px; min-height: 22px; height: 22px; margin-top: .08rem; flex: 0 0 auto; }
.incident-output { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.success-message { margin: 0 0 .8rem; padding: .75rem .85rem; border: 1px solid #a8cbbd; border-radius: var(--radius-sm); color: #184f3d; background: var(--green-soft); font-weight: 750; }
.incident-output textarea { min-height: 320px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86rem; line-height: 1.5; }
.output-actions, .offline-actions, .resource-links { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .7rem; }

.after-safe { margin-top: 2rem; padding: 2.75rem 0 1.5rem; border-top: 1px solid var(--line); }
.report-list { display: grid; gap: .6rem; margin-top: 1.25rem; }
.report-item { margin: 0; background: var(--card); box-shadow: var(--shadow-sm); }
.report-item summary { position: relative; padding-right: 3rem; }
.report-item summary::after { content: "+"; position: absolute; right: .9rem; font-size: 1.35rem; font-weight: 500; }
.report-item[open] summary::after { content: "−"; }
.report-content { padding-bottom: .1rem; }
.report-content p:first-child { margin-top: .25rem; }
.resource-links { padding-bottom: .2rem; }
.resource-links a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: .45rem .65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--soft);
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.offline { margin-top: 2rem; padding: 1.3rem; border-radius: var(--radius-lg); color: white; background: var(--green); }
.offline h2 { color: white; }
.offline .kicker { color: #ffd69b; }
.offline .copy-button { color: var(--green); background: white; border-color: white; }
.offline .copy-button:visited { color: var(--green); }
.offline .secondary-button { color: white; background: transparent; border-color: #9eb8b1; }
.offline-details { border-color: #688b82; background: rgba(255, 255, 255, .06); }
.offline-details summary { color: white; }
.offline .steps li, .offline .steps.compact li { color: #e1ece8; }
.other-actions { margin: 1.5rem 0 3rem; }
.other-actions p { display: flex; flex-wrap: wrap; gap: .35rem .75rem; }
.other-actions a { min-height: 44px; display: inline-flex; align-items: center; }

footer { padding: 1.5rem 0 max(2rem, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: .86rem; }
footer strong { color: var(--green); }
footer p { max-width: 650px; }
footer > div { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .85rem; }
footer > div > a,
.footer-share {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border: 0;
  padding: .2rem 0;
  color: var(--green);
  background: transparent;
  text-decoration: underline;
  text-underline-offset: .18em;
  cursor: pointer;
  font-weight: 750;
}
footer small { display: inline-flex; align-items: center; min-height: 44px; }
footer small a { min-height: 44px; display: inline-flex; align-items: center; margin-left: .25rem; }
.toast {
  position: fixed;
  z-index: 120;
  right: max(.75rem, env(safe-area-inset-right));
  bottom: max(.75rem, env(safe-area-inset-bottom));
  max-width: min(360px, calc(100% - 1.5rem));
  padding: .8rem 1rem;
  border-radius: var(--radius-sm);
  color: white;
  background: var(--green);
  box-shadow: var(--shadow-panel);
}

.privacy-page { width: min(720px, calc(100% - 24px)); margin: 0 auto; padding: 2rem 0 4rem; }
.privacy-page > a { min-height: 44px; display: inline-flex; align-items: center; font-weight: 800; }
.privacy-page h1 { margin: .75rem 0 1rem; }
.privacy-page p { color: var(--muted); }
.privacy-page h2 { margin-top: 2rem; font-size: 1.8rem; }
.hindi-privacy { margin-top: 3rem; padding-top: 2.5rem; border-top: 1px solid var(--line); }

@media (min-width: 620px) {
  .topbar { padding-inline: max(1rem, calc((100vw - 760px) / 2)); }
  .hero { padding-top: 2.25rem; }
  .call-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .call-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .decision-grid { grid-template-columns: 1fr 1fr; }
  form { grid-template-columns: 1fr 1fr; }
  label.full, .full { grid-column: 1 / -1; }
  .help-panel { padding: 1.75rem; }
  .offline { padding: 1.75rem; }
}

@media (max-width: 619px) {
  .network, .top-actions > a.quiet-button { display: none; }
}

@media (max-width: 350px) {
  main, footer { width: min(100% - 20px, 720px); }
  .topbar { gap: .35rem; padding-inline: max(.55rem, env(safe-area-inset-left)); }
  .top-actions { gap: .3rem; }
  .header-emergency span { display: none; }
  .quiet-button, .header-emergency { padding-inline: .6rem; }
  .hero { padding-top: 1.15rem; }
  .route { grid-template-columns: 34px minmax(0, 1fr) 20px; gap: .55rem; padding-inline: .65rem; }
  .route-number { width: 34px; height: 34px; }
  .help-panel { padding: .9rem; }
}

@media (max-height: 650px) and (max-width: 500px) {
  .hero { padding-top: .9rem; padding-bottom: .25rem; }
  h1 { font-size: 2rem; }
  .intro { margin-top: .45rem; font-size: .92rem; }
  .routes { gap: .4rem; padding-top: .4rem; }
  .route { min-height: 58px; padding-block: .48rem; }
  .route small { display: none; }
}

@media (max-height: 600px) and (orientation: landscape) and (min-width: 600px) {
  .hero { padding-top: 1rem; }
  h1 { font-size: 2.4rem; }
  .routes { grid-template-columns: 1fr 1fr; }
  .route { min-height: 78px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media (forced-colors: active) {
  .route, .call-card, .copy-button, .generate-button, .secondary-button, .back-button, details { border: 1px solid ButtonText; }
}

.print-card { display: none; }

@media print {
  body { background: white; font-size: 11pt; }
  .topbar, .offline-banner, .hero, .routes, .help-panel, .after-safe, .other-actions, footer, .offline, .toast { display: none !important; }
  .print-card { display: block; color: black; }
  .print-card h2 { color: black; font-size: 16pt; margin-bottom: .5rem; }
  .print-card p { margin: 0 0 .55rem; color: black; line-height: 1.45; }
}
