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

html,
body {
  width: 100%;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  background: #e5e7eb;
  -webkit-text-size-adjust: 100%;
}

.widget-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  height: 100dvh;
  min-height: -webkit-fill-available;
}

.map-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

#map {
  width: 100%;
  height: 100%;
}

.info-card {
  display: none;
}

#status-bar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas:
    "vehicle updated speed"
    "directions directions directions";
  align-items: center;
  gap: 6px 10px;
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  background: #111827;
  color: #f9fafb;
  font-size: 13px;
  border-top: 1px solid #1f2937;
}

#status-bar .vehicle,
.info-card .vehicle {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#status-bar .vehicle {
  grid-area: vehicle;
}

#status-bar .updated-ago,
.info-card .updated-ago {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #9ca3af;
  font-size: 12px;
  white-space: nowrap;
}

#status-bar .updated-ago {
  grid-area: updated;
  justify-self: end;
}

.time-icon {
  flex-shrink: 0;
  color: #9ca3af;
}

.updated-ago-text {
  line-height: 1.2;
}

#status-bar .speed,
.info-card .speed {
  color: #93c5fd;
  font-weight: 500;
  white-space: nowrap;
}

#status-bar .speed {
  grid-area: speed;
}

.directions-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #ea580c;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s ease;
}

#status-bar .directions-cta {
  grid-area: directions;
}

.directions-cta:hover,
.directions-cta:focus {
  background: #c2410c;
  color: #ffffff;
}

.directions-cta--popup {
  display: inline-flex;
  width: auto;
  margin-top: 10px;
  min-height: 36px;
  padding: 8px 12px;
  font-size: 13px;
}

#status-bar .error,
.info-card .error {
  color: #fca5a5;
  line-height: 1.4;
}

.leaflet-container {
  background: #e5e7eb;
  font: inherit;
}

.leaflet-control-zoom a {
  width: 34px;
  height: 34px;
  line-height: 34px;
}

.leaflet-popup-content {
  margin: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 640px) {
  #status-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "vehicle updated"
      "speed speed"
      "directions directions";
    gap: 8px 10px;
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

  #status-bar .speed {
    justify-self: start;
    font-size: 12px;
  }

  #status-bar .updated-ago {
    font-size: 11px;
    white-space: normal;
    justify-self: end;
    text-align: right;
  }
}

@media (min-width: 641px) {
  #status-bar.status-bar--mobile {
    display: none;
  }

  .info-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: absolute;
    left: 16px;
    bottom: 16px;
    z-index: 1000;
    width: min(320px, calc(100% - 32px));
    padding: 16px;
    border-radius: 12px;
    background: rgba(17, 24, 39, 0.94);
    color: #f9fafb;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .info-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .info-card .vehicle {
    font-size: 16px;
  }

  .info-card .updated-ago {
    font-size: 12px;
    justify-self: end;
  }

  .info-card .speed {
    font-size: 13px;
  }

  .info-card .directions-cta {
    margin-top: 4px;
  }
}
