/* TACTICAL MAP (tacmap.js): the square minimap (lane runs horizontally) in the top-right
   corner and the near-full-screen map overlay. The old #mmwrap rules in
   index.html / hud.css / hud-navigation.css are overridden here as a block. */

:root { --tm-top: 64px; --tm-right: 24px; --tm-w: 200px; --tm-h: var(--tm-w); }
body.touch { --tm-top: 68px; --tm-right: 16px; --tm-w: 170px; }
@media (max-width: 700px), (max-height: 450px) {
  :root, body.touch { --tm-w: 124px; }
}

/* ------------------------------ mini strip ------------------------------ */
html body #mmwrap.tm-mini {
  display: none !important;
  position: fixed !important; inset: auto !important;
  top: var(--tm-top) !important; right: var(--tm-right) !important; left: auto !important; bottom: auto !important;
  width: var(--tm-w) !important; height: var(--tm-h) !important;
  transform: none !important; margin: 0 !important; padding: 0 !important;
  z-index: 55; pointer-events: auto; cursor: pointer;
  border: 1px solid rgba(88,216,255,.38) !important; border-radius: 4px !important;
  background: #051316 !important; overflow: hidden;
  box-shadow: 0 6px 20px rgba(0,0,0,.35), inset 0 0 0 1px rgba(0,0,0,.4) !important;
  transition: border-color .15s, box-shadow .15s;
}
html body #mmwrap.tm-mini.tm-on { display: block !important; }
html body #mmwrap.tm-mini::before, html body #mmwrap.tm-mini::after { content: none !important; }
html body #mmwrap.tm-mini:hover { border-color: #58d8ff !important; box-shadow: 0 0 16px rgba(88,216,255,.3) !important; }
html body #mmwrap.tm-mini #minimap {
  display: block; width: 100% !important; height: 100% !important; margin: 0 !important;
  border: 0 !important; background: none !important;
}
/* edge vignette so markers read over the chart */
html body #mmwrap.tm-mini::after {
  content: '' !important; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 18px 4px rgba(3,12,14,.85);
}
.tm-mini-tag {
  position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: center;
  padding: 3px 7px; pointer-events: none; z-index: 1;
  font: 600 9px/1.2 'Share Tech Mono', Consolas, monospace; letter-spacing: .16em;
  color: #9fd9e0; text-shadow: 0 1px 3px #031114;
  background: linear-gradient(180deg, rgba(3,14,17,.8), transparent);
}
.tm-mini-open { color: #ff9a62; font-weight: 600; }
.tm-mini-open::after { content: ' ⤢'; }
/* things that used to own the top-right corner move below the strip */
html body #invhud { top: calc(var(--tm-top) + var(--tm-h) + 10px); }
body.paused #mmwrap.tm-mini, body.invasion-building #mmwrap.tm-mini,
body:is(.in-hangar, .hangar-departure) #mmwrap.tm-mini, body.tacmap-open #mmwrap.tm-mini { visibility: hidden !important; }

/* ------------------------------- overlay -------------------------------- */
#tacmap {
  position: fixed; inset: 0; z-index: 25000; display: flex; align-items: center; justify-content: center;
  padding: clamp(8px, 3vh, 28px) clamp(8px, 2.5vw, 36px);
  background: rgba(2,8,11,.62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  color: #dcecef; font-family: 'Segoe UI', system-ui, sans-serif;
  animation: tm-in .18s ease-out;
}
#tacmap[hidden] { display: none !important; }
@keyframes tm-in { from { opacity: 0; transform: scale(1.01); } }
.tm-panel {
  width: 100%; height: 100%; display: flex; flex-direction: column; min-height: 0;
  border: 1px solid rgba(88,216,255,.35); border-radius: 6px; overflow: hidden;
  background: linear-gradient(180deg, rgba(6,20,24,.97), rgba(4,13,16,.97));
  box-shadow: 0 24px 60px rgba(0,0,0,.55);
}
.tm-head {
  display: flex; align-items: center; gap: 18px; padding: 10px 12px 10px 18px;
  border-bottom: 1px solid rgba(88,216,255,.2);
}
.tm-title { display: flex; flex-direction: column; }
.tm-eyebrow { color: #58d8ff; font: 10px 'Share Tech Mono', monospace; letter-spacing: .24em; }
.tm-title h2 { margin: 0; font: 900 24px/1 'Big Shoulders Stencil', Impact, sans-serif; letter-spacing: .12em; }
.tm-legend {
  flex: 1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 16px;
  color: #9ab7bd; font: 10px 'Share Tech Mono', monospace; letter-spacing: .14em;
}
.tm-legend span { display: flex; align-items: center; gap: 6px; }
.tm-dot { width: 8px; height: 8px; border-radius: 50%; }
.tm-dot.you { background: #ff8a52; border-radius: 1px; transform: rotate(45deg); }
.tm-dot.blue { background: #58d8ff; } .tm-dot.red { background: #ff5a48; }
.tm-hex { width: 10px; height: 10px; border: 2px solid #d7cf9c; border-radius: 3px; }
.tm-crate { width: 7px; height: 7px; border: 1.5px solid #ffb347; transform: rotate(45deg); }
.tm-close {
  flex: none; width: 40px; height: 40px; cursor: pointer; font-size: 16px; color: #b9d5de;
  border: 1px solid rgba(88,216,255,.3); background: rgba(8,18,25,.8);
}
.tm-close:hover, .tm-close:focus-visible { color: #fff; border-color: #58d8ff; outline: none; }

.tm-body { flex: 1; min-height: 0; display: flex; }
.tm-stage { position: relative; flex: 1; min-width: 0; }
.tm-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.tm-hint {
  position: absolute; left: 12px; bottom: 8px; margin: 0; pointer-events: none;
  color: #7f9aa1; font: 10px 'Share Tech Mono', monospace; letter-spacing: .14em;
}
.tm-list {
  flex: none; width: clamp(200px, 22vw, 290px); overflow-y: auto; padding: 10px;
  border-left: 1px solid rgba(88,216,255,.15); background: rgba(3,11,13,.6);
  display: flex; flex-direction: column; gap: 5px;
}
.tm-list-head {
  display: flex; justify-content: space-between; margin-bottom: 4px;
  color: #58d8ff; font: 10px 'Share Tech Mono', monospace; letter-spacing: .2em;
}
.tm-list-head b { color: #dcecef; font-weight: 400; }
.tm-empty { color: #7f9aa1; font-size: 12px; }
.tm-row {
  display: grid; grid-template-columns: 26px 1fr auto; grid-template-rows: auto auto; column-gap: 9px; row-gap: 2px;
  align-items: center; width: 100%; padding: 7px 9px; text-align: left; color: inherit; font: inherit;
  border: 1px solid rgba(255,255,255,.06); border-left: 3px solid #d7cf9c; background: rgba(8,20,24,.8);
}
.tm-row.blue { border-left-color: #58d8ff; } .tm-row.red { border-left-color: #ff5a48; }
.tm-row.alert { box-shadow: inset 0 0 0 1px rgba(255,90,72,.5); }
button.tm-row { cursor: pointer; }
button.tm-row:hover, button.tm-row:focus-visible { background: rgba(22,52,62,.9); border-color: rgba(88,216,255,.5); outline: none; }
.tm-num {
  grid-row: 1 / 3; display: grid; place-items: center; width: 26px; height: 26px;
  font: 700 13px 'Share Tech Mono', monospace; color: #d7cf9c; border: 1px solid currentColor; border-radius: 3px;
}
.tm-row.blue .tm-num { color: #58d8ff; } .tm-row.red .tm-num { color: #ff5a48; }
.tm-meta { display: flex; flex-direction: column; min-width: 0; }
.tm-meta strong { font-size: 12.5px; font-weight: 600; letter-spacing: .04em; }
.tm-meta small { color: #7f9aa1; font: 9.5px 'Share Tech Mono', monospace; letter-spacing: .1em; }
.tm-state { grid-column: 2; min-width: 0; color: #9ab7bd; font: 10px 'Share Tech Mono', monospace; letter-spacing: .12em; }
.tm-row.alert .tm-state { color: #ff7a66; }
.tm-go { grid-column: 3; grid-row: 1 / 3; align-self: center; padding: 4px 6px; border: 1px solid rgba(88,216,255,.4); color: #58d8ff; white-space: nowrap; font: 700 10px 'Share Tech Mono', monospace; letter-spacing: .12em; }

@media (max-width: 760px), (max-height: 450px) {
  .tm-head { padding: 6px 8px 6px 12px; gap: 10px; }
  .tm-title h2 { font-size: 18px; }
  .tm-legend { gap: 4px 10px; font-size: 9px; }
  .tm-list { width: 190px; padding: 6px; }
  .tm-row { padding: 5px 7px; }
}
@media (max-width: 560px) {
  .tm-body { flex-direction: column; }
  .tm-list { width: auto; max-height: 38%; border-left: 0; border-top: 1px solid rgba(88,216,255,.15); }
  .tm-legend { display: none; }
}
