:root {
      --panel-bg: rgba(8, 14, 24, 0.84);
      --panel-bg-strong: rgba(8, 14, 24, 0.94);
      --panel-border: rgba(255, 255, 255, 0.14);
      --text-main: #f3f7ff;
      --text-muted: #b6c4d8;
      --radio: #64f58d;
      --visual: #88c7ff;
      --danger: #ff6b6b;
      --shadow: 0 18px 55px rgba(0,0,0,.42);
    }

    :root[data-theme="light"] {
      --panel-bg: rgba(255, 255, 255, 0.88);
      --panel-bg-strong: rgba(255, 255, 255, 0.94);
      --panel-border: rgba(19, 32, 51, 0.18);
      --text-main: #10223a;
      --text-muted: #51647d;
      --radio: #178a43;
      --visual: #1976d2;
      --danger: #b4232d;
      --shadow: 0 14px 34px rgba(31,58,87,.18);
    }

    * { box-sizing: border-box; }

    html, body, #map {
      height: 100%;
      margin: 0;
      background: #000;
      font-family: Arial, Helvetica, sans-serif;
      overflow: hidden;
    }

    .leaflet-container { background: #000; }

    .panel {
      position: absolute;
      z-index: 1000;
      background: var(--panel-bg);
      color: var(--text-main);
      border: 1px solid var(--panel-border);
      border-radius: 16px;
      box-shadow: var(--shadow, 0 12px 40px rgba(0, 0, 0, 0.38));
      backdrop-filter: blur(8px);
    }

    .top-left { top: 16px; left: 16px; width: 350px; padding: 16px 18px; }
    .tle-panel { top: 480px; left: 16px; width: 350px; padding: 9px 10px; }
    .top-right { top: 16px; right: 16px; width: 325px; padding: 10px 12px; }
    .bottom-left { bottom: 16px; left: 16px; width: auto; max-width: 430px; padding: 8px 10px; border-radius: 12px; }
    .bottom-right { bottom: 16px; right: 16px; width: 320px; padding: 12px 14px; background: var(--panel-bg-strong); }


    /* SpaceOpsLab branded breadcrumb */
    .breadcrumb-link {
      display: inline-flex;
      align-items: center;
      gap: 0;
      color: inherit;
      text-decoration: none !important;
      font-size: 1.15rem;
      font-weight: 850;
      letter-spacing: 0.01em;
      margin-bottom: 10px;
      opacity: 0.96;
    }
    .breadcrumb-link:hover {
      text-decoration: none !important;
    }
    .sol-site-mark{
      display:inline-flex;
      width:1.6em;
      height:1.6em;
      margin-right:.42em;
      vertical-align:-.22em;
      flex:0 0 auto;
      filter:drop-shadow(0 0 8px rgba(126,231,135,.25));
    }
    .sol-site-mark svg{
      display:block;
      width:100%;
      height:100%;
      overflow:visible;
    }
    .sol-brand-space,
    .sol-brand-lab{
      color:#7ee787;
      font-weight:900;
    }
    .sol-brand-ops{
      color:#9ad7ff;
      font-weight:850;
    }
    .breadcrumb-link:hover .sol-brand-space,
    .breadcrumb-link:hover .sol-brand-lab{
      color:#9ff5ad;
    }
    .breadcrumb-link:hover .sol-brand-ops{
      color:#c9e7ff;
    }
    .sol-orbit-logo{
      overflow:visible;
    }
    .sol-orbit-radiation{
      opacity:0;
      stroke:#7ee787;
      stroke-width:3.2;
      stroke-linecap:round;
      fill:none;
      transform-origin:76px 43px;
      filter:drop-shadow(0 0 8px rgba(126,231,135,.45));
    }
    .sol-orbit-radiation-1{
      animation:solOrbitRadiationPulse 5.5s ease-out .8s infinite;
    }
    .sol-orbit-radiation-2{
      animation:solOrbitRadiationPulse 5.5s ease-out 1.25s infinite;
    }
    @keyframes solOrbitRadiationPulse{
      0%{opacity:0;transform:scale(.72);}
      10%{opacity:.95;transform:scale(1.02);}
      22%{opacity:0;transform:scale(1.35);}
      100%{opacity:0;transform:scale(1.35);}
    }
    @media (prefers-reduced-motion: reduce){
      .sol-orbit-radiation-1,
      .sol-orbit-radiation-2{
        animation:none !important;
        opacity:0 !important;
      }
    }

    .title { font-size: 24px; font-weight: 800; letter-spacing: 0.2px; margin-bottom: 12px; }
    .subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 14px; line-height: 1.35; }
    .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: 14px; }
    .row { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid rgba(255,255,255,0.08); padding: 5px 0; font-size: 14px; }
    .label { color: var(--text-muted); }
    .value { font-weight: 700; text-align: right; }
    .time-large { font-size: 28px; font-weight: 800; letter-spacing: 0.8px; }
    .time-label { color: var(--text-muted); font-size: 12px; margin-top: 2px; margin-bottom: 12px; white-space: nowrap; }

    details.panel > summary,
    details.mini-details > summary {
      list-style: none;
      cursor: pointer;
      user-select: none;
      color: var(--text-main);
      font-weight: 800;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
    }
    details.panel > summary::-webkit-details-marker,
    details.mini-details > summary::-webkit-details-marker { display: none; }
    .summary-muted {
      color: var(--text-muted);
      font-size: 12px;
      font-weight: 600;
    }
    .summary-chevron {
      color: var(--text-muted);
      font-size: 14px;
    }
    details[open] .summary-chevron { transform: rotate(180deg); }
    .details-body { margin-top: 10px; }
    details.mini-details { margin-top: 8px; }

    .legend { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
    .legend-item { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 12px; white-space: nowrap; }
    .swatch { width: 18px; min-width: 18px; height: 4px; border-radius: 999px; display: inline-block; }
    .swatch.visual { background: var(--visual); box-shadow: 0 0 8px var(--visual); }
    .swatch.radio { background: var(--radio); box-shadow: 0 0 8px var(--radio); }
    .swatch.track { background: #fff; box-shadow: 0 0 8px #fff; }
    .swatch.station { width: 12px; min-width: 12px; height: 12px; border-radius: 50%; background: #ffdd57; border: 2px solid #111827; box-shadow: 0 0 10px rgba(255,221,87,.9); }

    .status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 999px; background: rgba(125, 211, 252, 0.12); border: 1px solid rgba(125, 211, 252, 0.28); color: #d9f5ff; font-size: 13px; margin-top: 10px; max-width: 100%; }
    .dot { width: 8px; min-width: 8px; height: 8px; border-radius: 50%; background: var(--radio); box-shadow: 0 0 10px var(--radio); }
    .dot.stale { background: var(--danger); box-shadow: 0 0 10px var(--danger); }
    .status-pill.heading { margin-top: 0; width: 100%; justify-content: flex-start; }
    .danger { color: var(--danger); }

  .iss-marker {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.46);
  border: 2px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 0 22px rgba(125, 211, 252, 0.95);
}

.iss-marker img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: brightness(1.25);
}
    .station-marker { width: 18px; height: 18px; border-radius: 50%; background: #ffdd57; border: 2px solid #111827; box-shadow: 0 0 12px rgba(255, 221, 87, 0.9); }

    .button-row { display: flex; gap: 5px; margin-top: 9px; flex-wrap: nowrap; }
    button { border: 1px solid rgba(255,255,255,0.18); background: rgba(255,255,255,0.08); color: var(--text-main); border-radius: 9px; padding: 6px 7px; cursor: pointer; font-weight: 700; font-size: 11px; white-space: nowrap; }
    button:hover { background: rgba(255,255,255,0.16); }
    .mask-input { width: 92px; border: 1px solid rgba(255,255,255,0.18); background: rgba(255,255,255,0.08); color: var(--text-main); border-radius: 8px; padding: 4px 6px; font-weight: 800; text-align: right; }
    .small-note { color: var(--text-muted); font-size: 11px; font-weight: 600; margin-top: 6px; }
    .tle-panel .row { align-items: center; }
    .tle-panel .value { white-space: nowrap; }
    .info-tip {
      position: relative;
      display: inline-grid;
      place-items: center;
      width: 18px;
      height: 18px;
      margin-left: 5px;
      border-radius: 50%;
      border: 1px solid rgba(125,211,252,.28);
      background: rgba(125,211,252,.12);
      color: #d9f5ff;
      font-size: 11px;
      font-weight: 900;
      line-height: 1;
      cursor: help;
      vertical-align: middle;
      z-index: 2100;
    }
    .info-tip.large { width: 22px; height: 22px; font-size: 13px; }
    .info-tip:hover,
    .info-tip:focus,
    .info-tip:focus-visible {
      background: rgba(125,211,252,.22);
      border-color: rgba(217,245,255,.65);
      outline: none;
    }
    .info-tip::after {
      content: attr(data-tip);
      position: absolute;
      left: 50%;
      bottom: calc(100% + 10px);
      transform: translateX(-50%);
      width: 265px;
      max-width: min(265px, calc(100vw - 36px));
      padding: 10px 12px;
      border-radius: 12px;
      background: rgba(8,14,24,.98);
      color: var(--text-main);
      border: 1px solid rgba(125,211,252,.34);
      box-shadow: 0 14px 42px rgba(0,0,0,.45);
      font-size: 12px;
      font-weight: 600;
      line-height: 1.35;
      text-align: left;
      white-space: normal;
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
      transition: opacity .14s ease, transform .14s ease;
      z-index: 2200;
    }
    .info-tip::before {
      content: '';
      position: absolute;
      left: 50%;
      bottom: calc(100% + 4px);
      transform: translateX(-50%);
      border: 6px solid transparent;
      border-top-color: rgba(125,211,252,.34);
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
      z-index: 2201;
    }
    .info-tip:hover::after,
    .info-tip:focus::after,
    .info-tip:focus-visible::after,
    .info-tip:hover::before,
    .info-tip:focus::before,
    .info-tip:focus-visible::before {
      opacity: 1;
      visibility: visible;
    }
    .tle-panel .info-tip::after,
    .bottom-right .info-tip::after {
      left: auto;
      right: -8px;
      transform: none;
    }
    .tle-panel .info-tip::before,
    .bottom-right .info-tip::before {
      left: auto;
      right: 0;
      transform: none;
    }

    .errorBox { display: none; margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(65, 15, 15, 0.92); border: 1px solid rgba(255, 107, 107, 0.55); color: #ffd6d6; font-size: 13px; line-height: 1.35; }


    /* Desktop: hide the compact mobile summary so the original panel header remains clean. */
    details.panel.top-left > summary { display: none !important; }
    .top-left > .details-body { margin-top: 0; }

    @media (max-width: 900px) {
      details.panel.top-left > summary {
        display: flex !important;
      }

      .top-left > .details-body {
        margin-top: 10px;
      }

      .top-left,
      .tle-panel {
        left: 10px;
        right: 10px;
        width: auto;
        max-width: none;
      }

      .top-left {
        top: 10px;
        padding: 10px 12px;
        max-height: 48vh;
        overflow-y: auto;
      }

      .tle-panel {
        top: auto;
        bottom: 10px;
        padding: 8px 10px;
        max-height: 44vh;
        overflow-y: auto;
      }

      .top-right,
      .bottom-left,
      .bottom-right {
        display: none;
      }

      .title,
      .subtitle {
        display: none;
      }

      .mobile-summary-title strong {
        font-size: 15px;
      }

      .grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px 10px;
      }

      .time-large {
        font-size: 20px;
      }

      .row {
        font-size: 13px;
        padding: 4px 0;
      }

      .button-row {
        overflow-x: auto;
        padding-bottom: 2px;
      }

      .button-row button {
        flex: 0 0 auto;
      }

      .panel {
        backdrop-filter: blur(12px);
      }

      .info-tip::after {
        width: min(245px, calc(100vw - 32px));
      }

      details.panel:not([open]) .details-body {
        display: none;
      }
    }

    /* Viewport-safe hover/focus tooltips */
    .info-tip::after,
    .info-tip::before {
      display: none !important;
      content: none !important;
    }

    .floating-tip {
      position: fixed;
      z-index: 5000;
      display: none;
      width: max-content;
      max-width: min(285px, calc(100vw - 24px));
      padding: 10px 12px;
      border-radius: 12px;
      background: rgba(8,14,24,.98);
      color: var(--text-main);
      border: 1px solid rgba(125,211,252,.34);
      box-shadow: 0 14px 42px rgba(0,0,0,.45);
      font-size: 12px;
      font-weight: 600;
      line-height: 1.35;
      text-align: left;
      white-space: normal;
      pointer-events: none;
    }

    .floating-tip.show {
      display: block;
    }


    /* Map attribution: keep Esri attribution visible but compact. */
    .leaflet-control-attribution {
      font-size: 10px !important;
      opacity: 0.82;
      background: rgba(8,14,24,.72) !important;
      color: #c9d7ec !important;
      border-radius: 8px 0 0 0;
    }
    .leaflet-control-attribution a {
      color: #9fd3ff !important;
    }



    /* SpaceOpsLab dark/light theme toggle */
    .theme-toggle {
      position: absolute;
      top: 16px;
      right: 16px;
      z-index: 1300;
      display: inline-flex;
      align-items: center;
      padding: 6px;
      border: 1px solid var(--panel-border);
      border-radius: 999px;
      background: rgba(11,20,40,0.80);
      cursor: pointer;
      box-shadow: var(--shadow, 0 18px 40px rgba(0,0,0,.28));
    }
    .theme-toggle:hover{border-color:rgba(126,231,255,.40)}
    .theme-toggle:focus-visible{outline:none;box-shadow:0 0 0 3px rgba(89,195,255,.20),var(--shadow, 0 18px 40px rgba(0,0,0,.28))}
    .toggle-track {
      position: relative;
      display: inline-flex;
      align-items: center;
      justify-content: space-between;
      width: 58px;
      height: 30px;
      padding: 0 7px;
      border-radius: 999px;
      background: rgba(5,10,22,0.65);
    }
    .toggle-icon {
      position: relative;
      z-index: 1;
      font-size: 0.83rem;
      line-height:1;
    }
    .toggle-thumb {
      position: absolute;
      top: 3px;
      left: 3px;
      width: 24px;
      height: 24px;
      border-radius: 50%;
      background: linear-gradient(180deg, #ffffff, #d9e8ff);
      box-shadow: 0 4px 12px rgba(0,0,0,0.26);
      transition: transform 180ms ease;
    }
    :root[data-theme="light"] .toggle-thumb {
      transform: translateX(28px);
      background: linear-gradient(180deg, #fff6c7, #ffd166);
    }
    :root[data-theme="light"] .theme-toggle{
      background:rgba(11,20,40,0.82);
      border-color:rgba(19,32,51,.26);
    }

    .map-pick-note.active {
      color:#d9f5ff;
      font-weight:800;
    }
    button.map-pick-active {
      border-color:rgba(100,245,141,.58);
      background:rgba(100,245,141,.16);
      box-shadow:0 0 0 3px rgba(100,245,141,.08);
    }
    body.map-pick-mode #map {
      cursor:crosshair;
    }

    /* Light mode for full-screen map layout: panels switch, map remains fully usable. */
    :root[data-theme="light"] html,
    :root[data-theme="light"] body,
    :root[data-theme="light"] #map,
    :root[data-theme="light"] .leaflet-container { background:#e8f1fb; }
    :root[data-theme="light"] .panel {
      background: var(--panel-bg);
      color: var(--text-main);
      border-color: var(--panel-border);
      box-shadow: var(--shadow);
      backdrop-filter: blur(12px);
    }
    :root[data-theme="light"] .bottom-right { background: var(--panel-bg-strong); }
    :root[data-theme="light"] .title,
    :root[data-theme="light"] .time-large,
    :root[data-theme="light"] .value,
    :root[data-theme="light"] details.panel > summary,
    :root[data-theme="light"] details.mini-details > summary { color: var(--text-main); }
    :root[data-theme="light"] .subtitle,
    :root[data-theme="light"] .time-label,
    :root[data-theme="light"] .label,
    :root[data-theme="light"] .summary-muted,
    :root[data-theme="light"] .summary-chevron,
    :root[data-theme="light"] .legend-item,
    :root[data-theme="light"] .small-note { color: var(--text-muted); }
    :root[data-theme="light"] .row { border-bottom-color: rgba(19,32,51,.12); }
    :root[data-theme="light"] button,
    :root[data-theme="light"] .mask-input {
      background: rgba(255,255,255,.92);
      color: var(--text-main);
      border-color: rgba(19,32,51,.22);
    }
    :root[data-theme="light"] button:hover { background: rgba(237,244,252,.96); }
    :root[data-theme="light"] .status-pill {
      background: rgba(25,118,210,.10);
      border-color: rgba(25,118,210,.24);
      color: #0b5fa5;
    }
    :root[data-theme="light"] .info-tip {
      background: rgba(25,118,210,.10);
      border-color: rgba(25,118,210,.30);
      color: #0b5fa5;
    }
    :root[data-theme="light"] .floating-tip {
      background: rgba(255,255,255,.98);
      color: var(--text-main);
      border-color: rgba(25,118,210,.26);
      box-shadow: 0 14px 34px rgba(31,58,87,.20);
    }
    :root[data-theme="light"] .errorBox {
      background:#fff1f1;
      border-color:#e0aaaa;
      color:#7a1515;
    }
    :root[data-theme="light"] .leaflet-control-attribution {
      background: rgba(255,255,255,.86) !important;
      color: #51647d !important;
    }
    :root[data-theme="light"] .leaflet-control-attribution a { color:#1976d2 !important; }

    /* Light mode SpaceOpsLab breadcrumb: match the space-glass treatment used on other pages. */
    :root[data-theme="light"] .breadcrumb-link{
      color:rgba(234,246,255,.90) !important;
      text-shadow:0 2px 10px rgba(0,0,0,.34);
      background:rgba(5,10,22,.30);
      border:1px solid rgba(234,246,255,.14);
      border-radius:999px;
      padding:3px 9px 3px 5px;
      box-shadow:0 8px 20px rgba(5,10,22,.16);
      backdrop-filter:blur(7px);
    }
    :root[data-theme="light"] .breadcrumb-link:hover{
      background:rgba(5,10,22,.40);
      border-color:rgba(126,231,255,.26);
    }
    :root[data-theme="light"] .sol-site-mark{filter:drop-shadow(0 0 7px rgba(126,231,135,.26));}
    :root[data-theme="light"] .sol-brand-space,
    :root[data-theme="light"] .sol-brand-lab{color:#7ee787;}
    :root[data-theme="light"] .sol-brand-ops{color:#9ad7ff;}

    /* Make every floating panel collapsible on desktop and mobile. */
    details.panel.top-left > summary { display: flex !important; }
    .top-left > .details-body { margin-top: 10px; }
    details.panel:not([open]) { padding: 10px 12px; }
    details.panel:not([open]) .details-body { display: none; }

    @media (max-width: 900px) {
      .theme-toggle { top: 10px; right: 10px; padding: 5px; }
      .toggle-track{width:54px;height:28px}
      .toggle-thumb{width:22px;height:22px}
      :root[data-theme="light"] .toggle-thumb{transform:translateX(26px)}
      .top-left { top: 56px; }
    }


    /* Single left control panel layout */
    .top-left{
      width:390px;
      max-height:calc(100vh - 88px);
      overflow-y:auto;
      scrollbar-width:thin;
    }
    .controlStatus{margin:10px 0 12px;}
    .controlSection{
      margin-top:10px;
      padding-top:10px;
      border-top:1px solid rgba(255,255,255,0.10);
    }
    .controlSection > summary{
      padding:2px 0;
    }
    .controlSection .details-body{
      margin-top:8px;
    }
    .panelLegend{
      margin:2px 0 10px;
    }
    :root[data-theme="light"] .controlSection{
      border-top-color:rgba(19,32,51,.12);
    }
    @media (max-width:900px){
      .top-left{
        width:auto;
        max-height:calc(100vh - 86px);
      }
    }



    /* Collapsed panel live snapshot + clean map UI toggle */
    .panel-summary-stack{
      min-width:0;
      flex:1 1 auto;
    }
    .summary-title-row{
      display:flex;
      align-items:center;
      gap:8px;
      flex-wrap:wrap;
    }
    .summary-live-grid{
      display:grid;
      grid-template-columns:repeat(3,minmax(0,1fr));
      gap:6px;
      margin-top:8px;
      max-width:100%;
    }
    .summary-chip{
      min-width:0;
      border:1px solid rgba(125,211,252,.22);
      background:rgba(125,211,252,.08);
      border-radius:10px;
      padding:6px 7px;
      line-height:1.15;
    }
    .summary-chip .k{
      display:block;
      color:var(--text-muted);
      font-size:10px;
      font-weight:800;
      text-transform:uppercase;
      letter-spacing:.06em;
      margin-bottom:2px;
    }
    .summary-chip .v{
      display:block;
      color:var(--text-main);
      font-size:12px;
      font-weight:900;
      white-space:nowrap;
      overflow:hidden;
      text-overflow:ellipsis;
    }
    details.panel[open] .summary-live-grid{
      display:none;
    }
    .ui-visibility-toggle{
      position:absolute;
      top:16px;
      right:104px;
      z-index:1400;
      border:1px solid var(--panel-border);
      background:rgba(11,20,40,.80);
      color:#eaf2ff;
      border-radius:999px;
      padding:9px 12px;
      cursor:pointer;
      font-size:12px;
      font-weight:900;
      box-shadow:var(--shadow, 0 18px 40px rgba(0,0,0,.28));
      backdrop-filter:blur(8px);
    }
    .ui-visibility-toggle:hover{border-color:rgba(126,231,255,.40);background:rgba(11,20,40,.92)}
    body.ui-hidden .panel,
    body.ui-hidden .theme-toggle{
      display:none !important;
    }
    body.ui-hidden .ui-visibility-toggle{
      right:16px;
      width:38px;
      height:38px;
      padding:0;
      display:inline-flex;
      align-items:center;
      justify-content:center;
      overflow:hidden;
      opacity:.10;
      color:transparent;
      font-size:0;
      background:rgba(11,20,40,.34);
      border-color:rgba(234,242,255,.18);
      transform:scale(.92);
      transition:opacity .16s ease, transform .16s ease, width .16s ease, padding .16s ease, background .16s ease;
    }
    body.ui-hidden .ui-visibility-toggle::before{
      content:"☰";
      color:#eaf2ff;
      font-size:16px;
      line-height:1;
      opacity:.85;
    }
    body.ui-hidden .ui-visibility-toggle:hover,
    body.ui-hidden .ui-visibility-toggle:focus-visible{
      width:auto;
      min-width:74px;
      padding:9px 12px;
      opacity:1;
      transform:scale(1);
      background:rgba(11,20,40,.92);
      border-color:rgba(126,231,255,.45);
    }
    body.ui-hidden .ui-visibility-toggle:hover::before,
    body.ui-hidden .ui-visibility-toggle:focus-visible::before{
      content:"Show UI";
      font-size:12px;
      font-weight:900;
      opacity:1;
    }
    :root[data-theme="light"] .summary-chip{
      background:rgba(25,118,210,.08);
      border-color:rgba(25,118,210,.20);
    }
    :root[data-theme="light"] .ui-visibility-toggle{
      background:rgba(11,20,40,.82);
      color:#eaf2ff;
      border-color:rgba(19,32,51,.26);
    }
    @media (max-width:900px){
      .ui-visibility-toggle{top:10px;right:94px;padding:8px 10px;font-size:11px;}
      body.ui-hidden .ui-visibility-toggle{right:10px;width:34px;height:34px;}
      body.ui-hidden .ui-visibility-toggle:hover,
      body.ui-hidden .ui-visibility-toggle:focus-visible{width:auto;min-width:70px;padding:8px 10px;}
      body.ui-hidden .ui-visibility-toggle::before{font-size:15px;}
      body.ui-hidden .ui-visibility-toggle:hover::before,
      body.ui-hidden .ui-visibility-toggle:focus-visible::before{font-size:11px;}
      .summary-live-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:5px;margin-top:0;}
      .summary-chip{padding:5px 6px;}
      .summary-chip .k{font-size:9px;}
      .summary-chip .v{font-size:11px;}
      .summary-chip.mobile-hide{display:none;}
    }


    /* Floating clickable map legend / layer controls */
    .map-legend-panel{
      top:auto;
      left:auto;
      right:16px;
      bottom:16px;
      width:320px;
      padding:10px 12px;
      background:var(--panel-bg-strong);
    }
    .map-legend-title{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:10px;
      margin-bottom:8px;
      color:var(--text-main);
      font-weight:900;
      font-size:13px;
      letter-spacing:.02em;
    }
    .legend-toggle-grid{
      display:grid;
      grid-template-columns:1fr 1fr;
      gap:7px;
    }
    .legend-toggle{
      display:flex;
      align-items:center;
      gap:7px;
      border:1px solid var(--panel-border);
      border-radius:999px;
      background:rgba(255,255,255,.07);
      color:var(--text-muted);
      padding:7px 9px;
      cursor:pointer;
      font-size:12px;
      font-weight:800;
      text-align:left;
      justify-content:flex-start;
    }
    .legend-toggle:hover{background:rgba(255,255,255,.13);color:var(--text-main);}
    .legend-toggle.active{
      color:var(--text-main);
      border-color:rgba(125,211,252,.42);
      background:rgba(125,211,252,.13);
    }
    .legend-toggle:not(.active){opacity:.58;}
    .swatch.iss{width:12px;min-width:12px;height:12px;border-radius:50%;background:#eaf2ff;border:2px solid #60a5fa;box-shadow:0 0 10px rgba(125,211,252,.85);}
    .swatch.future{background:#a58bff;box-shadow:0 0 8px #a58bff;}
    .legend-path-controls{
      margin-top:9px;
      padding-top:9px;
      border-top:1px solid var(--panel-border);
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:10px;
      color:var(--text-muted);
      font-size:12px;
      font-weight:800;
    }
    .legend-path-controls select{
      border:1px solid var(--panel-border);
      border-radius:999px;
      background:#0b1428;
      color:#eaf2ff;
      padding:6px 9px;
      font-weight:900;
      outline:none;
      min-width:118px;
    }
    .legend-path-controls select option{
      background:#0b1428;
      color:#eaf2ff;
    }
    .future-path-label{
      display:inline-flex;
      align-items:center;
      justify-content:center;
      width:auto !important;
      height:auto !important;
      padding:3px 7px;
      border-radius:999px;
      border:1px solid rgba(234,242,255,.24);
      background:rgba(11,20,40,.82);
      color:#f1edff;
      font-size:11px;
      font-weight:900;
      line-height:1;
      white-space:nowrap;
      box-shadow:0 8px 22px rgba(0,0,0,.36), 0 0 12px rgba(165,139,255,.24);
      backdrop-filter:blur(6px);
    }
    .summary-chip.next-pass-chip .v{
      font-size:11px;
      letter-spacing:-.03em;
    }

    .legend-title-main{display:block;line-height:1.1;}
    .legend-collapse-toggle{
      height:32px;
      border-radius:999px;
      display:inline-flex;
      align-items:center;
      justify-content:center;
      gap:6px;
      padding:0 10px;
      border:1px solid rgba(125,211,252,.32);
      background:linear-gradient(135deg,rgba(125,211,252,.18),rgba(165,139,255,.14));
      color:var(--text-main);
      box-shadow:0 8px 24px rgba(0,0,0,.22);
      font-size:11px;
      font-weight:950;
      min-width:72px;
    }
    .legend-collapse-toggle:hover{border-color:rgba(125,211,252,.62);background:linear-gradient(135deg,rgba(125,211,252,.28),rgba(165,139,255,.22));}
    .legend-action-text{line-height:1;}
    .legend-collapse-icon{display:inline-block;transition:transform .18s ease;font-size:14px;line-height:1;}
    .map-legend-panel.legend-collapsed .legend-collapse-icon{transform:rotate(180deg);}
    .map-legend-panel.legend-collapsed .map-legend-body{display:none;}
    .map-view-controls{
      display:grid;
      grid-template-columns:1fr 1fr;
      gap:7px;
      margin-bottom:9px;
    }
    .map-view-controls button{
      width:100%;
      border-radius:999px;
      padding:7px 10px;
      background:rgba(255,255,255,.07);
      border-color:var(--panel-border);
      color:var(--text-main);
      font-size:12px;
      font-weight:900;
    }
    .map-view-controls button:hover{background:rgba(125,211,252,.13);border-color:rgba(125,211,252,.42);}
    .legend-toggle{position:relative;}
    .legend-toggle .layer-name{min-width:0;overflow:hidden;text-overflow:ellipsis;}
    .legend-toggle .layer-state{
      margin-left:auto;
      padding:2px 6px;
      border-radius:999px;
      background:rgba(85,240,160,.12);
      color:#b7f5c2;
      border:1px solid rgba(85,240,160,.20);
      font-size:9px;
      font-weight:950;
      text-transform:uppercase;
      letter-spacing:.04em;
    }
    .legend-toggle:not(.active) .layer-state{
      background:rgba(255,255,255,.06);
      color:var(--text-muted);
      border-color:rgba(255,255,255,.12);
    }
    .future-path-label.highlighted{
      background:rgba(255,209,102,.96);
      color:#201300;
      border-color:rgba(255,255,255,.72);
      box-shadow:0 0 0 3px rgba(255,209,102,.24), 0 0 20px rgba(255,209,102,.65);
    }
    .legend-hint{
      margin-top:8px;
      color:var(--text-muted);
      font-size:11px;
      line-height:1.3;
    }
    :root[data-theme="light"] .map-legend-panel{background:var(--panel-bg-strong);}
    :root[data-theme="light"] .legend-toggle{background:rgba(255,255,255,.92);color:var(--text-muted);border-color:rgba(19,32,51,.18);}
    :root[data-theme="light"] .legend-toggle.active{background:rgba(25,118,210,.10);color:var(--text-main);border-color:rgba(25,118,210,.28);}
    :root[data-theme="light"] .map-view-controls button{background:rgba(255,255,255,.92);color:var(--text-main);border-color:rgba(19,32,51,.18);}
    :root[data-theme="light"] .map-view-controls button:hover{background:rgba(25,118,210,.10);border-color:rgba(25,118,210,.28);}
    :root[data-theme="light"] .legend-toggle .layer-state{background:rgba(23,138,67,.10);color:#08722f;border-color:rgba(23,138,67,.18);}
    :root[data-theme="light"] .legend-toggle:not(.active) .layer-state{background:#edf4fc;color:#51647d;border-color:#dce7f3;}
    :root[data-theme="light"] .legend-path-controls select{background:#ffffff;color:var(--text-main);border-color:rgba(19,32,51,.22);}
    :root[data-theme="light"] .legend-path-controls select option{background:#ffffff;color:var(--text-main);}
    :root[data-theme="light"] .future-path-label{background:rgba(255,255,255,.92);color:#3b2778;border-color:rgba(59,39,120,.22);box-shadow:0 8px 22px rgba(31,58,87,.16), 0 0 12px rgba(165,139,255,.18);}
    @media (max-width:900px){
      .map-legend-panel{left:10px;right:10px;bottom:10px;width:auto;max-width:none;padding:8px 10px;}
      .legend-toggle-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;}
      .legend-toggle{padding:6px 7px;font-size:11px;}
      .legend-path-controls{font-size:11px;}
    }
    @media (max-width:560px){
      .legend-toggle-grid{grid-template-columns:1fr 1fr;}
      .map-legend-title{font-size:12px;}
    }


    /* FINAL FIX: keep map layer control tray contained on all screen sizes. */
    .map-legend-panel{
      width:min(320px, calc(100vw - 32px)) !important;
      max-width:calc(100vw - 32px) !important;
      overflow:hidden !important;
      box-sizing:border-box !important;
    }
    .map-legend-title,
    .map-view-controls,
    .legend-toggle-grid,
    .legend-path-controls{
      min-width:0 !important;
      max-width:100% !important;
      box-sizing:border-box !important;
    }
    .map-view-controls,
    .legend-toggle-grid{
      grid-template-columns:repeat(2, minmax(0, 1fr)) !important;
    }
    .map-view-controls button,
    .legend-toggle{
      min-width:0 !important;
      max-width:100% !important;
      width:100% !important;
      overflow:hidden !important;
      box-sizing:border-box !important;
    }
    .legend-toggle .swatch{
      flex:0 0 auto !important;
    }
    .legend-toggle .layer-name{
      flex:1 1 auto !important;
      min-width:0 !important;
      overflow:hidden !important;
      text-overflow:ellipsis !important;
      white-space:nowrap !important;
    }
    .legend-toggle .layer-state{
      flex:0 0 auto !important;
      margin-left:4px !important;
      padding:2px 5px !important;
      font-size:8px !important;
    }
    .legend-path-controls select{
      min-width:0 !important;
      max-width:150px !important;
      box-sizing:border-box !important;
    }
    @media (max-width:900px){
      .map-legend-panel{
        left:10px !important;
        right:10px !important;
        bottom:10px !important;
        width:auto !important;
        max-width:calc(100vw - 20px) !important;
        max-height:42vh !important;
        overflow:auto !important;
      }
    }
    @media (max-width:560px){
      .map-view-controls,
      .legend-toggle-grid{
        grid-template-columns:repeat(2, minmax(0, 1fr)) !important;
      }
      .legend-path-controls{
        align-items:stretch !important;
      }
      .legend-path-controls select{
        max-width:135px !important;
      }
      .legend-toggle .layer-state{
        display:none !important;
      }
    }

    /* Clean layer buttons: dim means hidden, no extra state badges. */
    .legend-toggle .layer-state{display:none !important;}
    .legend-toggle{transition:opacity .16s ease, background .16s ease, border-color .16s ease, transform .16s ease;}
    .legend-toggle.active .swatch{opacity:1;}
    .legend-toggle:not(.active) .swatch{opacity:.42;filter:grayscale(.35);}
    .future-path-label{cursor:pointer;}
    .future-path-leaflet-popup .leaflet-popup-content-wrapper{
      background:rgba(8,14,24,.96);
      color:var(--text-main);
      border:1px solid rgba(125,211,252,.30);
      border-radius:13px;
      box-shadow:0 14px 38px rgba(0,0,0,.48);
      backdrop-filter:blur(8px);
    }
    .future-path-leaflet-popup .leaflet-popup-tip{
      background:rgba(8,14,24,.96);
      border:1px solid rgba(125,211,252,.24);
    }
    .future-path-leaflet-popup .leaflet-popup-content{
      margin:10px 12px;
    }
    .future-path-popup{
      min-width:210px;
      line-height:1.25;
    }
    .future-path-popup-title{
      color:#d9e7ff;
      font-size:11px;
      font-weight:900;
      letter-spacing:.02em;
      margin-bottom:5px;
      text-transform:uppercase;
    }
    .future-path-popup-time{
      color:#f3f7ff;
      font-size:13px;
      font-weight:900;
      white-space:nowrap;
    }
    .future-path-popup-zone{
      color:#9fb0c8;
      font-size:11px;
      font-weight:700;
      margin-top:4px;
      white-space:nowrap;
    }
    :root[data-theme="light"] .future-path-leaflet-popup .leaflet-popup-content-wrapper{
      background:rgba(12,25,45,.94);
      color:#f3f7ff;
      border-color:rgba(89,195,255,.30);
      box-shadow:0 14px 34px rgba(31,58,87,.28);
    }
    :root[data-theme="light"] .future-path-leaflet-popup .leaflet-popup-tip{
      background:rgba(12,25,45,.94);
      border-color:rgba(89,195,255,.22);
    }
    :root[data-theme="light"] .future-path-popup-title{color:#d9e7ff;}
    :root[data-theme="light"] .future-path-popup-time{color:#ffffff;}
    :root[data-theme="light"] .future-path-popup-zone{color:#b7c7de;}


    .config-grid{
      display:grid;
      grid-template-columns:1fr;
      gap:6px;
      margin-top:2px;
      font-size:11px;
      line-height:1.25;
    }
    .config-row{
      display:flex;
      justify-content:space-between;
      gap:12px;
      padding:5px 0;
      border-bottom:1px solid rgba(255,255,255,0.08);
    }
    .config-row span:first-child{color:var(--text-muted);font-weight:700;}
    .config-row span:last-child{color:var(--text-main);font-weight:800;text-align:right;}
    .config-note{color:var(--text-muted);font-size:10px;line-height:1.3;margin-top:7px;}
    :root[data-theme="light"] .config-row{border-bottom-color:rgba(19,32,51,.12);}

/* Observer location consolidated panel */
.observer-location-body{
  display:grid;
  gap:8px;
}
.observer-location-card{
  border:1px solid rgba(125,211,252,.22);
  background:linear-gradient(135deg, rgba(125,211,252,.12), rgba(126,231,135,.07));
  border-radius:12px;
  padding:10px 11px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04);
}
.observer-location-name{
  color:var(--text-main);
  font-size:15px;
  font-weight:950;
  line-height:1.2;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.observer-location-meta{
  display:flex;
  align-items:center;
  gap:6px;
  min-width:0;
  margin-top:5px;
  color:var(--text-muted);
  font-size:11px;
  font-weight:800;
  line-height:1.25;
  flex-wrap:wrap;
}
.observer-location-meta #observerGrid{
  color:#b7f5c2;
  letter-spacing:.05em;
}
.observer-location-meta .meta-sep{
  opacity:.65;
}
.observer-button-row{
  row-gap:6px;
}
.observer-config-details{
  margin-top:2px;
  padding-top:8px;
  border-top:1px solid rgba(255,255,255,.08);
}
.observer-config-details > summary{
  font-size:12px;
}
.observer-storage-note{
  margin-top:0;
}
:root[data-theme="light"] .observer-location-card{
  background:linear-gradient(135deg, rgba(25,118,210,.10), rgba(23,138,67,.06));
  border-color:rgba(25,118,210,.20);
}
:root[data-theme="light"] .observer-location-meta #observerGrid{
  color:#08722f;
}
:root[data-theme="light"] .observer-config-details{
  border-top-color:rgba(19,32,51,.12);
}


/* ISS Tracker UX update: default compact focus view, persistent panels, next-pass emphasis. */
.next-pass-row{
  border:1px solid rgba(100,245,141,.24);
  background:rgba(100,245,141,.08);
  border-radius:10px;
  padding:7px 9px;
  margin-top:6px;
}
.next-pass-row .label{color:#bfffd0;font-weight:850;}
.next-pass-row .value{color:#eaffef;}
.next-pass-row.needs-location{
  border-color:rgba(255,209,102,.28);
  background:rgba(255,209,102,.08);
}
.next-pass-row.needs-location .label{color:#ffe4a3;}
.next-pass-row.needs-location .value{color:#fff3d1;}
.next-pass-row.no-pass{
  border-color:rgba(255,107,107,.24);
  background:rgba(255,107,107,.08);
}
.next-pass-row.no-pass .label{color:#ffc7c7;}
.next-pass-row.no-pass .value{color:#ffe5e5;}
.next-pass-chip{
  border-color:rgba(100,245,141,.36);
  background:rgba(100,245,141,.12);
}
.next-pass-chip.needs-location{
  border-color:rgba(255,209,102,.32);
  background:rgba(255,209,102,.10);
}
.next-pass-chip.no-pass{
  border-color:rgba(255,107,107,.28);
  background:rgba(255,107,107,.10);
}
:root[data-theme="light"] .next-pass-row{
  background:rgba(23,138,67,.08);
  border-color:rgba(23,138,67,.18);
}
:root[data-theme="light"] .next-pass-row .label{color:#08722f;}
:root[data-theme="light"] .next-pass-row .value{color:#10223a;}
:root[data-theme="light"] .next-pass-row.needs-location{
  background:rgba(176,119,0,.09);
  border-color:rgba(176,119,0,.22);
}
:root[data-theme="light"] .next-pass-row.needs-location .label{color:#8a5a00;}
:root[data-theme="light"] .next-pass-row.no-pass{
  background:rgba(180,35,45,.08);
  border-color:rgba(180,35,45,.20);
}
:root[data-theme="light"] .next-pass-row.no-pass .label{color:#9a1c25;}
.map-legend-panel.legend-collapsed{
  width:auto !important;
  max-width:220px !important;
  padding:8px 10px !important;
}
.map-legend-panel.legend-collapsed .map-view-controls,
.map-legend-panel.legend-collapsed .map-legend-body{
  display:none !important;
}
.map-legend-panel.legend-collapsed .map-legend-title{
  margin-bottom:0 !important;
}
.map-legend-panel.legend-collapsed .legend-collapse-toggle{
  min-width:64px;
}
@media (max-width:900px){
  .top-left{
    max-height:38vh;
  }
  details.panel.top-left:not([open]){
    width:min(320px, calc(100vw - 20px));
    padding:8px 10px;
  }
  .summary-live-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:4px;
  }
  .summary-chip{
    padding:4px 5px;
    border-radius:8px;
  }
  .summary-chip .k{font-size:8px;margin-bottom:1px;}
  .summary-chip .v{font-size:10px;}
  .summary-chip-optional{display:none;}
  .next-pass-chip{
    order:-1;
    grid-column:1 / -1;
  }
  .next-pass-chip .v{font-size:11px;}
  .map-legend-panel.legend-collapsed{
    left:auto !important;
    right:10px !important;
    bottom:10px !important;
    width:auto !important;
    max-width:180px !important;
    max-height:none !important;
    overflow:hidden !important;
  }
}
@media (max-width:420px){
  details.panel.top-left:not([open]){
    width:min(270px, calc(100vw - 20px));
  }
  .summary-chip .v{font-size:9.5px;}
}


/* ISS Tracker UX update v2: one-tap useful panel, desktop/mobile layer collapse parity, mobile speed chip. */
.map-legend-panel.legend-collapsed .map-view-controls,
.map-legend-panel.legend-collapsed .map-legend-body,
.map-legend-panel.legend-collapsed .legend-toggle-grid,
.map-legend-panel.legend-collapsed .legend-path-controls{
  display:none !important;
  visibility:hidden !important;
}
.map-legend-panel.legend-collapsed{
  width:auto !important;
  min-width:0 !important;
  max-width:220px !important;
  padding:8px 10px !important;
}
.map-legend-panel.legend-collapsed .map-legend-title{
  margin-bottom:0 !important;
}
.map-legend-panel.legend-collapsed .legend-title-main{
  max-width:96px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
@media (max-width:900px){
  .summary-chip-speed{display:block;}
  .summary-chip-optional{display:none !important;}
  details.panel.top-left:not([open]){
    width:min(330px, calc(100vw - 20px));
  }
  .summary-live-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .next-pass-chip{
    order:-1;
    grid-column:1 / -1;
  }
}
@media (max-width:360px){
  details.panel.top-left:not([open]){
    width:min(300px, calc(100vw - 20px));
  }
  .summary-chip .k{font-size:7.5px;}
  .summary-chip .v{font-size:9px;}
}
