/* Análise de Spawns — oficina (mapa mundial + distribuição). */

:root {
  --sa-bg: #060a14;
  --sa-panel: rgba(9, 15, 28, 0.94);
  --sa-panel-border: rgba(148, 163, 184, 0.22);
  --sa-text: #e2e8f0;
  --sa-text-dim: #94a3b8;
  --sa-accent: #38bdf8;
  --sa-accent-soft: rgba(56, 189, 248, 0.16);
  --sa-fixed: #a78bfa;
  --sa-wild: #facc15;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--sa-bg);
  color: var(--sa-text);
  font: 14px/1.45 "Segoe UI", system-ui, sans-serif;
}

.sa-app {
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "header header header"
    "roster map sidebar";
  gap: 10px;
  height: 100vh;
  padding: 10px;
}

.sa-header {
  grid-area: header;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--sa-panel);
  border: 1px solid var(--sa-panel-border);
  border-radius: 12px;
}

.sa-header__meta {
  min-width: 0;
  flex: 1;
}

.sa-header__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sa-header__subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--sa-text-dim);
}

.sa-status {
  font-size: 12px;
  color: var(--sa-text-dim);
  white-space: nowrap;
}

.sa-header__actions {
  display: flex;
  gap: 8px;
}

.sa-btn {
  appearance: none;
  border: 1px solid var(--sa-panel-border);
  background: rgba(15, 23, 42, 0.8);
  color: var(--sa-text);
  border-radius: 8px;
  padding: 6px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.sa-btn:hover {
  border-color: var(--sa-accent);
  background: var(--sa-accent-soft);
}

.sa-btn--link {
  display: inline-flex;
  align-items: center;
}

.sa-roster {
  grid-area: roster;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding: 10px;
  background: var(--sa-panel);
  border: 1px solid var(--sa-panel-border);
  border-radius: 12px;
}

.sa-input,
.sa-select {
  width: 100%;
  border: 1px solid var(--sa-panel-border);
  background: rgba(2, 6, 23, 0.7);
  color: var(--sa-text);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
}

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

.sa-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--sa-text-dim);
}

.sa-types {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 72px;
  overflow: auto;
}

.sa-type {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  color: #0f172a;
  opacity: 0.45;
}

.sa-type.is-on {
  opacity: 1;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.sa-roster__list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sa-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.sa-row:hover {
  background: rgba(56, 189, 248, 0.08);
}

.sa-row.is-active {
  border-color: rgba(56, 189, 248, 0.45);
  background: var(--sa-accent-soft);
}

.sa-row__dex {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--sa-text-dim);
}

.sa-row__name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sa-row__counts {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--sa-text-dim);
}

.sa-row__counts b {
  color: var(--sa-wild);
  font-weight: 700;
}

.sa-row__counts i {
  color: var(--sa-fixed);
  font-style: normal;
  font-weight: 700;
}

.sa-map {
  grid-area: map;
  position: relative;
  min-width: 0;
  min-height: 0;
  border-radius: 12px;
  border: 1px solid var(--sa-panel-border);
  overflow: hidden;
  background: #020617;
}

.sa-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.sa-canvas:active {
  cursor: grabbing;
}

.sa-map__toolbar {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.78);
  border: 1px solid var(--sa-panel-border);
  backdrop-filter: blur(8px);
}

.sa-modes {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.9);
}

.sa-mode {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--sa-text-dim);
  border-radius: 6px;
  padding: 5px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.sa-mode.is-active {
  background: var(--sa-accent-soft);
  color: var(--sa-accent);
}

.sa-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--sa-text-dim);
  cursor: pointer;
  user-select: none;
}

.sa-field--inline {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.sa-select--sm {
  width: auto;
  min-width: 88px;
  padding: 4px 8px;
  font-size: 12px;
}

.sa-app:not([data-sa-mode="homes"]) .sa-homes-only {
  display: none;
}

.sa-app:not([data-sa-mode="homes"]) .sa-homes-panel {
  display: none;
}

.sa-tag--sim {
  background: rgba(34, 211, 238, 0.2);
  color: #67e8f9;
}

.sa-map__footer {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.78);
  border: 1px solid var(--sa-panel-border);
  font-size: 12px;
  color: var(--sa-text-dim);
}

.sa-sidebar {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 12px;
  background: var(--sa-panel);
  border: 1px solid var(--sa-panel-border);
  border-radius: 12px;
  overflow: auto;
}

.sa-sidebar__title {
  margin: 0;
  font-size: 16px;
}

.sa-sidebar__meta {
  margin: 0;
  font-size: 12px;
  color: var(--sa-text-dim);
}

.sa-sidebar__h {
  margin: 6px 0 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sa-text-dim);
}

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

.sa-stat {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.55);
  border: 1px solid var(--sa-panel-border);
}

.sa-stat__label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--sa-text-dim);
}

.sa-stat__value {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sa-places {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow: auto;
}

.sa-places li {
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(2, 6, 23, 0.45);
  font-size: 12px;
}

.sa-places .sa-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}

.sa-tag--fixed {
  background: rgba(167, 139, 250, 0.25);
  color: var(--sa-fixed);
}

.sa-tag--wild {
  background: rgba(250, 204, 21, 0.2);
  color: var(--sa-wild);
}

.sa-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.sa-legend__item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--sa-text-dim);
}

.sa-legend__swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

@media (max-width: 1100px) {
  .sa-app {
    grid-template-columns: 240px 1fr;
    grid-template-areas:
      "header header"
      "roster map"
      "sidebar sidebar";
    height: auto;
    min-height: 100vh;
  }

  .sa-map {
    min-height: 55vh;
  }

  .sa-sidebar {
    max-height: 40vh;
  }
}
