:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #0d1117;
  color: #e8edf4;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 18% 12%, rgba(56, 189, 248, 0.16), transparent 25rem),
    radial-gradient(circle at 80% 20%, rgba(52, 211, 153, 0.1), transparent 22rem),
    linear-gradient(135deg, #0c1117 0%, #151a21 48%, #0f1419 100%);
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}

.map-panel,
.sidebar {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(13, 17, 23, 0.78);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.map-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
  letter-spacing: 0;
}

.topbar p {
  margin-top: 6px;
  color: #aab4c2;
  font-size: 14px;
}

.status-pill,
.sidebar-head span {
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 7px 11px;
  color: #cdd7e4;
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
}

.status-pill.ok {
  border-color: rgba(55, 211, 142, 0.36);
  color: #8ff0bd;
  background: rgba(55, 211, 142, 0.08);
}

.status-pill.error {
  border-color: rgba(255, 202, 58, 0.4);
  color: #ffe08a;
  background: rgba(255, 202, 58, 0.08);
}

.map-wrap {
  display: grid;
  min-height: 0;
  padding: 14px;
  place-items: center;
}

.world-map {
  position: relative;
  touch-action: none;
  width: 100%;
  max-width: 1500px;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: #101820;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.28);
  cursor: grab;
  user-select: none;
}

.world-map.dragging {
  cursor: grabbing;
}

.map-stage {
  position: absolute;
  inset: 0;
  transform: translate3d(var(--pan-x, 0), var(--pan-y, 0), 0) scale(var(--zoom, 1));
  transform-origin: 0 0;
  will-change: transform;
}

.map-stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.map-controls {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 3;
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.map-controls button {
  min-width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  color: #e8edf4;
  background: rgba(12, 17, 23, 0.82);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.26);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.map-controls button:hover {
  background: rgba(28, 38, 49, 0.92);
}

.marker {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.marker-dot {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  box-shadow:
    0 0 0 7px color-mix(in srgb, var(--pin-color) 18%, transparent),
    0 10px 24px rgba(0, 0, 0, 0.45);
  color: #071016;
  font-size: 11px;
  font-weight: 800;
  background: var(--pin-color);
}

.marker::after {
  position: absolute;
  inset: -9px;
  border: 2px solid var(--pin-color);
  border-radius: 999px;
  content: "";
  opacity: 0.65;
  animation: pinPulse 2.2s ease-out infinite;
}

.marker:hover .marker-tooltip {
  opacity: 1;
  transform: translate(-50%, -112%);
}

.marker-tooltip {
  position: absolute;
  left: 50%;
  bottom: 100%;
  min-width: 170px;
  max-width: 220px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(17, 24, 32, 0.96);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.35);
  color: #e8edf4;
  font-size: 13px;
  line-height: 1.35;
  opacity: 0;
  transform: translate(-50%, -96%);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  pointer-events: none;
}

.marker-tooltip strong {
  display: block;
  margin-bottom: 4px;
  color: #ffffff;
}

.sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.app-list {
  overflow: auto;
  padding: 10px;
}

.app-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.swatch {
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.app-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.app-meta {
  margin-top: 4px;
  color: #aab4c2;
  font-size: 13px;
  line-height: 1.35;
}

.empty {
  padding: 16px 10px;
  color: #aab4c2;
  font-size: 14px;
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .world-map {
    min-width: 680px;
  }

  .map-wrap {
    overflow: auto;
  }
}

@keyframes pinPulse {
  to {
    inset: -22px;
    opacity: 0;
  }
}
