:root {
  --bg: #0a0e13;
  --panel: rgba(13, 18, 25, 0.78);
  --line: rgba(255, 255, 255, 0.09);
  --ink: #e9eff5;
  --dim: #8b9aa8;
  --green: #7ad86b;
  --blue: #5cb8ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#map {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 700px at 70% -10%, rgba(60, 120, 200, 0.14), transparent 60%),
    radial-gradient(900px 600px at 10% 110%, rgba(60, 200, 120, 0.10), transparent 60%),
    #0a0e13;
}
#map::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 48px 48px;
  z-index: 0;
}
#map .leaflet-pane { z-index: 1; }
#map.dimmed .leaflet-tile-pane { filter: saturate(0.85) brightness(0.86); }

/* ------------------------------------------------------------------ hud */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(8, 12, 17, 0.94), rgba(8, 12, 17, 0.55) 70%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; }

.logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  flex: 0 0 auto;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.35), transparent 55%),
    linear-gradient(160deg, #6fd35f, #2f8f3e 55%, #1d5c3a);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18), 0 6px 18px rgba(40, 140, 70, 0.35);
  position: relative;
  overflow: hidden;
}
.logo::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,0,0,0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.16) 1px, transparent 1px);
  background-size: 11px 11px;
}

.titles h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.2px;
  line-height: 1.15;
}
.titles h1 .dim { color: var(--dim); font-weight: 400; }
.titles .sub {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.35px;
  text-transform: lowercase;
}

/* ------------------------------------------------------------------ stats */
.stats {
  display: flex;
  align-items: stretch;
  gap: 6px;
  flex: 1 1 auto;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 2px 0;
}
.stats::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  padding: 5px 11px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  min-width: 64px;
}
.chip .k {
  font-size: 9px;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
}
.chip .v {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.chip.live .v { color: var(--green); }
.chip.live .v::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 6px;
  vertical-align: 1px;
  box-shadow: 0 0 8px var(--green);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ------------------------------------------------------------------ buttons */
.actions { display: flex; gap: 6px; flex: 0 0 auto; }
.actions button {
  font: inherit;
  font-size: 12px;
  font-weight: 550;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.actions button:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255,255,255,0.2); }
.actions button:active { transform: translateY(1px); }

/* ------------------------------------------------------------------ leaflet */
.leaflet-container { background: transparent; font: inherit; outline: none; }
.leaflet-control-attribution { display: none; }
.leaflet-control-zoom {
  border: 1px solid var(--line) !important;
  border-radius: 10px !important;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45) !important;
  margin-bottom: 64px !important;
  margin-right: 16px !important;
}
.leaflet-control-zoom a {
  background: var(--panel) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
  width: 34px !important;
  height: 34px !important;
  line-height: 32px !important;
  font-size: 17px !important;
  backdrop-filter: blur(10px);
}
.leaflet-control-zoom a:hover { background: rgba(255, 255, 255, 0.1) !important; }

/* ------------------------------------------------------------------ markers */
.player-marker {
  position: relative;
  width: 16px;
  height: 16px;
}
.player-marker .dot {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #ffd45e;
  border: 2px solid #2a1e05;
  box-shadow: 0 0 0 3px rgba(255, 212, 94, 0.22), 0 4px 12px rgba(0, 0, 0, 0.6);
}
.player-marker .ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(255, 212, 94, 0.55);
  animation: ping 2.6s ease-out infinite;
}
@keyframes ping {
  0% { transform: scale(0.6); opacity: 0.9; }
  80%, 100% { transform: scale(1.6); opacity: 0; }
}

.player-label {
  background: rgba(10, 14, 19, 0.88);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 3px 8px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}
.player-label .y { color: var(--dim); font-weight: 400; margin-left: 5px; }
.leaflet-tooltip.player-label::before { display: none; }

.spawn-marker {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.18), 0 4px 10px rgba(0, 0, 0, 0.5);
  transform: rotate(45deg);
}

/* ------------------------------------------------------------------ footer */
#foot {
  position: fixed;
  left: 16px;
  bottom: 14px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  font-size: 11px;
  color: var(--dim);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
#foot .sep { opacity: 0.4; }
#foot a { color: var(--dim); text-decoration: none; }
#foot a:hover { color: var(--ink); }
#foot #online-names { color: var(--green); }

#coords {
  position: fixed;
  right: 16px;
  bottom: 14px;
  z-index: 1000;
  padding: 7px 12px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

/* ------------------------------------------------------------------ toast */
#toast {
  position: fixed;
  left: 50%;
  bottom: 74px;
  transform: translate(-50%, 14px);
  z-index: 1200;
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(10, 14, 19, 0.92);
  border: 1px solid var(--line);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------------ mobile */
@media (max-width: 900px) {
  #hud {
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 8px 12px 10px;
  }
  .titles h1 { font-size: 14px; }
  .titles .sub { display: none; }
  .stats { order: 3; width: 100%; flex: 1 1 100%; }
  .actions { margin-left: auto; }
  .chip { padding: 4px 9px; min-width: 0; }
  .chip .v { font-size: 13px; }
  #coords { display: none; }
  #foot { left: 10px; right: 10px; bottom: 10px; justify-content: center; }
  .leaflet-control-zoom { margin-bottom: 58px !important; margin-right: 10px !important; }
}
