body {
  font-family: Arial, sans-serif;
  background-color: #1e1e1e;
  color: #f0f0f0;
  margin: 0;
  padding: 1em;
}
body.large-location-enabled .meta em {
  font-size: 1.4em;
  font-weight: bold;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1em;
  padding: 10px;
  background-color: #1e1e1e;
  z-index: 100;
  position: relative;
  min-height: 60px;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-left img.logo {
  height: 120px;
  width: auto;
}
.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.header-buttons-grid {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 10px;
}

.header-buttons-grid button,
#openFilter,
#muteButton,
#openStream,
#contactButton {
  padding: 10px 14px;
  font-size: 16px;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  background-color: #444;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.1);
  transition: background-color 0.2s ease;
  min-width: 110px;
}

.header-buttons-grid button:hover,
#openFilter:hover,
#muteButton:hover,
#openStream:hover,
#contactButton:hover {
  background-color: #555;
}

.logo {
  width: 100px;
  height: auto;
  opacity: 0.85;
}
h1 { margin: 0 0 0.25em; }
#lastUpdated { font-size: 0.9em; color: #aaa; }

.filter-selects label {
  display: flex;
  flex-direction: column;
  font-size: 0.95em;
}

select {
  background-color: #2c2c2c;
  color: #f0f0f0;
  border: 1px solid #555;
  padding: 0.4em;
  min-width: 180px;
  height: 100px;
}

.card-container,
#incidentCards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1em;
  margin-top: 1.5em;
}

.card {
  background-color: #2c2c2c;
  border: 1px solid #444;
  border-radius: 12px;
  padding: 1em;
  box-shadow: 0 2px 14px rgba(0,0,0,0.35);
  position: relative;
  overflow: visible;
}
.card.cleared { opacity: .6; }
.card h2 {
  font-size: 1.2em;
  margin: 0 0 0.3em;
  color: #fff;
}
.card h2.fire { color: rgb(255, 61, 61); }
.card h2.law { color: #3399ff; }
.card h2.alert { color: #ff33dd; }
.card h2.hazard { color: orange; }
.card h2.animal { color: rgb(0, 139, 0); }
.card h2.weather { color: #c187ff; }
.card h2.fatal { color: maroon; }
.card h2.medical { color: rgb(255, 61, 61); }

.card .meta {
  font-size: 0.95em;
  color: #cfcfcf;
  margin-bottom: 0.8em;
  overflow: visible;
  padding-right: 76px;
}
body.large-location-enabled .card .meta { padding-right: 120px; }
.card .meta .line { margin: 6px 0; }

.card button {
  background-color: #007acc;
  border: none;
  color: white;
  padding: 0.5em 1em;
  font-size: 0.9em;
  border-radius: 6px;
  cursor: pointer;
}
.card button:hover { background-color: #005f99; }

.emoji {
  position: absolute;
  bottom: 10px;
  right: 12px;
  font-size: 2.6em;
  pointer-events: none;
}
.empty {
  margin-top: 2em;
  text-align: center;
  color: #888;
}

.units-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.unit-chip {
  position: relative;
  cursor: default;
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 14px;
  line-height: 1.3;
  border: 1px solid #444;
}
.unit-chip.os-available { background:#0c2e1a; color:#baf7c8; border-color:#0a1e13; }
.unit-chip.on-scene { background:#175c2b; color:#d7ffe2; border-color:#124822; }
.unit-chip.dispatched { background:#7a5e00; color:#fff5bf; border-color:#5b4700; }
.unit-chip.other { background:#5a1b1b; color:#ffd7d7; border-color:#3d1212; }
.unit-chip[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(100% + 10px);
  background: #165a63;
  color: #fff;
  padding: 8px 12px;
  white-space: pre-line;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
  font-size: 15px;
  line-height: 1.25;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
  z-index: 9999;
  min-width: max-content;
  max-width: 280px;
  text-align: center;
}
.unit-chip[data-tip]::before {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 100%;
  border-width: 7px;
  border-style: solid;
  border-color: #165a63 transparent transparent transparent;
  opacity: 0;
  transition: opacity .12s ease;
  z-index: 10000;
}
.unit-chip:hover::after,
.unit-chip:hover::before { opacity: 1; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.65);
  padding: 16px;
}
.modal.show { display: flex; }
body.modal-open { overflow: hidden; }

.modal .modal-content,
.stream-modal-content {
  box-sizing: border-box;
  background: #2c2c2c;
  color: #f0f0f0;
  border: 1px solid #444;
  border-radius: 10px;
  padding: 16px 18px;
  width: min(96vw, 1100px);
  max-width: 1100px;
  max-height: 98vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  resize: none;
}
.modal-content h3 { margin-top: 0; }
.modal-content pre {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 1em;
  color: #ccc;
}
.modal-content button {
  margin-top: 1em;
  background: #444;
  color: white;
  border: none;
  padding: 0.5em 1em;
  cursor: pointer;
  border-radius: 6px;
}
.modal-content button:hover { background: #666; }

.contact-modal-content { max-height: 80vh; overflow-y: auto; }
.contact-modal-content::-webkit-scrollbar { width: 8px; }
.contact-modal-content::-webkit-scrollbar-thumb { background: #555; border-radius: 4px; }
.contact-modal-content::-webkit-scrollbar-track { background: #2c2c2c; }
.contact-modal-content {
  max-width: 600px;
  height: 65vh;
  display: flex;
  flex-direction: column;
}
.contact-scroll-container {
  flex: 1;
  overflow-y: auto;
  padding-right: 10px;
  margin-top: 10px;
}
.contact-scroll-container::-webkit-scrollbar { width: 8px; }
.contact-scroll-container::-webkit-scrollbar-thumb { background-color: #555; border-radius: 4px; }
.contact-scroll-container::-webkit-scrollbar-track { background-color: #2c2c2c; }

#filterModal .filter-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 16px 18px;
  position: relative;
  max-height: calc(88vh - 20px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.filter-selects {
  display: flex;
  gap: 2rem;
  justify-content: space-between;
  flex-wrap: wrap;
}
.filter-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}
#dispatchSelect,#areaSelect {
  min-height: 250px;
  font-size: 14px;
}

.city-block h3 { margin: 0.25rem 0 0.5rem; }
.city-checklist {
  display: grid;
  gap: 8px 24px;
  grid-template-columns: repeat(3, minmax(200px, 1fr));
}
.city-checklist label {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  line-height: 1.2;
}
.city-checklist input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.stream-entry {
  margin-bottom: 10px;
  background: #222;
  padding: 6px 8px;
  border-radius: 8px;
  color: #fff;
  max-width: none;
}
.stream-entry p { margin: 0 0 6px; font-weight: 600; font-size: 15px; }
.stream-entry audio { width: 100%; display: block; }
#streamModal .modal-content { max-width: 1100px; margin: auto; }
.stream-scroll-container {
  max-height: calc(88vh - 90px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 0 0;
}
.streams-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.details-scroll-container {
  max-height: 400px;
  overflow-y: auto;
  padding-right: 6px;
  margin-bottom: 10px;
}
.top-right-button { position: absolute; top: 30px; right: 20px; }

@media (max-width: 1100px) {
  .city-checklist { grid-template-columns: repeat(2, minmax(180px, 1fr)); gap: 8px 18px; }
  .streams-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .city-checklist { grid-template-columns: 1fr; gap: 8px 12px; }
  .streams-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .header { flex-direction: column; align-items: flex-start; }
  .header-left,.header-right { width: 100%; }
  .header-buttons-grid {
    width: 100%;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}

#contactList a { color: orange; text-decoration: none; }
#contactList a:hover { text-decoration: underline; }

.unit-chip.special-channel {
  background: #281a5a;
  color: #f2d9ff;
  border-color: #2a0f40;
}
