/* index.html primary map styles */
    * { margin: 0; padding: 0; box-sizing: border-box; }

    body {
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      background: #1a2332;
      color: #e0e8f0;
      height: 100vh;
      display: flex;
      flex-direction: column;
    }

    header {
      background: #1a2332;
      padding: 8px 16px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      border-bottom: 1px solid #2a3f55;
      flex-shrink: 0;
      min-height: 52px;
      flex-wrap: nowrap;
    }
    /* ── Moon strip ── */
    .header-center {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 2px;
      overflow: visible;
    }
    .moon-tiles-row {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      overflow-x: auto;
      scrollbar-width: none;
    }
    .moon-credit {
      font-size: 8px;
      color: #7a9ab0;
      letter-spacing: 0.05em;
      white-space: nowrap;
      user-select: none;
    }
    .leaflet-control-attribution {
      background: transparent !important;
      box-shadow: none !important;
    }
    .leaflet-bottom.leaflet-right .leaflet-control {
      margin-bottom: 2px;
    }

    /* ── Mobile: 2-row header ── */
    @media (max-width: 600px) {
      header {
        flex-wrap: wrap;
        padding: 6px 10px;
        gap: 4px;
        align-items: center;
      }
      /* Row 1: logo + buttons — sit side by side, full width */
      .header-logo {
        order: 1;
        flex-shrink: 0;
      }
      .header-right {
        order: 2;
        flex: 1;
        min-width: 0;
        display: flex;
        justify-content: flex-end;
        align-items: center;
      }
      /* Row 2: moon strip — full width below */
      .header-center {
        order: 3;
        width: 100%;
        flex-basis: 100%;
        justify-content: flex-start;
        padding: 4px 0 2px 0;
        border-top: 1px solid #2a3f55;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
      }
      .day-picker { flex-wrap: wrap; gap: 4px; }
      .day-picker-label { display: none; }
      .forecast-popup { width: 95vw !important; }
      .leaflet-popup-content { max-height: calc(100vh - 140px); }
      .tab-pane.active { max-height: 65vh; }
      .mid-desktop { display: none !important; }
      .mid-mobile { display: block !important; }
    }
    .moon-day {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 1px;
      min-width: 44px;
      padding: 3px 5px;
      border-radius: 6px;
      border: 1px solid #2a3f55;
      background: rgba(255,255,255,0.03);
      cursor: default;
    }
    .moon-day:hover { background: rgba(126,200,227,0.08); }
    .moon-date  { font-size: 9px; color: #7a9ab0; }
    .tide-row { display: flex; align-items: center; gap: 3px; margin-top: 2px; }
    .tide-label-text { font-size: 7px; color: #7a9ab0; white-space: nowrap; }
    .tide-bar-wrap {
      width: 28px;
      height: 4px;
      background: #1a2d40;
      border-radius: 2px;
      overflow: hidden;
    }
    .tide-bar { height: 100%; border-radius: 2px; }
    .king-crown { font-size: 9px; line-height: 1; }

    /* ── Day picker ── */
    .header-logo { flex-shrink: 0; display: flex; align-items: stretch; }
    .header-right { flex-shrink: 0; }
    .day-picker {
      display: flex;
      align-items: center;
      gap: 4px;
    }
    .day-picker-sep {
      width: 1px;
      align-self: stretch;
      background: #2a3f55;
      margin: 4px 8px;
    }
    .header-right {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: wrap;
      row-gap: 4px;
      justify-content: flex-end;
    }
    @media (max-width: 720px) {
      .day-picker-sep { display: none; }
    }
    .day-picker-label {
      font-size: 10px;
      color: #5a7a90;
      margin-right: 2px;
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }
    .day-btn {
      background: #1a2d40;
      border: 1px solid #2a3f55;
      color: #7ec8e3;
      font-size: 11px;
      font-weight: 600;
      padding: 4px 10px;
      border-radius: 5px;
      cursor: pointer;
      transition: all 0.15s;
    }
    .day-btn:hover  { background: #243d55; }
    .day-btn.active { background: #7ec8e3; color: #0f1823; border-color: #7ec8e3; }
    .day-btn.locked {
      opacity: 0.45;
      cursor: default;
      position: relative;
    }
    .day-btn.locked:hover { background: #1a2d40; }
    #loading-bar {
      height: 3px;
      background: linear-gradient(90deg, #7ec8e3, #3a8fbf);
      width: 0%;
      transition: width 0.4s ease;
      flex-shrink: 0;
    }

    #map {
      flex: 1;
      cursor: crosshair;
    }

    /* ── Override Leaflet popup width ── */
    .leaflet-popup-content-wrapper {
      border-radius: 8px;
      padding: 0;
      overflow: hidden;
      max-width: 95vw !important;
    }
    .leaflet-popup-content {
      margin: 0 !important;
      width: auto !important;
      /* Hard cap so popup + arrow + autoPan padding always fit; prevents
         popup top from clipping above the map's top controls. */
      max-height: calc(100vh - 160px);
      overflow-y: auto;
    }
    /* Keep the close X above the sticky .popup-title (z-index:3) */
    .leaflet-popup-close-button { z-index: 10 !important; }

    /* ── Popup shell ── */
    .forecast-popup {
      width: 560px;
      max-width: 90vw;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      font-size: 12px;
      color: #1a2332;
      background: #fff;
    }
    .popup-title {
      font-size: 13px;
      font-weight: 700;
      padding: 10px 14px 8px 14px;
      border-bottom: 2px solid #7ec8e3;
      background: #f5f9ff;
      letter-spacing: 0.03em;
      color: #0f1823;
      position: sticky;
      top: 0;
      z-index: 3;
    }

    /* ── Tabs ── */
    .tab-bar {
      display: flex;
      border-bottom: 1px solid #dde4ee;
      background: #f0f4fa;
      position: sticky;
      /* Height of .popup-title (~37 px) so tab bar sits right below it. */
      top: 37px;
      z-index: 2;
    }
    .tab-btn {
      flex: 1;
      padding: 7px 4px;
      font-size: 11px;
      font-weight: 600;
      text-align: center;
      cursor: pointer;
      border: none;
      background: transparent;
      color: #5a7a90;
      border-bottom: 3px solid transparent;
      transition: all 0.15s;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }
    .tab-btn:hover { color: #1a2332; background: #e8eef8; }
    .tab-btn.active {
      color: #1a2332;
      border-bottom: 3px solid #7ec8e3;
      background: #fff;
    }

    /* ── Tab content ── */
    .tab-pane { display: none; }
    .tab-pane.active {
      display: block;
      max-height: 320px;
      overflow-y: auto;
      padding: 6px 0;
    }

    /* ── Day rows ── */
    .day-block {
      display: flex;
      align-items: stretch;
      border-bottom: 1px solid #eef2f7;
      padding: 6px 14px;
      gap: 10px;
    }
    .day-block:last-child { border-bottom: none; }

    /* Left: date + status stacked */
    .day-left {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      width: 56px;
      flex-shrink: 0;
      gap: 1px;
    }
    .day-date-badge {
      font-size: 10px;
      color: #888;
      font-weight: 600;
      text-align: center;
    }
    .day-status {
      font-weight: 800;
      font-size: 12px;
      text-align: center;
    }
    .st-green  { color: #27ae60; }
    .st-yellow { color: #c8950a; }
    .st-red    { color: #c0392b; }
    .st-gray   { color: #999; }

    /* Middle: wind/wave details */
    .day-mid {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: center;
      gap: 1px;
      font-size: 11px;
      color: #333;
      line-height: 1.5;
    }
    .day-mid .mid-desktop { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .day-mid .mid-mobile { display: none; }
    .day-mid .mid-flags .flag-pills { flex-direction: row; align-items: center; justify-content: flex-start; flex-wrap: wrap; margin-top: 0; }
    .day-mid .mid-row2 { color: #666; }

    /* Right: sea state label + value + flag pills */
    .day-right {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      justify-content: center;
      width: 85px;
      flex-shrink: 0;
      gap: 2px;
    }
    .sea-label-txt {
      font-size: 9px;
      color: #aaa;
      text-transform: uppercase;
      letter-spacing: 0.06em;
    }
    .sea-val {
      font-size: 11px;
      font-weight: 700;
      text-align: right;
    }
    .sea-good      { color: #27ae60; }
    .sea-fair      { color: #c8950a; }
    .sea-poor      { color: #e67e22; }
    .sea-dangerous { color: #c0392b; }

    .flag-pills { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; margin-top: 1px; }
    .flag-pill  { font-size: 9px; font-weight: 600; padding: 1px 5px; border-radius: 8px; white-space: nowrap; }
    .flag-choppy  { background: #fff3e0; color: #e65100; }
    .flag-square  { background: #c0392b; color: #fff; }
    .flag-beam    { background: #f9a825; color: #4a3000; }
    .flag-blown   { background: #b71c1c; color: #fff; }
    .flag-calm    { background: #27ae60; color: #fff; }
    .flag-cape    { background: #f9a825; color: #4a3000; }
    .flag-default { background: #f0f0f0; color: #555; }

    /* ── Status dots on map markers ── */
    .marker-wrap {
      display: flex;
      flex-direction: column;
      align-items: center;
      cursor: pointer;
      transform: translate(-50%, -50%);
    }
    .marker-cross-row {
      display: flex;
      flex-direction: row;
      align-items: center;
      gap: 5px;
    }
    .cross-left  { flex-direction: row; }
    .cross-right { flex-direction: row; }
    .cross-arrow {
      font-size: 14px;
      line-height: 1;
      flex-shrink: 0;
    }
    .marker-label {
      background: rgba(255,252,240,0.92);
      border: 1.5px solid #2a6090;
      border-radius: 6px;
      padding: 3px 8px;
      color: #1a3a52;
      font-size: 11px;
      font-weight: 700;
      white-space: nowrap;
      box-shadow: 0 2px 6px rgba(0,0,0,0.25);
      text-align: center;
    }
    .marker-dots {
      display: flex;
      gap: var(--dot-gap, 8px);
      margin-top: 4px;
      justify-content: center;
      align-items: center;
    }
    /* Toggle: hide station forecast dot rows when "Station Flags" layer is off */
    #map.hide-station-flags .marker-dots,
    #map.hide-station-flags .cross-arrow { display: none !important; }
    /* Also drop crossing name labels when flags are off (city labels stay) */
    #map.hide-station-flags .marker-cross-row .marker-label { display: none !important; }
    /* Drop crossing dotted lines and non-city point labels when flags are off */
    #map.hide-station-flags path.crossing-line { display: none !important; }
    #map.hide-station-flags .marker-label.non-city { display: none !important; }

    /* ── Reference-city labels (always on; dot + small name) ── */
    .city-ref {
      display: flex;
      align-items: center;
      gap: 4px;
      transform: translateY(-50%);
      pointer-events: none;
      white-space: nowrap;
    }
    .city-ref-dot {
      width: 8px;
      height: 8px;
      margin-left: -4px;
      border-radius: 50%;
      background: #2a4a66;
      border: 1.5px solid #fff;
      box-shadow: 0 0 2px rgba(0,0,0,0.6);
      flex-shrink: 0;
    }
    .city-ref-name {
      font-size: 10px;
      font-weight: 600;
      color: #1a3a52;
      background: rgba(255,252,240,0.82);
      padding: 1px 4px;
      border-radius: 4px;
    }

    /* ── Crossing popup ── */
    .cross-header {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      padding: 8px 14px;
      border-bottom: 1px solid #dde4ee;
    }
    .cross-loc {
      font-weight: 700;
      font-size: 13px;
      color: #1a2332;
      min-width: 68px;
    }
    .cross-loc:first-child { text-align: right; }
    .cross-loc:last-child  { text-align: left; }
    .cross-toggle {
      position: relative;
      width: 56px;
      height: 26px;
      background: #b0cce8;
      border-radius: 13px;
      cursor: pointer;
      flex-shrink: 0;
      transition: background 0.2s;
      border: none;
      padding: 0;
    }
    .cross-toggle:hover { background: #90b8d8; }
    .cross-toggle.flipped { background: #7aaec8; }
    .cross-toggle-knob {
      position: absolute;
      top: 3px;
      left: 3px;
      width: 20px;
      height: 20px;
      background: #fff;
      border-radius: 50%;
      box-shadow: 0 1px 4px rgba(0,0,0,0.25);
      transition: left 0.2s;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 11px;
      font-weight: 700;
      color: #2a5080;
      pointer-events: none;
    }
    .cross-toggle.flipped .cross-toggle-knob { left: 33px; }

    /* ── Marker-level crossing slider ── */
    .marker-dir-toggle {
      width: 34px;
      height: 14px;
      background: rgba(80,140,190,0.75);
      border-radius: 7px;
      border: none;
      cursor: pointer;
      position: relative;
      margin-top: 4px;
      transition: background 0.2s;
      padding: 0;
      display: block;
    }
    .marker-dir-toggle.flipped { background: rgba(60,120,170,0.85); }
    .marker-dir-knob {
      position: absolute;
      top: 2px;
      left: 2px;
      width: 10px;
      height: 10px;
      background: #fff;
      border-radius: 50%;
      box-shadow: 0 1px 3px rgba(0,0,0,0.3);
      transition: left 0.18s;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 7px;
      font-weight: 700;
      color: #1a4060;
      pointer-events: none;
    }
    .marker-dir-toggle.flipped .marker-dir-knob { left: 22px; }


    .cross-day-section { border-bottom: 2px solid #ccd8e8; }
    .cross-day-section:last-child { border-bottom: none; }
    .cross-day-date-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 4px 14px;
      background: #eef3fa;
      border-bottom: 1px solid #dde4ee;
      font-size: 11px;
      font-weight: 700;
      color: #3a5a7a;
    }
    .cross-loc-strip {
      font-size: 10px;
      font-weight: 700;
      color: #7a9ab8;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      padding: 3px 14px 0;
    }
    .cross-day-row {
      display: grid;
      grid-template-columns: 42px 1fr 1fr;
      align-items: center;
      padding: 5px 14px;
      border-bottom: 1px solid #eef2f7;
      gap: 6px;
    }
    .cross-day-row:last-child { border-bottom: none; }
    .cross-date-col {
      font-size: 11px;
      color: #8aaccc;
      font-weight: 600;
    }
    .cross-cell {
      display: flex;
      flex-direction: column;
      gap: 1px;
    }
    .cross-wind {
      font-size: 10px;
      color: #7a9ab8;
    }

    #hint {
      position: absolute;
      bottom: 30px;
      left: 50%;
      transform: translateX(-50%);
      background: rgba(15,24,35,0.8);
      color: #7ec8e3;
      padding: 6px 14px;
      border-radius: 20px;
      font-size: 12px;
      pointer-events: none;
      z-index: 1000;
      border: 1px solid #2a3f55;
    }

    /* ── Hamburger menu ── */
    .hamburger-btn {
      background: #1a2d40;
      border: 1px solid #2a3f55;
      color: #7ec8e3;
      font-size: 18px;
      font-weight: 400;
      padding: 4px 10px;
      border-radius: 5px;
      cursor: pointer;
      transition: all 0.15s;
      line-height: 1;
    }
    .hamburger-btn:hover { background: #243d55; border-color: #7ec8e3; }
    .hamburger-wrap { position: relative; }
    .hamburger-dropdown {
      display: none;
      position: absolute;
      top: calc(100% + 6px);
      right: 0;
      background: #1a2d40;
      border: 1px solid #2a3f55;
      border-radius: 8px;
      min-width: 180px;
      z-index: 10000;
      box-shadow: 0 8px 24px rgba(0,0,0,0.5);
      padding: 6px 0;
    }
    .hamburger-dropdown.open { display: block; }
    .hm-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 9px 16px;
      font-size: 0.82rem;
      color: #c8dce8;
      cursor: pointer;
      text-decoration: none;
      transition: background 0.12s;
      white-space: nowrap;
    }
    .hm-item:hover { background: #243d55; color: #fff; }
    .hm-item .hm-icon { width: 16px; text-align: center; font-size: 14px; }
    .hm-divider { border: none; border-top: 1px solid #2a3f55; margin: 4px 0; }
    .hm-label {
      padding: 6px 16px 2px;
      font-size: 0.68rem;
      color: #5a7a90;
      text-transform: uppercase;
      letter-spacing: 0.06em;
    }
    .hm-badge {
      background: linear-gradient(135deg, #f1c40f, #e67e22);
      color: #0f1823;
      font-size: 0.6rem;
      font-weight: 700;
      padding: 1px 5px;
      border-radius: 3px;
      margin-left: auto;
    }

    .legal-tab {
      background: #1a2d3f;
      border: 1px solid #2a3f55;
      color: #7ec8e3;
      padding: 4px 12px;
      border-radius: 4px;
      font-size: 0.78rem;
      cursor: pointer;
    }
    .legal-tab.active {
      background: #2a3f55;
      color: #e0e8f0;
      font-weight: 600;
    }

    /* ── Map layer overlay panel ── */
    #map-layers-btn {
      position: absolute;
      top: 80px;
      right: 10px;
      z-index: 1000;
      background: #1a2332;
      border: 1px solid #2a3f55;
      border-radius: 6px;
      padding: 5px 9px;
      font-size: 13px;
      color: #e0e8f0;
      cursor: pointer;
      white-space: nowrap;
      box-shadow: 0 2px 6px rgba(0,0,0,0.4);
      user-select: none;
    }
    #map-layers-btn:hover { background: #243448; }
    #map-layers-panel {
      position: absolute;
      top: 115px;
      right: 10px;
      z-index: 1000;
      background: #1a2332;
      border: 1px solid #2a3f55;
      border-radius: 8px;
      padding: 10px 14px;
      min-width: 210px;
      box-shadow: 0 4px 12px rgba(0,0,0,0.5);
      display: none;
    }
    #map-layers-panel.open { display: block; }
    .layer-row {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 5px 0;
      border-bottom: 1px solid #2a3f55;
      font-size: 13px;
      color: #c8d8e8;
    }
    .layer-row:last-child { border-bottom: none; }
    .layer-row input[type=checkbox] { accent-color: #4a90d9; width: 15px; height: 15px; cursor: pointer; }
    .layer-row label { cursor: pointer; flex: 1; }
    .layer-opacity {
      width: 60px;
      accent-color: #4a90d9;
      cursor: pointer;
    }
    .loop-btn {
      cursor: pointer; font-size: 13px; user-select: none; opacity: 0.35;
      padding: 0 3px; line-height: 1;
    }
    .loop-btn.on { opacity: 1; }
    .loop-btn:hover { opacity: 0.8; }
    .loop-btn.on:hover { opacity: 1; }
    /* Animated-frame crossfade (shared by Rainmaker + GIBS animators).
       Duration must be < the animator's per-frame tick to avoid setUrl
       racing an in-progress fade-out. Tick floor is 250ms. */
    .anim-frame, .rain-frame { transition: opacity 180ms ease; }
    /* Disable Leaflet's per-tile fade-in on animated layers so only the
       container opacity transitions (prevents tile-fade vs container-fade
       double animation that strobes on larger tiles like GOES TC). */
    .anim-frame .leaflet-tile,
    .rain-frame .leaflet-tile { opacity: 1 !important; transition: none !important; }
    /* SST spot gauges (storm-engine warning markers) */
    .sst-marker {
      width: 30px; height: 30px; border-radius: 50%;
      display: flex; align-items: center; justify-content: center;
      font-size: 18px; border: 2px solid #1a2332;
      box-shadow: 0 2px 4px rgba(0,0,0,0.35);
      background: rgba(128,128,128,0.6);
    }
    .sst-green  { background: rgba(46, 204, 113, 0.9); }
    .sst-yellow { background: rgba(241, 196, 15, 0.9); }
    .sst-red    { background: rgba(231, 76, 60, 0.9); }
    /* SST history heat strip (popup on marker click) */
    .sst-hist { font-size: 11px; color: #1a2332; }
    .sst-hist .sst-hist-title { font-weight: 700; margin-bottom: 2px; }
    .sst-hist .sst-hist-sub   { color: #667; margin-bottom: 6px; }
    .sst-hist .sst-hist-arrow-row {
      position: relative; height: 13px; padding-left: 36px;
    }
    .sst-hist .sst-hist-arrow {
      position: absolute; transform: translateX(-50%);
      font-size: 13px; color: #000; line-height: 1; white-space: nowrap;
      font-weight: 700; top: 0;
    }
    .sst-hist .sst-hist-row {
      display: flex; flex-direction: row; align-items: center; gap: 4px;
    }
    .sst-hist .sst-hist-ylabel {
      font-weight: 700; font-size: 10px; width: 32px; text-align: right;
    }
    .sst-hist .sst-hist-strip {
      display: flex; flex-direction: row; gap: 0;
      border: 1px solid #1a2332; width: fit-content;
      position: relative;
    }
    .sst-hist .sst-hist-season-line {
      position: absolute; top: -1px; bottom: -1px; width: 0;
      border-left: 1.5px dashed #000; pointer-events: none;
    }
    .sst-hist .sst-hist-season-row {
      position: relative; height: 14px; padding-left: 36px;
      font-size: 10px; color: #1a2332; font-weight: 700;
    }
    .sst-hist .sst-hist-season-span {
      position: absolute; top: 0; height: 14px;
      display: flex; align-items: center; gap: 4px;
      font-size: 10px; color: #000; white-space: nowrap;
    }
    .sst-hist .sst-hist-season-span .shaft {
      flex: 1; border-top: 1px solid #000; height: 0; min-width: 12px;
    }
    .sst-hist .sst-hist-season-span .head {
      font-weight: 700; line-height: 1;
    }
    .sst-hist .sst-hist-tile { width: 2px; height: 14px; }
    .sst-hist .sst-hist-tile.b-green  { background: #2ecc71; }
    .sst-hist .sst-hist-tile.b-yellow { background: #f1c40f; }
    .sst-hist .sst-hist-tile.b-red    { background: #e74c3c; }
    .sst-hist .sst-hist-tile.b-na     { background: #e5e5e5; }
    .sst-hist .sst-hist-palmen {
      margin: 8px 0 10px; padding: 8px 10px;
      background: rgba(0,0,0,0.04); border-radius: 6px;
      font-size: 11px; line-height: 1.45; color: #1a2332;
    }
    .sst-hist .sst-hist-palmen-intro { margin-bottom: 6px; }
    .sst-hist .sst-hist-palmen-row {
      display: flex; gap: 6px; align-items: flex-start; margin: 3px 0;
    }
    .sst-hist .sst-hist-palmen-emoji { flex: 0 0 auto; line-height: 1.4; }
    .sst-hist .sst-hist-upsell {
      margin: 4px 0 6px; padding: 6px 8px;
      background: rgba(241,196,15,0.10);
      border: 1px dashed rgba(241,196,15,0.55);
      border-radius: 6px;
      font-size: 11px; color: #1a2332;
      display: flex; gap: 6px; align-items: center; justify-content: center;
    }
    .sst-hist .sst-hist-upsell .lock { font-size: 13px; }
    .sst-hist .sst-hist-upsell a { color: #b07f00; font-weight: 700; text-decoration: none; }
    .sst-hist .sst-hist-upsell a:hover { text-decoration: underline; }
    .sst-hist .sst-hist-axis {
      position: relative; height: 12px; margin-left: 36px;
      font-size: 9px; color: #667;
    }
    .sst-hist .sst-hist-axis span { position: absolute; transform: translateX(-50%); }
    .sst-hist .sst-hist-legend {
      margin-top: 6px; display: flex; gap: 8px; font-size: 10px; color: #667;
    }
    .sst-hist .sst-hist-legend i {
      display: inline-block; width: 10px; height: 10px; margin-right: 3px;
      vertical-align: middle; border: 1px solid #1a2332;
    }
    /* ── Wind-regime compass marker + popup ── */
    .wr-marker { width: 56px; height: 56px; cursor: pointer; }
    .wr-marker svg { width: 100%; height: 100%; display: block;
      filter: drop-shadow(0 1px 2px rgba(0,0,0,0.45)); }
    .wr-pop { font-size: 11px; color: #1a2332; min-width: 260px; }
    .wr-pop .wr-pop-title { font-weight: 700; text-align: center; margin-bottom: 2px; }
    .wr-pop .wr-pop-brand { text-align: center; color: #1e3a8a; font-size: 10px;
      font-weight: 700; margin-bottom: 4px; }
    .wr-pop .wr-pop-chip { text-align: center; font-size: 12px; font-weight: 700;
      margin-bottom: 8px; }
    .wr-pop .wr-pop-chip .wr-arrow { display: inline-block; margin: 0 4px;
      transform: translateY(1px); }
    .wr-pop .wr-pop-row { display: flex; align-items: center; gap: 4px;
      margin-bottom: 1px; }
    .wr-pop .wr-pop-ylabel { width: 32px; text-align: right; font-size: 10px;
      font-weight: 700; }
    .wr-pop .wr-pop-strip { display: flex; gap: 0; }
    .wr-pop .wr-pop-tile { width: 2px; height: 14px; }
    .wr-pop .wr-pop-arrow-row { font-size: 11px; line-height: 1; margin-left: 36px;
      position: relative; height: 12px; }
    .wr-pop .wr-pop-arrow { position: absolute; transform: translateX(-50%); }
    .wr-pop .wr-pop-axis { margin-left: 36px; position: relative; height: 12px;
      font-size: 9px; color: #667; }
    .wr-pop .wr-pop-axis span { position: absolute; transform: translateX(-50%); }
    .wr-pop .wr-pop-legend { margin-top: 6px; display: flex; gap: 10px; font-size: 10px;
      color: #667; justify-content: center; }
    .wr-pop .wr-pop-legend i { display: inline-block; width: 10px; height: 10px;
      margin-right: 3px; vertical-align: middle; border: 1px solid #1a2332; }
    .wr-pop .wr-pop-upsell { margin-top: 6px; padding: 6px 8px; background: #fff8e1;
      border: 1px solid #f0c419; border-radius: 4px; font-size: 10px; text-align: center; }
    .wr-pop .wr-pop-upsell a { color: #b07f00; font-weight: 700; text-decoration: none; }
    .wr-pop .wr-pop-upsell a:hover { text-decoration: underline; }
    /* Loop timelines (bottomright, one strip per active loop) */
    .timeline-strip { display: flex; align-items: center; gap: 4px; font-size: 10px; color: #1a2332; margin-bottom: 2px; }
    .timeline-strip .tl-label { font-weight: 700; min-width: 68px; }
    .timeline-strip .tl-ticks { display: flex; gap: 1px; flex: 1; }
    .timeline-strip .tl-tick { flex: 1; height: 8px; background: rgba(26,35,50,0.25); border-radius: 1px; }
    .timeline-strip .tl-tick.active { background: #e74c3c; }
    .timeline-strip .tl-range { font-size: 9px; opacity: 0.8; white-space: nowrap; }
    /* Precip-loop crossfade: smooth opacity transitions between frames */
    .rain-frame { transition: opacity 300ms ease; }
    .layer-group-title {
      font-size: 10px;
      font-weight: 700;
      color: #7ec8e3;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      margin: 4px 0 2px;
      padding-top: 2px;
      border-top: 1px solid rgba(255,255,255,0.08);
    }
    .layer-group-title:first-of-type { border-top: none; padding-top: 0; }
    /* ── Leg analyzer block in station popups (light/white popup bg) ── */
    .leg-analysis-slot { border-top: 1px solid #dde4ee; }
    .leg-analysis-slot:empty { border-top: none; }
    .leg-header {
      font-size: 11px; font-weight: 700; color: #1a2332;
      padding: 8px 14px 4px; letter-spacing: 0.03em;
    }
    .leg-line {
      font-size: 11px; color: #1a2332; padding: 2px 14px 6px; line-height: 1.45;
    }
    .leg-line b { color: #1a2332; }
    .leg-head { padding-top: 4px; }
    .leg-body { color: #1a2332; }
    .leg-body b { color: #1a2332; }
    .leg-sub2 { color: #5a7a90; font-size: 10.5px; padding-top: 0; padding-bottom: 4px; }
    .leg-dim { color: #5a7a90; }
    .leg-row {
      display: flex; gap: 10px; padding: 1px 14px; font-size: 11px; color: #1a2332;
    }
    .leg-rn { min-width: 62px; color: #5a7a90; }
    .leg-loading { font-size: 11px; color: #5a7a90; padding: 2px 14px 8px; font-style: italic; }
    .leg-caveat { font-size: 10px; color: #5a7a90; padding: 2px 14px 8px; }
    .layer-panel-title {
      font-size: 11px;
      font-weight: 700;
      color: #7a9ab0;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      margin-bottom: 6px;
      display: flex;
      justify-content: space-between;
      align-items: baseline;
    }
    .layer-panel-title .opacity-header {
      font-size: 9px;
      color: #5c7790;
      letter-spacing: 0.1em;
      padding-right: 4px;
    }

    /* ── Modal overlay ── */
    .modal-overlay {
      display: flex;
      visibility: hidden;
      pointer-events: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.6);
      z-index: 9999;
      align-items: center;
      justify-content: center;
      padding: 20px;
      opacity: 0;
      transition: opacity 0.15s;
    }
    .modal-overlay.open {
      visibility: visible;
      pointer-events: auto;
      opacity: 1;
    }

    .modal-box {
      background: #1a2332;
      border: 1px solid #2a3f55;
      border-radius: 12px;
      padding: 24px 28px;
      max-width: 560px;
      width: 100%;
      max-height: 85vh;
      overflow-y: auto;
      position: relative;
      color: #c8d8e8;
    }
    .modal-box h2 {
      font-size: 1.1rem;
      color: #7ec8e3;
      margin-bottom: 6px;
    }
    .modal-box h3 {
      font-size: 0.8rem;
      color: #7ec8e3;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      margin: 16px 0 8px 0;
      border-bottom: 1px solid #2a3f55;
      padding-bottom: 4px;
    }
    .modal-box p {
      font-size: 0.82rem;
      line-height: 1.6;
      color: #a0b8cc;
      margin-bottom: 8px;
    }
    .modal-box a { color: #7ec8e3; }
    .modal-intro {
      font-size: 0.85rem !important;
      color: #c8d8e8 !important;
      font-style: italic;
    }
    .modal-close {
      position: absolute;
      top: 12px;
      right: 14px;
      background: none;
      border: none;
      color: #5a7a90;
      font-size: 18px;
      cursor: pointer;
      line-height: 1;
      padding: 4px;
    }
    .modal-close:hover { color: #e0e8f0; }

    .help-row {
      display: flex;
      align-items: baseline;
      gap: 10px;
      margin-bottom: 6px;
      font-size: 0.82rem;
      line-height: 1.5;
      color: #a0b8cc;
    }
    .help-light {
      flex-shrink: 0;
      font-weight: 700;
      min-width: 90px;
      font-size: 0.78rem;
    }
    .help-light.green  { color: #2ecc71; }
    .help-light.yellow { color: #f1c40f; }
    .help-light.red    { color: #e74c3c; }

    .help-sea {
      flex-shrink: 0;
      font-weight: 700;
      min-width: 90px;
      font-size: 0.78rem;
      padding: 1px 6px;
      border-radius: 3px;
    }
    .help-sea.good      { background: #1a4a2a; color: #2ecc71; }
    .help-sea.fair      { background: #4a3a0a; color: #f1c40f; }
    .help-sea.poor      { background: #4a1a0a; color: #e67e22; }
    .help-sea.dangerous { background: #3a0a0a; color: #e74c3c; }

    .disclaimer {
      background: rgba(231,76,60,0.1);
      border: 1px solid rgba(231,76,60,0.3);
      border-radius: 6px;
      padding: 10px 12px !important;
      color: #c8a0a0 !important;
      font-size: 0.78rem !important;
    }
    .modal-footer {
      margin-top: 16px !important;
      font-size: 0.75rem !important;
      color: #4a6a80 !important;
      text-align: center;
      border-top: 1px solid #2a3f55;
      padding-top: 12px;
    }
    /* Live Satellite side panel — NESDIS NOAA STAR sector GIFs */
    #sat-widget {
      position: fixed; top: 80px; left: 0; z-index: 1000;
      width: 240px; max-width: 92vw;
      background: rgba(15, 25, 38, 0.92);
      border: 1px solid #2a3f55; border-left: 0;
      border-radius: 0 8px 8px 0;
      box-shadow: 2px 2px 8px rgba(0,0,0,0.4);
      color: #cfe; font-size: 0.8rem;
      transition: transform 0.25s ease;
    }
    #sat-widget.collapsed { transform: translateX(calc(-100% + 32px)); }
    #sat-widget-header {
      display: flex; align-items: center; justify-content: space-between;
      padding: 8px 10px; cursor: pointer;
      border-bottom: 1px solid #2a3f55;
      user-select: none;
    }
    #sat-widget-title { font-weight: 600; letter-spacing: 0.02em; }
    #sat-widget-toggle { font-size: 1rem; line-height: 1; }
    #sat-widget-body { padding: 8px; }
    .sat-frame { margin-bottom: 8px; }
    .sat-frame:last-child { margin-bottom: 0; }
    .sat-frame img {
      width: 100%; height: auto; display: block;
      border-radius: 4px; cursor: pointer;
      background: #0a1320;
    }
    .sat-caption {
      margin-top: 4px; font-size: 0.7rem; color: #88a8c0;
      display: flex; justify-content: space-between;
    }
    @media (max-width: 720px) {
      #sat-widget { width: 200px; top: 64px; }
    }

/* Shepherd.js onboarding tour theme overrides */
  .shepherd-theme-custom {
    background: transparent !important;
    box-shadow: none !important;
  }
  .shepherd-theme-custom .shepherd-content {
    background: #0f1823;
    border: 1px solid #2a3f55;
    border-radius: 10px;
    color: #e0e8f0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    max-width: 320px;
  }
  .shepherd-theme-custom .shepherd-text { color: #a0b8cc; font-size: 0.85rem; line-height: 1.5; padding: 14px 16px 8px; max-height: 40vh; overflow-y: auto; }
  .shepherd-theme-custom .shepherd-text:not(.scrolled) {
    -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
  }
  .shepherd-theme-custom .shepherd-text::after {
    content: '▼ scroll for more';
    display: block;
    text-align: center;
    font-size: 0.7rem;
    color: #5a7a90;
    padding: 4px 0 0;
    letter-spacing: 0.05em;
  }
  .shepherd-theme-custom .shepherd-text.scrolled::after { display: none; }
  .shepherd-theme-custom .shepherd-text.scrolled {
    -webkit-mask-image: none;
    mask-image: none;
  }
  .shepherd-theme-custom .shepherd-header { padding: 14px 16px 0; background: none; }
  .shepherd-theme-custom .shepherd-title { color: #7ec8e3; font-size: 0.95rem; font-weight: 700; }
  .shepherd-theme-custom .shepherd-footer { padding: 8px 16px 14px; gap: 8px; }
  .shepherd-theme-custom .shepherd-button { border-radius: 6px; font-size: 0.8rem; padding: 6px 14px; border: none; cursor: pointer; }
  .shepherd-theme-custom .shepherd-button-primary { background: #7ec8e3; color: #0f1823; font-weight: 700; }
  .shepherd-theme-custom .shepherd-button-secondary { background: #1a2d40; color: #7ec8e3; border: 1px solid #2a3f55; }
  .shepherd-theme-custom .shepherd-arrow:before { background: #0f1823; border-color: #2a3f55; }
  .shepherd-has-cancel-icon .shepherd-cancel-icon { color: #5a7a90; }
  .shepherd-has-cancel-icon .shepherd-cancel-icon:hover { color: #e0e8f0; }
  .shepherd-modal-overlay-container { display: none !important; opacity: 0 !important; }
  .shepherd-modal-overlay-container svg { display: none !important; }
  .shepherd-modal-overlay-container path { display: none !important; }
  .shepherd-modal-overlay-container * { display: none !important; }
  .shepherd-target-click-disabled { box-shadow: none !important; }
  .shepherd-enabled.shepherd-target { box-shadow: 0 0 0 2px #7ec8e3 !important; border-radius: 4px; }
  .shepherd-modal-overlay-container * { display: none !important; }
  .shepherd-has-cancel-icon .shepherd-content { box-shadow: 0 4px 24px rgba(0,0,0,0.6) !important; }
  .shepherd-element[data-popper-placement] { filter: none !important; }
