.sos-services {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 18px 0;
}

.sos-service-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 1 150px;
  min-height: 112px;
  padding: 12px 10px;
  border: 2px solid var(--sos-color);
  border-radius: 14px;
  background: white;
  color: var(--sos-color);
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
  cursor: pointer;
}

.sos-service-button[data-sos-service="police"] { --sos-color: #175cd3; }
.sos-service-button[data-sos-service="ambulance"] { --sos-color: #087443; }
.sos-service-button[data-sos-service="fire"] { --sos-color: #b42318; }
.sos-service-button:hover { background: #f2f4f7; }
.sos-service-button:focus-visible { outline: 3px solid #101828; outline-offset: 3px; }
.sos-service-button:disabled { opacity: .55; cursor: wait; }
.sos-service-button img { display: block; width: 64px; height: 48px; object-fit: contain; }
.sos-icon-still { display: none !important; }
.sos-service-note { font-size: 14px; line-height: 1.5; }

@media (max-width: 420px) {
  .sos-services { gap: 8px; }
  .sos-service-button { flex: 1 1 80px; min-width: 80px; padding: 10px 6px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .sos-icon-animated { display: none !important; }
  .sos-icon-still { display: block !important; }
}

/* Compact driver toolbar matching the rider emergency controls. */
.driver-sos-compact.emergency-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px;
  border: 1px solid #ff302b;
  border-radius: 9px;
  box-shadow: 0 3px 8px rgb(217 45 32 / 8%);
}
.driver-sos-compact.emergency-card h2 {
  margin: 0;
  color: #d00;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
}
.driver-sos-compact .sos-services {
  flex-wrap: nowrap;
  gap: 4px;
  margin: 0;
}
.driver-sos-compact .sos-service-button {
  flex: 0 1 79px;
  width: 79px;
  min-width: 0;
  min-height: 54px;
  margin: 0;
  padding: 3px;
  gap: 2px;
  border-width: 1px;
  border-radius: 5px;
  font-size: 9px;
  line-height: 1.1;
}
.driver-sos-compact .sos-service-button img {
  width: 24px;
  height: 18px;
}
.driver-sos-compact > a[href="tel:911"] {
  margin: 0 !important;
  padding: 9px 5px !important;
  border-radius: 5px !important;
  font-size: 9px;
  min-width: 44px;
  min-height: 32px;
  box-sizing: border-box;
  white-space: nowrap;
}
.driver-sos-compact #sosResult {
  flex-basis: 100%;
  margin: 8px 0 0;
  font-size: 14px;
}
.driver-sos-compact #sosResult:empty { display: none; }
/* Compact rider emergency controls, with all three services in one row. */
main .rider-emergency-card {
  display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center;
  gap:8px; margin-top:20px; padding:12px; border-width:2px; border-radius:12px;
  text-align:left; box-shadow:0 3px 10px rgba(217,45,32,.1);
}
main .rider-emergency-card h2 {
  grid-column:1 / -1; margin:0; font-size:18px; line-height:1.25;
}
main .rider-emergency-card .sos-services {
  display:grid; grid-template-columns:repeat(3,minmax(0,1fr));
  gap:6px; margin:0; min-width:0;
}
main .rider-emergency-card .sos-service-button {
  flex:none; min-width:0; min-height:44px; margin:0; padding:5px 3px;
  gap:3px; border-width:1px; border-radius:7px; font-size:11px; line-height:1.15;
}
main .rider-emergency-card .sos-service-button img {
  width:24px; height:18px;
}
main .rider-emergency-card > a[href="tel:911"] {
  margin:0 !important; padding:10px 8px !important;
  min-height:44px; font-size:11px; text-align:center;
}
main .rider-emergency-card .rider-emergency-warning,
main .rider-emergency-card .sos-service-note,
main .rider-emergency-card .rider-emergency-note {
  grid-column:1 / -1; margin:0; max-width:none;
  font-size:12px; line-height:1.4; font-weight:400;
}
main .rider-emergency-card .rider-emergency-warning { grid-row:3; }
main .rider-emergency-card #riderSosResult {
  grid-column:1 / -1; margin:0; max-width:100%; font-size:13px;
}
main .rider-emergency-card #riderSosResult:empty { display:none; }
@media (min-width:601px) {
  main .rider-emergency-card { grid-template-columns:auto minmax(0,1fr) auto; }
  main .rider-emergency-card h2 { grid-column:auto; }
  main .rider-emergency-card .rider-emergency-warning { grid-row:2; }
}


/* Roomier emergency controls with legible service names. */
.driver-sos-compact.emergency-card { gap:10px; padding:14px; }
.driver-sos-compact.emergency-card h2 { font-size:17px; }
.driver-sos-compact .sos-services { flex:1 1 330px; flex-wrap:wrap; gap:7px; }
.driver-sos-compact .sos-service-button,
main .rider-emergency-card .sos-service-button {
  flex:1 1 100px;
  width:auto;
  min-width:0;
  min-height:78px !important;
  padding:10px 8px !important;
  gap:6px;
  font-size:14px !important;
  line-height:1.3 !important;
}
.driver-sos-compact .sos-service-button img,
main .rider-emergency-card .sos-service-button img { width:40px; height:30px; }
.driver-sos-compact > a[href="tel:911"],
main .rider-emergency-card > a[href="tel:911"] {
  display:inline-flex; align-items:center; justify-content:center;
  min-height:48px; padding:12px 14px !important;
  font-size:14px; line-height:1.3; white-space:normal;
}
main .rider-emergency-card { padding:16px; gap:10px; }
main .rider-emergency-card h2 { font-size:19px; }
@media (max-width:420px) {
  main .rider-emergency-card { grid-template-columns:minmax(0,1fr); }
  main .rider-emergency-card > a[href="tel:911"] { justify-self:stretch; }
  .driver-sos-compact .sos-services { flex-basis:100%; }
}

/* Two available emergency services share the rider toolbar evenly. */
main .rider-emergency-card .sos-services { grid-template-columns:repeat(2,minmax(0,1fr)); }
