/*
 * XoraEmergency. Large text, high contrast, one hand: every button and link
 * is at least 64 px tall (the language switch and footer links too), text on
 * solid colour only, light and dark from the phone.
 * Red #C80627 (the icon's) with white text is 6.0:1; body text is near black on white or
 * near white on near black.
 */
:root {
  --bg: #ffffff;
  --fg: #111827;
  --muted: #374151;
  --panel: #f3f4f6;
  --line: #9ca3af;
  --red: #c80627;
  --red-press: #8f041b;
  --on-red: #ffffff;
  --button: #ffffff;
  --button-fg: #111827;
  --warn-bg: #fef3c7;
  --warn-fg: #78350f;
  --focus: #1d4ed8;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f19;
    --fg: #f9fafb;
    --muted: #d1d5db;
    --panel: #1f2937;
    --line: #6b7280;
    --button: #1f2937;
    --button-fg: #f9fafb;
    --warn-bg: #451a03;
    --warn-fg: #fde68a;
    --focus: #93c5fd;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    "Noto Sans",
    "Noto Sans Devanagari",
    sans-serif;
  font-size: 20px;
  line-height: 1.45;
  overflow-x: hidden;
}

.screen {
  max-width: 560px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  overflow-wrap: anywhere;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 64px;
}

.brand {
  font-weight: 800;
  font-size: 1.3rem;
}

.back {
  display: inline-flex;
  align-items: center;
  min-height: 64px;
  min-width: 64px;
  padding: 0 12px 0 0;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.lang {
  display: inline-flex;
  border: 2px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.lang button {
  min-height: 64px;
  min-width: 64px;
  padding: 0 12px;
  border: 0;
  background: var(--button);
  color: var(--button-fg);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
}

.lang button[aria-pressed="true"] {
  background: var(--fg);
  color: var(--bg);
}

h1 {
  font-size: 1.6rem;
  line-height: 1.2;
  margin: 8px 0 12px;
}

.free {
  margin: 4px 0 16px;
  font-weight: 600;
  color: var(--muted);
}

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

.primary {
  display: grid;
  gap: 12px;
}

.big {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 96px;
  padding: 12px 20px;
  border: 0;
  border-radius: 18px;
  background: var(--red);
  color: var(--on-red);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.big:active,
.call:active {
  background: var(--red-press);
}

.big-name {
  font-size: 1.5rem;
  font-weight: 700;
}

.big-number {
  font-size: 2.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.actions {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}

.wide {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 64px;
  padding: 10px 16px;
  border: 2px solid var(--fg);
  border-radius: 14px;
  background: var(--button);
  color: var(--button-fg);
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.wide.quiet {
  border-color: var(--line);
  font-weight: 600;
}

.wide[disabled],
a.wide:not([href]) {
  opacity: 0.55;
  cursor: default;
}

.list {
  border: 2px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.list li + li {
  border-top: 1px solid var(--line);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 72px;
  padding: 10px 16px;
  border: 0;
  background: var(--button);
  color: var(--button-fg);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.row-name {
  min-width: 0;
  font-weight: 600;
}

.row-number {
  flex-shrink: 0;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--red);
  font-variant-numeric: tabular-nums;
}

@media (prefers-color-scheme: dark) {
  .row-number {
    color: #fca5a5;
  }
}

.hint {
  margin: 0 0 16px;
  padding: 16px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  font-size: 1rem;
}

.hint p {
  margin: 0 0 12px;
}

.foot {
  margin-top: 24px;
  padding: 16px;
  border-radius: 14px;
  background: var(--panel);
  font-size: 1rem;
}

.foot p {
  margin: 0 0 8px;
}

.foot .strong {
  font-weight: 700;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}

.links a {
  display: inline-flex;
  align-items: center;
  min-height: 64px;
  min-width: 64px;
  font-weight: 600;
  text-underline-offset: 4px;
}

.why,
.small {
  font-size: 1rem;
  color: var(--muted);
}

.loc {
  padding: 16px;
  border-radius: 14px;
  background: var(--panel);
}

.coord {
  display: flex;
  flex-direction: column;
  margin-bottom: 8px;
}

.coord-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
}

.coord-value {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.readout .coord-value {
  display: flex;
  flex-wrap: wrap;
  gap: 0 12px;
  align-items: baseline;
}

.readout .point,
.readout .hemi {
  font-size: 1.3rem;
  font-weight: 700;
}

.readout-title {
  margin: 0 0 8px;
  font-weight: 700;
}

.accuracy {
  margin: 4px 0 0;
  font-weight: 600;
}

.status {
  margin: 0;
  font-weight: 600;
}

.status.warn {
  padding: 12px;
  border-radius: 10px;
  background: var(--warn-bg);
  color: var(--warn-fg);
}

.notice:empty {
  display: none;
}

.notice {
  font-weight: 600;
}

.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;
}

.dialog {
  width: 100%;
  max-width: 560px;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 20px 20px 0 0;
  background: var(--bg);
  color: var(--fg);
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.sheet {
  padding: 20px 16px max(20px, env(safe-area-inset-bottom));
  display: grid;
  gap: 12px;
}

.sheet h2 {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1.25;
}

.call {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 88px;
  border-radius: 18px;
  background: var(--red);
  color: var(--on-red);
  font-size: 1.7rem;
  font-weight: 800;
  text-decoration: none;
}

.sheet .small {
  margin: 0;
}

.sheet-loc {
  display: grid;
  gap: 8px;
}

.sheet-loc-title {
  margin: 4px 0 0;
  font-weight: 700;
}

.loc.compact .coord-value {
  font-size: 1.6rem;
}
