:root {
  --atlas-panel: rgba(8, 12, 25, 0.76);
  --atlas-panel-strong: rgba(8, 12, 25, 0.92);
  --atlas-line: rgba(168, 184, 255, 0.22);
  --atlas-line-strong: rgba(168, 184, 255, 0.4);
  --port: #40d889;
  --waterway: #ffbd45;
  --air: #38d6ff;
  --rail: #b58cff;
  --risk: #ff5733;
}

html,
body {
  width: 100%;
  height: 100%;
  max-width: 100%;
  overflow: hidden;
}

body {
  min-height: 100%;
}

.atlas-app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  width: 100%;
  height: 100%;
  padding: clamp(12px, 2vw, 22px);
  color: var(--text);
}

.atlas-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(12px, 2vw, 24px);
  min-height: 74px;
  padding: 10px 12px;
  border: 1px solid var(--atlas-line);
  border-radius: 18px;
  background: rgba(10, 14, 28, 0.62);
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

.atlas-back {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--atlas-line);
  border-radius: 50%;
  background: rgba(7, 10, 22, 0.78);
  color: var(--text);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
}

.atlas-title {
  min-width: 0;
}

.atlas-title .eyebrow {
  margin-bottom: 5px;
  font-size: 11px;
  letter-spacing: 0;
}

.atlas-title h1 {
  margin: 0;
  font-size: 4.25rem;
  line-height: 0.82;
  letter-spacing: 0;
}

.layer-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.layer-tabs::-webkit-scrollbar {
  display: none;
}

.layer-tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--atlas-line);
  border-radius: 999px;
  background: rgba(7, 10, 22, 0.72);
  box-shadow: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.layer-tab.is-active {
  border-color: rgba(255, 87, 51, 0.78);
  background: var(--accent);
  color: #11121d;
  box-shadow: 0 16px 34px rgba(255, 87, 51, 0.22);
}

.map-frame {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--atlas-line-strong);
  border-radius: 24px;
  background: #070a16;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.52);
}

.atlas-map {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #070a16;
  cursor: grab;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.atlas-map.is-dragging {
  cursor: grabbing;
}

.atlas-tile-plane,
.atlas-route-plane,
.atlas-marker-plane {
  position: absolute;
  inset: 0;
}

.atlas-tile-plane {
  z-index: 1;
}

.atlas-route-plane {
  z-index: 2;
  overflow: visible;
  pointer-events: auto;
}

.atlas-marker-plane {
  z-index: 3;
}

.atlas-tile {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: 256px;
  height: 256px;
  max-width: none;
  max-height: none;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.atlas-route-line {
  cursor: pointer;
  filter: drop-shadow(0 0 7px currentColor);
}

.atlas-marker-wrap {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  cursor: pointer;
  transform-origin: 0 0;
}

.atlas-marker-wrap:hover {
  filter: none;
  transform: none;
}

.atlas-marker-wrap .atlas-marker {
  transform: translate(-50%, -50%);
}

.atlas-marker-wrap .marker-label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  white-space: nowrap;
}

.atlas-marker {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(246, 247, 255, 0.82);
  border-radius: 50%;
  box-shadow: 0 0 0 6px var(--marker-glow), 0 0 30px var(--marker-color);
  background: var(--marker-color);
}

.atlas-marker::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(5, 8, 18, 0.72);
}

.atlas-marker.port {
  --marker-color: var(--port);
  --marker-glow: rgba(64, 216, 137, 0.14);
}

.atlas-marker.waterway {
  --marker-color: var(--waterway);
  --marker-glow: rgba(255, 189, 69, 0.16);
}

.atlas-marker.air {
  --marker-color: var(--air);
  --marker-glow: rgba(56, 214, 255, 0.15);
}

.atlas-marker.rail {
  --marker-color: var(--rail);
  --marker-glow: rgba(181, 140, 255, 0.15);
}

.atlas-marker.risk {
  --marker-color: var(--risk);
  --marker-glow: rgba(255, 87, 51, 0.17);
}

.marker-label {
  padding: 4px 8px;
  border: 1px solid rgba(246, 247, 255, 0.18);
  border-radius: 999px;
  background: rgba(7, 10, 22, 0.74);
  color: var(--text);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  backdrop-filter: blur(12px);
}

.detail-panel {
  position: absolute;
  z-index: 500;
  top: 18px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(380px, calc(100% - 36px));
  max-height: calc(100% - 36px);
  overflow-y: auto;
  padding: clamp(18px, 2vw, 24px);
  border: 1px solid var(--atlas-line-strong);
  border-radius: 20px;
  background: var(--atlas-panel);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(22px);
}

.detail-panel .eyebrow {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0;
}

.detail-panel h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 3rem;
  line-height: 0.9;
  letter-spacing: 0;
}

.detail-headline {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.25;
  font-weight: 900;
}

.detail-description {
  margin: 0;
  color: rgba(246, 247, 255, 0.8);
  font-size: 14px;
  line-height: 1.55;
}

.status-box,
.metric,
.note-box {
  border: 1px solid var(--atlas-line);
  border-radius: 14px;
  background: rgba(5, 8, 18, 0.54);
}

.status-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
}

.status-box span,
.metric span,
.note-box span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.status-box strong,
.metric strong {
  color: var(--text);
  font-size: 14px;
}

.status-box.normal {
  border-color: rgba(64, 216, 137, 0.28);
}

.status-box.watch {
  border-color: rgba(255, 189, 69, 0.38);
}

.status-box.risk {
  border-color: rgba(255, 87, 51, 0.48);
}

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

.metric {
  min-width: 0;
  padding: 12px;
}

.metric span,
.metric strong {
  display: block;
}

.metric strong {
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.note-box {
  padding: 13px 14px;
}

.note-box p {
  margin: 6px 0 0;
  color: rgba(246, 247, 255, 0.72);
  font-size: 13px;
  line-height: 1.45;
}

.atlas-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  min-height: 32px;
  color: rgba(246, 247, 255, 0.62);
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 880px) {
  .atlas-app {
    gap: 10px;
    padding: 10px;
  }

  .atlas-header {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: end;
  }

  .layer-tabs {
    grid-column: 1 / -1;
    width: 100%;
    padding-bottom: 2px;
  }

  .map-frame {
    border-radius: 20px;
  }

  .detail-panel {
    top: auto;
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    max-height: 42%;
    border-radius: 18px;
  }

  .detail-panel h2 {
    font-size: 2rem;
  }

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

  .atlas-footer {
    display: block;
    min-height: 28px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 520px) {
  .atlas-header {
    gap: 8px 10px;
    min-height: 62px;
    padding: 8px;
    border-radius: 16px;
  }

  .atlas-back {
    width: 38px;
    height: 38px;
  }

  .atlas-title h1 {
    font-size: 2.375rem;
  }

  .layer-tab {
    min-height: 34px;
    padding: 0 11px;
    font-size: 12px;
  }

  .detail-panel {
    gap: 10px;
    max-height: 48%;
    padding: 16px;
  }

  .detail-description {
    font-size: 13px;
  }

  .metric-list {
    grid-template-columns: 1fr;
  }
}
