:root {
  --bg: #0c111d;
  --surface: #111827;
  --line: #1f2a3c;
  --ink: #f1f4f9;
  --ink-2: #b7c0cf;
  --ink-3: #7f8aa0;
  --off: #ff6a3d;      /* status: offline */
  --back: #3ccf91;     /* status: back online */
  --adv: #e6ebf3;      /* advisory ring */
  --news: #b98cff;     /* news diamonds */
  --err: #ff6a6a;
  --side-w: 380px;
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
a { color: var(--ink-2); }
button { font: inherit; }

.top { display: flex; justify-content: space-between; gap: 32px; padding: 20px 24px 16px; border-bottom: 1px solid var(--line); }
.top h1 { font-family: Bahnschrift, "Arial Narrow", "Roboto Condensed", sans-serif; font-stretch: condensed; font-weight: 700;
  font-size: clamp(32px, 4vw, 52px); line-height: .98; letter-spacing: -.5px; margin: 0 0 12px; }
.top p { margin: 0; max-width: 560px; color: var(--ink-2); line-height: 1.55; font-size: 14.5px; }
.controls { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; padding-top: 6px; }
.btn { background: var(--ink); color: #0c111d; border: 0; border-radius: 6px; padding: 9px 16px; font-weight: 600; cursor: pointer; }
.btn:hover { background: #fff; }
.btn.ghost { background: rgba(17,24,39,.92); color: var(--ink); border: 1px solid #2c3950; }
.btn.ghost:hover, .btn.ghost.on { border-color: var(--ink-3); background: #1a2333; }

.feeds { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 12.5px; }
.feeds li { color: var(--ink-3); display: flex; align-items: center; gap: 7px; }
.feeds li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.feeds li.ok::before { background: var(--back); }
.feeds li.busy::before { background: #f2c94c; animation: blink 1s infinite; }
.feeds li.err { color: var(--err); }
.feeds li.err::before { background: var(--err); }
@keyframes blink { 50% { opacity: .25; } }

.layout { display: grid; grid-template-columns: 1fr var(--side-w); height: calc(100vh - 150px); min-height: 560px; }
.mapwrap { position: relative; overflow: hidden; border-right: 1px solid var(--line); }
#map { position: absolute; inset: 0; background: var(--bg); }
#heat { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 450; mix-blend-mode: screen; }
.leaflet-container { font: inherit; background: var(--bg); }
.leaflet-control-attribution { background: rgba(12,17,29,.7) !important; color: var(--ink-3) !important; }
.leaflet-control-attribution a { color: var(--ink-2) !important; }
.leaflet-control-zoom a { background: var(--surface) !important; color: var(--ink) !important; border-color: var(--line) !important; }

.panel { background: rgba(12,17,29,.82); backdrop-filter: blur(6px); border: 1px solid var(--line); border-radius: 8px; }
.legend { position: absolute; top: 14px; left: 56px; z-index: 600; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--ink-2); }
.legend label { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.legend input { accent-color: #3b82f6; margin: 0; }
.sym { width: 12px; height: 12px; display: inline-block; flex: none; }
.sym-off { border-radius: 50%; background: var(--off); box-shadow: 0 0 0 2px var(--bg); }
.sym-back { border-radius: 50%; border: 2px solid var(--back); }
.sym-adv { border-radius: 50%; border: 2px dashed var(--adv); }
.sym-news { width: 10px; height: 10px; margin: 1px; background: var(--news); transform: rotate(45deg); }
.sym-heat { border-radius: 50%; background: radial-gradient(circle, #fff3b0, #ff8a2b 45%, #6b1d8f 80%, transparent); }
.ramp-label { margin-top: 4px; font-size: 12px; color: var(--ink-3); }
.ramp { height: 6px; width: 170px; border-radius: 3px; }
.ramp-ends { display: flex; justify-content: space-between; width: 170px; font-size: 11px; color: var(--ink-3); margin-top: -4px; }

.regions { position: absolute; left: 12px; bottom: 26px; z-index: 600; display: flex; gap: 8px; flex-wrap: wrap; }

/* map markers */
.mk { position: relative; }
.mk .core { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); border-radius: 50%; }
.mk.off .core { background: var(--off); box-shadow: 0 0 0 2px var(--bg), 0 0 12px 2px rgba(255,106,61,.55); }
.mk.off .pulse { position: absolute; left: 50%; top: 50%; width: 100%; height: 100%; transform: translate(-50%,-50%); border-radius: 50%;
  border: 2px solid var(--off); animation: pulse 2.4s ease-out infinite; opacity: 0; }
@keyframes pulse { 0% { transform: translate(-50%,-50%) scale(.6); opacity: .9; } 100% { transform: translate(-50%,-50%) scale(2.6); opacity: 0; } }
.mk.back .core { border: 2.5px solid var(--back); background: rgba(12,17,29,.6); }
.mk.adv .core { border: 2px dashed var(--adv); animation: spin 8s linear infinite; }
@keyframes spin { to { transform: translate(-50%,-50%) rotate(360deg); } }
.mk .count { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); font-size: 10.5px; font-weight: 700; color: #1a0b05; pointer-events: none; }
.mk.news .core { border-radius: 2px; transform: translate(-50%,-50%) rotate(45deg); background: var(--news); box-shadow: 0 0 0 2px var(--bg), 0 0 14px rgba(185,140,255,.6); }
.mk.news .count { color: #1b0e33; }
.mk:hover .core, .mk.hl .core { outline: 2px solid #fff; outline-offset: 2px; }

/* tooltip */
.tip { position: fixed; z-index: 2000; max-width: 340px; pointer-events: none; background: #0f1626; border: 1px solid #2c3950; border-radius: 8px;
  padding: 10px 12px; font-size: 13px; color: var(--ink-2); box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.tip h4 { margin: 0 0 6px; font-size: 14px; color: var(--ink); }
.tip ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.tip li { display: flex; gap: 8px; align-items: baseline; }
.tip .more { color: var(--ink-3); font-size: 12px; margin-top: 6px; }
.tip .hint { color: var(--ink-3); font-size: 11.5px; margin-top: 8px; }

.badge { flex: none; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 4px; line-height: 1.6; }
.badge.off { background: rgba(255,106,61,.18); color: #ff8b66; }
.badge.back { background: rgba(60,207,145,.16); color: var(--back); }
.badge.advisory { background: rgba(230,235,243,.12); color: var(--adv); }
.badge.src { background: rgba(185,140,255,.15); color: #cdb0ff; }
.probe { font-size: 11px; color: var(--ink-3); }
.probe.up::before { content: "● "; color: var(--back); }
.probe.down::before { content: "● "; color: var(--err); }

/* side */
.side { display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.stat { padding: 14px 16px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat b { display: block; font-family: Bahnschrift, "Arial Narrow", sans-serif; font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12.5px; color: var(--ink-3); }
.stat-sum { margin: 0; padding: 8px 16px 10px; border-bottom: 1px solid var(--line); font-size: 12px; line-height: 1.5; color: var(--ink-3); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.tab { background: none; border: 0; color: var(--ink-3); padding: 12px; cursor: pointer; font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.filter { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.filter input { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; color: var(--ink); padding: 8px 10px; font: inherit; font-size: 13px; }
.list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.list li { padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.list li:hover, .list li.hl { background: #131c2c; }
.list .t { font-weight: 600; font-size: 14.5px; margin-bottom: 4px; color: var(--ink); }
.list .m { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; font-size: 12.5px; color: var(--ink-2); }
.list .news-t { font-weight: 500; font-size: 13.5px; line-height: 1.4; margin-bottom: 5px; }
.list .news-t a { color: var(--ink); text-decoration: none; }
.list .news-t a:hover { text-decoration: underline; }
.list .empty { color: var(--ink-3); cursor: default; font-size: 13px; }
.list .group { position: sticky; top: 0; background: var(--bg); color: var(--ink-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; padding: 8px 16px; cursor: default; z-index: 1; }

.foot { padding: 14px 24px 22px; border-top: 1px solid var(--line); }
.foot p { margin: 0; max-width: 900px; font-size: 12.5px; line-height: 1.6; color: var(--ink-3); }

@media (max-width: 900px) {
  .top { flex-direction: column; gap: 14px; }
  .controls { align-items: flex-start; }
  .feeds { align-items: flex-start; }
  .layout { grid-template-columns: 1fr; height: auto; }
  .mapwrap { height: 70vh; border-right: 0; }
  .side { height: 70vh; }
  .legend { left: 12px; top: auto; bottom: 74px; }
}
@media (prefers-reduced-motion: reduce) {
  .mk.off .pulse, .mk.adv .core { animation: none; }
}
