:root {
  --bg: #1a1a1a;
  --panel: rgba(255,255,255,0.05);
  --panel-2: #2a2a2a;
  --border: rgba(255,255,255,0.1);
  --fg: #e0e0e0;
  --muted: #888;
  --accent: #00ff00;
  --yellow: #ffaa00;
  --red: #ff4444;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--fg); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }

.map-body { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* Status page .header provides bg/padding/border/title styles.
   We override the layout to flex so title + info sit reliably on one row
   regardless of the outer flex-column body. */
body.map-body .header {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  background-color: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 30px;
  margin: 20px;
}
body.map-body .header .data-rate-info { float: none; line-height: normal; }
body.map-body .header h1.dropdown-title {
  font-size: 2.2em !important;
  font-weight: 600 !important;
  margin: 3px 0 0 0 !important;
  line-height: 1.2 !important;
}

.map-debug { font-size: 11px; color: var(--yellow); font-family: monospace; }
#conn-status { font-size: 12px; color: var(--muted); }
#conn-status.ok  { color: var(--accent); }
#conn-status.bad { color: var(--red); }

.map-kpi-strip {
  min-height: 54px;
  background: var(--panel);
  border: 1px solid var(--border);
  margin: 0 20px;
  border-radius: 8px;
  display: flex; align-items: center; gap: 28px;
  padding: 10px 20px;
  flex-shrink: 0;
  overflow-x: auto;
}
.kpi { display: flex; flex-direction: column; min-width: 80px; }
.kpi-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-val { font-size: 16px; font-weight: 600; color: var(--fg); }
.kpi-sub { font-size: 11px; color: var(--muted); font-weight: 400; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.sq  { display: inline-block; width: 9px; height: 9px; border-radius: 1px; margin-right: 4px; vertical-align: middle; }

.intel-section { border-bottom: 1px solid var(--border); padding: 10px 0; }
.intel-section:last-child { border-bottom: none; }
.intel-header { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; }
.intel-sub { color: var(--muted); font-weight: 400; margin-left: 6px; }
.intel-close { margin-left: auto; color: var(--muted); text-decoration: none; font-size: 18px; line-height: 1; }

.fleet-list { display: flex; flex-direction: column; gap: 2px; }
.fleet-row {
  display: grid;
  grid-template-columns: 12px 12px 1fr auto auto auto;
  gap: 6px;
  align-items: center;
  padding: 4px 6px;
  font-size: 12px;
  border-radius: 3px;
  cursor: pointer;
}
.fleet-ind { width: 10px; height: 10px; border-width: 1.5px; border-style: solid; }
.fleet-row:hover { background: var(--panel-2); }
.fleet-row.selected { background: #1f3a1f; }
.fleet-name { font-weight: 500; }
.fleet-kw, .fleet-ths, .fleet-miners { color: var(--muted); font-family: monospace; font-size: 11px; }

.nongeo-list { font-size: 11px; color: var(--muted); }
.nongeo-row { display: flex; justify-content: space-between; padding: 2px 6px; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}
.detail-cell { background: var(--panel-2); padding: 8px; border-radius: 3px; }
.detail-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.detail-val { font-size: 14px; color: var(--fg); margin-top: 2px; }

.map-main { flex: 1; display: flex; min-height: 0; gap: 20px; padding: 20px; }
#map-canvas {
  flex: 1; background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden;
}
.map-intel {
  width: 340px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  overflow-y: auto;
}
.intel-empty { color: var(--muted); font-size: 13px; }

.map-ticker-row {
  min-height: 34px;
  background: var(--panel);
  border: 1px solid var(--border);
  margin: 0 20px;
  border-radius: 8px;
  padding: 0;
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
  display: flex;
  align-items: stretch;
}
.map-ticker-row:first-of-type { margin-top: 0; }
.map-ticker-row + .map-ticker-row { margin-top: 6px; }
.map-ticker-row:last-of-type { margin-bottom: 20px; }

.ticker-label {
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-family: monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}
.ticker-label-pod { color: #ff4444; }
.ticker-label-gen { color: #ffaa00; }

.ticker-body {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  padding: 6px 14px;
}
.ticker-marquee {
  display: flex;
  overflow: hidden;
  width: 100%;
}
.ticker-marquee:hover .ticker-track { animation-play-state: paused; }
.ticker-track {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding-right: 40px;
  animation: ticker-scroll 90s linear infinite;
}
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  flex-shrink: 0;
}
.ticker-item:hover { background: var(--panel-2); color: var(--fg); }
.ticker-text { color: var(--fg); }
.ticker-dur { color: var(--muted); font-family: monospace; font-size: 11px; margin-left: 2px; }
.ticker-sep { color: #444; }
.ticker-more { color: var(--muted); font-style: italic; flex-shrink: 0; }
.ticker-empty { color: var(--muted); }

/* Leaflet dark tweaks */
.leaflet-container { background: #0a0a0a; }
.leaflet-tile { filter: brightness(0.6) invert(1) contrast(0.9) hue-rotate(180deg) saturate(0.5); }

.site-polygon {
  fill-opacity: 0.35;
  stroke-width: 2;
  transition: fill-opacity 0.15s;
  cursor: pointer;
}
.site-polygon:hover { fill-opacity: 0.65; }

/* Callout labels */
.site-callout-wrap { background: transparent !important; border: none !important; }
.site-callout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: rgba(26, 26, 26, 0.92);
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  color: #e0e0e0;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 4px rgba(0,0,0,0.6);
  transition: background 0.15s;
}
.site-callout:hover { background: rgba(42, 42, 42, 0.98); }
.site-callout-name { letter-spacing: 0.3px; }
.site-callout-gen,
.site-callout-pod {
  display: inline-block;
  width: 9px; height: 9px;
  border: 1.5px solid #888;
  vertical-align: middle;
}
/* Circle = generators (matches status page convention) */
.site-callout-gen { border-radius: 50%; }
/* Square = pods */
.site-callout-pod { border-radius: 1px; }
