*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: calc(16px * var(--font-scale)); }
html[lang="hi"] body, html[lang="mr"] body, html[lang="gu"] body { font-family: var(--font-indic), var(--font-body); line-height: 1.7; }
body {
  margin: 0; min-height: 100vh; background: var(--sand); color: var(--ink);
  font-family: var(--font-body); line-height: 1.55; font-size: 1rem;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: var(--backdrop); background-size: cover; background-position: center;
  opacity: var(--backdrop-alpha);
}
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--plum-deep); line-height: 1.2; margin: 0 0 var(--space-3); font-weight: 600; }
html[lang="hi"] h1, html[lang="hi"] h2, html[lang="hi"] h3, html[lang="mr"] h1, html[lang="mr"] h2, html[lang="mr"] h3,
html[lang="gu"] h1, html[lang="gu"] h2, html[lang="gu"] h3 { font-family: var(--font-indic), var(--font-display); }
h1 { font-size: 1.9rem; } h2 { font-size: 1.45rem; } h3 { font-size: 1.15rem; } h4 { font-size: 1rem; }
/* A title that sits directly under the page h1 is an h2 so heading levels never skip, but keeps the smaller h3 look. */
.h-sub { font-size: 1.15rem; }
p { margin: 0 0 var(--space-3); }
a { color: var(--plum); text-underline-offset: 3px; }
a:hover { color: var(--plum-deep); }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
hr { border: 0; border-top: 1px solid var(--outline-soft); margin: var(--space-4) 0; }
ul, ol { padding-inline-start: 1.3em; margin: 0 0 var(--space-3); }
/* An outline, not a box-shadow: components with their own box-shadow (tiles, cards, the counter bead) would otherwise hide the ring. */
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
::selection { background: var(--lavender-soft); color: var(--ink); }
.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; }
[hidden] { display: none !important; }
.skip-link { position: absolute; inset-inline-start: var(--space-3); top: -60px; z-index: 1000; background: var(--plum); color: var(--on-plum); padding: var(--space-2) var(--space-4); border-radius: var(--radius-s); }
.skip-link:focus { top: var(--space-2); }
.muted { color: var(--ink-faint); }
.small { font-size: .85rem; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: var(--space-3); }
.grow { flex: 1 1 auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
/* The in-app Reduce motion switch must do what the OS preference does above: a .001ms infinite animation still loops (flicker, CPU), so the count is pinned to 1 as well. */
html[data-motion="reduce"] *, html[data-motion="reduce"] *::before, html[data-motion="reduce"] *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
html[data-contrast="high"] { --outline: var(--ink-soft); --outline-soft: var(--ink-faint); }

/* ---------- App shell ---------- */
#app { min-height: 100vh; display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); grid-template-rows: var(--topbar-h) 1fr; grid-template-areas: "top top" "nav main"; }
.topbar {
  grid-area: top; position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: var(--space-3);
  padding: 0 var(--space-4); background: var(--cream); border-bottom: 1px solid var(--outline-soft); box-shadow: var(--shadow-1);
}
.brand { display: flex; align-items: center; gap: var(--space-2); text-decoration: none; color: var(--plum-deep); font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; white-space: nowrap; }
.brand img { width: 34px; height: 34px; border-radius: 8px; object-fit: contain; }
.topbar .spacer { flex: 1 1 auto; }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.topbar-actions select { max-width: 8.5rem; min-height: 36px; padding: 4px 8px; border: 1px solid var(--outline); border-radius: var(--radius-s); background: var(--cream); color: var(--ink); }
.nav { grid-area: nav; position: sticky; top: var(--topbar-h); align-self: start; height: calc(100vh - var(--topbar-h)); overflow-y: auto; background: var(--cream); border-inline-end: 1px solid var(--outline-soft); padding: var(--space-3) var(--space-2); }
.nav a { display: flex; align-items: center; gap: var(--space-3); padding: 10px 12px; border-radius: var(--radius); color: var(--ink-soft); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--lavender-soft); color: var(--plum-deep); }
.nav a[aria-current="page"] { background: var(--plum); color: var(--on-plum); }
.nav .nav-ico { font-size: 1.15rem; width: 1.5rem; text-align: center; }
.nav-label { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); padding: var(--space-3) 12px var(--space-1); }
main { grid-area: main; min-width: 0; padding: var(--space-5); max-width: 1180px; width: 100%; margin: 0 auto; outline: none; }
.footer-note { margin-top: var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--outline-soft); font-size: .8rem; color: var(--ink-faint); }
.bottombar { display: none; }

.emergency-btn {
  display: inline-flex; align-items: center; gap: 6px; background: var(--danger); color: var(--on-danger); border: 0; text-decoration: none;
  font-weight: 700; padding: 8px 14px; border-radius: 999px; cursor: pointer; letter-spacing: .02em; box-shadow: var(--shadow-1); white-space: nowrap;
}
.emergency-btn:hover { filter: brightness(1.08); color: var(--on-danger); }
.emergency-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--cream), 0 0 0 6px var(--danger); }

@media (max-width: 860px) {
  #app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main"; }
  .nav { display: none; }
  main { padding: var(--space-4); padding-bottom: calc(var(--bottombar-h) + var(--space-5)); }
  .bottombar {
    display: flex; position: fixed; inset-inline: 0; bottom: 0; z-index: 30; height: var(--bottombar-h); background: var(--cream);
    border-top: 1px solid var(--outline-soft); box-shadow: 0 -2px 10px rgb(60 40 50 / 8%);
    overflow-x: auto; overflow-y: hidden; scrollbar-width: none; overscroll-behavior-x: contain; /* up to 12 customised slots scroll sideways */
  }
  .bottombar::-webkit-scrollbar { display: none; }
  .bottombar a { flex: 1 0 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .68rem; color: var(--ink-soft); text-decoration: none; min-width: 64px; padding: 4px 2px; }
  .bottombar a span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bottombar a[aria-current="page"] { color: var(--plum-deep); font-weight: 700; }
  .bottombar .nav-ico { font-size: 1.3rem; }
  .brand-name { display: none; }
  .topbar-actions select { max-width: 6.5rem; }
  .topbar { padding: 0 var(--space-3); gap: var(--space-2); }
  h1 { font-size: 1.6rem; }
}
/* The four header controls plus the brand mark need about 400px with the English "Emergency" label; below that the label
   goes and the red pill keeps its icon and aria-label, instead of the language select being squeezed until its text clips. */
@media (max-width: 420px) { .emergency-btn .em-text { display: none; } }
