:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #07131a;
  color: #eefaff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow: hidden;
}

button,
input {
  font: inherit;
}

.app-shell,
#map,
#flow-canvas {
  position: fixed;
  inset: 0;
}

#map {
  background: #07131a;
}

#flow-canvas {
  pointer-events: none;
  z-index: 3;
}

.top-bar {
  position: fixed;
  z-index: 5;
  top: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 5px;
  color: #9adbea;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: #f5fdff;
  font-size: clamp(24px, 3vw, 42px);
  line-height: 1.05;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.42);
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.status-pill {
  min-width: 92px;
  border: 1px solid rgba(136, 226, 241, 0.25);
  border-radius: 999px;
  padding: 8px 11px;
  background: rgba(5, 18, 24, 0.72);
  color: #a9c9d1;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  backdrop-filter: blur(12px);
}

.status-pill.ready {
  border-color: rgba(70, 218, 167, 0.46);
  color: #bfffe6;
  box-shadow: 0 0 20px rgba(44, 209, 176, 0.18);
}

.control-panel {
  position: fixed;
  z-index: 6;
  left: 18px;
  top: 104px;
  width: min(340px, calc(100vw - 36px));
  max-height: calc(100vh - 150px);
  overflow: auto;
  border: 1px solid rgba(152, 221, 234, 0.2);
  border-radius: 8px;
  padding: 16px;
  background: rgba(4, 18, 25, 0.82);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(16px);
}

.panel-section + .panel-section,
.legend,
.basemap-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(151, 222, 235, 0.16);
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h2 {
  margin: 0 0 12px;
  color: #dff9ff;
  font-size: 14px;
}

.icon-button,
.secondary-button {
  border: 1px solid rgba(112, 222, 241, 0.28);
  border-radius: 7px;
  background: rgba(20, 70, 82, 0.58);
  color: #e7fbff;
  cursor: pointer;
}

.icon-button {
  width: 38px;
  height: 32px;
  font-weight: 800;
}

.secondary-button {
  width: 100%;
  margin-top: 12px;
  padding: 9px 10px;
  font-weight: 700;
}

.icon-button:hover,
.secondary-button:hover {
  background: rgba(26, 103, 119, 0.72);
}

.control-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 10px;
  margin: 12px 0;
  color: #c4dce2;
  font-size: 13px;
}

.control-row strong {
  color: #f3fdff;
  font-variant-numeric: tabular-nums;
}

.control-row input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: #35d5ef;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 11px 0;
  color: #d7ecf1;
  font-size: 13px;
}

.switch-row input {
  width: 17px;
  height: 17px;
  accent-color: #35d5ef;
}

.basemap-select {
  width: 100%;
  border: 1px solid rgba(136, 226, 241, 0.16);
  border-radius: 7px;
  padding: 10px 12px;
  background: rgba(12, 43, 52, 0.42);
  color: #d7ecf1;
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

.basemap-select:hover,
.basemap-select:focus {
  border-color: rgba(92, 217, 239, 0.42);
  background: rgba(18, 67, 80, 0.58);
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 8px 0;
  color: #d7ecf1;
  font-size: 13px;
}

.swatch {
  display: inline-block;
  width: 28px;
  height: 4px;
  border-radius: 999px;
  box-shadow: 0 0 14px currentColor;
}

.slow {
  color: #d6efff;
  background: #d6efff;
}

.normal {
  color: #8cc7e6;
  background: #8cc7e6;
}

.fast {
  color: #3f93c7;
  background: #3f93c7;
}

.very-fast {
  color: #0b4f9c;
  background: #0b4f9c;
}

.notice {
  position: fixed;
  z-index: 5;
  right: 18px;
  bottom: 20px;
  max-width: min(520px, calc(100vw - 36px));
  border: 1px solid rgba(224, 245, 250, 0.16);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(4, 18, 25, 0.76);
  color: #c8e8ef;
  font-size: 12px;
  line-height: 1.45;
  backdrop-filter: blur(12px);
}

.load-error {
  position: fixed;
  z-index: 10;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(460px, calc(100vw - 36px));
  border: 1px solid rgba(255, 149, 117, 0.44);
  border-radius: 8px;
  padding: 18px;
  background: rgba(38, 10, 7, 0.92);
  color: #ffe7de;
  text-align: center;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

.maplibregl-ctrl-bottom-right {
  right: 14px;
  bottom: 70px;
}

@media (max-width: 760px) {
  .top-bar {
    display: block;
  }

  .status-strip {
    justify-content: flex-start;
    margin-top: 12px;
  }

  .control-panel {
    top: auto;
    bottom: 18px;
    max-height: 44vh;
  }

  .notice {
    display: none;
  }

  h1 {
    font-size: 25px;
  }
}
