:root {
  --sztorm-bg: rgba(8, 12, 20, 0.88);
  --sztorm-bg-soft: rgba(10, 16, 28, 0.82);
  --sztorm-border: rgba(255, 255, 255, 0.1);
  --sztorm-text: #eef4ff;
  --sztorm-muted: rgba(221, 232, 246, 0.76);
}

.sztorm-page {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.card-glass,
.legend,
.sztorm-status,
.sztorm-map-shell {
  border: 1px solid var(--sztorm-border);
  border-radius: 22px;
  background:
    radial-gradient(420px 180px at 0% 0%, rgba(82, 161, 255, 0.08), transparent 74%),
    radial-gradient(300px 180px at 100% 0%, rgba(12, 74, 110, 0.12), transparent 68%),
    var(--sztorm-bg);
  color: var(--sztorm-text);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.sztorm-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 12px;
  align-items: stretch;
}

.sztorm-hero__copy,
.sztorm-status {
  padding: 18px 20px;
}

.sztorm-eyebrow,
.sztorm-status__eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(238, 244, 255, 0.88);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sztorm-hero h1 {
  margin: 10px 0 0;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.sztorm-lead {
  max-width: 860px;
  margin: 10px 0 0;
  color: var(--sztorm-muted);
  font-size: 14px;
  line-height: 1.62;
}

.sztorm-hero__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.sztorm-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(244, 247, 255, 0.92);
  font-size: 12px;
  font-weight: 800;
}

.sztorm-status {
  display: grid;
  gap: 10px;
}

.sztorm-status__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sztorm-status__title {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  line-height: 1.08;
}

.sztorm-status__message {
  color: rgba(235, 244, 255, 0.88);
  font-size: 14px;
  line-height: 1.55;
}

.sztorm-status__meta {
  display: grid;
  gap: 8px;
}

.status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.status-line span {
  color: rgba(220, 232, 248, 0.7);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-line strong {
  text-align: right;
  font-size: 13px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #5b6474;
  box-shadow: 0 0 0 rgba(255, 255, 255, 0);
}

.dot.ok {
  background: #19c37d;
  box-shadow: 0 0 16px rgba(25, 195, 125, 0.5);
}

.dot.warn {
  background: #f4b43a;
  box-shadow: 0 0 16px rgba(244, 180, 58, 0.48);
}

.dot.err {
  background: #f35f6b;
  box-shadow: 0 0 16px rgba(243, 95, 107, 0.5);
}

.sztorm-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 12px;
  align-items: start;
}

.sztorm-map-shell {
  position: relative;
  padding: 8px;
}

.sztorm-map-hud {
  display: none !important;
}

.map {
  height: clamp(620px, calc(100vh - 205px), 820px);
  min-height: 560px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.legend {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 110px);
  padding: 14px;
  overflow: auto;
}

.legend-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.legend h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.legend-subtitle {
  margin: 6px 0 0;
  color: rgba(223, 233, 246, 0.72);
  font-size: 12px;
  line-height: 1.5;
}

.legend-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  appearance: none;
  border: 1px solid rgba(125, 211, 252, 0.18);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(14, 116, 144, 0.82), rgba(37, 99, 235, 0.9));
  color: #f6fbff;
  min-height: 40px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease, filter 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.btn:disabled {
  opacity: 0.72;
  cursor: default;
  transform: none;
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.legend-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 0 2px;
}

.legend-metric {
  min-height: 92px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.legend-metric__label {
  display: block;
  color: rgba(214, 227, 245, 0.68);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.legend-metric__value {
  display: block;
  margin-top: 10px;
  font-size: 23px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.legend-metric__meta {
  display: block;
  margin-top: 8px;
  color: rgba(226, 236, 248, 0.74);
  font-size: 12px;
  line-height: 1.45;
}

.legend-section {
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.legend-section:last-child {
  border-bottom: none;
}

.legend h3 {
  margin: 0 0 10px;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.layer-toggles {
  display: grid;
  gap: 10px;
}

.layer-toggle {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.layer-toggle input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: #38bdf8;
}

.layer-toggle__copy {
  display: grid;
  gap: 4px;
}

.layer-toggle__copy strong {
  font-size: 15px;
}

.layer-toggle__copy small {
  color: rgba(223, 233, 246, 0.75);
  font-size: 12px;
  line-height: 1.5;
}

.scale {
  display: grid;
  gap: 9px;
}

.scale-row {
  display: grid;
  grid-template-columns: 18px 118px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.swatch {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 3px 10px rgba(0, 0, 0, 0.2);
}

.scale-row .lbl {
  font-size: 13px;
  font-weight: 900;
}

.scale-row .desc {
  color: rgba(223, 233, 246, 0.74);
  font-size: 12px;
  line-height: 1.45;
}

.note,
.legend-section ul {
  margin: 10px 0 0;
  color: rgba(223, 233, 246, 0.76);
  font-size: 13px;
  line-height: 1.6;
}

.legend-section ul {
  padding-left: 18px;
}

.legend-section li + li {
  margin-top: 6px;
}

.sztorm-popup .leaflet-popup-content-wrapper {
  border-radius: 18px;
  padding: 0;
  background: rgba(8, 13, 24, 0.96);
  color: #eef4ff;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 22px 40px rgba(0, 0, 0, 0.34);
}

.sztorm-popup .leaflet-popup-tip {
  background: rgba(8, 13, 24, 0.96);
}

.sztorm-popup .leaflet-popup-content {
  margin: 0;
}

.popup-card {
  width: min(320px, 82vw);
  padding: 14px;
  color: #eef4ff;
}

.popup-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.popup-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.08;
}

.popup-sub {
  margin-top: 4px;
  color: rgba(223, 233, 246, 0.72);
  font-size: 12px;
  line-height: 1.45;
}

.popup-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.popup-badge--wind {
  background: rgba(59, 130, 246, 0.16);
  color: #b8d9ff;
}

.popup-badge--waves {
  background: rgba(52, 211, 200, 0.16);
  color: #b7fff7;
}

.popup-badge--alert {
  background: rgba(243, 95, 107, 0.18);
  color: #ffd2d8;
}

.popup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
  margin-top: 12px;
}

.popup-item {
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.04);
}

.popup-item .k {
  display: block;
  color: rgba(213, 227, 247, 0.68);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.popup-item .v {
  display: block;
  margin-top: 5px;
  font-size: 14px;
  font-weight: 900;
}

.wind-marker,
.wave-marker {
  position: relative;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.34));
}

.wind-marker {
  width: 48px;
  height: 48px;
}

.wind-marker__trail {
  position: absolute;
  left: 4px;
  top: 50%;
  width: 22px;
  height: 5px;
  border-radius: 999px;
  background: currentColor;
  transform: translateY(-50%);
  opacity: 0.96;
}

.wind-marker__trail::after {
  content: "";
  position: absolute;
  left: -11px;
  top: 0;
  width: 11px;
  height: 5px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.55;
}

.wind-marker__arrow {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.wind-marker__arrow svg {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

.wave-marker {
  width: 34px;
  height: 34px;
}

.wave-marker__pulse {
  position: absolute;
  inset: 3px;
  border-radius: 999px;
  border: 2px solid currentColor;
  background: rgba(7, 13, 24, 0.72);
}

.wave-marker__pulse::after {
  content: none;
}

.wave-marker--alert .wave-marker__pulse::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 999px;
  border: 2px solid currentColor;
  opacity: 0.45;
  animation: wavePulse 1.6s ease-out infinite;
}

.wave-marker__arrow {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.wave-marker__arrow svg {
  width: 18px;
  height: 18px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.38));
}

.wave-marker--alert {
  filter: drop-shadow(0 10px 18px rgba(243, 95, 107, 0.28));
}

@keyframes wavePulse {
  0% {
    transform: scale(0.78);
    opacity: 0.5;
  }
  100% {
    transform: scale(1.18);
    opacity: 0;
  }
}

@media (max-width: 1200px) {
  .sztorm-hero {
    grid-template-columns: minmax(0, 1fr) 300px;
  }

  .sztorm-shell {
    grid-template-columns: minmax(0, 1fr) 308px;
  }
}

@media (max-width: 980px) {
  .sztorm-page {
    padding: 10px;
    gap: 10px;
  }

  .sztorm-hero,
  .sztorm-shell {
    grid-template-columns: 1fr;
  }

  .sztorm-hero__copy,
  .sztorm-status,
  .legend {
    padding: 16px;
    border-radius: 18px;
  }

  .sztorm-map-shell {
    padding: 6px;
    border-radius: 18px;
  }

  .legend {
    position: relative;
    top: 0;
    max-height: none;
  }

  .map {
    height: 60vh;
    min-height: 390px;
    border-radius: 16px;
  }
}

@media (max-width: 680px) {
  .sztorm-hero h1 {
    font-size: 26px;
  }

  .sztorm-lead {
    font-size: 13px;
    line-height: 1.55;
  }

  .sztorm-hero__chips {
    display: none;
  }

  .status-line {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding: 10px 12px;
  }

  .legend-header {
    flex-direction: column;
  }

  .legend-actions {
    width: 100%;
  }

  .legend-actions .btn {
    flex: 1 1 0;
  }

  .legend-metrics,
  .popup-grid {
    grid-template-columns: 1fr;
  }

  .scale-row {
    grid-template-columns: 18px minmax(0, 1fr);
  }

  .scale-row .desc {
    grid-column: 2;
  }

  .map {
    height: 55vh;
    min-height: 340px;
  }
}

@media (max-width: 980px), (pointer: coarse) {
  .card-glass,
  .legend,
  .sztorm-status,
  .sztorm-map-shell {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
