:root {
  --red: #d32f2f;
  --red-dark: #b71c1c;
  --blue: #1565c0;
  --green: #2e7d32;
  --amber: #f9a825;
  --gray-50: #fafafa;
  --gray-100: #f0f0f0;
  --gray-300: #ccc;
  --gray-600: #555;
  --gray-900: #1a1a1a;
  --radius: 12px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  font-size: 17px;
  line-height: 1.4;
}

a { color: var(--blue); }

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 80px;
}

header.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: white;
  border-bottom: 1px solid var(--gray-100);
  position: sticky;
  top: 0;
  z-index: 10;
}

header.topbar .brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 20px;
  color: var(--red);
  text-decoration: none;
}

header.topbar .brand-logo {
  height: 28px;
  width: 28px;
  object-fit: contain;
}

.lang-toggle {
  background: none;
  border: 1px solid var(--gray-300);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
  cursor: pointer;
}

.btn {
  display: block;
  width: 100%;
  padding: 18px;
  font-size: 18px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary { background: var(--red); color: white; }
.btn-primary:active { background: var(--red-dark); }
.btn-secondary { background: white; color: var(--gray-900); border: 2px solid var(--gray-300); }
.btn-secondary:active { background: var(--gray-100); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.stack { display: flex; flex-direction: column; gap: 12px; }

.big-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.big-buttons .btn {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
}

.big-buttons .btn .icon { font-size: 36px; }

.big-buttons .donate-btn {
  grid-column: span 2;
  aspect-ratio: auto;
  flex-direction: row;
  gap: 10px;
  padding: 16px;
  background: #fde7e9;
  color: var(--red-dark);
  border: 2px solid #f6c6cb;
}
.big-buttons .donate-btn .icon { font-size: 22px; }

.alert-banner {
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  font-weight: 600;
  color: white;
}
.alert-banner.advisory { background: var(--blue); }
.alert-banner.watch { background: var(--amber); color: #3a2e00; }
.alert-banner.warning { background: #e65100; }
.alert-banner.severe { background: var(--red-dark); }

.card {
  background: white;
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

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

.icon-option {
  background: white;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 12px 6px;
  text-align: center;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  -webkit-tap-highlight-color: transparent;
}
.icon-option .icon { font-size: 28px; }
.icon-option.selected { border-color: var(--red); background: #fdeaea; }

label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 15px; }

input[type=text], input[type=tel], input[type=number], textarea, select {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  border: 2px solid var(--gray-300);
  border-radius: 10px;
  font-family: inherit;
  margin-bottom: 14px;
}
textarea { resize: vertical; min-height: 70px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-weight: 500; }
.checkbox-row input { width: 20px; height: 20px; }

.field-group { margin-bottom: 16px; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.badge.critical { background: var(--red); color: white; }
.badge.high { background: var(--amber); color: #3a2e00; }
.badge.normal { background: var(--gray-100); color: var(--gray-600); }

.status-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--gray-100);
}

.sos-item {
  border-bottom: 1px solid var(--gray-100);
  padding: 12px 0;
}
.sos-item:last-child { border-bottom: none; }

.muted { color: var(--gray-600); font-size: 14px; }

.toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 100;
  max-width: 90%;
  text-align: center;
}

.error-text { color: var(--red-dark); font-size: 14px; margin-top: -8px; margin-bottom: 12px; }

#live-alert-wrap {
  position: fixed;
  top: 70px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 320px;
}
.live-alert-bubble {
  color: white;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.live-alert-bubble.live-alert-show { opacity: 1; transform: translateX(0); }
.live-alert-bubble.live-alert-request { background: var(--red); }
.live-alert-bubble.live-alert-report { background: var(--blue); }
.live-alert-bubble.live-alert-need { background: #b45309; }

nav.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: white;
  border-top: 1px solid var(--gray-100);
  padding: 6px 0;
}
nav.bottom-nav a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  color: var(--gray-600);
  font-size: 12px;
  padding: 6px 0;
}
nav.bottom-nav a .icon { display: block; font-size: 20px; }
nav.bottom-nav a.active { color: var(--red); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--gray-100); }

@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; }
  html, body { background: #121212; color: #eee; }
  header.topbar, .card, input, textarea, select, .icon-option, .btn-secondary { background: #1e1e1e; color: #eee; border-color: #333; }
  .icon-option.selected { background: #3a1414; border-color: var(--red); }
  nav.bottom-nav { background: #1e1e1e; border-color: #333; }
}
