.weather-aerogram-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 18px;
}

.weather-aerogram-modal.is-hidden {
  display: none;
}

.weather-aerogram-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(2, 8, 18, 0.76);
  backdrop-filter: blur(4px);
  cursor: default;
}

.weather-aerogram-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1180px, calc(100vw - 36px));
  height: min(820px, calc(100vh - 36px));
  min-height: 520px;
  overflow: hidden;
  border: 1px solid rgba(125, 211, 252, 0.34);
  border-radius: 8px;
  background: #081321;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.58);
  color: #edf7ff;
}

.weather-aerogram-header {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  background: #0d1b2d;
}

.weather-aerogram-title-wrap {
  min-width: 0;
}

.weather-aerogram-title {
  margin: 0;
  color: #ffffff;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.2;
}

.weather-aerogram-meta {
  margin-top: 4px;
  overflow: hidden;
  color: rgba(224, 242, 254, 0.68);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weather-aerogram-controls {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.weather-aerogram-source-control {
  display: grid;
  gap: 4px;
  color: rgba(224, 242, 254, 0.68);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.weather-aerogram-source-select {
  min-width: 142px;
  height: 36px;
  padding: 0 30px 0 10px;
  border: 1px solid rgba(125, 211, 252, 0.28);
  border-radius: 6px;
  background: #111f32;
  color: #edf7ff;
  font-size: 12px;
  font-weight: 800;
}

.weather-aerogram-icon-button {
  display: grid;
  flex: 0 0 36px;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(125, 211, 252, 0.28);
  border-radius: 6px;
  background: #111f32;
  color: #e0f2fe;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.weather-aerogram-icon-button:hover,
.weather-aerogram-icon-button:focus-visible,
.weather-aerogram-source-select:focus-visible {
  border-color: #38bdf8;
  outline: 2px solid rgba(56, 189, 248, 0.2);
}

.weather-aerogram-icon-button:disabled {
  opacity: 0.36;
  cursor: default;
}

.weather-aerogram-body {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  overflow: hidden;
  background: #07111d;
}

.weather-aerogram-chart {
  min-height: 0;
  width: 100%;
  height: 100%;
}

.weather-aerogram-svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 400px;
}

.weather-aerogram-plot {
  fill: #0a1727;
  stroke: rgba(148, 163, 184, 0.34);
}

.weather-aerogram-grid {
  stroke: rgba(148, 163, 184, 0.18);
  stroke-width: 1;
}

.weather-aerogram-grid.is-vertical {
  stroke-dasharray: 4 5;
}

.weather-aerogram-grid.is-freezing {
  stroke: rgba(248, 113, 113, 0.64);
  stroke-width: 1.6;
}

.weather-aerogram-axis-label,
.weather-aerogram-axis-title {
  fill: rgba(224, 242, 254, 0.72);
  font-size: 12px;
  font-weight: 700;
}

.weather-aerogram-axis-label.is-altitude,
.weather-aerogram-axis-label.is-mmhg {
  fill: rgba(186, 230, 253, 0.58);
  font-size: 11px;
}

.weather-aerogram-axis-label.is-pressure-profile {
  fill: #a5b4fc;
  font-size: 11px;
  font-weight: 900;
}

.weather-aerogram-axis-title {
  fill: #e0f2fe;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.weather-aerogram-pressure-axis-tick {
  stroke: #818cf8;
  stroke-width: 1.4;
}

.weather-aerogram-profile-line {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.weather-aerogram-profile-line.is-pressure {
  stroke: #818cf8;
  stroke-width: 3;
}

.weather-aerogram-profile-line.is-temperature {
  stroke: #fb7185;
}

.weather-aerogram-profile-line.is-dew-point {
  stroke: #22d3ee;
}

.weather-aerogram-wind-barb {
  pointer-events: none;
}

.weather-aerogram-hover-target {
  fill: transparent;
  cursor: crosshair;
}

.weather-aerogram-hover-indicator {
  pointer-events: none;
}

.weather-aerogram-hover-indicator.is-hidden,
.weather-aerogram-hover-point.is-hidden {
  display: none;
}

.weather-aerogram-hover-line {
  stroke: #fbbf24;
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
  pointer-events: none;
}

.weather-aerogram-hover-point {
  stroke: #07111d;
  stroke-width: 3;
}

.weather-aerogram-hover-point.is-pressure {
  fill: #818cf8;
}

.weather-aerogram-hover-point.is-temperature {
  fill: #fb7185;
}

.weather-aerogram-hover-point.is-dew-point {
  fill: #22d3ee;
}

.weather-aerogram-status {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 30px;
  color: #bae6fd;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.weather-aerogram-status.is-hidden {
  display: none;
}

.weather-aerogram-status.is-error {
  color: #fecaca;
}

.weather-aerogram-level-readout {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  width: 100%;
  border-top: 1px solid rgba(125, 211, 252, 0.26);
  background: #0a1727;
  pointer-events: none;
}

.weather-aerogram-level-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 8px 12px;
  border-right: 1px solid rgba(148, 163, 184, 0.14);
  color: rgba(224, 242, 254, 0.64);
  font-size: 10px;
  font-weight: 700;
}

.weather-aerogram-level-item:last-child {
  border-right: 0;
}

.weather-aerogram-level-item strong {
  overflow: hidden;
  color: #ffffff;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weather-aerogram-footer {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  padding: 9px 16px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  background: #0d1b2d;
}

.weather-aerogram-time-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: rgba(224, 242, 254, 0.78);
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.weather-aerogram-quality-warning {
  color: #fcd34d;
  font-size: 10px;
  font-weight: 800;
  text-align: right;
}

body.has-aerogram-modal {
  overflow: hidden;
}

@media (max-width: 980px) {
  .weather-aerogram-level-readout {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .weather-aerogram-level-item:nth-child(3n) {
    border-right: 0;
  }

  .weather-aerogram-level-item:nth-child(-n + 3) {
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  }
}

@media (max-width: 720px) {
  .weather-aerogram-modal {
    padding: 0;
  }

  .weather-aerogram-panel {
    width: 100vw;
    height: 100dvh;
    min-height: 0;
    border: 0;
    border-radius: 0;
  }

  .weather-aerogram-header {
    align-items: flex-start;
    gap: 10px;
    min-height: 116px;
    padding: 10px 12px;
  }

  .weather-aerogram-title {
    font-size: 16px;
  }

  .weather-aerogram-controls {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .weather-aerogram-source-control {
    flex: 1 0 100%;
  }

  .weather-aerogram-source-select {
    width: 100%;
    min-width: 120px;
  }

  .weather-aerogram-svg {
    width: auto;
    min-width: 760px;
    min-height: 470px;
  }

  .weather-aerogram-chart {
    overflow: auto;
  }

  .weather-aerogram-level-readout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .weather-aerogram-level-item {
    padding: 5px 7px;
    border-right: 1px solid rgba(148, 163, 184, 0.14);
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  }

  .weather-aerogram-level-item:nth-child(3n) {
    border-right: 1px solid rgba(148, 163, 184, 0.14);
  }

  .weather-aerogram-level-item:nth-child(2n) {
    border-right: 0;
  }

  .weather-aerogram-level-item:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .weather-aerogram-footer {
    display: grid;
    min-height: 68px;
    padding: 8px 12px;
  }

  .weather-aerogram-quality-warning {
    text-align: left;
  }
}
