/* Map overlays: readout tiles (hud.js), pointer to a target (pointer.js), vehicle card, layers sheet rows.
   Positions come from --nx-l / --nx-t / --nx-b / --nx-r that map.js measures from the shell's variables
   (--dock-b, --panel-l, --chrome-t) and the controls on the map, so nothing here uses a fixed offset. No class-name or :has() selectors. */

.map-top .map-look:empty { display: none; }
.map-tr { margin-left: auto; }

/* ---------- orientation button */
.fab.compass .cmp { display: grid; place-items: center; transition: transform .12s ease-out; }
.fab.compass .cmp svg { width: 24px; height: 24px; }
.fab.compass.accent .cmp svg { fill: currentColor; }

/* ---------- readout dock */
.nx-hud { --nx-bg: rgba(14, 17, 21, .86); --nx-fg: #f2f4f7; --nx-mut: #aab3be; --nx-num: 22px; --nx-speed: 36px; --nx-lab: 12px;
  position: absolute; z-index: 6; left: 0; top: 0; /* placed by hud.js: dragged by its handle, kept inside the visible map */
  width: max-content; max-width: calc(100% - var(--nx-l, 0px) - var(--nx-r, 76px) - 12px);
  display: flex; flex-direction: column; padding: 0 6px 6px; border-radius: 18px; background: var(--nx-bg); color: var(--nx-fg);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .09), 0 6px 20px rgba(0, 0, 0, .45); touch-action: none; user-select: none; -webkit-user-select: none; font-variant-numeric: tabular-nums; }
.nx-hud[hidden] { display: none; }
.nx-hud { max-height: calc(100% - var(--nx-b, 0px) - var(--nx-t, 0px) - 24px); }
.nx-hud.dragging { box-shadow: 0 0 0 2px var(--accent, #ffb020), 0 10px 28px rgba(0, 0, 0, .5); }
.nx-hud.dragging .nx-grab { cursor: grabbing; } .nx-grab { cursor: grab; }
.nx-body { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; scrollbar-width: none; touch-action: pan-y; }
.nx-body::-webkit-scrollbar { display: none; }
.nx-hud[data-size="L"] { --nx-num: 32px; --nx-speed: 58px; --nx-lab: 13px; }
.nx-day .nx-hud { --nx-bg: rgba(255, 255, 255, .92); --nx-fg: #0b0d10; --nx-mut: #4a525c; box-shadow: 0 0 0 1px rgba(0, 0, 0, .14), 0 6px 20px rgba(0, 0, 0, .25); }

.nx-grab { position: relative; align-self: stretch; height: 22px; padding: 0; border: 0; background: none; display: grid; place-items: center; color: inherit; }
.nx-grab::before { content: ""; position: absolute; left: 0; right: 0; top: -12px; bottom: -10px; } /* 44 px target around a slim handle */
.nx-grab i { display: block; width: 36px; height: 4px; border-radius: 2px; background: currentColor; opacity: .35; transition: transform .2s ease-out; }
.nx-hud[data-open="true"] .nx-grab i { transform: scaleX(.7); opacity: .5; }

.nx-main { display: flex; flex-wrap: wrap; gap: 2px; }
.nx-tile { flex: 1 1 auto; min-width: max-content; padding: 2px 8px 4px; display: flex; flex-direction: column; justify-content: flex-end; }
.nx-tile[data-id="speed"] { flex-grow: 1.3; }
.nx-val { display: flex; min-width: 0; align-items: baseline; gap: 3px; white-space: nowrap; }
.nx-v { font: 700 var(--nx-num)/1.05 var(--font); }
.nx-tile[data-id="speed"] .nx-v { font-size: var(--nx-speed); letter-spacing: -.5px; line-height: 1; }
.nx-u { font: 600 12px/1 var(--font); color: var(--nx-mut); white-space: nowrap; }
.nx-l { margin-top: 2px; font: 600 var(--nx-lab)/1.2 var(--font); color: var(--nx-mut); white-space: nowrap; }

.nx-more-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .2s ease-out; }
.nx-more { min-height: 0; overflow: hidden; visibility: hidden; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px 2px; transition: visibility 0s .2s; }
.nx-hud[data-open="true"] .nx-more-wrap { grid-template-rows: 1fr; }
.nx-hud[data-open="true"] .nx-more { visibility: visible; transition-delay: 0s; padding-top: 6px; }
.nx-more:empty { padding: 0 !important; }

/* anchored at the bottom the grid opens upward and the compact row stays put */
.nx-hud[data-cy="b"] .nx-more-wrap { order: -1; }
.nx-hud[data-cy="b"] .nx-more { padding-top: 0; }
.nx-hud[data-cy="b"][data-open="true"] .nx-more { padding-top: 0; padding-bottom: 6px; }
.nx-hud[data-size="L"] .nx-more { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }

.map-stage.da-on .nx-hud, .map-stage.da-on .nx-tgt, .map-stage.da-on .nx-tdot, .map-stage.da-on .nx-mcard { display: none !important; }

/* ---------- pointer to a target */
.nx-tgt { position: absolute; left: 0; top: 0; z-index: 6; display: flex; align-items: center; max-width: min(280px, calc(100% - 24px)); border-radius: 24px; background: #0b0d10; color: #fff;
  box-shadow: 0 0 0 2px var(--accent, #ffb020), 0 0 0 4px #fff, 0 4px 14px rgba(0, 0, 0, .5); will-change: transform; }
.nx-tgt[hidden], .nx-tdot[hidden] { display: none; }
.nx-tgt.stale { box-shadow: 0 0 0 2px #aab2bb, 0 0 0 4px #fff, 0 4px 14px rgba(0, 0, 0, .5); }
.nx-tmain { display: flex; align-items: center; gap: 8px; min-height: 44px; min-width: 0; padding: 0 4px 0 10px; border: 0; background: none; color: inherit; font: inherit; text-align: left; }
.nx-tico { display: grid; flex: none; place-items: center; width: 24px; height: 24px; color: var(--accent, #ffb020); }
.nx-tico .ico { grid-area: 1 / 1; display: grid; }
.nx-tico svg { width: 22px; height: 22px; fill: currentColor; }
.nx-tgt[data-on="1"] .nx-tico .ico:first-child, .nx-tgt[data-on="0"] .nx-tico .ico:last-child { display: none; }
.nx-tgt[data-on="1"] .nx-tico svg { fill: none; }
.nx-ttxt { display: flex; flex-direction: column; min-width: 0; }
.nx-tl { font: 700 14px/1.15 var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nx-ts { font: 600 12px/1.2 var(--font); color: #cbd2da; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nx-tx { display: grid; flex: none; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; color: #cbd2da; }
.nx-tx svg { width: 18px; height: 18px; }
.nx-tdot { position: absolute; left: -8px; top: -8px; z-index: 5; width: 16px; height: 16px; border-radius: 50%; background: var(--accent, #ffb020); box-shadow: 0 0 0 3px #fff, 0 0 0 4.5px #0b0d10; pointer-events: none; will-change: transform; }

/* ---------- vehicle card */
.nx-mcard { position: absolute; z-index: 8; left: calc(var(--nx-l, 0px) + 12px); top: calc(var(--nx-t, 0px) + 6px); width: min(380px, calc(100% - var(--nx-l, 0px) - 24px));
  padding: 8px 8px 10px 14px; border-radius: 18px; background: var(--surface, #14171c); color: var(--text, #f2f4f7); box-shadow: 0 0 0 1px var(--line-strong, rgba(255, 255, 255, .14)), 0 8px 24px rgba(0, 0, 0, .55); }
.nx-day .nx-mcard { background: #fff; color: #0b0d10; }
.nx-mc-head { display: flex; align-items: center; gap: 8px; }
.nx-mc-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nx-mc-name b { font: 700 17px/1.2 var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-mc-name small { font: 600 13px/1.3 var(--font); color: var(--muted, #98a2ad); }
.nx-mc-btns { display: flex; gap: 8px; padding: 6px 6px 0 0; }
.nx-mc-btns .btn { flex: 1; min-height: 48px; gap: 6px; padding: 0 8px; font-size: 14px; }

/* ---------- layers sheet and tile editor (these render in the sheet root, outside the map) */
.nx-segrow { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px 14px; }
.nx-segt { display: flex; flex-direction: column; gap: 2px; }
.nx-pad > .nx-segrow + .nx-segrow { border-top: 1px solid var(--line, rgba(255, 255, 255, .08)); }
.nx-satrows[hidden] { display: none; } /* Satellite only: what is drawn over the picture, and how strong */
.nx-pad > .nx-segrow + .nx-satrows, .nx-satrows > .nx-segrow + .nx-segrow, .nx-pad > .nx-satrows + .nx-segrow { border-top: 1px solid var(--line, rgba(255, 255, 255, .08)); }
.nx-tilthint { margin-top: -4px; }
.nx-lrow { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 0 12px 0 16px; border: 0; background: none; color: inherit; font: inherit; text-align: left; }
.nx-lrow .row-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.nx-lrow:active { background: var(--raised, #1c2026); }
.nx-list { list-style: none; margin: 0; padding: 0; border-radius: var(--r-card, 16px); background: var(--surface, #14171c); box-shadow: 0 0 0 1px var(--line, rgba(255, 255, 255, .08)); overflow: hidden; }
.nx-er { display: flex; align-items: center; gap: 2px; min-height: 52px; padding: 0 4px 0 0; }
.nx-er + .nx-er { border-top: 1px solid var(--line, rgba(255, 255, 255, .08)); }
.nx-er > .nx-en:first-child { padding-left: 16px; }
.nx-er.off .nx-en { color: var(--muted, #98a2ad); }
.nx-er.drag { background: var(--raised, #1c2026); box-shadow: 0 6px 16px rgba(0, 0, 0, .5); position: relative; z-index: 2; }
.nx-grip { display: grid; place-items: center; flex: none; width: 44px; height: 48px; color: var(--muted, #98a2ad); touch-action: none; cursor: grab; }
.nx-en { flex: 1; min-width: 0; display: flex; flex-direction: column; font: 600 15px/1.25 var(--font); }
.nx-en small { font-weight: 400; font-size: 13px; color: var(--muted, #98a2ad); }
.nx-ib { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; color: var(--muted, #98a2ad); }
.nx-ib:disabled { opacity: .35; }
.nx-ib svg { width: 22px; height: 22px; }
.nx-ib.on { color: var(--accent, #ffb020); } .nx-ib.on svg { fill: currentColor; }

@media (prefers-reduced-motion: reduce) {
  .nx-more-wrap, .nx-more, .nx-grab i, .fab.compass .cmp { transition: none !important; }
}

/* one notice at a time above the strip, clear of the dock: the privacy / location pill always sits above the member strip */
.map-priv { bottom: calc(var(--dock-b) + 72px); max-width: calc(100% - var(--panel-l) - 96px); }

/* pointer row inside the dock */
.nx-slot { margin: 0 0 4px; }
.nx-slot[hidden] { display: none; }
.nx-trow { display: flex; align-items: center; border-radius: 12px; background: rgba(255, 176, 32, .14); }
.nx-trow .nx-tmain { flex: 1; min-width: 0; color: inherit; }
.nx-trow .nx-ts { color: var(--nx-mut); }
.nx-trow .nx-tx { color: var(--nx-mut); }
.nx-trow.stale { background: rgba(150, 160, 170, .16); }
.nx-day .nx-trow { background: rgba(194, 120, 0, .13); }
.nx-day .nx-tico { color: #b36b00; }
/* with the row in the dock the edge arrow is just an arrow and a short name */
.nx-tgt[data-dock="1"] .nx-ts, .nx-tgt[data-dock="1"] .nx-tx { display: none; }
.nx-tgt[data-dock="1"] .nx-tl { max-width: 120px; font-size: 13px; }
.nx-tgt[data-dock="1"] .nx-tmain { padding-right: 12px; }

/* ---------- fewer overlays */
.mchip.plain { display: none; }
.stripbtn { display: grid; }
.map-stage.strip-off .map-strip { display: none; }
.nx-badge { position: absolute; top: -2px; right: -2px; display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--accent, #ffb020); color: #0b0d10; font: 800 12px/1 var(--font); font-style: normal; box-shadow: 0 0 0 2px var(--bg, #0b0d10); pointer-events: none; }
.nx-badge[hidden] { display: none; }
.nx-badge.warn { min-width: 14px; width: 14px; height: 14px; padding: 0; top: 2px; right: 2px; background: var(--warn, #ffb020); }
.nx-badge.lock { background: var(--raised, #1c2026); color: var(--text, #f2f4f7); } .nx-badge.lock svg { width: 12px; height: 12px; }
.fab { position: relative; }
.nx-nx { display: grid; place-items: center; flex: none; width: 44px; height: 44px; margin: -6px -10px -6px 0; border: 0; border-radius: 50%; background: none; color: var(--muted, #98a2ad); }
.nx-nx svg { width: 18px; height: 18px; }

/* ---------- idle dim: controls fade to 35 %, the dock and the pointer stay and only lose weight */
#v-map > .bar, .map-top, .map-fab, .map-strip, .map-priv, .map-chips, .back-pill, .tfollow { transition: opacity .15s ease-out; }
#v-map.nx-idle > .bar, #v-map.nx-idle .map-top, #v-map.nx-idle .map-fab, #v-map.nx-idle .map-strip, #v-map.nx-idle .map-priv, #v-map.nx-idle .map-chips, #v-map.nx-idle .back-pill, #v-map.nx-idle .tfollow { opacity: .35; transition-duration: .6s; }
#v-map.nx-idle .nx-hud { box-shadow: 0 0 0 1px rgba(255, 255, 255, .04), 0 2px 8px rgba(0, 0, 0, .25); }
#v-map.nx-idle .nx-tgt { box-shadow: 0 0 0 2px rgba(255, 176, 32, .7), 0 2px 8px rgba(0, 0, 0, .3); }
@media (prefers-reduced-motion: reduce) {
  #v-map > .bar, .map-top, .map-fab, .map-strip, .map-priv, .map-chips, .back-pill, .tfollow { transition: none !important; }
}

/* the (i) attribution sits top-left under the shell's status chip, clear of the bottom docks, the dock and the buttons */
.map-stage .maplibregl-ctrl-top-left { top: calc(var(--chrome-t, 56px) - 4px); left: calc(var(--panel-l, 0px) + 6px); }
.map-stage .maplibregl-ctrl-top-left .maplibregl-ctrl { margin: 0; }

/* Compact arrangement for short or narrow screens (review item 8). Pinch zooms, so the +/- buttons go first; orientation, layers and
   recentre always stay. Short landscape: the button column becomes a row at the bottom right, under the top-right buttons. The readout
   dock hides itself (hud.js, data-squeezed) when the free map is too short for it. */
.nx-hud[data-squeezed] { display: none !important; }
@media (max-height: 520px) {
  .map-fab #map-in, .map-fab #map-out { display: none; }
  /* one row, left of the top-right buttons (people, layers, full screen), so the sheet at any height leaves them all reachable */
  html:not([data-full="1"]) .map-fab { top: var(--chrome-t); bottom: auto; right: calc(max(12px, var(--safe-r)) + 3 * var(--tap) + 3 * var(--s2)); flex-direction: row-reverse; }
}
@media (max-width: 799px) and (max-height: 760px) {
  #app[data-snap="half"] .map-fab #map-in, #app[data-snap="half"] .map-fab #map-out { display: none; }
}
.nx-grab::after { content: ""; position: absolute; left: 0; right: 0; top: -11px; bottom: -11px; } /* 44 px tall hit area for the 22 px handle */
