:root {
  --sidebar-width: 280px;
  --bg-main: #111;
  --bg-side: #1a1a1a;
  --card:    #222;
  --card-hov:#333;
  --text:    #eee;
  --accent:  #88f;
}
.chat-form button { border: none; background: var(--accent); color: #111; padding: 8px 12px; cursor: pointer; }

/* Chat overlay styling */
 .chat-overlay {
  position: absolute;
  top: 10px;
  left: calc(var(--sidebar-width) + 10px);
  width: 300px;
  height: 400px;
  background: rgba(20,20,20,0.95);
  border: 1px solid #444;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  z-index: 1000;
}
.chat-overlay.hidden {
  display: none;
}
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  background: #333;
  color: #eee;
  font-weight: bold;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  color: #eee;
  font-size: 0.85rem;
}
.chat-form {
  display: flex;
  border-top: 1px solid #444;
}
.chat-form input {
  flex: 1;
  border: none;
  padding: 8px;
  background: #222;
  color: #eee;
}
.chat-form input:focus {
  outline: none;
}
.chat-form button {
  border: none;
  background: var(--accent);
  color: #111;
  padding: 8px 12px;
  cursor: pointer;
}
.chat-message {
  margin-bottom: 6px;
}
.chat-message:nth-child(odd) {
  background: rgba(255,255,255,0.05);
  padding: 4px 6px;
  border-radius: 3px;
}
.chat-message:nth-child(even) {
  background: rgba(255,255,255,0.02);
  padding: 4px 6px;
  border-radius: 3px;
}

html {
  margin: 0;
  height: 100%;
  width: 100%;
}

body {
  margin: 0;
  height: 100%;
  display: flex;
  overflow: hidden;
  font-family: "Segoe UI", sans-serif;
  background: var(--bg-main);
  color: var(--text);
}

/* ---------- sort buttons --------------------------------------- */
.sort-buttons {
  display: flex;
  gap: 4px;
  margin: 12px 16px 8px;
}
.sort-buttons .btn {
  flex: 1;
  padding: 6px 8px;
  background: #222;
  color: #eee;
  border: 1px solid #555;
  border-radius: 4px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
}
.sort-buttons .btn.active {
  background: var(--accent);
  color: #111;
  border-color: var(--accent);
}

/* ---------- sidebar --------------------------------------------- */
#sidebar {
  width: var(--sidebar-width);
  scrollbar-width: none;
  background: var(--bg-side);
  border-right: 2px solid #333;
  box-sizing: border-box;
  padding: 18px 16px;
  overflow-y: auto;
}
#sidebar h2 {
  margin: 8px 0 12px;
  font-size: 1.25rem;
  color: var(--accent);
}
#playerList {
  list-style: none;
  margin: 0;
  padding: 0;
}
#playerList li {
  margin: 4px 0;
  padding: 6px 8px;
  background: var(--card);
  border-left: 4px solid #555;
  cursor: pointer;
}
#playerList li:hover {
  background: var(--card-hov);
}
#playerList li.selected {
  background: #454545;
}

/* ---------- map container --------------------------------------- */
#mapContainer {
  flex: 1;
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: #000;
  cursor: grab;
}
#mapContainer.dragging {
  cursor: grabbing;
}
#mapGroup {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
}
#map {
  display: block;
  user-select: none;
  pointer-events: none;
}

/* ---------- dots ------------------------------------------------ */
#dots {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}
.dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1px solid #000;
  transform: translate(-50%, -50%);

  /* enable events on each dot */
  pointer-events: auto;
  cursor: pointer;
}
.dot.highlight {
  width: 10px;
  height: 10px;
  animation: blink 0.6s step-end infinite;
}
@keyframes blink {
  50% { opacity: 0; }
}

/* ---------- tooltip --------------------------------------------- */
.tooltip {
  position: absolute;
  display: none;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  pointer-events: none;
  white-space: nowrap;
  z-index: 1000;
}
/* make each row a flex container */
/* 2-column flex layout for each player row */
/* make each row a flex container */
/* make each row a vertical stack */
/* make each player row into a 3×2 grid */
#playerList li {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  grid-template-areas:
    "name  loc"
    "kills kph"
    "rares meta";
  gap: 4px 8px;
  margin: 6px 0;
  padding: 8px 10px;
  background: var(--card);
  border-left: 4px solid transparent;
  transition: background 0.15s;
  font-size: 0.85rem;
}

/* assign each span into its grid cell */
.player-name { grid-area: name; font-weight: 600; color: var(--text); }
.player-loc  { grid-area: loc;  font-size: 0.75rem; color: #aaa; }

.stat.kills { grid-area: kills; }
.stat.kph   { grid-area: kph; }
.stat.rares { grid-area: rares; }
.stat.meta  { grid-area: meta; }

/* pill styling */
#playerList li .stat {
  background: rgba(255,255,255,0.1);
  padding: 4px 8px;
  border-radius: 12px;
  display: inline-block;
  font-size: 0.75rem;
  white-space: nowrap;
  color: var(--text);
}

/* icons & suffixes */
.stat.kills::before   { content: "⚔️ ";                     }
.stat.kph::after      { content: " KPH"; font-size:0.7em; color:#aaa; }
.stat.rares::after    { content: " Rares"; font-size:0.7em; color:#aaa; }
.stat.meta {
  background: var(--accent);
  color: #111;
}

/* hover & selected states */
#playerList li:hover    { background: var(--card-hov); }
#playerList li.selected { background: #454545; }
/* trails paths */
#trails {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}
.trail-path {
  fill: none;
  stroke-width: 2px;
  stroke-opacity: 0.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Chat overlay styling */
.chat-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 300px;
  height: 400px;
  background: rgba(20,20,20,0.95);
  border: 1px solid #444;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  z-index: 1000;
}
.chat-overlay.hidden {
  display: none;
}
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  background: #333;
  color: #eee;
  font-weight: bold;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  color: #eee;
  font-size: 0.85rem;
}
.chat-form {
  display: flex;
  border-top: 1px solid #444;
}
.chat-form input {
  flex: 1;
  border: none;
  padding: 8px;
  background: #222;
  color: #eee;
}
.chat-form input:focus {
  outline: none;
}
.chat-form button {
  border: none;
  background: var(--accent);
  color: #111;
  padding: 8px 12px;
  cursor: pointer;
}
.chat-message {
  margin-bottom: 6px;
}
.chat-message:nth-child(odd) {
  background: rgba(255,255,255,0.05);
  padding: 4px 6px;
  border-radius: 3px;
}
.chat-message:nth-child(even) {
  background: rgba(255,255,255,0.02);
  padding: 4px 6px;
  border-radius: 3px;
}
