:root {
  color-scheme: light;
  --red: #b42318;
  --red-dark: #7a140d;
  --ink: #111827;
  --muted: #4b5563;
  --line: #cbd5e1;
  --soft: #f1f5f9;
  --yellow: #ffdf63;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 18px;
  line-height: 1.45;
}

button, a, summary { -webkit-tap-highlight-color: transparent; }
button, input, textarea { font: inherit; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 12px 16px;
  background: #fff;
  color: #000;
  transform: translateY(-150%);
}
.skip-link:focus { transform: none; }

.emergency-header {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px max(16px, env(safe-area-inset-left));
  border-bottom: 3px solid #ff6257;
  background: linear-gradient(135deg, #7a140d, #b42318 58%, #8d170f);
  box-shadow: 0 8px 24px rgba(122, 20, 13, .28);
}
.emergency-header img { display: block; width: min(230px, 60vw); height: auto; }
.exit-link { min-height: 44px; display: inline-flex; align-items: center; padding: 8px 13px; border: 2px solid #fff; border-radius: 8px; background: rgba(74, 7, 4, .25); color: #fff; font: inherit; font-weight: 800; text-decoration: none; cursor: pointer; }
.exit-link:hover, .exit-link:focus-visible { background: #fff; color: var(--red-dark); }

main { width: min(760px, 100%); margin: 0 auto; padding-bottom: 48px; }

.alarm { padding: 28px 18px 30px; background: var(--red); color: #fff; text-align: center; }
.alarm-label { display: inline-block; margin: 0 0 12px; padding: 5px 10px; border: 2px solid #fff; border-radius: 5px; font-size: .78rem; font-weight: 900; letter-spacing: .12em; }
.alarm h1 { margin: 0; font-size: clamp(2rem, 9vw, 3.4rem); line-height: 1; letter-spacing: -.04em; }
.alarm p { max-width: 620px; margin: 18px auto 0; font-size: 1.05rem; }
.alarm .calm-line { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.45); font-size: 1rem; }

.action-section { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 12px; padding: 30px 18px; border-bottom: 8px solid var(--soft); }
.section-number { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: #111827; color: #fff; font-size: 1.3rem; font-weight: 950; }
.section-content { min-width: 0; }
h2 { margin: 2px 0 5px; font-size: clamp(1.45rem, 6vw, 2rem); line-height: 1.1; letter-spacing: -.025em; }
.help-text { margin: 0 0 20px; color: var(--muted); }

.country-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.country-button { min-height: 112px; display: grid; justify-items: center; align-content: center; gap: 2px; padding: 12px 8px; border: 3px solid #111827; border-radius: 10px; background: #fff; color: #111827; cursor: pointer; }
.country-button > span { font-size: 2rem; line-height: 1; }
.country-button strong { font-size: 1rem; }
.country-button small { font-size: .75rem; color: var(--muted); }
.country-button[aria-pressed="true"] { background: #111827; color: #fff; box-shadow: 0 0 0 4px var(--yellow); }
.country-button[aria-pressed="true"] small { color: #fff; }
.choose-notice { margin: 14px 0 0; padding: 12px; background: var(--yellow); color: #111; border-radius: 7px; text-align: center; font-weight: 850; }

.phone-panel { margin-top: 18px; }
.phone-panel h3 { margin: 0 0 10px; font-size: 1.15rem; }
.call-button { min-height: 78px; display: flex; align-items: center; gap: 14px; margin: 10px 0; padding: 12px 14px; border: 3px solid var(--red); border-radius: 9px; background: #fff; color: var(--red-dark); text-decoration: none; }
.call-button.primary-call { background: var(--red); color: #fff; }
.call-icon { width: 40px; flex: 0 0 40px; text-align: center; font-size: 1.65rem; font-weight: 950; }
.call-button span:last-child { display: grid; }
.call-button strong { font-size: 1.16rem; line-height: 1.1; }
.call-button small { margin-top: 3px; font-weight: 700; }
.dial-warning { margin: 12px 0 0; color: var(--muted); font-size: .8rem; }

.secondary-numbers, .manual-help { margin-top: 12px; border: 2px solid var(--line); border-radius: 8px; background: var(--soft); }
.secondary-numbers summary, .manual-help summary { min-height: 54px; display: flex; align-items: center; padding: 12px; font-weight: 850; cursor: pointer; }
.secondary-numbers summary::marker, .manual-help summary::marker { display: none; }
.secondary-numbers summary::after, .manual-help summary::after { content: "+"; margin-left: auto; font-size: 1.4rem; }
.secondary-numbers[open] summary::after, .manual-help[open] summary::after { content: "−"; }
.secondary-numbers > div { display: grid; border-top: 1px solid var(--line); }
.secondary-numbers a { display: grid; padding: 13px; color: #111827; text-decoration: none; border-bottom: 1px solid var(--line); }
.secondary-numbers a:last-child { border-bottom: 0; }
.secondary-numbers span { color: var(--muted); font-size: .82rem; }

.big-action { width: 100%; min-height: 78px; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 14px; border: 0; border-radius: 9px; cursor: pointer; }
.location-action { background: #075985; color: #fff; }
.location-action span { font-size: 2rem; }
.location-action strong { font-size: 1.05rem; }
.location-action[disabled] { opacity: .7; cursor: wait; }
.location-status { margin-top: 12px; padding: 12px; border: 2px solid var(--line); border-radius: 8px; background: var(--soft); font-size: .9rem; }
.location-status.is-error { border-color: var(--red); background: #fff1f0; color: var(--red-dark); font-weight: 750; }
.location-result { margin-top: 12px; }
.coordinates { display: grid; gap: 4px; margin: 0; padding: 16px; border: 3px solid #075985; border-radius: 8px; text-align: center; }
.coordinates span { font-size: .72rem; font-weight: 900; letter-spacing: .1em; }
.coordinates strong { font-size: clamp(1.15rem, 5vw, 1.6rem); overflow-wrap: anywhere; }
.coordinates small { color: var(--muted); }
.location-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 8px; }
.location-actions button, .location-actions a { min-height: 70px; display: grid; place-content: center; padding: 8px 4px; border: 2px solid #075985; border-radius: 8px; background: #fff; color: #06496b; text-align: center; text-decoration: none; cursor: pointer; }
.location-actions strong { font-size: .78rem; }
.location-actions small { margin-top: 3px; font-size: .63rem; line-height: 1.15; }
#emergency-message { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.manual-help ol { margin: 0; padding: 0 18px 16px 40px; }
.privacy-note { margin: 12px 0 0; color: var(--muted); font-size: .78rem; }

.scenario-list { display: grid; gap: 10px; }
.scenario { border: 3px solid #1f2937; border-radius: 9px; overflow: hidden; }
.scenario.danger { border-color: var(--red); }
.scenario summary { min-height: 72px; display: flex; align-items: center; gap: 13px; padding: 14px; background: #fff; cursor: pointer; }
.scenario summary::marker { display: none; }
.scenario summary > span { width: 34px; flex: 0 0 34px; font-size: 1.6rem; text-align: center; }
.scenario summary strong { font-size: 1rem; line-height: 1.15; }
.scenario summary::after { content: "+"; margin-left: auto; font-size: 1.8rem; font-weight: 900; }
.scenario[open] summary { background: #111827; color: #fff; }
.scenario.danger[open] summary { background: var(--red); }
.scenario[open] summary::after { content: "−"; }
.scenario ol { margin: 0; padding: 16px 18px 18px 42px; }
.scenario li { margin-bottom: 12px; }
.scenario li:last-child { margin-bottom: 0; }

.final-reminder, .official-sources { margin: 28px 18px; padding: 20px; border-radius: 9px; }
.final-reminder { background: var(--yellow); color: #111; }
.final-reminder h2, .official-sources h2 { font-size: 1.35rem; }
.final-reminder ul { margin: 12px 0 0; padding-left: 22px; }
.final-reminder li { margin: 7px 0; }
.official-sources { border: 2px solid var(--line); background: var(--soft); }
.official-sources p { font-size: .85rem; }
.official-sources div { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.official-sources a { color: #06496b; font-size: .8rem; font-weight: 750; }

/* Modo Emergencia: cabecera y pie forman una envolvente roja inequívoca. */
.emergency-mode .site-global-footer {
  --site-footer-line: rgba(255, 255, 255, .22);
  --site-footer-cyan: #fff;
  --site-footer-muted: #ffd9d6;
  border-top: 4px solid #ff6257;
  background: linear-gradient(145deg, #5b0b07, #8d170f 52%, #6d100a);
  color: #ffd9d6;
}
.emergency-mode .site-footer-brand img { filter: drop-shadow(0 7px 18px rgba(48, 0, 0, .42)); }
.emergency-mode .site-footer-social a { border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.08); color: #fff; }
.emergency-mode .site-footer-social a:hover,
.emergency-mode .site-footer-social a:focus-visible { border-color: #fff; background: #fff; color: var(--red-dark); }
.emergency-mode .site-footer-social i { color: inherit; }
.emergency-mode .site-footer-purpose strong,
.emergency-mode .site-footer-links a { color: #fff; }
.emergency-mode .site-footer-purpose span,
.emergency-mode .site-footer-bottom { color: #ffc5c0; }
.emergency-mode .site-footer-links a:hover,
.emergency-mode .site-footer-links a:focus-visible { color: var(--yellow); }

button:focus-visible, a:focus-visible, summary:focus-visible { outline: 4px solid #2563eb; outline-offset: 3px; }

@media (max-width: 480px) {
  body { font-size: 17px; }
  .action-section { grid-template-columns: 38px minmax(0,1fr); gap: 8px; padding-inline: 12px; }
  .section-number { width: 36px; height: 36px; }
  .country-button { min-height: 108px; }
  .call-button { margin-block: 8px; }
  .location-actions { grid-template-columns: 1fr; }
  .location-actions button, .location-actions a { min-height: 60px; }
  .location-actions small { font-size: .7rem; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
