html, body { height: 100%; margin: 0; padding: 0; background: #0b1a2b; }
#map { height: 100%; width: 100%; background: #0b1a2b; }
body.city-dark #map { background: #cfe3ee; }
body.night #map { background: #050a12; }

/* ---- One skin for every overlay (Leaflet controls + ours): same surface, radius, shadow, no borders */
:root { --iw-radius: 6px; --iw-shadow: 0 1px 6px rgba(0,0,0,.3); --iw-surface: rgba(255,255,255,.96); --iw-line: #e3e7ec; --iw-ink: #1c232b; --iw-muted: #6b7684; --iw-accent: #3b6cff; }
.leaflet-bar, .iw-toolbar, .iw-links, .iw-basemaps, .iw-panel, .iw-search, .iw-time {
  border: 0 !important; border-radius: var(--iw-radius) !important; box-shadow: var(--iw-shadow) !important; background: var(--iw-surface);
}
.leaflet-touch .leaflet-bar a { border-bottom: 1px solid var(--iw-line); width: 34px; height: 34px; line-height: 34px; background: transparent; }
.leaflet-touch .leaflet-bar a:last-child { border-bottom: 0; }
.leaflet-touch .leaflet-bar a:first-child { border-top-left-radius: var(--iw-radius); border-top-right-radius: var(--iw-radius); }
.leaflet-touch .leaflet-bar a:last-child { border-bottom-left-radius: var(--iw-radius); border-bottom-right-radius: var(--iw-radius); }
.leaflet-container .leaflet-control-attribution { background: rgba(255,255,255,.75); border-radius: var(--iw-radius) 0 0 0; font-size: 10px; }
.leaflet-container { font-family: Roboto, Arial, sans-serif; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--iw-accent); outline-offset: 1px; }

/* Toolbar (bottom-left, above zoom): layer toggles + GPS */
.iw-toolbar { display: flex; flex-direction: column; padding: 4px; gap: 4px; user-select: none; }
.iw-toolbar button { border: 0; background: transparent; border-radius: 4px; width: 34px; height: 34px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: rgba(0,0,0,.6); font-size: 18px; }
.iw-toolbar button:hover { background: #f4f4f4; }
.iw-toolbar button.selected { background: #e6e6e6; }
.iw-toolbar button img { width: 22px; height: 22px; display: block; }

/* Top-right: links + basemap chooser */
.iw-links { padding: 8px 11px; font: 14px/1.3 Roboto, Arial, sans-serif; user-select: none; }
.iw-links a { text-decoration: none; color: #1a56db; }
.iw-links .meta { display: block; font-size: 11px; color: var(--iw-muted); margin-top: 3px; }
.iw-basemaps { display: flex; padding: 3px; gap: 2px; user-select: none; }
.iw-basemaps button { border: 0; background: transparent; border-radius: 4px; padding: 5px 9px; font: 12px Roboto, Arial, sans-serif; color: var(--iw-ink); cursor: pointer; }
.iw-basemaps button:hover { background: #f4f4f4; }
.iw-basemaps button.selected { background: var(--iw-accent); color: #fff; }

/* Search (top centre) */
.iw-search { position: absolute; z-index: 1000; left: 50%; top: 10px; transform: translateX(-50%); width: min(340px, calc(100% - 340px)); padding: 0; }
.iw-search input { width: 100%; box-sizing: border-box; border: 0; background: transparent; padding: 9px 12px; font: 14px Roboto, Arial, sans-serif; color: var(--iw-ink); border-radius: var(--iw-radius); }
.iw-search input.nomatch { box-shadow: inset 0 0 0 2px #d3382d; }
.iw-search input::placeholder { color: #98a2ae; }

/* Time control (bottom centre) */
.iw-time { position: absolute; z-index: 1000; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 6px 10px; font: 12px Roboto, Arial, sans-serif; color: var(--iw-ink); width: min(520px, calc(100% - 140px)); box-sizing: border-box; }
.iw-time button { border: 0; background: #eef1f4; border-radius: 4px; padding: 4px 8px; font: 12px Roboto, Arial, sans-serif; cursor: pointer; color: var(--iw-ink); min-width: 32px; }
.iw-time button:hover { background: #e2e7ee; }
.iw-time input[type=range] { flex: 1; accent-color: var(--iw-accent); min-width: 80px; }
.iw-time .badge { padding: 2px 7px; border-radius: 999px; background: #eef1f4; color: var(--iw-muted); font-weight: 600; white-space: nowrap; }
.iw-time .badge.sim { background: #fbe7cf; color: #8a4b0f; }
.iw-time .label { color: var(--iw-muted); white-space: nowrap; }
body.simtime #map { box-shadow: inset 0 0 0 3px rgba(224,145,58,.6); }

/* Selected-location marker: numbered badge */
.iw-loc { width: 26px; height: 26px; border-radius: 50%; background: #d3382d; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.5); color: #fff; font: bold 13px/22px Arial, sans-serif; text-align: center; }

/* Satellite marker label (orbital plane number).
   NOTE: never set `position` on .iw-sat — Leaflet positions marker icons with position:absolute +
   translate3d; overriding it stacks the icons in normal flow (N×16 px offsets that drift on zoom). */
.iw-sat img { width: 32px; height: 32px; display: block; }
.iw-sat span { position: absolute; left: 18px; top: 15px; transform: translate(-50%, -50%); color: #ccf; font: 9px/1 Arial, sans-serif; pointer-events: none; }
.iw-sat.nonop img { width: 30px; height: 30px; }


/* City labels — deliberately subdued */
.iw-city { color: rgba(255,255,255,.72); font: 10.5px/1 Arial, sans-serif; letter-spacing: .01em; text-shadow: 0 0 3px rgba(0,0,0,.6), 0 0 1px rgba(0,0,0,.6); white-space: nowrap; pointer-events: none; }
.iw-city::before { content: ""; display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: rgba(255,255,255,.7); margin-right: 4px; vertical-align: middle; }
.iw-city.cap { font-size: 11px; }
body.city-dark .iw-city { color: rgba(70,80,92,.8); text-shadow: 0 0 3px rgba(255,255,255,.9), 0 0 1px rgba(255,255,255,.9); }
body.city-dark .iw-city::before { background: rgba(70,80,92,.7); }

/* Panels: satellite (left) and my location (right) */
.iw-panel { position: absolute; z-index: 1000; top: 10px; width: 280px; font: 13px/1.4 Roboto, Arial, sans-serif; color: var(--iw-ink); display: flex; flex-direction: column; overflow: hidden; }
.iw-panel-sat { left: 10px; bottom: 250px; max-height: 620px; }
.iw-panel-loc { right: 10px; top: 112px; bottom: 60px; width: 300px; }
.iw-panel[hidden] { display: none; }
.iw-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 12px; border-bottom: 1px solid var(--iw-line); flex: none; }
.iw-panel-head b { font-size: 15px; }
.iw-panel-head button { border: 0; background: transparent; font-size: 20px; line-height: 1; width: 28px; height: 28px; cursor: pointer; color: #666; border-radius: 4px; }
.iw-panel-head button:hover { background: #eef1f4; color: #000; }
.iw-panel-body { overflow: auto; padding: 8px 12px 10px; }
.iw-panel h4 { margin: 10px 0 4px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--iw-muted); font-weight: 600; }
.iw-panel table { border-collapse: collapse; width: 100%; }
.iw-panel td { padding: 2px 6px 2px 0; vertical-align: top; }
.iw-panel td:first-child { color: var(--iw-muted); white-space: nowrap; width: 46%; }
.iw-panel td:last-child { font-variant-numeric: tabular-nums; }
.iw-panel .status-op { color: #1f7a45; font-weight: 600; }
.iw-panel .status-spare { color: #8a6d1f; font-weight: 600; }
.iw-panel .status-nonop { color: #a33; font-weight: 600; }
.iw-panel .muted { color: var(--iw-muted); font-size: 12px; }
.iw-panel .warn { color: #8a4b0f; }
.loc-coords { font-size: 12px; color: var(--iw-muted); font-variant-numeric: tabular-nums; }
.loc-big { font-size: 26px; font-weight: 700; line-height: 1.1; margin: 4px 0 6px; }
.loc-big span { font-size: 14px; font-weight: 400; color: var(--iw-muted); }
.loc-line { margin: 2px 0; }
.iw-slider { display: block; margin-top: 10px; font-size: 12px; color: var(--iw-muted); }
.iw-slider > span:first-child { color: var(--iw-ink); font-weight: 600; }
.iw-slider input { display: block; width: 100%; margin: 4px 0 2px; accent-color: var(--iw-accent); }
.iw-slider .hint { display: block; font-size: 11px; color: #98a2ae; }
.iw-timeline { display: block; width: 100%; height: 96px; }
.iw-sky { display: block; width: 100%; aspect-ratio: 1 / 1; max-height: 276px; }

/* Hover tooltip: name only */
.iw-tip { background: rgba(20,28,38,.9); color: #fff; border: 0; border-radius: 4px; padding: 3px 7px; font: 12px Roboto, Arial, sans-serif; box-shadow: none; }
.iw-tip::before { border-top-color: rgba(20,28,38,.9); }

/* Phones: panels become bottom sheets (one at a time), search full width, time control compact */
@media (max-width: 640px) {
  .iw-search { width: calc(100% - 20px); }
  .iw-panel-sat, .iw-panel-loc { left: 0; right: 0; top: auto; bottom: 0; width: auto; max-height: 50%; border-radius: 10px 10px 0 0 !important; }
  .iw-time { left: 10px; right: 10px; bottom: auto; top: 54px; transform: none; width: auto; }
  .iw-time .label { display: none; }
  .iw-links { font-size: 13px; }
  .iw-links .meta { display: none; }
}
