:root {
  --bg: #0b0f14;
  --bg-card: #141b22;
  --border: #232d38;
  --text: #f2f4f6;
  --muted: #93a1ac;
  --red: #c0392b;
  --red-bright: #e74c3c;
  --green: #25d366;
  --blue: #2d7dd2;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

.view {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px 40px;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px 20px;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 20px; margin: 0; }
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--red-bright);
  box-shadow: 0 0 0 4px rgba(231,76,60,0.15);
}
.brand-dot.pulsing { animation: pulse 1.4s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(231,76,60,0.5); }
  70% { box-shadow: 0 0 0 12px rgba(231,76,60,0); }
  100% { box-shadow: 0 0 0 0 rgba(231,76,60,0); }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.card h2 { margin-top: 0; font-size: 19px; }
.card h3 { margin-top: 0; font-size: 16px; }
.lead { color: var(--muted); line-height: 1.5; font-size: 15px; }

.note-card ul { padding-left: 20px; margin: 8px 0 0; color: var(--muted); line-height: 1.8; font-size: 14px; }

.form { display: flex; flex-direction: column; gap: 6px; }
.form label { font-size: 13px; color: var(--muted); margin-top: 8px; }
.form input, .form textarea {
  background: #0e141b;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 16px;
  width: 100%;
}
.form textarea { resize: vertical; font-family: inherit; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn-primary { background: var(--red-bright); color: white; margin-top: 14px; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost { background: #1c2530; color: var(--text); }
.btn-whatsapp { background: var(--green); color: #04250f; }
.btn-sms { background: var(--blue); color: white; }

.link-result { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); }
.link-result .ok { color: var(--green); font-size: 14px; margin: 0 0 10px; }
.share-row { display: flex; gap: 8px; margin-bottom: 10px; }
.share-row input { flex: 1; background: #0e141b; border: 1px solid var(--border); color: var(--muted); border-radius: 10px; padding: 10px; font-size: 13px; }
.share-buttons { display: flex; flex-direction: column; gap: 8px; }

#btn-try-mine { width: 100%; margin-top: 8px; }

.disclaimer {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
  text-align: center;
  padding: 10px 6px 0;
}

/* ===== Emergencia ===== */
.emergency-topbar { position: sticky; top: 0; background: var(--bg); z-index: 5; padding-top: 12px; }
.btn-toggle {
  background: #1c2530;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
}
.btn-toggle[aria-pressed="true"] { background: var(--red); color: white; }

.sender-banner {
  background: rgba(45,125,210,0.12);
  border: 1px solid var(--blue);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 16px;
}

.sos-section { text-align: center; padding: 20px 0 10px; }
.btn-sos {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--red-bright), var(--red) 70%);
  border: 6px solid rgba(231,76,60,0.25);
  color: white;
  font-weight: 800;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 0 0 0 rgba(231,76,60,0.5);
}
.btn-sos.active { animation: sos-pulse 1s infinite; }
@keyframes sos-pulse {
  0% { box-shadow: 0 0 0 0 rgba(231,76,60,0.6); }
  70% { box-shadow: 0 0 0 30px rgba(231,76,60,0); }
  100% { box-shadow: 0 0 0 0 rgba(231,76,60,0); }
}
.sos-label { padding: 0 20px; display: block; }
.sos-status { color: var(--muted); margin-top: 14px; font-size: 14px; }

.muted { color: var(--muted); font-size: 14px; }
.muted.small { font-size: 13px; }
.coords { font-family: "SF Mono", Consolas, monospace; font-size: 15px; background: #0e141b; padding: 10px 12px; border-radius: 10px; margin: 8px 0; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 10px; line-height: 1.5; }

.rescue-preview {
  background: linear-gradient(145deg, #1a2129, #141b22);
  border: 2px solid var(--red);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.rescue-preview h3 { margin-top: 0; color: var(--red-bright); }
.rp-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.rp-row:last-child { border-bottom: none; }
.rp-row span { color: var(--muted); }
.rp-row strong { text-align: right; }
.rp-nota { flex-direction: column; }
.rp-nota strong { text-align: left; margin-top: 4px; }

.btn-deactivate {
  width: 100%;
  margin-top: 6px;
  opacity: 0.6;
  font-size: 13px;
  padding: 10px 16px;
}
.btn-deactivate:hover { opacity: 1; }

#flash-overlay {
  position: fixed;
  inset: 0;
  background: white;
  opacity: 0;
  pointer-events: none;
  z-index: 999;
}
#flash-overlay.on { opacity: 1; }

/* ===== Modo ahorro de energía ===== */
body.power-save {
  background: #000;
}
body.power-save .view { background: #000; }
body.power-save .card, body.power-save .rescue-preview, body.power-save .sender-banner {
  background: #000;
  border-color: #1a1a1a;
}
body.power-save .btn-sos {
  background: #3a0e0e;
  box-shadow: none;
}
body.power-save * {
  animation: none !important;
  transition: none !important;
}
