:root {
  color-scheme: light dark;
  --emergency-ink: var(--ink, #151c29);
  --emergency-muted: #455164;
  --emergency-paper: var(--paper, #f3f5f8);
  --emergency-panel: var(--white, #fff);
  --emergency-line: var(--line, #dbe0e8);
  --emergency-blue: var(--blue, #1743ed);
  --emergency-navy: var(--navy, #111827);
  --emergency-red: #8d1721;
  --emergency-focus: var(--blue-bright, #2864ff);
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; scroll-padding-top: 92px; }
body {
  margin: 0;
  padding-bottom: 0;
  background: var(--emergency-paper);
  color: var(--emergency-ink);
  font-family: var(--font-body, "Manrope", Arial, sans-serif);
  font-size: 18px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}
a { color: #123bbd; text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--emergency-focus);
  outline-offset: 3px;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.emergency-header-inner { justify-content: space-between; }
.emergency-site-header { position: sticky; top: 0; z-index: 120; box-shadow: 0 2px 8px rgba(12, 19, 31, .18); }
.emergency-header-inner .brand { color: #fff; text-decoration: none; }
.emergency-header-inner .header-call { color: #fff; text-decoration: none; }

.emergency-main { width: 100%; margin: 0 auto; padding: 20px var(--gutter) 36px; }
.safety-panel, .emergency-intro, .safety-check-panel, .form-panel, .confirmation-panel { max-width: 1120px; margin-right: auto; margin-left: auto; }
.safety-panel {
  padding: 14px clamp(14px, 3vw, 22px);
  border: 1px solid #a31622;
  border-left-width: 6px;
  border-radius: 9px;
  background: #fff0f0;
  color: #351014;
}
.safety-panel.is-guidance { border-color: #8a641e; background: #fff8e7; color: #30250f; }
.safety-panel.is-safe { border-color: #63789d; background: #edf2fb; color: #20304b; }
.safety-panel h2 { margin: 0 0 5px; font-size: clamp(20px, 4vw, 25px); line-height: 1.2; letter-spacing: -.3px; }
.safety-panel p { margin: 5px 0; font-size: 16px; line-height: 1.45; }
.call-999 {
  width: 100%;
  min-height: 62px;
  margin: 10px 0 5px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #5f0c14;
  border-radius: 6px;
  background: var(--emergency-red);
  color: #fff;
  font-size: clamp(18px, 4.5vw, 22px);
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}
.highway-code-link { display: inline-block; margin-top: 5px; color: #332000; font-size: 14px; font-weight: 700; }

.emergency-intro { padding: 22px 2px 16px; }
.emergency-eyebrow { margin: 0 0 4px; }
.emergency-intro h1 { margin: 0; font-size: clamp(29px, 7vw, 40px); font-weight: 800; line-height: 1.08; letter-spacing: -1.1px; }
.emergency-intro p { margin: 5px 0 0; color: var(--emergency-muted); }
.quick-call {
  width: min(100%, 360px);
  min-height: 66px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--emergency-blue);
  border-radius: 7px;
  background: linear-gradient(120deg, #2458ff, #123bdc);
  color: #fff;
  font-size: clamp(16px, 4.2vw, 20px);
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.safety-check-panel, .safety-choice-grid { max-width: 1120px; margin-right: auto; margin-left: auto; }
.safety-check-panel {
  width: 100%;
  margin-top: 18px;
  padding: clamp(14px, 3vw, 22px);
  border: 1px solid var(--emergency-line);
  border-radius: 9px;
  background: var(--emergency-panel);
}
.safety-check-panel .form-heading { margin-bottom: 12px; }
.safety-check-panel .form-heading > p:last-child { margin-bottom: 0; }
.safety-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.safety-choice {
  min-height: 62px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  border: 1px solid #aebbd0;
  border-radius: 6px;
  background: #fff;
  color: #17243a;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.35;
  text-decoration: none;
}
.safety-choice:hover, .safety-choice.is-selected { border-color: var(--emergency-blue); background: #edf2ff; color: #1239c8; }
.selected-safety-guidance {
  margin-top: 14px;
  padding: 14px;
  border: 2px solid #a31622;
  border-left-width: 7px;
  border-radius: 7px;
  background: #fff0f0;
  color: #351014;
}
.selected-safety-guidance h3 { margin: 0 0 7px; font-size: 21px; line-height: 1.2; }
.selected-safety-guidance p { margin: 7px 0; font-size: 16px; line-height: 1.5; }
.guidance-next-step { font-weight: 700; }
.continue-emergency {
  width: 100%;
  min-height: 56px;
  margin-top: 7px;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #1239d6;
  border-radius: 6px;
  background: #fff;
  color: #1239c8;
  font-size: 17px;
  font-weight: 900;
  text-align: center;
}
.safe-location-note, .location-safety-note { padding: 9px 11px; border-left: 3px solid var(--emergency-blue); background: #edf2ff; color: #253657; font-size: 15px; font-weight: 700; }
.safe-location-note { margin: 12px 0 0; }
.location-safety-note { margin: 3px 0 9px; }

.form-panel, .confirmation-panel {
  width: 100%;
  padding: clamp(14px, 3vw, 22px);
  border: 1px solid #dbe1ea;
  border-radius: 9px;
  background: linear-gradient(180deg, #fff, #f8f9fb);
  box-shadow: 0 6px 19px rgba(21, 32, 49, .05);
}
.form-panel, .confirmation-panel { margin-top: 24px; }
.confirmation-call { width: min(100%, 420px); }
.form-heading h2, .confirmation-panel h2 { margin: 0; font-size: clamp(23px, 5.7vw, 30px); font-weight: 800; line-height: 1.2; letter-spacing: -.7px; }
.form-heading > p, .confirmation-panel > p { margin: 5px 0 14px; color: var(--emergency-muted); }
.form-panel form { display: grid; gap: 8px; }
.field-label, .assistance-options legend, .location-options legend {
  margin-top: 7px;
  color: var(--emergency-ink);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.35;
}
.field-label span, .assistance-options legend span, .location-options legend span { color: var(--emergency-muted); font-size: 14px; font-weight: 600; }
.large-input {
  width: 100%;
  min-height: 56px;
  padding: 11px 13px;
  border: 1px solid #c8d0dc;
  border-radius: 5px;
  background: var(--emergency-panel);
  color: var(--emergency-ink);
  font-size: 18px;
}
.large-input:focus-visible { border-color: #5579ff; box-shadow: 0 0 0 3px rgba(23, 67, 237, .12); }
.large-input::placeholder { color: #737f90; opacity: 1; }
.assistance-options, .location-options { min-width: 0; margin: 9px 0 0; padding: 0; border: 0; }
.assistance-options legend, .location-options legend { margin-bottom: 8px; padding: 0; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choice-option {
  min-width: 0;
  min-height: 54px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #c8d0dc;
  border-radius: 5px;
  background: var(--emergency-panel);
  color: var(--emergency-ink);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.choice-option:has(input:checked) { border-color: #5579ff; background: #e9efff; color: #1239c8; }
.choice-option input { flex: 0 0 auto; width: 22px; height: 22px; margin: 0; accent-color: var(--emergency-blue); }
.gps-button {
  width: 100%;
  min-height: 58px;
  padding: 10px 14px;
  border: 1px solid #1239d6;
  border-radius: 7px;
  background: linear-gradient(120deg, #2458ff, #123bdc);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 5px 16px rgba(20, 63, 230, .17);
  cursor: pointer;
}
.gps-button:disabled { opacity: .78; cursor: wait; }
.gps-status { min-height: 1.5em; margin: 4px 0 10px; color: var(--emergency-muted); font-size: 15px; }
.motorway-details { margin: 9px 0 7px; border-top: 1px solid var(--emergency-line); border-bottom: 1px solid var(--emergency-line); }
.motorway-details summary { min-height: 52px; padding: 11px 2px; color: #1239c8; font-size: 16px; font-weight: 800; cursor: pointer; }
.motorway-fields { display: grid; gap: 6px; padding: 0 0 12px; }
.motorway-marker-guide { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; margin: 4px 0 8px; padding: 12px; border: 1px solid #d6deec; border-radius: 6px; background: #f6f8fc; }
.motorway-marker-guide p { margin: 0; color: #334155; font-size: 14px; line-height: 1.5; }
.marker-example { min-width: 102px; padding: 8px 10px; display: grid; justify-items: center; border: 2px solid #fff; border-radius: 5px; background: #1743ed; box-shadow: 0 0 0 1px #1743ed; color: #fff; font-weight: 900; line-height: 1.05; }
.marker-example span { font-size: 15px; }
.marker-example strong { margin-top: 4px; font-size: 21px; }
.find-what3words { width: fit-content; min-height: 42px; margin: 3px 0; display: inline-flex; align-items: center; font-size: 15px; font-weight: 800; }
.what3words-note { margin: 4px 0 0; color: var(--emergency-muted); font-size: 13px; line-height: 1.5; }
.assistance-flag-options { min-width: 0; margin: 12px 0 0; padding: 0; border: 0; }
.assistance-flag-options legend { margin-bottom: 8px; padding: 0; color: var(--emergency-ink); font-size: 17px; font-weight: 800; }
.assistance-flag-options legend span { color: var(--emergency-muted); font-size: 14px; font-weight: 600; }
.assistance-flag-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.assistance-flag {
  min-height: 56px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #c8d0dc;
  border-radius: 5px;
  background: var(--emergency-panel);
  color: var(--emergency-ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
}
.assistance-flag input { flex: 0 0 auto; width: 23px; height: 23px; margin: 0; accent-color: var(--emergency-blue); }
.submit-emergency {
  width: 100%;
  min-height: 64px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #1239d6;
  border-radius: 7px;
  background: linear-gradient(120deg, #2458ff, #123bdc);
  color: #fff;
  font-size: clamp(17px, 4.4vw, 20px);
  font-weight: 900;
  box-shadow: 0 7px 19px rgba(23, 67, 237, .19);
  cursor: pointer;
}
.privacy-copy { margin: 7px 0 0; color: var(--emergency-muted); font-size: 14px; line-height: 1.45; }
.form-errors { margin: 14px 0; padding: 12px 14px; border: 2px solid #941f28; border-radius: 6px; background: #fff0f0; color: #531017; }
.submission-error-summary { max-width: 1120px; margin: 14px auto; }
.submission-error-summary a { width: fit-content; min-height: 44px; padding-top: 0; display: flex; align-items: center; }
.form-errors p { margin: 0 0 5px; font-weight: 900; }
.form-errors ul { margin: 0 0 7px; padding-left: 22px; }
.form-errors a { display: inline-block; min-height: 42px; padding-top: 7px; color: #62101a; font-weight: 900; }
.confirmation-panel { padding: clamp(18px, 5vw, 30px); border-top: 6px solid var(--emergency-blue); }
.reference-label { margin: 0; color: var(--emergency-muted); font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; }
.request-reference { margin: 0 0 10px; color: #1239c8; font-size: 30px; font-weight: 900; }
.confirmation-panel h2 { margin-bottom: 9px; }
.confirmation-call { margin: 15px 0; }
.confirmation-panel > p:last-child { margin-bottom: 0; font-size: 14px; }
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 820px) {
  body { padding-bottom: 82px; padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
}

@media (max-width: 560px) {
  body { font-size: 18px; }
  .emergency-main { padding-top: 12px; padding-bottom: 16px; }
  .emergency-intro { padding: 16px 2px 13px; }
  .safety-panel { padding: 12px 11px; }
  .safety-panel p { font-size: 16px; }
  .quick-call { min-height: 60px; }
  .safety-choice-grid, .assistance-flag-grid { grid-template-columns: 1fr; gap: 7px; }
  .safety-choice { min-height: 58px; font-size: 16px; }
  .selected-safety-guidance { padding: 12px; }
  .motorway-marker-guide { grid-template-columns: 1fr; justify-items: start; }
  .form-panel, .confirmation-panel { padding: 13px 12px; }
  .choice-grid { gap: 6px; }
  .choice-option { min-height: 52px; padding: 7px; gap: 7px; font-size: 15px; }
}

@media (max-width: 820px) {
  html { scroll-padding-top: 78px; }
  .emergency-header-inner .header-call { display: none; }
  .mobile-action-bar .mobile-call { flex-direction: column; gap: 0; }
  .mobile-action-bar .mobile-call strong { font-size: 13px; line-height: 1.1; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --emergency-ink: #f4f6fb;
    --emergency-muted: #c3cbd7;
    --emergency-paper: #111722;
    --emergency-panel: #1a2433;
    --emergency-line: #536176;
  }
  a, .motorway-details summary, .find-what3words { color: #b9caff; }
  .safety-panel { border-color: #ff7b82; background: #421e24; color: #ffe7e9; }
  .safety-panel.is-guidance { border-color: #dfbd72; background: #342b18; color: #fff1cc; }
  .safety-panel.is-safe { border-color: #88a8ff; background: #1d2b48; color: #e4ebff; }
  .form-panel, .confirmation-panel { border-color: #536176; background: var(--emergency-panel); }
  .highway-code-link { color: #fff0c5; }
  .choice-option:has(input:checked) { background: #1c2a49; color: #e2eaff; }
  .choice-option:has(input:checked) { border-color: #88a8ff; }
  .large-input, .choice-option { border-color: #8995a8; }
  .large-input::placeholder { color: #c0c8d4; }
  .motorway-details summary { color: #b9caff; }
  .safety-check-panel { border-color: #536176; background: var(--emergency-panel); }
  .safety-choice { border-color: #8995a8; background: var(--emergency-panel); color: #f4f6fb; }
  .safety-choice:hover, .safety-choice.is-selected, .safe-location-note, .location-safety-note { background: #202f50; color: #e4ebff; }
  .selected-safety-guidance { border-color: #ff7b82; background: #421e24; color: #ffe7e9; }
  .continue-emergency { border-color: #8aa5ff; background: #1a2433; color: #dce5ff; }
  .motorway-marker-guide { border-color: #536176; background: #202a3a; }
  .motorway-marker-guide p { color: #e1e7f0; }
  .assistance-flag { border-color: #8995a8; }
  .form-errors { border-color: #e88990; background: #421e24; color: #ffe7e9; }
  .form-errors a { color: #ffdadd; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
