/* Map workspace, 3D map frame, legends and metrics */

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.47fr) minmax(340px, .67fr);
  align-items: start;
  gap: 18px;
}

.map-column, .control-panel { min-width: 0; }

.map-frame {
  position: relative;
  height: clamp(530px, 68vh, 750px);
  min-height: 530px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: #061421;
  box-shadow: var(--shadow);
  isolation: isolate;
}

.map-shell {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  background: #061421;
  transform: perspective(var(--map-perspective, 1800px)) rotateX(var(--map-tilt, 0deg)) scale(var(--map-camera-scale, 1));
  transform-origin: 50% 50%;
  transition: transform .18s ease-out;
  will-change: transform;
}

.map-shell::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03), inset 0 -100px 120px rgba(2, 8, 15, .22);
}


#mapCanvas {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
  cursor: crosshair;
  pointer-events: auto;
  touch-action: none;
}

#mapCanvas.is-dragging { cursor: grabbing; }

#stationBarCanvas {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-shell.is-tilting { transition: none; }

.map-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid rgba(170, 200, 220, .18);
  border-radius: 999px;
  background: rgba(5, 16, 27, .64);
  color: #d6e0e9;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  backdrop-filter: blur(12px);
}

.map-kicker .pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(255, 107, 89, .9);
}

.map-top-meta {
  display: grid;
  gap: 6px;
  justify-items: end;
  text-align: right;
}

.map-top-meta span { color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.map-top-meta strong { color: #f4d3cc; font-size: 12px; letter-spacing: .04em; }

.device-load {
  position: absolute;
  z-index: 4;
  top: 158px;
  left: 22px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 27px;
  padding: 0 9px;
  border: 1px solid rgba(160, 190, 220, .16);
  border-radius: 9px;
  background: rgba(5, 16, 27, .62);
  color: rgba(215, 225, 232, .75);
  font-size: 9px;
  letter-spacing: .05em;
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.device-load-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 10px rgba(70, 214, 206, .8);
}

.device-load strong { color: #a8eee9; font-size: 10px; font-variant-numeric: tabular-nums; }
.device-load.medium .device-load-dot { background: #f2d84d; box-shadow: 0 0 10px rgba(242, 216, 77, .7); }
.device-load.medium strong { color: #f5da6b; }
.device-load.high .device-load-dot { background: var(--accent); box-shadow: 0 0 10px rgba(255, 107, 89, .75); }
.device-load.high strong { color: #ff9b87; }

.map-context {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(14, 27, 43, .72);
}

.map-context-head, .map-context-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.map-context-readout { align-items: flex-end; }

.simulation-time { display: flex; align-items: baseline; gap: 9px; }
.simulation-time strong { color: #f4f7f8; font-size: clamp(25px, 4vw, 40px); font-weight: 500; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.simulation-time span { color: var(--muted); font-size: 9px; letter-spacing: .14em; }
.map-source-outside { color: var(--muted); font-size: 11px; letter-spacing: .03em; }
.device-load-outside { position: static; }

.map-utility { display: grid; gap: 10px; margin-top: 12px; }
.map-hint-outside {
  justify-self: start;
  padding: 8px 11px;
  border: 1px solid rgba(155, 209, 135, .23);
  border-radius: 999px;
  background: rgba(7, 19, 28, .72);
  color: #c9e4bc;
  font-size: 10px;
  letter-spacing: .04em;
}
.map-footer-outside {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(14, 27, 43, .55);
}

.legend-block { display: grid; gap: 7px; min-width: 205px; }

.legend-title {
  color: rgba(233, 240, 243, .82);
  font-size: 10px;
  letter-spacing: .08em;
}

.legend-bar {
  width: min(260px, 42vw);
  height: 8px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 99px;
  background: linear-gradient(90deg, #0b4165 0%, #2ac7c0 21%, #f2d84d 42%, #ff752f 61%, #f3274f 76%, #8f28e8 90%, #09070c 100%);
  box-shadow: 0 0 20px rgba(53, 190, 195, .12);
}

.legend-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.map-tools-note {
  display: grid;
  justify-items: end;
  gap: 4px;
  color: rgba(204, 219, 226, .6);
  font-size: 9px;
  line-height: 1.5;
  text-align: right;
}

.map-tools-note strong { color: rgba(236, 243, 245, .82); font-size: 10px; font-weight: 600; }
.gsi-attribution { pointer-events: auto; }
.gsi-attribution a { color: rgba(204, 219, 226, .68); text-decoration: underline; text-underline-offset: 2px; }
.gsi-attribution a:hover { color: #d8f3ef; }
.gsi-attribution-note { max-width: 220px; color: rgba(204, 219, 226, .46); font-size: 8px; line-height: 1.35; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.metric {
  min-width: 0;
  padding: 16px 17px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(14, 27, 43, .67);
}

.metric-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.metric-label::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }
.metric:nth-child(2) .metric-label::before { background: #f2d84d; }
.metric:nth-child(3) .metric-label::before { background: #ff752f; }
.metric:nth-child(4) .metric-label::before { background: var(--accent); }

.metric-value {
  margin-top: 10px;
  color: #f4f7f8;
  font-size: clamp(20px, 2.6vw, 29px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.05em;
  white-space: nowrap;
}

.metric-value small { margin-left: 2px; color: var(--muted); font-size: 11px; letter-spacing: 0; }
.metric-sub { margin-top: 4px; color: var(--muted-2); font-size: 9px; white-space: nowrap; }
