: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);
  --safety-bg-base: #fff0cd;
  --safety-bg-alert: #ff777d;
  --safety-border-base: #7c3900;
  --safety-border-alert: #a30818;
  --safety-halo: rgba(163, 8, 24, .38);
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; scroll-padding-top: 14px; }
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-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 { max-width: 1120px; margin-right: auto; margin-left: auto; }
.form-panel, .confirmation-panel { max-width: 980px; margin-right: auto; margin-left: auto; }
.safety-panel {
  padding: 16px clamp(14px, 3vw, 22px);
  border: 2px solid var(--safety-border-base);
  border-left-width: 8px;
  border-radius: 9px;
  background: var(--safety-bg-base);
  color: #2c1b06;
  animation: safety-panel-flash 1.3s ease-in-out infinite;
}
.safety-panel h1 { margin: 0 0 7px; font-size: clamp(25px, 6vw, 34px); line-height: 1.12; letter-spacing: -.5px; }
@keyframes safety-panel-flash {
  0%, 100% {
    background: var(--safety-bg-base);
    border-color: var(--safety-border-base);
    box-shadow: 0 0 0 0 transparent;
  }
  50% {
    background: var(--safety-bg-alert);
    border-color: var(--safety-border-alert);
    box-shadow: 0 0 0 6px var(--safety-halo), 0 0 28px var(--safety-halo);
  }
}
.safety-panel p { margin: 7px 0; font-size: 17px; line-height: 1.48; }
.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 h2 { 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 12px; color: var(--emergency-muted); }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-call, .quick-request {
  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;
}
.quick-request { border-color: #b8c7f2; background: #fff; color: #1239c8; }

.form-panel, .confirmation-panel {
  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-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); }
.call-alternative { margin: 14px 0; padding: 10px 12px; border-left: 3px solid var(--emergency-blue); background: #edf1fa; color: #303b4c; font-size: 16px; font-weight: 700; }
.call-alternative a { color: #1239c8; font-weight: 800; text-decoration: underline; text-underline-offset: 2px; }
.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; }
.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; }
.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; }
.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; }
  .safety-panel { padding: 13px 12px; }
  .safety-panel p { font-size: 16px; }
  .quick-actions { grid-template-columns: 1fr; gap: 8px; }
  .quick-call, .quick-request { min-height: 60px; }
  .form-panel, .confirmation-panel { padding: 13px 12px; }
  .choice-grid { gap: 6px; }
  .choice-option { min-height: 52px; padding: 7px; gap: 7px; font-size: 15px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --emergency-ink: #f4f6fb;
    --emergency-muted: #c3cbd7;
    --emergency-paper: #111722;
    --emergency-panel: #1a2433;
    --emergency-line: #536176;
    --safety-bg-base: #3b2b10;
    --safety-bg-alert: #8d1721;
    --safety-border-base: #d48a30;
    --safety-border-alert: #ff7b82;
    --safety-halo: rgba(255, 70, 83, .42);
  }
  a, .motorway-details summary, .find-what3words { color: #b9caff; }
  .safety-panel { color: #fff4d6; }
  .form-panel, .confirmation-panel { border-color: #536176; background: var(--emergency-panel); }
  .highway-code-link { color: #fff0c5; }
  .quick-request, .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; }
  .call-alternative { background: #202f50; color: #f0f4ff; }
  .call-alternative a, .motorway-details summary { color: #b9caff; }
  .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; }
  .safety-panel {
    animation: none;
    background: var(--safety-bg-alert);
    border-color: var(--safety-border-alert);
    box-shadow: 0 0 0 6px var(--safety-halo);
  }
}
