
:root {
  --map-stage-min-h: 820px;
  --map-panel-w: 400px;
  --map-bg-0: #04070d;
  --map-bg-1: #09111d;
  --map-border: rgba(122, 171, 255, 0.18);
  --map-text: #e8f1ff;
  --map-muted: #8ea6cf;
  --map-good: #79f0c7;
  --map-cur: #8bc1ff;
}

html,
body {
  min-height: 100%;
}

body.map-page {
  margin: 0;
  color: var(--map-text);
  background:
    radial-gradient(900px 520px at 18% 12%, rgba(30, 72, 140, 0.22), transparent 62%),
    radial-gradient(860px 520px at 82% 18%, rgba(118, 43, 146, 0.16), transparent 58%),
    linear-gradient(180deg, var(--map-bg-1), var(--map-bg-0));
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, var(--map-panel-w));
  gap: 16px;
  padding: 16px;
  align-items: start;
}

.map-main-col {
  min-width: 0;
  display: grid;
  gap: 16px;
  align-content: start;
}

.map-stage-panel,
.map-info-panel,
.map-detail-panel {
  border: 1px solid var(--map-border);
  background: linear-gradient(180deg, rgba(15, 22, 36, 0.88), rgba(6, 10, 18, 0.92));
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  overflow-anchor: none;
}

.map-stage-panel .panel-head,
.map-info-panel .panel-head,
.map-detail-panel .panel-head {
  border-bottom: 1px solid rgba(122, 171, 255, 0.08);
}

.map-stage-body {
  gap: 0;
}

.worldmap-stage {
  position: relative;
  width: 100%;
  min-height: var(--map-stage-min-h);
  height: calc(100vh - var(--pixiHudH, 88px) - 104px);
  max-height: 1120px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(122, 171, 255, 0.12);
  background: linear-gradient(180deg, rgba(7, 10, 18, 0.98), rgba(3, 5, 9, 0.995));
}

.worldmap-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.map-info-panel {
  position: sticky;
  top: calc(var(--hdrStickyOffset, 88px) + 16px);
  align-self: start;
}

.map-info-panel .panel-body,
.map-detail-panel .panel-body {
  overflow: visible;
  overflow-anchor: none;
}

.map-info-shell,
.map-detail-shell {
  display: grid;
  gap: 14px;
}

.map-info-shell--compact {
  gap: 12px;
}

.map-detail-panel {
  min-height: 220px;
}

.wm-card {
  border: 1px solid rgba(122, 171, 255, 0.12);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(18, 27, 42, 0.82), rgba(8, 12, 20, 0.92));
  padding: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.wm-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.wm-title {
  display: grid;
  gap: 4px;
}

.wm-title-main {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.wm-title-main--section {
  font-size: 14px;
}

.wm-title-sub {
  font-size: 12px;
  color: var(--map-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wm-card--collapsible {
  padding: 0;
  overflow: hidden;
}

.wm-section-toggle {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 0;
  color: inherit;
  font: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.wm-section-toggle:hover {
  background: rgba(122, 171, 255, 0.06);
}

.wm-section-toggle:focus-visible {
  outline: 1px solid rgba(139, 193, 255, 0.70);
  outline-offset: -3px;
}

.wm-section-caret {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(122, 171, 255, 0.18);
  color: var(--map-cur);
  background: rgba(9, 14, 24, 0.62);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.wm-section-body {
  padding: 0 14px 14px;
}

.wm-card--collapsible[data-open="0"] .wm-section-body {
  display: none;
}

.wm-gap {
  height: 10px;
}

.wm-muted {
  margin: 0;
  color: var(--map-muted);
  line-height: 1.5;
}

.wm-error {
  color: #ffb5c5;
}


.wm-contract-mini {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(122, 171, 255, 0.10);
  display: grid;
  gap: 8px;
}

.wm-contract-mini-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wm-contract-mini-title,
.wm-contract-mini-deadline {
  color: var(--map-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wm-contract-mini-route,
.wm-contract-route {
  color: var(--map-text);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.wm-contract-list {
  gap: 10px;
}

.wm-contract-item {
  display: grid;
  gap: 10px;
}

.wm-contract-item--active {
  border-color: rgba(121, 240, 199, 0.18);
}

.wm-contract-kv {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  align-items: center;
}

.wm-contract-kv .k {
  color: var(--map-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wm-contract-kv .v {
  color: var(--map-text);
  font-weight: 700;
}

.wm-btn-row {
  display: none;
  flex-wrap: wrap;
  gap: 10px;
}

.wm-btn {
  min-height: 34px;
}

.wm-btn--ghost {
  border-color: rgba(122, 171, 255, 0.18);
  background: rgba(17, 23, 38, 0.78);
}

.wm-hero {
  display: grid;
  gap: 12px;
}

.wm-hero--compact {
  gap: 10px;
}

.wm-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 3;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(122, 171, 255, 0.12);
  background:
    radial-gradient(circle at 20% 18%, rgba(89, 113, 255, 0.20), transparent 26%),
    radial-gradient(circle at 72% 22%, rgba(155, 70, 210, 0.18), transparent 26%),
    linear-gradient(180deg, rgba(12, 17, 29, 0.95), rgba(5, 8, 14, 0.98));
}

.wm-preview-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: auto;
}

.wm-preview-note {
  color: var(--map-muted);
  font-size: 12px;
  letter-spacing: 0.03em;
}

.wm-placeholder {
  display: grid;
  gap: 12px;
  justify-items: start;
}

.wm-big-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-size: 28px;
  font-weight: 800;
  color: #ffffff;
  background: rgba(17, 23, 38, 0.8);
  border: 1px solid rgba(122, 171, 255, 0.12);
}

.wm-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wm-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(122, 171, 255, 0.14);
  color: var(--map-text);
  background: rgba(17, 23, 38, 0.7);
}

.wm-chip--good {
  border-color: rgba(114, 240, 200, 0.24);
  color: #c6fff0;
}

.wm-chip--warn {
  border-color: rgba(255, 255, 255, 0.14);
  color: #e9eef7;
}

.wm-chip--pvp {
  border-color: rgba(255, 105, 137, 0.22);
  color: #ffd1dc;
}

.wm-status-card {
  display: grid;
  gap: 0;
}

.wm-status-grid,
.wm-kv {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
}

.wm-status-grid .k,
.wm-kv .k {
  color: var(--map-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wm-status-grid .v,
.wm-kv .v {
  color: var(--map-text);
  font-weight: 700;
}

.wm-list {
  display: grid;
  gap: 8px;
}

.wm-list-item {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(122, 171, 255, 0.10);
  background: rgba(12, 18, 30, 0.72);
}

.wm-list-name {
  font-weight: 700;
}

.wm-list-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.wm-list-meta {
  color: var(--map-muted);
  font-size: 12px;
}

.wm-exits {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wm-exit {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.06em;
  border: 1px solid rgba(122, 171, 255, 0.12);
  background: rgba(14, 20, 34, 0.78);
}

.wm-minimap-legend {
  display: grid;
  gap: 8px;
}

.wm-minimap-legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--map-text);
  font-size: 13px;
}

.wm-legend-swatch {
  position: relative;
  width: 16px;
  height: 16px;
  display: inline-block;
  flex: 0 0 16px;
}

.wm-legend-swatch--teleport::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  border: 2px solid #56d6ff;
  background: rgba(15, 37, 63, 0.92);
}

.wm-legend-swatch--station::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%) rotate(45deg);
  border: 2px solid #7ef0ff;
  background: rgba(17, 53, 76, 0.92);
}

.wm-legend-swatch--planet::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid #d6e6ff;
  background: rgba(146, 174, 247, 0.92);
}

.wm-legend-swatch--respawn::before,
.wm-legend-swatch--respawn::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: #79f0c7;
  transform: translate(-50%, -50%);
}

.wm-legend-swatch--respawn::before {
  width: 12px;
  height: 2px;
}

.wm-legend-swatch--respawn::after {
  width: 2px;
  height: 12px;
}

.wm-desc-clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}

@media (max-width: 1240px) {
  .map-layout {
    grid-template-columns: 1fr;
  }

  .map-info-panel {
    position: static;
    top: auto;
  }
}

@media (max-width: 720px) {
  .map-layout {
    padding: 12px;
    gap: 12px;
  }

  .map-main-col {
    gap: 12px;
  }

  .worldmap-stage {
    min-height: 520px;
    height: 68vh;
  }
}


.map-info-panel,
.map-detail-panel {
  overflow: hidden;
}

.map-territory-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(122, 171, 255, 0.08);
  background:
    radial-gradient(circle at 16% 0%, rgba(76, 138, 255, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(10, 16, 28, 0.92), rgba(7, 11, 20, 0.86));
}

.map-territory-summary,
.map-territory-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.map-territory-actions {
  margin-left: auto;
}

.map-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(122, 171, 255, 0.14);
  background: rgba(15, 22, 36, 0.78);
  color: var(--map-text);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.map-pill--good {
  border-color: rgba(121, 240, 199, 0.24);
  color: #c8fff1;
}

.map-pill--warn {
  border-color: rgba(255, 208, 124, 0.26);
  color: #ffe3a5;
}

.map-pill--danger {
  border-color: rgba(255, 120, 154, 0.24);
  color: #ffd3df;
}

.map-pill--muted {
  color: var(--map-muted);
}

.map-toggle-btn {
  appearance: none;
  border: 1px solid rgba(122, 171, 255, 0.16);
  background: rgba(12, 18, 30, 0.72);
  color: var(--map-text);
  border-radius: 12px;
  min-height: 32px;
  padding: 0 12px;
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, background .12s ease, box-shadow .12s ease;
}

.map-toggle-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(122, 171, 255, 0.28);
  background: rgba(16, 24, 40, 0.84);
}

.map-toggle-btn.is-active {
  border-color: rgba(126, 200, 255, 0.38);
  background: rgba(27, 42, 72, 0.88);
  box-shadow: inset 0 0 0 1px rgba(126, 200, 255, 0.16);
}

.map-toggle-btn--refresh {
  border-color: rgba(255, 255, 255, 0.12);
}

.wm-chip--danger {
  border-color: rgba(255, 120, 154, 0.24);
  color: #ffd3df;
}

.wm-chip--neutral {
  border-color: rgba(152, 176, 216, 0.18);
  color: #d6e3ff;
}

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

.wm-kv-card {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(122, 171, 255, 0.10);
  background: rgba(12, 18, 30, 0.72);
  display: grid;
  gap: 4px;
}

.wm-kv-card .k {
  color: var(--map-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wm-kv-card .v {
  color: var(--map-text);
  font-weight: 700;
}

.wm-station-access-grid .wm-kv-card .v {
  display: flex;
  align-items: center;
}

.wm-progress {
  display: grid;
  gap: 8px;
}

.wm-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.wm-progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(122, 171, 255, 0.08);
}

.wm-progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(116, 222, 255, 0.92), rgba(176, 107, 255, 0.92));
}

.wm-section-stack {
  display: grid;
  gap: 12px;
}

.wm-note-row {
  display: none;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--map-muted);
  font-size: 12px;
}

.wm-legend-swatch--territory::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid #d6e6ff;
  background: #8fc3ff;
}

.wm-legend-swatch--turret::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%) rotate(45deg);
  border: 1px solid #ffb87c;
  background: rgba(255, 136, 106, 0.92);
}

.wm-legend-swatch--objective::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid #ffffff;
  background: rgba(192, 164, 255, 0.92);
}

.wm-legend-swatch--module::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
  border-radius: 3px;
  border: 1px solid #9df0e2;
  background: rgba(123, 184, 255, 0.92);
}

@media (max-width: 960px) {
  .map-territory-bar {
    padding: 10px 12px;
  }

  .map-territory-actions {
    width: 100%;
    margin-left: 0;
  }

  .wm-kv-grid {
    grid-template-columns: 1fr;
  }
}

/* v4_1 world map readability pass */
.wm-exploration-mini {
  margin-top: 10px;
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(122, 171, 255, 0.10);
  background: rgba(9, 14, 24, 0.58);
}

.map-territory-summary {
  max-width: min(100%, 980px);
}

.map-territory-actions {
  align-self: center;
}
