* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
  background: #0a1929;
  color: #e0e0e0;
}

/* ── Map ── */

#map {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
}

/* ── Home button ── */

.home-btn {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1000;
  width: 36px;
  height: 36px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3Cpolyline points='9 22 9 12 15 12 15 22'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px;
}

.home-btn:active {
  background-color: #e8e8e8;
}

/* ── Location banner ── */

.location-banner {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translate(-50%, -16px);
  z-index: 1000;
  max-width: calc(100% - 96px);
  background: rgba(10, 25, 41, 0.92);
  border: 1px solid #274357;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.location-banner.visible {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.location-banner button {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid #3a5a72;
  color: #cfe0ea;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}

.location-banner button:active {
  background: #16324a;
}

/* ── Offline indicator ── */

.offline-indicator {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  background: rgba(217, 130, 43, 0.15);
  border: 1px solid #d9822b;
  color: #f0b06a;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.offline-indicator.visible {
  opacity: 1;
}

/* ── Markers ── */

.ship-marker {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ship-marker .ship-glyph-circle {
  display: none;
}

.ship-marker.ship-marker-unknown .ship-glyph-arrow {
  display: none;
}

.ship-marker.ship-marker-unknown .ship-glyph-circle {
  display: block;
}

.home-marker {
  cursor: pointer;
}

/* ── Upcoming arrivals button ── */

.arrivals-btn {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 36, 56, 0.92);
  border: 1px solid #274357;
  color: #cfe0ea;
  font-size: 12px;
  font-family: inherit;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}

.arrivals-btn:active {
  background: #16324a;
}

.arrivals-badge {
  background: #2e7dd7;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Arrivals list ── */

.arrivals-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.arrivals-empty {
  color: #8ba3b5;
  font-size: 13px;
  padding: 8px 0;
}

.arrivals-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  background: #0a1929;
  border: 1px solid #16324a;
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.arrivals-row:hover,
.arrivals-row:focus {
  background: #16324a;
  border-color: #274357;
}

.arrivals-row-name {
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

.arrivals-row-dest {
  color: #8ba3b5;
  font-size: 12px;
}

.arrivals-row-eta {
  color: #9fb6c4;
  font-size: 12px;
}

/* ── Modal ── */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #0f2438;
  border: 1px solid #274357;
  border-radius: 14px;
  max-width: 400px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.5);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #9fb6c4;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover,
.modal-close:focus {
  background: #16324a;
  color: #fff;
}

.modal-card h2 {
  font-size: 18px;
  margin: 0 24px 14px 0;
  color: #fff;
}

.modal-field {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid #16324a;
  font-size: 14px;
}

.modal-field:last-child {
  border-bottom: none;
}

.modal-field .field-label {
  color: #8ba3b5;
}

.modal-field .field-value {
  color: #e6eef3;
  font-weight: 500;
  text-align: right;
}

/* ── Override MapLibre controls styling ── */

.maplibregl-ctrl-group {
  background: #0f2438 !important;
  border: 1px solid #274357 !important;
}

.maplibregl-ctrl-group button {
  background-color: #0f2438 !important;
}

.maplibregl-ctrl-group button + button {
  border-top: 1px solid #274357 !important;
}

.maplibregl-ctrl-group button .maplibregl-ctrl-icon {
  filter: invert(1);
}

.maplibregl-ctrl-attrib {
  background: rgba(10, 25, 41, 0.7) !important;
  color: #8ba3b5 !important;
  font-size: 10px !important;
}

.maplibregl-ctrl-attrib a {
  color: #aaa !important;
}

/* Safe area for notched devices */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .arrivals-btn {
    bottom: calc(32px + env(safe-area-inset-bottom));
  }
}
