
/* Keep map controls inside the map's own layer so they never draw over the sticky bars */
.map-wrap, .wind-wrap { isolation: isolate; }
.wind-wrap { position: relative; }
#windMap { height: 62vh; min-height: 360px; background: #070b0f; }
.wind-legend {
  position: absolute; right: 8px; bottom: 22px; z-index: 700; width: 168px; padding: 6px 8px 5px;
  background: rgba(10, 15, 20, .86); border: 1px solid var(--line); border-radius: 7px; font-size: 10px; color: var(--muted); pointer-events: none;
}
.wl-bar { height: 7px; margin: 4px 0 2px; border-radius: 3px;
  background: linear-gradient(90deg, rgb(36,50,79) 0%, rgb(32,102,160) 10%, rgb(31,161,135) 20%, rgb(143,209,79) 30%, rgb(242,227,58) 40%, rgb(248,149,64) 50%, rgb(228,71,43) 60%, rgb(194,24,127) 75%, rgb(122,12,168) 100%); }
.wl-ticks { position: relative; height: 12px; margin: 0 6px; font-family: var(--font-mono); }
.wl-ticks span { position: absolute; top: 0; transform: translateX(-50%); }
.wind-bar { margin-top: 10px; }
.wind-pop .leaflet-popup-content { font-size: 12px; line-height: 1.4; }
.map-hint {
  position: absolute; inset: 0; z-index: 800; display: grid; place-items: center; padding: 16px;
  background: rgba(5, 8, 12, .55); color: #fff; font: 600 15px/1.3 var(--font-body); text-align: center;
  pointer-events: none; opacity: 0; transition: opacity .25s;
}
.map-hint.is-on { opacity: 1; }

/* Coastal watch/warning legend (top-right of the radar map) */
.ww-legend {
  position: absolute; right: 10px; top: 10px; z-index: 500; background: rgba(10,15,20,.86);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 11px; display: grid; gap: 3px; pointer-events: none;
}
.ww-title { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 1px; }
.ww-sw { width: 16px; height: 4px; border-radius: 2px; display: inline-block; }

/* First-time helper over the layer switches */
.layer-toggles { position: relative; }
.layer-tip {
  position: absolute; right: 0; bottom: calc(100% + 12px); z-index: 30; width: 260px;
  padding: 10px 30px 10px 12px; border-radius: 9px; background: #e8f7fa; color: #0a1a20;
  font-size: 12.5px; line-height: 1.4; box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.layer-tip b { display: block; font-size: 13px; margin-bottom: 2px; }
.layer-tip::after { content: ""; position: absolute; right: 44px; bottom: -6px; width: 12px; height: 12px; background: #e8f7fa; transform: rotate(45deg); }
.layer-tip-x {
  position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border: 0; border-radius: 6px;
  background: transparent; color: #0a1a20; font: 600 18px/1 var(--font-body); cursor: pointer;
}
.layer-tip-x:hover { background: rgba(0,0,0,.08); }
@media (prefers-reduced-motion: no-preference) { .layer-tip { animation: tip-in .3s ease-out; } }
@keyframes tip-in { from { opacity: 0; transform: translateY(6px); } }

/* Touch polish for Android and iOS */
button, .chip, label, .mini-row { -webkit-tap-highlight-color: transparent; }

/* ===== Phones (iOS first) ===== */
.sh { display: none; }
.clock-m { display: none; }
.mini, .to-top { display: none; }
@media (max-width: 760px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overscroll-behavior-y: contain; } /* no accidental pull-to-refresh (it would mute the siren) */
  .layer-tip { left: 0; right: auto; width: min(280px, calc(100vw - 64px)); }
  .layer-tip::after { left: 36px; right: auto; }
  .ww-legend { top: 8px; right: 8px; padding: 5px 8px; font-size: 10px; }
  .lg { display: none !important; }
  .sh { display: inline; }

  /* Full header */
  .topbar { position: static; display: flex; flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 16px 12px; }
  .head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
  .clock-m { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font: 600 22px/1 var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .clock-m .clock-utc { font-size: 12px; font-weight: 500; color: var(--muted); }
  .topbar-right .clock { display: none; }
  .storm-class { font-size: 11px; }
  .storm-name { font-size: 36px; margin-top: 3px; }
  .storm-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; flex: none; }
  .stat dt { font-size: 10px; letter-spacing: .08em; }
  .stat dd { font-size: 14px; }
  .topbar-right { flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: center; margin: 0; gap: 8px; }
  .adv { font-size: 11px; }
  .btn { padding: 8px 11px; font-size: 12.5px; }

  /* Sticky mini bar */
  .mini {
    display: block; position: fixed; left: 0; right: 0; top: var(--hb-h, 0px); z-index: 950;
    padding-top: var(--mini-pad, env(safe-area-inset-top, 0px));
    background: rgba(10, 15, 20, .97); border-bottom: 1px solid var(--line);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: 0 6px 18px rgba(0,0,0,.4);
  }
  .mini[hidden] { display: none !important; }
  .mini-row {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; margin: 0;
    background: none; border: 0; color: var(--fg); font: inherit; text-align: left; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .mini-name { font: 600 17px/1 var(--font-display); text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
  .mini-stat { font: 500 13px/1 var(--font-mono); white-space: nowrap; }
  .mini-k { font: 600 10px/1 var(--font-body); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
  .mini-time { margin-left: auto; font: 600 14px/1 var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .mini-chev { width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-3px); transition: transform .2s; flex: none; }
  .mini.is-open .mini-chev { transform: rotate(-135deg) translateY(-2px); }
  .mini-full { display: grid; gap: 12px; padding: 2px 16px 14px; cursor: pointer; }
  .mini-full[hidden] { display: none; }
  .mini-full .storm-name { font-family: var(--font-display); font-weight: 600; }

  /* Back to top */
  .to-top {
    display: grid; place-items: center; position: fixed; z-index: 940;
    right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    width: 46px; height: 46px; border-radius: 50%; padding: 0;
    background: var(--panel-2); color: var(--fg); border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(0,0,0,.45); cursor: pointer;
  }
  .to-top[hidden] { display: none !important; }

  /* Section order: conditions, tornadoes, radar, wind, forecast, Hattiesburg, New Orleans, updates */
  .layout { gap: 12px; padding-block: 12px 72px; }
  .regions { display: contents; }
  .card-obs { order: 1; }
  .card-tor { order: 2; }
  .card-map { order: 3; }
  .card-wind { order: 4; }
  .card-track { order: 5; }
  #regionHat { order: 6; }
  #regionNola { order: 7; }
  .card-feed { order: 8; }

  .card { padding: 12px; }
  h2 { font-size: 18px; }
  h2 .sub { font-size: 11px; margin-left: 4px; }
  .card-head { margin-bottom: 8px; gap: 8px; }

  /* Conditions */
  .obs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ob { padding: 9px 10px; }
  .ob-name { font-size: 15px; }
  .ob-wind { font-size: 18px; }
  .ob-wind small { font-size: 11px; }
  .ob-rest { font-size: 11px; }

  /* Tornadoes */
  .tor-watch { font-size: 12.5px; padding: 9px 10px; }
  .tw { padding: 9px 10px; }
  .tw-area { font-size: 16px; }
  .tw-meta { font-size: 11.5px; gap: 2px 10px; }

  /* Maps */
  #map { height: 56vh; height: 56svh; min-height: 320px; }
  #windy { height: 62vh; height: 62svh; min-height: 360px; }
  #windMap { height: 62vh; height: 62svh; }
  .map-bar { gap: 8px; }
  .map-bar input[type=range] { flex: 1 1 120px; }
  .frame-time { font-size: 12px; min-width: 0; }
  .layer-toggles { gap: 8px 12px; font-size: 11.5px; margin-left: 0; }
  .fine { font-size: 11px; }

  /* Forecast */
  .closest { font-size: 12.5px; }
  .track { font-size: 11.5px; }
  .track th { font-size: 10px; }
  .gfx { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }

  /* Alert regions */
  .tally .zero { display: none; }
  .tally span { font-size: 10px; padding: 4px 6px; }
  .agroup { padding: 9px 10px; border-left-width: 4px; }
  .ag-event { font-size: 16px; }
  .ag-until { font-size: 11px; }
  .ag-counties { gap: 3px; margin-top: 6px; }
  .cty { font-size: 11px; padding: 1px 6px; }
  .agroup details { margin-top: 6px; }
  .agroup summary { font-size: 11.5px; }
  .alert-text { font-size: 11px; max-height: 50vh; }

  /* Latest updates */
  .feed { max-height: none; overflow: visible; }
  .fi { padding: 10px 0; }
  .fi-meta { gap: 6px; font-size: 11px; }
  .src { max-width: 58%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .fi-when { color: var(--muted); }
  .fi-title { font-size: 14px; line-height: 1.3; margin-top: 5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .fi-lines { list-style: none; padding: 0; margin-top: 3px; font-size: 12.5px; line-height: 1.35; color: var(--muted); }
  .fi-lines li:nth-child(n+2) { display: none; }
  .fi-lines li:first-child { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .fi details summary { font-size: 11px; }
  .feed-filters .chip { padding: 6px 9px; font-size: 11.5px; }
  .news-extra { display: none; }
  .leaflet-control-attribution { font-size: 9px; }

  /* Tornado banner */
  .hb-inner { padding: 12px 16px; gap: 10px; }
  .hb-kicker { font-size: 11px; letter-spacing: .1em; line-height: 1.3; }
  .hb-detail { font-size: 12.5px; }
}
@media (max-width: 370px) {
  .mini-name { display: none; }
  .storm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
