:root {
  --fg: #12ff80;
  --fg-amber: #ffb000;
  --fg-red: #ff5050;
  --bg: #000;
  --bg-panel: rgba(0, 30, 15, 0.35);
  --border: rgba(18, 255, 128, 0.35);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Courier New', Consolas, monospace;
  font-size: 14px;
  min-height: 100vh;
  text-shadow: 0 0 3px currentColor;
}
body {
  padding: 16px;
  background:
    radial-gradient(circle at center, rgba(0,40,20,0.2), #000 80%),
    repeating-linear-gradient(0deg, rgba(0,0,0,0) 0px, rgba(0,0,0,0) 2px, rgba(0,0,0,0.4) 3px);
}
header.tt {
  border-bottom: 2px solid var(--fg);
  padding-bottom: 8px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
header.tt h1 {
  font-size: 18px;
  letter-spacing: 2px;
}
header.tt .status {
  font-size: 12px;
  opacity: 0.7;
}
header.tt .status a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  padding: 12px;
}
.panel h2 {
  font-size: 14px;
  letter-spacing: 2px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  margin-bottom: 8px;
}
.row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  border-bottom: 1px dotted rgba(18,255,128,0.1);
}
.row:last-child { border-bottom: none; }
.row .k { opacity: 0.7; }
.row .v { font-weight: bold; }
.connected-yes { color: var(--fg); }
.connected-no { color: var(--fg-red); text-shadow: 0 0 3px var(--fg-red); }
.connected-sim { color: var(--fg-amber); text-shadow: 0 0 3px var(--fg-amber); }
button.act, input.act {
  display: block;
  width: 100%;
  margin: 6px 0;
  padding: 10px;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 1px;
  cursor: pointer;
  text-shadow: 0 0 3px currentColor;
}
button.act:hover {
  background: rgba(18, 255, 128, 0.15);
  box-shadow: 0 0 8px var(--fg);
}
button.act:active { background: rgba(18, 255, 128, 0.3); }
button.act:disabled { opacity: 0.4; cursor: wait; }
input.field {
  width: 100%;
  padding: 10px;
  margin: 6px 0;
  background: #000;
  color: var(--fg);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 13px;
  text-shadow: 0 0 3px currentColor;
  letter-spacing: 1px;
}
input.field:focus { outline: none; box-shadow: 0 0 8px var(--fg); }
footer.tt {
  margin-top: 16px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  opacity: 0.6;
  text-align: center;
}

/* Login page */
.login-wrap {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-box {
  width: 100%;
  max-width: 420px;
}
.login-box h2 { margin-bottom: 16px; }
.login-error {
  color: var(--fg-red);
  text-shadow: 0 0 3px var(--fg-red);
  margin-bottom: 8px;
  font-size: 12px;
  letter-spacing: 1px;
}

/* Dashboard layout */
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 12px;
  align-items: start;
}
@media (max-width: 800px) { .layout { grid-template-columns: 1fr; } }

.dweller-list { max-height: 70vh; overflow-y: auto; }
.dweller {
  padding: 6px 4px;
  border-bottom: 1px dotted rgba(18,255,128,0.15);
  cursor: pointer;
}
.dweller:hover { background: rgba(18,255,128,0.05); }
.dweller.active { background: rgba(18,255,128,0.12); box-shadow: inset 0 0 6px var(--fg); }
.dweller .name { font-weight: bold; letter-spacing: 1px; }
.dweller .meta { font-size: 11px; opacity: 0.7; margin-top: 2px; }
.dweller .dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px; box-shadow: 0 0 4px currentColor;
}
.dweller .dot.online { background: var(--fg); color: var(--fg); }
.dweller .dot.offline { background: var(--fg-red); color: var(--fg-red); }

#map {
  width: 100%;
  height: 60vh;
  min-height: 360px;
  background: #000;
  border: 1px solid var(--border);
}

/* Override Leaflet defaults to match CRT */
.leaflet-container {
  background: #000 !important;
  font-family: 'Courier New', Consolas, monospace;
}
.leaflet-tile { filter: hue-rotate(80deg) saturate(0.6) brightness(0.7) contrast(1.1); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: rgba(0, 30, 15, 0.92) !important;
  color: var(--fg) !important;
  border: 1px solid var(--border) !important;
  border-radius: 0 !important;
  text-shadow: 0 0 3px currentColor;
  box-shadow: 0 0 12px rgba(18,255,128,0.2) !important;
}
.leaflet-popup-content { margin: 8px 12px; font-size: 12px; }
.leaflet-popup-content b { letter-spacing: 1px; }
.leaflet-control-attribution {
  background: rgba(0,0,0,0.7) !important;
  color: rgba(18,255,128,0.6) !important;
}
.leaflet-control-attribution a { color: rgba(18,255,128,0.8) !important; }
.leaflet-control-zoom a {
  background: rgba(0,30,15,0.9) !important;
  color: var(--fg) !important;
  border-color: var(--border) !important;
  text-shadow: 0 0 3px currentColor;
}

/* Pulsing marker for online dwellers */
.dweller-marker {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--fg);
  box-shadow: 0 0 12px var(--fg);
  animation: pulse 2s infinite;
}
.dweller-marker.offline {
  background: var(--fg-red);
  box-shadow: 0 0 8px var(--fg-red);
  animation: none;
  opacity: 0.7;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 8px var(--fg); }
  50% { box-shadow: 0 0 16px var(--fg), 0 0 24px var(--fg); }
}

#detail .row .k { width: 45%; }
.muted { opacity: 0.6; font-style: italic; }
