* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: #0f131a;
  color: #eef3f8;
  scrollbar-width: thin;
  scrollbar-color: rgba(59, 116, 242, 0.48) rgba(255, 255, 255, 0.05);
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
#gangSidebar::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
#gangSidebar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
#gangSidebar::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(59, 116, 242, 0.78), rgba(38, 87, 199, 0.78));
  border-radius: 999px;
  border: 2px solid rgba(15, 19, 26, 0.55);
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover,
#gangSidebar::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(78, 131, 255, 0.88), rgba(47, 102, 223, 0.88));
}

button,
input,
textarea {
  font: inherit;
}

body {
  min-width: 0;
}

#gangApp {
  --gang-map-ocean:
    radial-gradient(circle at 18% 24%, rgba(63, 163, 181, 0.2), transparent 18%),
    radial-gradient(circle at 76% 18%, rgba(28, 110, 134, 0.16), transparent 24%),
    radial-gradient(circle at 30% 72%, rgba(20, 82, 103, 0.14), transparent 20%),
    linear-gradient(180deg, #0b3541 0%, #082a33 48%, #06222a 100%);
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  width: 100%;
  height: 100%;
}

#gangSidebar {
  background: #161c25;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 18px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(59, 116, 242, 0.48) rgba(255, 255, 255, 0.05);
}

#gangApp.observer-mode .editor-only-panel {
  display: none;
}

#gangApp.observer-mode .editor-only-actions {
  display: none;
}

.gm-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.gm-brand img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: contain;
}

.gm-brand h1 {
  margin: 0 0 4px;
  font-size: 25px;
}

.gm-brand p {
  margin: 0;
  color: #98acc2;
}

.gm-panel {
  background: #1d2531;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 14px;
}

.gm-panel.small ul {
  margin: 0;
  padding-left: 18px;
  line-height: 1.5;
  color: #d8e1ea;
}

.gm-panel h2 {
  margin: 0 0 10px;
  font-size: 15px;
}

.gm-nav-link {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #2b3647;
  color: #eef3f8;
  font-weight: 700;
  text-decoration: none;
}

.gm-nav-link:hover {
  filter: brightness(1.06);
}

.gm-panel-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.gm-grid {
  display: grid;
  gap: 8px;
}

.gm-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.gm-field span {
  font-size: 12px;
  color: #9fb2c7;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.gm-field input,
.gm-field textarea {
  width: 100%;
  background: #111822;
  color: #eef3f8;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}

.gm-field input:focus,
.gm-field textarea:focus {
  border-color: #66a3ff;
  box-shadow: 0 0 0 2px rgba(102, 163, 255, 0.2);
}

button {
  width: 100%;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  background: #2f6df4;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.08);
}

button.gm-secondary {
  background: #2b3647;
}

button.gm-danger {
  background: #b43c4d;
}

button:disabled,
input:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.tool-btn.is-active {
  outline: 2px solid #8fc0ff;
}

.gm-muted {
  margin: 0;
  color: #9fb2c7;
  line-height: 1.45;
  font-size: 13px;
}

.gm-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 10px;
  color: #9fb2c7;
  font-size: 13px;
}

.gm-stat-row strong {
  color: #eef3f8;
  text-align: right;
}

.gm-badge {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #253348;
  color: #cfe1f2;
  font-size: 12px;
  font-weight: 700;
}

.gm-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gang-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px;
  background: #243044;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
}

.gang-card.no-toggle {
  grid-template-columns: auto minmax(0, 1fr);
}

.gang-card.is-active {
  border-color: #66a3ff;
  background: #2a3a53;
}

.gang-card input[type="checkbox"] {
  margin: 0;
}

.gang-swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.gang-meta {
  min-width: 0;
  text-align: left;
}

.gang-name,
.gang-counts {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gang-name {
  font-size: 14px;
  font-weight: 700;
}

.gang-counts {
  color: #9fb2c7;
  font-size: 12px;
}

.gm-audit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.gm-audit-item {
  padding: 10px 12px;
  border-radius: 12px;
  background: #182231;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.gm-audit-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.gm-audit-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  color: #8ea4bc;
  font-size: 12px;
}

.gm-audit-details {
  margin: 0;
  color: #d5deea;
  font-size: 13px;
  line-height: 1.45;
}

#gangMain,
#gangMap {
  width: 100%;
  height: 100%;
  min-width: 0;
}

#gangMain {
  background: var(--gang-map-ocean);
}

.leaflet-container,
.leaflet-pane,
.leaflet-map-pane,
.leaflet-tile-pane,
.leaflet-overlay-pane,
.leaflet-shadow-pane,
.leaflet-marker-pane {
  background: transparent !important;
}

#gangMap,
.leaflet-container {
  background: var(--gang-map-ocean);
}

.leaflet-tile-pane {
  will-change: transform;
}

.leaflet-tile {
  opacity: 1;
  backface-visibility: hidden;
  transform: translateZ(0);
  transition: opacity 0.22s ease-out;
}

.leaflet-tile.is-unavailable {
  opacity: 0 !important;
  visibility: hidden !important;
  background: transparent !important;
}

.leaflet-fade-anim .leaflet-tile,
.leaflet-zoom-anim .leaflet-tile {
  transition: opacity 0.22s ease-out, transform 0.22s ease-out;
}

.gang-marker {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.96);
  box-shadow: 0 0 0 3px rgba(10, 16, 24, 0.22), 0 6px 16px rgba(0, 0, 0, 0.36);
}

.gang-marker.is-selected {
  transform: scale(1.18);
  box-shadow: 0 0 0 5px rgba(102, 163, 255, 0.3), 0 6px 16px rgba(0, 0, 0, 0.36);
}

.gang-vertex {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #f7fbff;
  border: 2px solid #2f6df4;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
}

.leaflet-tooltip.gang-tooltip {
  background: rgba(16, 22, 30, 0.94);
  color: #eef3f8;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.leaflet-tooltip.gang-tooltip::before {
  border-top-color: rgba(16, 22, 30, 0.94);
}
