:root {
  --bg: #0b0f17;
  --panel: #121826;
  --panel-2: #0e141f;
  --line: #1f2a3c;
  --text: #d7e0ef;
  --muted: #7d8aa3;
  --accent: #4ea1ff;
  --p1: #ff4d5e;
  --p2: #ffb020;
  --p3: #6fd3a0;
  --above: #ff6b6b;
  --below: #4ea1ff;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
#app { display: grid; grid-template-columns: 380px 1fr; height: 100vh; }

#sidebar {
  background: var(--panel-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow-y: auto; padding: 14px;
  gap: 12px;
}
#brand .logo { font-weight: 700; letter-spacing: .5px; font-size: 16px; }
#brand .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
#brand .cycle { color: var(--accent); font-size: 11px; margin-top: 6px; font-variant-numeric: tabular-nums; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.panel h2 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.pill { background: var(--line); color: var(--text); border-radius: 999px; padding: 1px 8px; font-size: 11px; }
.muted { color: var(--muted); }

.alerts { display: flex; flex-direction: column; gap: 6px; max-height: 230px; overflow-y: auto; }
.alert { border-left: 3px solid var(--p3); background: var(--panel-2); border-radius: 6px; padding: 7px 9px; font-size: 12px; line-height: 1.35; }
.alert.p1 { border-color: var(--p1); }
.alert.p2 { border-color: var(--p2); }
.alert.p3 { border-color: var(--p3); }
.alert .who { font-weight: 600; }
.alert .meta { color: var(--muted); font-size: 11px; }
.alert .dir-above { color: var(--above); }
.alert .dir-below { color: var(--below); }

#spark { width: 100%; height: 90px; margin: 6px 0; }
.explain { font-size: 12px; line-height: 1.45; }
.pools { display: flex; flex-direction: column; gap: 4px; }
.pool { display: grid; grid-template-columns: 120px 1fr 56px; align-items: center; gap: 8px; font-size: 11px; }
.pool .bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.pool .bar > span { display: block; height: 100%; }
.pool .val { text-align: right; font-variant-numeric: tabular-nums; }

.signals { display: flex; flex-direction: column; gap: 4px; max-height: 150px; overflow-y: auto; font-size: 11px; }
.sig { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }
.sig b { color: var(--text); font-weight: 600; }

#ask-form { display: flex; gap: 6px; }
#ask { flex: 1; background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 9px 10px; font-size: 12px; }
#ask-form button { background: var(--accent); border: none; color: #04101f; font-weight: 700; border-radius: 8px; padding: 0 12px; cursor: pointer; }
.ask-out { font-size: 11px; color: var(--muted); white-space: pre-wrap; max-height: 120px; overflow-y: auto; }

#map { position: relative; }
.legend { position: absolute; right: 14px; bottom: 14px; background: rgba(14,20,31,.9); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.legend i { width: 16px; height: 10px; border-radius: 2px; display: inline-block; }
.legend .g0 { background: #2f9e6f; } .legend .g1 { background: #8bd17c; } .legend .g2 { background: #ffd166; } .legend .g3 { background: #f3833b; } .legend .g4 { background: #ff4d5e; }
.mapboxgl-popup-content { background: var(--panel); color: var(--text); border: 1px solid var(--line); font-size: 12px; }
.mapboxgl-popup-tip { border-top-color: var(--panel) !important; }
