:root {
  --bg: rgba(8, 10, 18, 0.82);
  --text: #f4f7ff;
  --accent: #5eead4;
  --muted: #9aa4bf;
}

* {
  box-sizing: border-box;
}

body.overlay-body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: transparent;
}

.hidden {
  display: none !important;
}

.scoreboard {
  min-width: 320px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.scoreboard-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 8px;
  font-size: 14px;
}

#match-title {
  font-weight: 700;
  color: var(--accent);
}

#match-meta {
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 4px 6px;
  text-align: left;
}

th:last-child,
td:last-child,
th:nth-child(3),
td:nth-child(3),
th:nth-child(2),
td:nth-child(2) {
  text-align: right;
}

.match-list {
  display: grid;
  gap: 8px;
  max-width: 420px;
}

.match-card {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.match-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.match-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.match-card-id {
  margin-top: 6px !important;
  font-size: 11px !important;
  font-family: ui-monospace, monospace;
  word-break: break-all;
}

.match-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.overlay-btn {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}

.overlay-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.overlay-btn-primary {
  background: rgba(94, 234, 212, 0.12);
  border-color: rgba(94, 234, 212, 0.35);
}

.viewer-body {
  padding: 16px;
  background: #0b0d14;
  min-height: 100vh;
}

.viewer-panel {
  max-width: 480px;
  padding: 16px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.viewer-title {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--accent);
}

.viewer-hint,
.viewer-obs-hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.viewer-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 13px;
}

.viewer-field select {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #111522;
  color: var(--text);
}

.viewer-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.viewer-actions .overlay-btn {
  width: 100%;
  text-align: left;
  font-size: 14px;
  padding: 10px 12px;
}

.map-stage {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.map-stage-frame {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  line-height: 0;
}

.map-zoom-host {
  flex: 0 0 auto;
  width: 512px;
  height: 512px;
  overflow: hidden;
  position: relative;
  /* width/height updated by applyMapZoom() when mapZoomPercent != 100 */
}

.map-3d-host {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #0d0a18;
  overflow: hidden;
}
.map-3d-host canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.map-widget-root.map-view-3d #map-zoom-host,
.map-widget-maximized.map-view-3d #map-zoom-host {
  visibility: hidden;
}
.map-widget-root.map-view-3d #map-3d-host,
.map-widget-maximized.map-view-3d #map-3d-host {
  display: block;
}
.map-3d-host.hidden {
  display: none !important;
}

/* Slipgate-style camera presets over the 3D canvas */
.map-3d-cam-toolbar {
  position: absolute;
  bottom: 48px;
  left: 8px;
  z-index: 10;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 5px;
  max-width: calc(100% - 16px);
  padding: 6px;
  border-radius: 4px;
  background: rgba(13, 10, 24, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  pointer-events: auto;
}
.map-3d-cam-btn {
  margin: 0;
  padding: 4px 10px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #d3d0de;
  font: 600 11px/1.2 "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.map-3d-cam-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
.map-3d-cam-btn.is-active {
  background: rgba(94, 234, 212, 0.22);
  border-color: rgba(94, 234, 212, 0.55);
  color: #5eead4;
}
.map-3d-cam-btn:focus-visible {
  outline: 1px solid #5eead4;
  outline-offset: 1px;
}
.map-3d-cam-select {
  margin: 0;
  box-sizing: border-box;
  height: 24px;
  max-width: 110px;
  padding: 0 8px;
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #d3d0de;
  font: 600 11px/22px "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.02em;
  cursor: pointer;
  vertical-align: middle;
  appearance: none;
  -webkit-appearance: none;
}
.map-3d-cam-select:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
.map-3d-cam-select:focus-visible {
  outline: 1px solid #5eead4;
  outline-offset: 1px;
}

.map-page-overlays {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  overflow: hidden;
}

.map-wrap {
  position: relative;
  width: 512px;
  height: 512px;
  transform-origin: top left;
  will-change: transform;
}

.map-chrome {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  display: block;
  overflow: hidden;
}

.map-chrome-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 14;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: auto;
}

.map-chrome-stack {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 14;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  pointer-events: none;
  max-width: min(280px, 58%);
  max-height: calc(100% - 16px);
  min-height: 0;
}

.map-chrome-stack .map-toolbar {
  position: relative;
  top: auto;
  left: auto;
  pointer-events: auto;
}

.map-chrome-stack .map-killfeed {
  position: relative;
  top: auto;
  left: auto;
  z-index: 13;
  flex: 1 1 auto;
  min-height: 0;
  max-width: 100%;
  overflow: hidden;
}

.map-killfeed {
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
}

.map-killfeed.hidden {
  display: none;
}

.map-score {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 15;
  pointer-events: none;
  max-width: min(360px, 62%);
}

.map-score.hidden {
  display: none;
}

.map-score-duel {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(12, 10, 9, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
}

.map-score-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #e7e5e4;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.map-score-left {
  text-align: right;
}

.map-score-right {
  text-align: left;
}

.map-score-mid {
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  white-space: nowrap;
}

.map-score-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(12, 10, 9, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

.map-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  line-height: 1.25;
}

.map-score-val {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

#map-players {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.map-contour-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-contour-layer.hidden {
  display: none;
}

.map-wrap.map-contour-hide-image #map-image {
  opacity: 0;
}

.map-wrap.map-contour-hide-image {
  background:
    repeating-conic-gradient(rgba(255, 255, 255, 0.04) 0% 25%, transparent 0% 50%) 50% / 16px 16px,
    #111;
}

.map-heatmap-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-heatmap-layer.hidden {
  display: none;
}

.map-calib {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.map-calib-box {
  position: absolute;
  box-sizing: border-box;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.map-calib-grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-grid-line {
  stroke: rgba(94, 234, 212, 0.55);
  stroke-width: 1;
}

.map-calib-move {
  position: absolute;
  inset: 0;
  cursor: move;
  pointer-events: auto;
  background: rgba(56, 189, 248, 0.03);
}

.dbg-span-y-row.hidden {
  display: none;
}

.dbg-accent {
  color: #38bdf8;
  font-weight: 600;
}

.map-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
}

/* "Fullscreen" is a CSS overlay (position:fixed, covers the browser's own
   viewport/tab, not the real Fullscreen API - see map-widget.js setFullscreen)
   so it plays nicely with OBS/streaming setups and needs no permission
   round-trip. z-index is the highest in the app on purpose: this must sit
   above literally everything else on the dashboard page.
   applyFit() (map-widget.js) scales .map-layout via zoom to contain-fit the
   viewport on both axes; absolute-position + translate centers the (now
   natural-size times zoom) box within it - more reliable across browsers
   than flex centering next to a position:fixed sibling (#map-page-overlays),
   which isn't a flex participant but some engines' centering math can still
   end up skewed by it. */
.map-widget-root.map-widget-maximized {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  background: #05070c;
}

.map-widget-root.map-widget-maximized .map-layout {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.map-fullscreen-btn {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 15;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(17, 22, 34, 0.82);
  color: #eef2ff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.map-widget-root.map-fs-chrome-visible .map-fullscreen-btn {
  opacity: 1;
  pointer-events: auto;
}

/* Replay bar (play/scrub/speed): in maximized mode it's pulled out of
   .map-main's normal in-flow stack (where it would just render as a strip
   below the map square, always taking up layout space) and floated as a
   fixed overlay centered at the bottom of the screen, like a video
   player's control bar - it only auto-hides while actually in fullscreen,
   mousemove reveals it via the same idle timer as the fullscreen button;
   the embedded/standalone view leaves it in its normal always-shown flow
   position. No :not(.hidden) guard needed: if the bar is display:none
   (standalone, no replay active) opacity is moot; if dashboard.css
   force-shows it (embedded + fullscreen) this layers the fade on top. */
.map-widget-root.map-widget-maximized #map-replay-bar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 101;
  max-width: min(90vw, 640px);
  margin: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.map-widget-root.map-widget-maximized.map-fs-chrome-visible #map-replay-bar {
  opacity: 1;
  pointer-events: auto;
}

/* Compact "video player" look for the floating bar specifically - the
   standalone OBS page keeps the roomier default styling above (operators
   there have room and want the record/segment controls legible). */
.map-widget-root.map-widget-maximized #map-replay-bar {
  width: min(80vw, 900px);
  max-width: min(80vw, 900px);
  gap: 8px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(10, 14, 22, 0.6);
  border-color: rgba(148, 163, 184, 0.18);
  backdrop-filter: blur(4px);
}

.map-widget-root.map-widget-maximized .map-replay-playback {
  gap: 8px;
  min-width: 0;
}

.map-widget-root.map-widget-maximized .map-replay-play {
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
}

.map-widget-root.map-widget-maximized .map-replay-play svg {
  width: 16px;
  height: 16px;
}

.map-widget-root.map-widget-maximized .map-replay-scrub-wrap {
  padding-top: 8px;
}

.map-widget-root.map-widget-maximized .map-replay-time {
  font-size: 11px;
  min-width: 72px;
}

.map-widget-root.map-widget-maximized .map-replay-speed {
  padding: 2px 4px;
  font-size: 11px;
  background: transparent;
  border-color: rgba(148, 163, 184, 0.25);
}

.map-fullscreen-btn svg {
  width: 18px;
  height: 18px;
}

.map-fullscreen-btn .map-fullscreen-icon-exit {
  display: none;
}

.map-fullscreen-btn[aria-pressed="true"] .map-fullscreen-icon-enter {
  display: none;
}

.map-fullscreen-btn[aria-pressed="true"] .map-fullscreen-icon-exit {
  display: inline-flex;
}

.map-main {
  flex: 0 0 auto;
}

.map-debug-mode .map-debug {
  display: block;
}

body.map-body.map-debug-mode {
  padding: 16px;
  min-height: 100vh;
  background: #0b0d14;
  color: #eef2ff;
}

.map-debug {
  flex: 1 1 320px;
  max-width: 420px;
  min-width: 280px;
  background: #151b28;
  color: #eef2ff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.45;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.map-debug-head h2 {
  margin: 0 0 4px;
  font-size: 15px;
  color: #f8fbff;
}

.map-debug-hint {
  margin: 0 0 8px;
  color: #b8c4dc;
}

.map-debug-hint code {
  color: #5eead4;
  background: rgba(94, 234, 212, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
}

.map-debug-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.map-debug-section h3 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #c9d4ea;
  font-weight: 600;
}

.dbg-meta {
  color: #eef2ff;
}

.dbg-meta > div {
  margin-bottom: 4px;
}

.dbg-meta b {
  color: #9fb0cf;
  font-weight: 600;
}

.dbg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.dbg-image-grid {
  margin-top: 10px;
}

.dbg-bounds {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dbg-bound-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dbg-bound-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dbg-bound-label {
  color: #d5deef;
  font-size: 11px;
  font-weight: 600;
}

.dbg-num {
  width: 108px;
  box-sizing: border-box;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: #0d111a;
  color: #f8fbff;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  text-align: right;
}

.dbg-range {
  width: 100%;
  height: 18px;
  margin: 0;
  accent-color: #f97316;
  cursor: pointer;
}

.dbg-slider-tools {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dbg-slider-range-meta {
  color: #b8c4dc;
  font-size: 11px;
}

.dbg-slider-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dbg-preset {
  padding: 4px 8px !important;
  font-size: 11px !important;
}

.dbg-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #d5deef;
  font-weight: 600;
}

.dbg-grid input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: #0d111a;
  color: #f8fbff;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
}

.dbg-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: #eef2ff;
}

.dbg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  color: #eef2ff;
}

.dbg-table th,
.dbg-table td {
  text-align: left;
  padding: 4px 6px 4px 0;
  vertical-align: top;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dbg-table th {
  color: #b8c4dc;
  font-weight: 600;
}

.dbg-table td {
  color: #f0f4ff;
}

.dbg-table .mono,
.mono {
  font-family: ui-monospace, Consolas, monospace;
}

.dbg-pre {
  margin: 0 0 8px;
  padding: 8px;
  border-radius: 6px;
  background: #0a0f18;
  color: #dce6fa;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: auto;
  font-size: 11px;
  line-height: 1.4;
  white-space: pre;
}

.dbg-click {
  color: #dce6fa;
}

.dbg-select {
  width: 100%;
  margin-top: 4px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.85);
  color: #e2e8f0;
  font-size: 12px;
}

.map-debug .overlay-btn {
  background: #1c2433;
  border-color: rgba(255, 255, 255, 0.2);
  color: #f0f4ff;
}

.map-debug .overlay-btn:hover {
  background: #243044;
  border-color: #5eead4;
  color: #5eead4;
}

body.map-debug-mode .map-meta,
body.map-debug-mode .status {
  color: #b8c4dc;
}

.dbg-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: #f97316;
  color: #111;
  font-size: 10px;
  font-weight: 700;
}

.dbg-list {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 12px;
  color: #b8c4dc;
}

.dbg-warn {
  color: #fb923c;
}

.dbg-table-compact th,
.dbg-table-compact td {
  padding: 3px 6px;
  font-size: 11px;
}

.map-debug-click {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  border: 2px solid #38bdf8;
  background: rgba(56, 189, 248, 0.35);
  pointer-events: none;
  z-index: 5;
}

#map-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
  background: #111;
}

.map-marker {
  position: absolute;
  pointer-events: none;
  will-change: left, top;
}

.map-label {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, calc(-100% - 5px));
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
  color: #fff;
  white-space: nowrap;
  text-shadow:
    0 0 4px rgba(0, 0, 0, 0.95),
    0 1px 2px rgba(0, 0, 0, 0.95),
    0 0 1px #000;
  z-index: 3;
}

.map-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--map-player-other-color, #f97316);
  border: 2px solid #fff;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
  will-change: width, height;
  z-index: 1;
}

.map-marker--self .map-dot {
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.55);
}

.map-marker--opponent .map-dot {
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.55);
}

/* Brief flash on the victim's marker when they die (handleDeathEvent). */
.map-dot--hit {
  border-color: #ec4899;
  box-shadow: 0 0 8px rgba(236, 72, 153, 0.9);
}

.map-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  overflow: visible;
  pointer-events: none;
  transform-origin: 50% 50%;
  z-index: 2;
  will-change: transform, width, height;
}

.map-pin-fill,
.map-pin-spike {
  fill: var(--map-player-other-color, #f97316);
  stroke: none;
}

.map-pin-fill {
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.55));
}

.map-pin-outline {
  fill: none;
  stroke: #fff;
  stroke-linejoin: round;
  stroke-linecap: round;
  pointer-events: none;
}

/* Brief flash on the victim's marker when they die (handleDeathEvent). */
.map-pin-outline--hit {
  stroke: #ec4899;
  filter: drop-shadow(0 0 4px rgba(236, 72, 153, 0.85));
}

.map-marker--self .map-pin-fill {
  filter: drop-shadow(0 0 4px rgba(59, 130, 246, 0.55));
}

.map-marker--opponent .map-pin-fill {
  filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.55));
}

.map-fov {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 160px;
  height: 160px;
  margin-left: -80px;
  margin-top: -80px;
  overflow: visible;
  pointer-events: none;
  transform-origin: 50% 50%;
  z-index: 0;
}

#map-wrap {
  --map-spawn-active-color: rgba(0, 255, 0, 0.8);
  --map-spawn-inactive-color: rgba(170, 51, 51, 0.8);
  --map-fov-fill: rgba(255, 255, 255, 0.1);
  --map-fov-stroke: rgba(255, 255, 255, 0.28);
  --map-fov-opacity: 1;
  --map-view-color-start: rgba(255, 255, 255, 0.35);
  --map-view-color-end: rgba(255, 255, 255, 0.95);
  --map-view-opacity: 1;
  --map-view-length-px: 80px;
  --map-view-head-color: #ffffff;
  --map-player-self-color: #3b82f6;
  --map-player-opponent-color: #ef4444;
  --map-player-other-color: #f97316;
  --map-respawn-ring-color: #4ade80;
  --map-respawn-ring-bg: rgba(20, 24, 32, 0.82);
  --map-respawn-count-color: #f8fafc;
}

.map-fov-fill {
  fill: var(--map-fov-fill);
  stroke: var(--map-fov-stroke);
  stroke-width: 1;
  opacity: var(--map-fov-opacity);
}

.map-view {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--map-view-length-px, 80px);
  height: 3px;
  margin-top: -1.5px;
  background: linear-gradient(
    90deg,
    var(--map-view-color-start),
    var(--map-view-color-end)
  );
  border-radius: 2px;
  transform-origin: 0 50%;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.45);
  will-change: transform;
  z-index: 2;
  opacity: var(--map-view-opacity);
}

.map-view::before {
  content: "";
  position: absolute;
  left: calc(100% + 6px);
  top: 50%;
  width: 40px;
  height: 2px;
  margin-top: -1px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.2),
    rgba(255, 255, 255, 0)
  );
  border-radius: 1px;
  pointer-events: none;
}

.map-view::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 50%;
  transform: translateY(-50%);
  border: 4px solid transparent;
  border-left: 7px solid var(--map-view-head-color);
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
}

.map-theme-view-sprite .map-view {
  background: var(--map-view-sprite) center / contain no-repeat;
  height: 16px;
}

.map-theme-view-sprite .map-view::before,
.map-theme-view-sprite .map-view::after {
  display: none;
}

/* UDT-style in-hand weapon sprite: a portrait gun/tool image held to the
   side of the player dot, like DrawPlayerWeapon() in the UDT viewer. JS
   (placePlayerElement) applies the side offset + rotation via `transform`;
   here the image is just centered on the marker before that transform. */
.map-weapon-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 13.5px;
  height: 36px;
  object-fit: contain;
  margin-left: -6.75px;
  margin-top: -18px;
  pointer-events: none;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.85));
}

.map-meta {
  /* Map caption (e.g. "REPLAY · bloodrun · duel · server-1" / "bloodrun · N
     players") is redundant clutter on both the OBS overlay and the embedded
     analytics widget; hide everywhere. */
  display: none;
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.map-replay-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.map-replay-bar.hidden {
  display: none;
}

.map-record-controls,
.map-replay-select-wrap {
  flex: 1 1 180px;
  min-width: 160px;
  max-width: 360px;
}

.map-replay-select-wrap.hidden {
  display: none;
}

.map-replay-select {
  width: 100%;
  max-width: 360px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.92);
  color: var(--text);
  font-size: 12px;
}

.map-replay-playback {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 200px;
}

.map-record-controls.hidden,
.map-replay-playback.hidden,
.map-replay-load-wrap.hidden {
  display: none;
}

.map-record-btn,
.map-replay-play {
  flex: 0 0 auto;
  min-width: 52px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(30, 41, 59, 0.9);
  color: var(--text);
  cursor: pointer;
}

.map-record-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#map-record-start {
  border-color: rgba(248, 113, 113, 0.55);
  color: #fecaca;
}

.map-record-status {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.map-replay-load-wrap {
  flex: 0 0 auto;
  cursor: pointer;
}

.map-replay-load-btn {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(30, 41, 59, 0.9);
  color: var(--text);
  font-size: 12px;
}

.map-replay-play {
  min-width: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.map-replay-play svg {
  width: 18px;
  height: 18px;
}

.map-replay-play .map-replay-play-icon-pause {
  display: none;
}

.map-replay-play[aria-pressed="true"] .map-replay-play-icon-play {
  display: none;
}

.map-replay-play[aria-pressed="true"] .map-replay-play-icon-pause {
  display: inline-flex;
}

.map-replay-scrub-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 120px;
  padding-top: 14px;
}

.map-replay-lifecycle {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 12px;
  pointer-events: none;
}

.map-replay-lifecycle.hidden {
  display: none;
}

.map-replay-life {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
}

.map-replay-life-mark {
  display: block;
  width: 2px;
  height: 10px;
  border-radius: 1px;
}

.map-replay-life--countdown .map-replay-life-mark {
  background: #fbbf24;
}

.map-replay-life--started .map-replay-life-mark {
  background: #4ade80;
}

.map-replay-life--ended .map-replay-life-mark {
  background: #f87171;
}

.map-match-timer {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 13;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  pointer-events: none;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.9);
  color: #e2e8f0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  line-height: 1.1;
}

.map-match-timer.hidden {
  display: none;
}

.map-match-timer--countdown {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.5);
}

.map-match-timer--playing {
  color: #e2e8f0;
}

.map-match-timer--paused {
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.45);
  font-size: 16px;
}

.map-lifecycle-banner {
  position: absolute;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: none;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.88);
  color: var(--text);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.map-lifecycle-banner.hidden {
  display: none;
}

.map-lifecycle-banner--countdown,
.map-lifecycle-banner--warmup {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.5);
}

.map-lifecycle-banner--started,
.map-lifecycle-banner--playing {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.5);
}

.map-lifecycle-banner--ended {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.5);
}

.map-asset-warning {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  max-width: 90%;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  pointer-events: none;
  border: 1px solid rgba(251, 191, 36, 0.5);
  background: rgba(120, 53, 15, 0.9);
  color: #fbbf24;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.map-asset-warning.hidden {
  display: none;
}

.map-replay-scrub {
  width: 100%;
  flex: 1 1 auto;
  min-width: 120px;
}

.map-replay-time {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 88px;
}

.map-replay-speed {
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(30, 41, 59, 0.9);
  color: var(--text);
}

body.map-replay-mode .map-replay-bar {
  display: flex;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.status {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.status.error {
  color: #f87171;
}

/* Duel spawn overlay (ql-spawns / Memento_Mori) */
.map-spawn-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.map-spawn-cursor {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: auto;
  cursor: crosshair;
  background: transparent;
}

.map-spawn-cursor.hidden {
  display: none;
}

.map-spawn-ref {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  border: 2px solid #8ed6ff;
  background: rgba(142, 214, 255, 0.35);
  pointer-events: none;
  z-index: 4;
  display: none;
}

.map-death-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.map-death-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.map-death-marker-cross {
  width: 22px;
  height: 22px;
}

.map-death-marker-cross-svg {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.85));
}

.map-death-marker-cross-svg line {
  stroke: #ef4444;
  stroke-width: 3;
  stroke-linecap: round;
}

.map-death-marker-sprite {
  width: 28px;
  height: 28px;
}

.map-death-marker-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.85));
}

.map-beam-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  pointer-events: none;
}

.map-fx-beam-line {
  stroke: #f87171;
  stroke-width: 2;
  stroke-linecap: round;
}

.map-fx-beam-lightninggun {
  stroke: #fde047;
  stroke-width: 2.5;
}

.map-impact-layer,
.map-projectile-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.map-fx-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  border-radius: 50%;
}

.map-fx-impact {
  width: 10px;
  height: 10px;
  background: #e5e7eb;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.85);
}

.map-fx-impact-explosion {
  width: 16px;
  height: 16px;
  background: #f97316;
}

.map-fx-impact-plasma {
  background: #38bdf8;
}

.map-fx-impact-shaft {
  background: #fde047;
}

.map-fx-projectile {
  /* Unrotated shape points along +X (screen-right) - yaw=0 convention, same as
     the player FOV wedge/direction arrow (fovWedgePath / -yaw rotation). */
  width: 14px;
  height: 10px;
  background: #f8fafc;
  border-radius: 0;
  clip-path: polygon(0% 0%, 100% 50%, 0% 100%, 22% 50%);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.9);
}

.map-fx-projectile-rocketlauncher {
  background: #fb923c;
}

.map-fx-projectile-plasmagun {
  background: #38bdf8;
}

/* UDT draws the in-flight grenade as a plain green ball, not an arrow. */
.map-fx-projectile-grenadelauncher {
  width: 9px;
  height: 9px;
  background: radial-gradient(circle at 35% 30%, #bbf7b0, #22c55e 70%);
  clip-path: none;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.9);
}

.map-fx-projectile-sprite {
  position: absolute;
  width: 18px;
  height: 18px;
  pointer-events: none;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.9));
}

/* Plasma/impact/explosion sprites imported from UDT are baked on a black
   background (meant for additive blending in its nanovg renderer) - screen
   blend approximates that over our map art instead of showing a black box. */
.map-fx-projectile-plasma-sprite {
  mix-blend-mode: screen;
}

.map-fx-impact-sprite {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  mix-blend-mode: screen;
}

.map-fx-impact-bullet-sprite {
  width: 14px;
  height: 14px;
}

.map-fx-impact-plasma-sprite {
  width: 16px;
  height: 16px;
}

.map-fx-impact-explosion-sprite {
  width: 34px;
  height: 34px;
}

.map-item-respawn-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.map-item-respawn {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 26px;
  height: 26px;
  pointer-events: none;
}

.map-item-respawn-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.map-item-respawn--linear {
  width: 22px;
  height: 28px;
}

.map-item-respawn--linear .map-item-respawn-ring {
  border-radius: 4px;
  background: var(--map-respawn-ring-bg);
  overflow: hidden;
}

.map-item-respawn-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: var(--map-respawn-ring-color);
  transition: height 0.08s linear;
}

.map-item-respawn-count {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  color: var(--map-respawn-count-color);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}

.map-entity-respawn-cooldown {
  opacity: 0.18;
  filter: grayscale(0.85);
}

.map-entity-hidden {
  visibility: hidden;
  opacity: 0;
}

.map-spawn {
  position: absolute;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.45);
  pointer-events: none;
  box-sizing: border-box;
}

.map-spawn.is-active {
  background: var(--map-spawn-active-color);
  background-image: var(--map-spawn-active-sprite, none);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.map-spawn.is-inactive {
  background: var(--map-spawn-inactive-color);
  background-image: var(--map-spawn-inactive-sprite, none);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.map-spawn-has-sprite {
  background-color: transparent !important;
  border-color: rgba(255, 255, 255, 0.35);
}

.map-teleport {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-sizing: border-box;
}

.map-teleport-exit {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(180, 120, 90, 0.85);
  background: rgba(48, 36, 30, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-teleport-x {
  font-size: 13px;
  line-height: 1;
  color: rgba(214, 180, 150, 0.95);
  font-weight: 700;
  transform: translateY(-1px);
}

.map-teleport-entrance {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px dashed rgba(168, 140, 115, 0.7);
  background: rgba(40, 32, 28, 0.28);
  box-shadow: 0 0 0 1px rgba(12, 10, 9, 0.35);
}

.map-killfeed-line {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  line-height: 1.25;
  color: #e7e5e4;
  background: rgba(12, 10, 9, 0.82);
  padding: 4px 7px;
  border-radius: 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.map-killfeed-weapon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.75));
}

.map-killfeed-weapon-text {
  flex: 0 0 auto;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #d6d3d1;
  text-transform: uppercase;
}

.map-killfeed-names {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-killfeed-killer {
  color: #fca5a5;
}

.map-killfeed-victim {
  color: #93c5fd;
}

.map-killfeed-sep {
  color: #78716c;
  margin: 0 2px;
}

.map-pickups {
  position: absolute;
  right: 8px;
  top: 36px;
  z-index: 8;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
  max-width: 45%;
}

.map-pickup-line {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  line-height: 1.2;
  color: #fef3c7;
  background: rgba(12, 10, 9, 0.72);
  padding: 3px 6px;
  border-radius: 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  transition: opacity 0.65s ease;
}

.map-pickup-line.is-fading {
  opacity: 0;
}

.map-pickup-icon {
  width: 14px;
  height: 14px;
  object-fit: contain;
  flex: 0 0 auto;
}

.map-pickup-text {
  min-width: 0;
}

.map-pickup-log-btn {
  pointer-events: auto;
  font-size: 10px;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 4px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: rgba(12, 10, 9, 0.82);
  color: #fde68a;
  cursor: pointer;
}

.map-pickup-log-btn:hover {
  background: rgba(28, 25, 23, 0.92);
}

body.map-pickup-log-open .map-pickup-log-btn {
  display: none;
}

.map-pickup-log {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 15;
  width: min(300px, 62%);
  min-height: 96px;
  max-height: min(320px, 52%);
  display: flex;
  flex-direction: column;
  background: rgba(12, 10, 9, 0.92);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
}

.map-pickup-log.hidden {
  display: none;
}

.map-pickup-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.map-pickup-log-head h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: #fde68a;
}

.map-pickup-log-close {
  border: none;
  background: transparent;
  color: #e7e5e4;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}

.map-pickup-log-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.map-pickup-log-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  line-height: 1.25;
  color: #fef3c7;
  padding: 4px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
}

.map-pickup-log-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex: 0 0 auto;
}

.map-pickup-log-text {
  min-width: 0;
}

.map-entity {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-sizing: border-box;
  border: 1px solid rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-entity-circle {
  border-radius: 50%;
}

.map-entity-square {
  border-radius: 2px;
}

.map-entity-diamond {
  border-radius: 2px;
  transform: translate(-50%, -50%) rotate(45deg);
}

.map-entity-label {
  font-size: 7px;
  font-weight: 800;
  color: #0b0d14;
  line-height: 1;
  transform: rotate(0deg);
}

.map-entity-diamond .map-entity-label {
  transform: rotate(-45deg);
}

.map-entity-has-sprite {
  border: none;
  background: transparent !important;
  width: 20px !important;
  height: 20px !important;
}

.map-entity-sprite {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.85));
  pointer-events: none;
}

.map-entity-has-sprite.map-entity-diamond {
  transform: translate(-50%, -50%);
}

.map-spawn-threshold {
  position: absolute;
  box-sizing: border-box;
  border: 1px dashed rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.04);
  pointer-events: none;
}

.map-spawns-toggle {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(12, 16, 24, 0.82);
  color: #c8f0d8;
  cursor: pointer;
}

.map-spawns-toggle:hover,
.map-spawns-toggle[aria-pressed="true"] {
  border-color: #4ade80;
  color: #4ade80;
}

.map-spawns-toggle.hidden {
  display: none;
}

.map-spawns-panel {
  position: absolute;
  top: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  width: min(380px, 94%);
  max-width: 380px;
  min-width: 0;
  background: rgba(21, 27, 40, 0.96);
  color: #eef2ff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.45;
  max-height: none;
  overflow: auto;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
  backdrop-filter: blur(6px);
}

.map-spawns-panel.hidden {
  display: none;
}

body.map-spawns-mode .map-chrome-actions {
  z-index: 3;
}

.map-spawns-mode .map-spawns-panel:not(.hidden) {
  display: block;
}

.map-spawns-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.map-spawns-head h2 {
  margin: 0;
  font-size: 15px;
}

.map-spawns-close {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: #e7e5e4;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 4px;
}

.map-spawns-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.map-spawns-hint {
  margin: 0 0 10px;
  color: #9aa8c4;
}

.map-spawns-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 10px;
}

.map-spawns-tab {
  flex: 1 1 auto;
  min-width: 0;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(10, 14, 22, 0.6);
  color: #9aa8c4;
  cursor: pointer;
}

.map-spawns-tab:hover {
  color: #c8d4ec;
  border-color: rgba(255, 255, 255, 0.22);
}

.map-spawns-tab.is-active {
  color: #4ade80;
  border-color: #4ade80;
  background: rgba(74, 222, 128, 0.08);
}

.map-spawns-tab-panels {
  margin-top: 4px;
}

.map-spawns-tab-panel.hidden {
  display: none;
}

.map-spawns-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.map-spawns-section h3 {
  margin: 0 0 8px;
  font-size: 12px;
  color: #9aa8c4;
  font-weight: 600;
}

.map-spawns-section .dbg-toggle {
  display: block;
  margin: 6px 0;
}

.map-spawns-section .dbg-field {
  display: block;
  margin: 8px 0;
}

.map-spawns-section .dbg-field input[type="number"] {
  width: 72px;
  margin-left: 6px;
}

.map-spawns-section .dbg-field input[type="range"] {
  width: 100%;
  margin-top: 4px;
  accent-color: #5eead4;
}

.map-spawns-zoom-value {
  margin-left: 6px;
  font-family: ui-monospace, Consolas, monospace;
  color: #9aa8c4;
  font-size: 11px;
}

.map-spawns-section .dbg-field select {
  margin-left: 6px;
  max-width: 100%;
  font-size: 12px;
  background: #1a1f2e;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 4px;
}

.map-spawns-section .dbg-field.is-disabled {
  opacity: 0.55;
}

.spawn-item-category-group {
  margin: 8px 0 4px;
}

.spawn-item-category-group-head .spawn-item-category-parent {
  margin: 4px 0;
}

.spawn-item-category-details {
  margin: 2px 0 0 14px;
}

.spawn-item-category-details > summary {
  cursor: pointer;
  font-size: 11px;
  color: #8b98b0;
  margin: 2px 0 4px;
  user-select: none;
}

.spawn-item-category-children {
  margin-left: 12px;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.spawn-item-category-child {
  margin: 4px 0 !important;
  font-size: 12px;
}

.spawn-item-category-child.is-disabled {
  opacity: 0.55;
}

.spawn-heatmap-player-toggles {
  margin: 4px 0 0;
  padding-left: 0;
  border-left: none;
}

.spawn-heatmap-players-head {
  margin: 12px 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: #c9d4ea;
}

.spawn-heatmap-player-row {
  display: block;
  margin: 4px 0;
  font-size: 12px;
}

.spawn-pickup-display-group {
  margin: 10px 0 4px;
}

.spawn-pickup-display-group-head .spawn-pickup-display-parent {
  margin: 4px 0;
}

.spawn-pickup-display-details {
  margin: 2px 0 0 14px;
}

.spawn-pickup-display-details > summary {
  cursor: pointer;
  font-size: 11px;
  color: #8b98b0;
  margin: 2px 0 4px;
  user-select: none;
}

.spawn-pickup-display-children {
  margin-left: 12px;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.spawn-pickup-display-child {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 6px 0 !important;
  font-size: 12px;
}

.spawn-pickup-display-child select {
  flex: 1 1 160px;
  min-width: 0;
  font-size: 11px;
}

.spawn-pickup-display-child.is-disabled {
  opacity: 0.55;
}

.map-spawns-section .dbg-field input[type="url"],
.map-spawns-section .dbg-field input[type="text"] {
  width: 100%;
  margin-top: 4px;
  font-size: 11px;
  box-sizing: border-box;
}

.map-spawns-section .dbg-field input[type="color"] {
  margin-left: 6px;
  vertical-align: middle;
}

.map-spawns-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.map-spawns-import-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  color: #8b98b0;
  font-size: 11px;
}

.map-spawns-credit code {
  font-size: 10px;
}

body.map-spawns-mode .map-meta,
body.map-spawns-mode .status {
  color: #b8c4dc;
}

/* OBS background modes (?bg=) */
body.obs-bg-checkerboard {
  background:
    repeating-conic-gradient(rgba(255, 255, 255, 0.06) 0% 25%, transparent 0% 50%) 50% / 20px
      20px,
    #1a1a2e !important;
}

/* Matches list */
body.matches-body.matches-operator-mode {
  padding: 16px;
  background: #0b0d14;
  min-height: 100vh;
}

.matches-operator {
  max-width: 720px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.matches-operator-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.matches-operator-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.matches-operator-field select {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #111522;
  color: var(--text);
}

.match-list.layout-compact {
  max-width: none;
  gap: 4px;
}

.match-list.layout-compact .match-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
}

.match-list.layout-compact .match-card h3 {
  margin: 0;
  font-size: 14px;
}

.match-list.layout-compact .match-card-compact-meta {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.match-list.layout-compact .match-card-id,
.match-list.layout-compact .match-card-actions {
  display: none;
}

.match-list.layout-cards .match-card-compact-main {
  display: block;
}

.match-card-ended {
  opacity: 0.72;
}

.match-status-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.match-status-badge.is-live {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
}

.match-status-badge.is-warmup {
  background: rgba(250, 204, 21, 0.15);
  color: #facc15;
}

.match-status-badge.is-ended {
  background: rgba(154, 164, 191, 0.15);
  color: var(--muted);
}

.match-clock {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.match-page-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

/* Match page (operator) */
body.match-page-body {
  padding: 16px;
  background: #0b0d14;
  min-height: 100vh;
}

.match-page {
  max-width: 720px;
}

.match-page-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.match-page-header {
  padding: 16px;
  margin-bottom: 16px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.match-page-tournament {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.match-page-title {
  margin: 0 0 8px;
  font-size: 22px;
  color: var(--accent);
}

.match-page-meta {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
}

.match-page-connect {
  margin: 0 0 8px;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  color: var(--accent);
}

.match-page-section {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.match-page-section h2 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--accent);
}

.match-page-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.match-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.match-page-status {
  position: static;
  margin-top: 12px;
}

.match-archive-accuracy {
  font-size: 13px;
  color: var(--overlay-muted, #aab);
  margin-bottom: 8px;
  line-height: 1.5;
}

.match-archive-events {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.45;
}

.match-archive-events li {
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* ---- Map overlay toolbar (top-left, icon buttons) ---- */
.map-toolbar {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 14;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  background: rgba(17, 22, 34, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  pointer-events: auto;
}

.map-tb-btn {
  position: relative;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.map-tb-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.map-tb-btn img {
  width: 18px;
  height: 18px;
  filter: invert(1);
  opacity: 0.85;
  pointer-events: none;
}

.map-tb-btn[aria-pressed="true"] {
  background: rgba(94, 160, 255, 0.28);
  border-color: rgba(120, 175, 255, 0.6);
}

.map-tb-btn[aria-pressed="true"] img {
  opacity: 1;
}

.map-tb-sep {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.14);
  margin: 0 2px;
}

/* Main toggle button + its settings caret, grouped so they read as one control. */
.map-tb-group {
  display: inline-flex;
  align-items: stretch;
}

.map-tb-caret {
  width: 13px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin-left: -1px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #cdd6f4;
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
}

.map-tb-caret:hover {
  background: rgba(255, 255, 255, 0.1);
}

.map-tb-caret[aria-expanded="true"] {
  background: rgba(94, 160, 255, 0.28);
  border-color: rgba(120, 175, 255, 0.6);
  color: #fff;
}

.map-tb-heatmap-popover {
  min-width: 210px;
  max-width: 260px;
}

/* The heatmap field labels lose their .map-spawns-section scoped styles once
   relocated into the toolbar popover; restore block layout + full-width ranges. */
.map-tb-heatmap-popover .dbg-field {
  display: block;
  margin: 4px 0;
  width: 100%;
  font-size: 12px;
  color: #eef2ff;
}

.map-tb-heatmap-popover .dbg-field input[type="range"] {
  width: 100%;
  margin-top: 4px;
  accent-color: #5eead4;
}

.map-tb-heatmap-popover .dbg-field select {
  margin-left: 6px;
  max-width: 100%;
  font-size: 12px;
  background: #1a1f2e;
  color: #eef2ff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  padding: 2px 4px;
}

.map-tb-heatmap-popover .dbg-toggle {
  display: block;
  margin: 4px 0;
}

.map-tb-heatmap-popover .dbg-field.is-disabled {
  opacity: 0.55;
}

.map-tb-heatmap-popover .spawn-heatmap-player-toggles {
  margin: 2px 0 0;
}

.map-tb-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(21, 27, 40, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.map-tb-popover.hidden {
  display: none;
}

.map-tb-zoom-popover {
  min-width: 190px;
}

.map-tb-zoom-slider {
  flex: 1;
}

.map-tb-zoom-value {
  min-width: 38px;
  font-size: 11px;
  color: #cdd6f4;
}

.map-tb-select {
  background: #0e1320;
  color: #eef2ff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12px;
  max-width: 220px;
}

.map-tb-popover-list {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 210px;
  max-width: 280px;
  max-height: 340px;
  overflow: auto;
  color: #eef2ff;
  font-size: 12px;
}

.map-tb-popover-row {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.map-tb-popover-row-range {
  flex-wrap: wrap;
  cursor: default;
}

.map-tb-popover-row-range input[type="range"] {
  flex: 1 1 110px;
  min-width: 90px;
}

.map-tb-popover-range-val {
  min-width: 2.5em;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #9aa6c4;
}

.map-tb-pop-head {
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #9aa6c4;
  margin-top: 2px;
}

.map-tb-handle {
  font-size: 16px;
  line-height: 1;
  color: #cdd6f4;
  font-weight: 700;
}

.map-toolbar.collapsed {
  gap: 0;
  padding: 2px;
}

.map-toolbar.collapsed > *:not(.map-tb-handle) {
  display: none;
}

/* ---- Item controls (Items popover + settings) ---- */
.spawn-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
}

.spawn-item-row-child {
  padding-left: 8px;
}

.spawn-item-row.is-disabled {
  opacity: 0.4;
}

.spawn-item-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex: 0 0 auto;
}

.spawn-item-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #eef2ff;
}

.spawn-item-states {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}

.spawn-item-state {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}

.spawn-item-state:hover {
  background: rgba(255, 255, 255, 0.1);
}

.spawn-item-state img {
  width: 14px;
  height: 14px;
  filter: invert(1);
  opacity: 0.6;
  pointer-events: none;
}

.spawn-item-state[aria-pressed="true"] {
  background: rgba(94, 160, 255, 0.28);
  border-color: rgba(120, 175, 255, 0.6);
}

.spawn-item-state[aria-pressed="true"] img {
  opacity: 1;
}

.spawn-item-details {
  margin: 2px 0 4px 0;
}

.spawn-item-details > summary {
  cursor: pointer;
  font-size: 11px;
  color: #9aa6c4;
  padding: 2px 0;
}

/* ---- Settings modal (was side panel) ---- */
.map-spawns-backdrop {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(4, 6, 12, 0.55);
  pointer-events: auto;
}

.map-spawns-backdrop.hidden {
  display: none;
}

.map-spawns-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%);
  width: min(420px, 94%);
  max-height: 90%;
  z-index: 31;
}
