:root {
  --bg: #0b1220;
  --panel: #121b2f;
  --panel-2: #1a2742;
  --text: #e7ecf7;
  --muted: #9fb0d6;
  --grid: #2d3d60;
  --active: #65b3ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.page {
  padding: 12px;
  max-width: 1400px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.topbar a {
  color: #9bd0ff;
  text-decoration: none;
}

.chip {
  border: 1px solid #2f4a78;
  background: #15345f;
  color: var(--text);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
}

.map-card,
.list-card {
  border: 1px solid #253452;
  background: var(--panel);
  border-radius: 12px;
  padding: 10px;
}

.map-card {
  overflow: hidden;
  min-height: 62vh;
  position: relative;
  touch-action: none;
}


.hover-name {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  background: rgba(8, 14, 26, 0.88);
  border: 1px solid #3a5a8f;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  color: #eaf2ff;
  pointer-events: none;
  z-index: 30;
  white-space: nowrap;
  text-align: center;
}

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

.list-card {
  margin-top: 10px;
}

.list-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.list-wrap {
  overflow: auto;
  max-height: 38vh;
}

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

th, td {
  border-bottom: 1px solid #253452;
  text-align: left;
  padding: 8px 6px;
}

tr.selected {
  background: #203457;
}

/* ── Map search ──────────────────────────────────────────────────────────── */

.map-search-wrap {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0;
  background: rgba(10, 16, 30, 0.88);
  border: 1px solid #2f4a78;
  border-radius: 8px;
  padding: 0 6px 0 10px;
  backdrop-filter: blur(6px);
  width: min(260px, calc(100% - 24px));
}

.map-search-icon {
  color: var(--muted);
  font-size: 17px;
  margin-right: 4px;
  user-select: none;
  flex-shrink: 0;
}

.map-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  padding: 8px 2px;
  min-width: 0;
}
.map-search-input::placeholder { color: #4a5e80; }
/* Remove native search clear button */
.map-search-input::-webkit-search-cancel-button { display: none; }

.map-search-clear {
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.map-search-clear:hover { color: var(--text); }

tr.search-match td { color: #ffe066; }

/* ── Tile popup ──────────────────────────────────────────────────────────── */

.tile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile-popup {
  background: var(--panel);
  border: 1px solid #2f4a78;
  border-radius: 14px;
  padding: 20px 22px 18px;
  min-width: 270px;
  max-width: 340px;
  width: calc(100vw - 32px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  position: relative;
}

.tile-popup-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.tile-popup-close:hover { color: var(--text); }

.tile-popup-rs {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--active);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.tile-popup-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  word-break: break-word;
}

.tile-popup-coords {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.coord-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.coord-lbl {
  width: 84px;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 11px;
}

.coord-val {
  flex: 1;
  font-family: 'Courier New', monospace;
  color: #c5d8ff;
  background: #0d1728;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 12px;
  letter-spacing: 0.03em;
}

.coord-row.is-primary .coord-val {
  color: #fff;
  background: #132244;
  border: 1px solid #2f4a78;
}

.copy-btn {
  flex-shrink: 0;
  background: #1a3060;
  border: 1px solid #2f4a78;
  color: var(--active);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.copy-btn:hover  { background: #244380; }
.copy-btn.copied { color: #6ee7b7; border-color: #2a6050; }

@media (max-width: 920px) {
  .map-card { min-height: 52vh; }
  .list-wrap { max-height: 42vh; }
}
