:root {
  --cold: rgb(44, 125, 160);
  --hot: rgb(244, 121, 31);
  --ink: #12151a;
  --panel: rgba(18, 21, 26, 0.86);
}

* {
  box-sizing: border-box;
}

/* the hidden attribute must win over class-level display rules below */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #fff;
  background: #0d1014;
}

body {
  display: flex;
  flex-direction: column;
}

.navbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 18px;
  background: var(--panel);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 1000;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: #fff;
}

.brand .dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cold), var(--hot));
  box-shadow: 0 0 12px rgba(244, 121, 31, 0.6);
  flex: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.2px;
}

.brand-text small {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-links a,
.link-btn {
  font: inherit;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.nav-links a:hover,
.link-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-links a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.total-chip {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
}

.total-chip strong {
  color: #fff;
  font-size: 15px;
}

.btn-discord {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: #5865f2;
  border: 0;
  padding: 9px 14px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-discord:hover {
  background: #4752c4;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 6px 4px 4px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.07);
}

.avatar {
  border-radius: 50%;
  display: block;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-btn {
  font: inherit;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
  border: 0;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
}

.logout-btn:hover {
  background: rgba(237, 66, 69, 0.25);
  color: #fff;
}

/* About modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(6, 8, 11, 0.72);
}

.modal {
  position: relative;
  max-width: 460px;
  background: #161a21;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 26px 26px 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.modal p {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.78);
}

.modal p strong {
  color: #fff;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 26px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.55);
  background: none;
  border: 0;
  cursor: pointer;
}

.modal-close:hover {
  color: #fff;
}

#map {
  flex: 1;
  width: 100%;
  background: #0d1014;
}

.legend {
  background: var(--panel);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.scale {
  display: flex;
  align-items: center;
  gap: 10px;
}

.scale-bar {
  width: 160px;
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--cold), var(--hot));
}

.scale-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.note {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

.note strong {
  color: #fff;
}

.updated {
  margin-left: 8px;
  color: rgba(255, 255, 255, 0.4);
}

/* count badge sitting on each zone */
.badge {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 19px;
  color: #fff;
  border: 3px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.badge.muted {
  font-size: 16px;
  letter-spacing: 1px;
}

.badge-label {
  margin-top: 3px;
  padding: 2px 8px;
  border-radius: 11px;
  background: rgba(18, 21, 26, 0.85);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translate(-50%, -50%);
}

.leaflet-popup-content-wrapper {
  border-radius: 12px;
}

.popup h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.popup .count {
  font-size: 13px;
  color: #444;
}

@media (max-width: 640px) {
  .navbar {
    gap: 12px;
    padding: 8px 12px;
  }
  .nav-links {
    display: none;
  }
  .brand-text small {
    display: none;
  }
  .total-chip {
    display: none;
  }
  .user-name {
    max-width: 90px;
  }
  .scale-bar {
    width: 110px;
  }
}
