<!-- SOLID CITY · part 2889 -->
10), pad = pill ? 4 * k : 1, w = tw + pad * 2, h = fh * 1.15, gap = 5 * k;
    var spots = [[i.bx + gap, i.by - h / 2], [i.bx - gap - w, i.by - h / 2], [i.bx - w / 2, i.by + gap], [i.bx - w / 2, i.by - gap - h], [i.bx + gap, i.by + gap * 0.4], [i.bx - gap - w, i.by + gap * 0.4], [i.bx + gap, i.by - gap * 0.4 - h], [i.bx - gap - w, i.by - gap * 0.4 - h]];
    if (!pill) spots = spots.slice(0, 2);
    for (var n = 0; n <= spots.length; n++) {
      var last = n === spots.length; if (last && !pill) return false;   // featured labels always show
      var sp = spots[last ? 0 : n], x0 = Math.max(2, Math.min(W - 2 - w, sp[0])), y0 = Math.max(2, Math.min(H - 2 - h, sp[1])), b = [x0, y0, x0 + w, y0 + h];
      if (!last && !free(b)) continue;
      boxes.push(b);
      var tx = x0 + pad, ty = y0 + h * 0.8;
      if (pill) { var r = h / 2; g.fillStyle = col; g.beginPath(); g.moveTo(x0 + r, y0); g.arcTo(x0 + w, y0, x0 + w, y0 + h, r); g.arcTo(x0 + w, y0 + h, x0, y0 + h, r); g.arcTo(x0, y0 + h, x0, y0, r); g.arcTo(x0, y0, x0 + w, y0, r); g.closePath(); g.fill(); g.strokeStyle = 'rgba(0,0,0,.7)'; g.lineWidth = 1.2 * k; g.stroke(); g.fillStyle = '#0a0608'; g.fillText(txt, tx, ty); }
      else { g.strokeStyle = 'rgba(0,0,0,.85)'; g.lineWidth = 3 * k; g.strokeText(txt, tx, ty); g.fillStyle = col; g.fillText(txt, tx, ty); }
      return true;
    }
    return false;
  }
  g.save(); g.lineJoin = 'round';
  // featured: distinct colour, outlined dot, label pill (nearest first so close ones win the space)
  var feat = list.filter(function (i) { return FEAT[i.c.id]; });
  feat.forEach(function (i) {
    var f = FEAT[i.c.id], rr = (i.c === fol ? 6 : 4.5) * k;
    g.fillStyle = f.col; g.beginPath(); g.arc(i.bx, i.by, rr, 0, Math.PI * 2); g.fill(); g.strokeStyle = '#000'; g.lineWidth = 1.5 * k; g.stroke();
    boxes.push([i.bx - rr, i.by - rr, i.bx + rr, i.by + rr]);
  });
  g.font = 'bold ' + Math.round(13 * k) + 'px system-ui';
  feat.forEach(function (i) { i.lab = label(i, FEAT[i.c.id].lab, FEAT[i.c.id].col, true); });
  g.font = 'bold ' + Math.round(11 * k) + 'px system-ui';
  list.filter(function (i) { return !FEAT[i.c.id]; }).slice(0, big ? 99 : 3).forEach(function (i) { label(i, big ? i.c.name.split(' ')[0].slice(0, 8) : initials(i.c.name), colOf(i.c), false); });
  g.restore();
  lastLabels = feat.map(function (i) { return i.c.id + (i.lab ? '' : '!'); });
};
var lastLabels = [];

/* ---- big map ---- */
function setBig(on) {
  big = !!on; radarEl.classList.toggle('rf-big', big);
  var px = big ? 480 : 240; if (radarEl.width !== px) { radarEl.width = radarEl.height = px; }
  var b = $('rf-big'); if (b) b.textContent = big ? '\u2922 Smaller map' : '\u2922 Bigger map';
}

/* ---- picker ---- */
(function css() {
  var st = document.createElement('style');
  st.textContent = '#sc-radar{pointer-events:auto;cursor:pointer;touch-action:manipulation}' +
    '#sc-radar.rf-big{width:min(88vw,58vh,520px)!important;height:min(88vw,58vh,520px)!important;top:calc(60px + env(safe-area-inset-top))!important;right:50%!important;transform:translateX(50%);z-index:15;opacity:1!important}' +
    '.rf-pick{position:absolute;z-index:23;left:50%;bottom:calc(10px + env(safe-area-inset-bottom));transform:translateX(-50%);width:min(460px,96vw);max-height:40vh;overflow:auto;background:rgba(8,5,9,.96);border:2px solid #e8c36a;border-radius:14px;padding:8px 10px;color:#f3e6c4;font:14px system-ui;pointer-events:auto}' +
    '.rf-hd{display:flex;align-items:center;gap:6px;margin-bottom:4px}.rf-hd b{flex:1;letter-spacing:.06em;color:#e8c36a}' +
    '.rf-row{display:flex;align-items:center;gap:6px;padding:4px 0;border-top:1px solid rgba(232,195,106,.18)}' +
    '.rf-dot{width:14px;height:14px;border-radius:50%;flex:none;border:1px solid #000}.rf-nm{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rf-nm small{display:block;opacity:.7}' +
    '.rf-pick button{min-width:48px;min-height:48px;padding:0 8px;border-radius:10px;border:1px solid #e8c36a;background:#1a1216;color:#f3e6c4;font:600 13px system-ui;cursor:pointer}' +
    '.rf-pick button:active{background:#3a2a1a}';
  document.head.appendChild(st);
})();
function closePicker() { if (picker) { picker.remove(); picker = null; } }
function openPicker(only) {
  closePicker();
  var p = me(), list = CZ.roster.filter(function (c) { return c.x != null; }).map(function (c) { return { c: c, d: Math.hypot(c.x - p.x, c.z - p.z) }; })
    .sort(function (a, b) { return (FEAT[b.c.id] && b.d < 900 ? 1 : 0) - (FEAT[a.c.id] && a.d < 900 ? 1 : 0) || a.d - b.d; });
  if (only) list = list.filter(function (i) { return i.c === only; }); else list = list.slice(0, 8);
  var el = document.createElement('div'); el.className = 'rf-pick'; el.id = 'rf-pick';
  var h = '<div class="rf-hd"><b>' + (only ? 'CITIZEN' : 'NEARBY CITIZENS') + '</b><button type="button" id="rf-big"></button><button type="button" id="rf-x" aria-label="Close">\u2715</button></div>';
  list.forEa