:root {
  color-scheme: dark;
  --bg: #080a0f;
  --panel: rgba(16, 18, 24, 0.92);
  --panel-strong: rgba(24, 27, 35, 0.96);
  --text: #f3f6fb;
  --muted: #98a1b2;
  --line: rgba(255, 255, 255, 0.12);
  --accent: #6ec8ff;
  --accent-2: #4fb3f2;
  --good: #9edcff;
  --accent-soft: rgba(84, 181, 242, 0.18);
  --accent-line: rgba(102, 198, 255, 0.72);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 12% 20%, rgba(84, 181, 242, 0.18), transparent 28%),
    radial-gradient(circle at 86% 24%, rgba(55, 151, 221, 0.14), transparent 24%),
    linear-gradient(145deg, #090b10 0%, #0e1118 52%, #090b10 100%);
  color: var(--text);
}

button,
input {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  min-height: 100vh;
  overflow: hidden;
}

.globe-stage {
  position: relative;
  min-height: 100vh;
  padding: 32px;
  background:
    radial-gradient(circle at 50% 46%, rgba(70, 164, 235, 0.09), transparent 35%),
    radial-gradient(circle at 34% 52%, rgba(126, 208, 255, 0.08), transparent 21%),
    radial-gradient(circle at 12% 18%, rgba(55, 151, 221, 0.12), transparent 28%),
    radial-gradient(circle at 88% 82%, rgba(14, 67, 116, 0.34), transparent 26%),
    radial-gradient(1px 1px at 8% 20%, rgba(180, 225, 255, 0.52), transparent),
    radial-gradient(1px 1px at 18% 74%, rgba(180, 225, 255, 0.34), transparent),
    radial-gradient(1px 1px at 29% 35%, rgba(180, 225, 255, 0.42), transparent),
    radial-gradient(1px 1px at 48% 18%, rgba(180, 225, 255, 0.3), transparent),
    radial-gradient(1px 1px at 72% 28%, rgba(180, 225, 255, 0.38), transparent),
    radial-gradient(1px 1px at 86% 62%, rgba(180, 225, 255, 0.28), transparent),
    linear-gradient(145deg, #03070d 0%, #07111c 46%, #03060b 100%);
  overflow: hidden;
}

.globe-stage::before {
  content: "";
  position: absolute;
  z-index: 3;
  inset: 0 0 auto;
  height: 280px;
  background: linear-gradient(180deg, rgba(8, 10, 15, 0.98), rgba(8, 10, 15, 0.74) 56%, transparent);
  pointer-events: none;
}

.globe-stage::after {
  content: "";
  position: absolute;
  z-index: 0;
  inset: auto -12% -18%;
  height: 42%;
  background: radial-gradient(ellipse at center, rgba(70, 164, 235, 0.12), transparent 68%);
  filter: blur(8px);
  pointer-events: none;
}

#globe {
  position: absolute;
  inset: 0;
  z-index: 1;
  cursor: grab;
  filter: saturate(1.02) contrast(1.08) brightness(0.94) drop-shadow(0 0 18px rgba(58, 158, 226, 0.16));
}

#globe:active {
  cursor: grabbing;
}

.globe-inner-rim {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  width: clamp(340px, min(70vw, 94vh), 760px);
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -48%);
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.72;
  background:
    radial-gradient(circle at 36% 26%, rgba(255, 255, 255, 0.08), transparent 18%),
    radial-gradient(circle, transparent 62%, rgba(67, 176, 242, 0.08) 68%, rgba(91, 199, 255, 0.34) 73%, rgba(23, 92, 151, 0.18) 78%, transparent 84%);
  box-shadow:
    inset 0 0 34px rgba(87, 190, 255, 0.22),
    inset -28px -24px 54px rgba(8, 31, 62, 0.42);
}

.topbar {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  pointer-events: none;
}

.kicker {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 820px;
  font-size: 44px;
  line-height: 1.04;
  font-weight: 800;
  text-shadow: 0 4px 22px rgba(0, 0, 0, 0.72);
}

h2 {
  font-size: 26px;
  line-height: 1.15;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  min-width: 220px;
}

.stats span,
.hint {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.stats span {
  padding: 10px 12px;
  border-radius: 6px;
  color: #dfe8f7;
  font-size: 13px;
  font-weight: 700;
}

.hint {
  position: absolute;
  z-index: 6;
  left: 32px;
  bottom: 28px;
  max-width: calc(100% - 64px);
  padding: 10px 13px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
}

.panel {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100vh;
  max-height: 100vh;
  padding: 28px;
  border-left: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  display: grid;
  gap: 4px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.filter-button,
#reset-view {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #dce5f3;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.filter-button {
  padding: 8px 10px;
  text-align: left;
}

.filter-button:hover,
#reset-view:hover,
.filter-button.active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px rgba(102, 198, 255, 0.12), inset 0 0 24px rgba(84, 181, 242, 0.08);
}

.filter-button:active,
#reset-view:active {
  transform: translateY(1px);
}

.search-wrap input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
}

.search-wrap input:focus {
  border-color: rgba(102, 198, 255, 0.78);
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

#reset-view {
  min-width: 98px;
  padding: 0 12px;
  color: var(--text);
}

.distributor-list {
  display: grid;
  gap: 10px;
  padding-right: 4px;
  overflow: auto;
}

.distributor-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.distributor-card.active {
  border-color: rgba(102, 198, 255, 0.9);
  background: linear-gradient(180deg, rgba(84, 181, 242, 0.15), rgba(24, 27, 35, 0.96) 38%);
  box-shadow: 0 0 0 1px rgba(102, 198, 255, 0.16), 0 18px 42px rgba(48, 145, 219, 0.16);
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.country {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.company {
  margin-top: 4px;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.25;
}

.continent {
  align-self: flex-start;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.details {
  display: grid;
  gap: 7px;
  color: #c8d1de;
  font-size: 13px;
  line-height: 1.35;
}

.details a {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.marker {
  position: relative;
  width: 82px;
  height: 82px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transform: translate(-50%, -50%);
  isolation: isolate;
  pointer-events: auto;
}

.marker-hit,
.marker-orbit,
.marker-core,
.marker-count {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.marker-hit {
  inset: 0;
  background: rgba(84, 181, 242, 0.001);
}

.marker-orbit {
  inset: 24px;
  border: 1px solid rgba(102, 198, 255, 0.32);
  background: radial-gradient(circle, transparent 46%, rgba(84, 181, 242, 0.08) 64%, transparent 72%);
  box-shadow: 0 0 9px rgba(84, 181, 242, 0.28);
}

.marker-core {
  inset: 35px;
  border: 1px solid rgba(202, 236, 255, 0.92);
  background: radial-gradient(circle at 36% 30%, #effaff 0%, var(--marker-color, var(--accent)) 40%, #1f7ec4 100%);
  box-shadow: 0 0 7px rgba(102, 198, 255, 0.58), 0 0 14px rgba(84, 181, 242, 0.42);
}

.marker-count {
  right: 16px;
  top: 16px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border: 1px solid rgba(102, 198, 255, 0.72);
  background: rgba(8, 13, 19, 0.82);
  color: #d7f0ff;
  font-size: 10px;
  font-weight: 800;
  line-height: 14px;
  text-align: center;
  box-shadow: 0 0 14px rgba(84, 181, 242, 0.24);
}

.marker.filtered-out {
  opacity: 0.2;
}

.marker.active {
  z-index: 4;
}

.marker.active .marker-orbit {
  inset: 18px;
  border-color: rgba(102, 198, 255, 0.96);
  background: radial-gradient(circle, transparent 42%, rgba(84, 181, 242, 0.24) 66%, transparent 72%);
  box-shadow: 0 0 16px rgba(84, 181, 242, 0.58), 0 0 30px rgba(47, 145, 219, 0.26);
}

.marker.active .marker-core {
  inset: 33px;
  background: radial-gradient(circle at 36% 30%, #ffffff 0%, #9edcff 42%, #2f91db 100%);
  box-shadow: 0 0 12px rgba(102, 198, 255, 0.76), 0 0 22px rgba(47, 145, 219, 0.48);
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(520px, 56vh) auto;
    overflow: auto;
  }

  .globe-stage {
    min-height: 520px;
  }

  .panel {
    min-height: auto;
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 620px) {
  .globe-stage {
    min-height: 500px;
    padding: 20px;
  }

  .topbar {
    display: grid;
  }

  h1 {
    font-size: 32px;
  }

  .stats {
    justify-content: flex-start;
  }

  .panel {
    padding: 20px;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .summary-row {
    align-items: stretch;
    flex-direction: column;
  }

  #reset-view {
    width: 100%;
  }
}
