* { box-sizing: border-box; }

:root {
  color-scheme: dark;
  font-family: 'Rubik', system-ui, sans-serif;
  background: #0b0d10;
  color: #f4f6f8;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: #0b0d10;
}

body { min-height: 100vh; }

.topbar {
  min-height: 84px;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid #242932;
  background: #11151a;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: .18em;
  color: #8c98a8;
  font-weight: 700;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(24px, 3vw, 38px); }
h2 { font-size: 20px; }

.statusbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill,
.timer {
  border: 1px solid #303743;
  border-radius: 999px;
  padding: 8px 12px;
  background: #171c22;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
}

.pill.online { border-color: #2d7b4d; color: #86e3aa; }
.pill.offline { border-color: #7d3434; color: #ff9c9c; }
.timer { font-variant-numeric: tabular-nums; font-size: 18px; }

.layout {
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(340px, .9fr);
  grid-template-areas:
    "map roster"
    "stats stats";
  gap: 18px;
}

.panel {
  border: 1px solid #242932;
  border-radius: 16px;
  background: #11151a;
  overflow: hidden;
  min-width: 0;
}

.mapPanel { grid-area: map; }
.rosterPanel { grid-area: roster; }
.statsPanel { grid-area: stats; }

.panelHeader {
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #242932;
}

.panelHeader p {
  margin-top: 4px;
  color: #8c98a8;
  font-size: 13px;
}

button {
  border: 1px solid #39414d;
  background: #1b2129;
  color: #f4f6f8;
  border-radius: 9px;
  padding: 9px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

button:hover { background: #242c36; }

#map {
  height: min(62vh, 660px);
  min-height: 420px;
  background: #0d1116;
}

.mapNotice {
  padding: 10px 14px;
  font-size: 12px;
  color: #99a5b5;
  border-top: 1px solid #242932;
}

.teams {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 14px 14px 0;
}

.teamColumn {
  border: 1px solid #252b34;
  border-radius: 12px;
  overflow: hidden;
  background: #0d1116;
}

.teamColumn h3 {
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  border-bottom: 1px solid #252b34;
}

.teamColumn.alpha h3 { color: #ff8e8e; }
.teamColumn.bravo h3 { color: #8ebcff; }
.teamColumn.unassigned { margin: 12px 14px 14px; }
.teamColumn.unassigned h3 { color: #bcc5d1; }

.playerList {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 9px;
  min-height: 70px;
}

.playerList.compact { min-height: 40px; }

.playerCard {
  padding: 10px;
  background: #171c22;
  border: 1px solid #292f38;
  border-radius: 9px;
}

.playerCard.inactive { opacity: .55; }

.playerTop {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.playerName { font-weight: 700; }
.playerClass { color: #8c98a8; font-size: 12px; }

.playerStats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.statBox {
  border-radius: 7px;
  background: #0f1318;
  padding: 6px;
  text-align: center;
}

.statBox span { display: block; color: #7f8997; font-size: 9px; text-transform: uppercase; }
.statBox strong { font-size: 12px; }

.gpsDot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: #3fd27f;
  margin-right: 5px;
}

.empty {
  color: #7f8997;
  text-align: center;
  padding: 20px !important;
}

.tableWrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; border-bottom: 1px solid #222831; text-align: left; font-size: 13px; }
th { color: #8c98a8; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
tbody tr:last-child td { border-bottom: 0; }

.player-marker {
  border-radius: 50%;
  width: 18px !important;
  height: 18px !important;
  margin-left: -9px !important;
  margin-top: -9px !important;
  border: 3px solid white;
  box-shadow: 0 0 0 2px rgba(0,0,0,.35), 0 2px 8px rgba(0,0,0,.45);
}
.player-marker.alpha { background: #e24a4a; }
.player-marker.bravo { background: #3979db; }
.player-marker.unassigned { background: #8b95a3; }

.leaflet-popup-content-wrapper,
.leaflet-popup-tip { background: #11151a; color: #f4f6f8; }
.leaflet-control-attribution { font-size: 9px; }

@media (max-width: 1000px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-areas: "map" "roster" "stats";
  }
  #map { height: 52vh; min-height: 360px; }
}

@media (max-width: 620px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .statusbar { justify-content: flex-start; }
  .layout { padding: 10px; gap: 10px; }
  .teams { grid-template-columns: 1fr; }
  #map { min-height: 320px; }
}
