<!-- SOLID CITY · part 72 -->
/ 2; g.save(); g.strokeStyle = 'rgba(232,195,106,.55)'; g.lineWidth = 2; g.beginPath(); ROADS.forEach(function (r) { r.pts.forEach(function (q, i) { var x = W2 + (q.x - ax) * sc, y = W2 + (q.z - az) * sc; if (i) g.lineTo(x, y); else g.moveTo(x, y); }); }); g.stroke(); g.restore(); }
  CAMPUS.forEach(function (c) { blip(c.x, c.z, '#e8c36a', fl ? 3 : 5, fl ? '' : RADAR[c.id]); }); }
function init() {
  U.state = 'loading'; var t0 = performance.now();
  try {
    CAMPUS.forEach(addHallSolids);
    planRoads(); buildWorld(); hyperStops(); watchTour();
    U.state = 'ready'; U.initMs = Math.round(performance.now() - t0);
    curriculum().then(function () { if (U.pending) { var p = U.pending; U.pending = null; p(); } }).catch(function () {});
    arrive();
  } catch (e) { U.state = 'failed'; try { console.warn('[city] Solid City University skipped:', e && e.message); } catch (x) {} }
}
function arrive() {   // /city/?to=university  or  ?to=<campus id>
  var to = QS.get('to'); if (!to) return;
  var c = CM.get(to), p = c ? c.front : (to === 'university' ? HUB_STAND : null);
  if (!p) return;
  (function wait() {
    var boot = $('sc-boot'); if ((boot && !boot.hidden) || S.mode !== 'walk') return setTimeout(wait, 500);
    S.p.x = p.x; S.p.z = p.z; S.p.y = A.groundAt(p.x, p.z);
    var tx = c ? c.x : HUB.x, tz = c ? c.z : HUB.z; S.camYaw = Math.atan2(-(tx - p.x), -(tz - p.z));
    if (c) { U.said[c.id] = true; openCampus(c.id); } else openDirectory();
    if (window.CityHyper && CityHyper.narrate) CityHyper.narrate('Welcome to <b>Solid City University</b>: eight campuses on the Ring, linked to the capital by the lit University roads. Say "drive me to sciences" or open the directory.', 9);
  })();
}

/* ======================= panels: directory, catalog, reader, ask, library ======================= */
var P = null, body = null;
function styles() {
  if ($('uni-css')) return;
  var css = document.createElement('style'); css.id = 'uni-css';
  css.textContent = '#uni-panel{position:absolute;z-index:22;left:12px;top:calc(110px + env(safe-area-inset-top));bottom:16px;width:min(440px,92vw);display:flex;flex-direction:column;background:rgba(10,6,10,.93);border:2px solid #e8c36a;border-radius:16px;color:#f6e9c4;font:14px/1.45 system-ui,sans-serif;pointer-events:auto;box-shadow:0 10px 40px #000a;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}' +
    '#uni-panel[hidden]{display:none}#uni-panel .u-hd{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid #3a2228}#uni-panel .u-hd b{flex:1;color:#e8c36a;font:700 16px Georgia,serif;letter-spacing:.04em}' +
    '#uni-panel .u-bd{flex:1;overflow:auto;padding:10px 12px;-webkit-overflow-scrolling:touch;touch-action:pan-y}#uni-panel button,#uni-panel .u-btn{min-height:40px;min-width:44px;padding:0 12px;border-radius:12px;border:1px solid #e8c36a;background:#140c10;color:#f6dc8e;font:700 13px system-ui,sans-serif;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;justify-content:center}' +
    '#uni-panel button.gold{background:#e8c36a;color:#140c10}#uni-panel .u-x{min-width:40px}#uni-panel .u-row{display:flex;gap:6px;flex-wrap:wrap;margin:8px 0}#uni-panel .u-tabs{display:flex;gap:6px;margin:4px 0 10px}#uni-panel .u-tabs button.on{background:#ff2a40;border-color:#ff2a40;color:#fff}' +
    '#uni-panel .u-item{display:block;width:100%;text-align:left;margin:6px 0;padding:10px 12px;border-radius:12px;border:1px solid #5a1a1f;background:#120a0d;color:#f6e9c4;font:14px/1.35 system-ui,sans-serif;cursor:pointer}#uni-panel .u-item b{color:#ffd27a;display:block}#uni-panel .u-item small{color:#b9a3a3}' +
    '#uni-panel .u-meta{color:#b9a3a3;font-size:12px}#uni-panel h3{margin:6px 0;color:#ffd27a;font:700 17px Georgia,serif}#uni-panel h4{margin:10px 0 4px;color:#e8c36a}#uni-panel p{margin:6px 0}' +
    '#uni-panel textarea,#uni-panel input,#uni-panel select{width:100%;box-sizing:border-box;margin:4px 0;padding:9px;border-radius:10px;border:1px solid #6b5220;background:#0b0709;color:#fff;font:14px system-ui,sans-serif}#uni-panel textarea{min-height:84px;resize:vertical}' +
    '#uni-panel .u-ans{border-left:3px solid #e8c36a;padding:6px 10px;margin:8px 0;background:#120a0d;border-radius:0 10px 10px 0}#uni-panel .u-err{color:#ff7272}#uni-panel .u-md a{color:#f6dc8e}#uni-panel .u-md pre{background:#0b0709;padding:8px;border-radius:8px;overflow:auto}#uni-panel .u-md hr{border:0;border-top:1px solid #6b5220;margin:12px 0}#uni-panel .u-md blockquote{border-left:3px solid #e8c36a;margin:6px 0;padding-left:10px}' +
    '#uni-btn[hidden]{display:none}#uni-btn{position:absolute;z-index:13;left:8px;bottom:calc(16px + env(safe-area-inset-bottom));min-height:44px;padding:0 14px;border-radius:22px;border:1px solid #e8c36a;background:rgba(10,6,10,.85);color:#f6dc8e;font:800 12px system-ui,sans-serif;letter-spacing:.1em;pointer-events:auto;cursor:pointer}' +
    '@media (max-width:600px){#uni-panel{left:0;right:0;wi