/* ==========================================================================
   Real-time 3D host (WebGL canvas + HTML overlays: labels, tooltip, controls)
   ========================================================================== */
:root, :root[data-theme="light"] {
  --scene-sky: linear-gradient(180deg, #e8f0f9 0%, #f4f7fb 46%, #eef1f5 100%);
  --scene-ground: #e8ebf0;
  --scene-fog: #eef1f5;
}
:root[data-theme="dark"] {
  --scene-sky: linear-gradient(180deg, #0d1628 0%, #121c31 50%, #0f1626 100%);
  --scene-ground: #1a2233;
  --scene-fog: #111a2c;
}

.s3 {
  position: relative; overflow: hidden; border-radius: var(--r-lg); background: var(--scene-sky);
  border: 1px solid var(--line); min-height: 300px; outline: none; isolation: isolate; box-shadow: var(--shadow-xs);
}
.s3:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 35%, transparent); }
.s3-canvas, .s3-canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.s3-canvas canvas { cursor: grab; }
.s3-canvas canvas:active { cursor: grabbing; }
.s3::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1; background: radial-gradient(ellipse at 50% 40%, transparent 55%, rgba(15, 23, 42, .06) 100%); }
:root[data-theme="dark"] .s3::after { background: radial-gradient(ellipse at 50% 40%, transparent 50%, rgba(0, 0, 0, .35) 100%); }
.s3-labels { position: absolute; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.s3-layer { position: absolute; inset: 0; }

/* ---------- labels ---------- */
.s3-label {
  position: absolute; left: 0; top: 0; pointer-events: none; white-space: nowrap; will-change: transform;
  font: 600 11.5px/1.25 var(--font); color: #0f172a; background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(15, 23, 42, .08); padding: 4px 9px; border-radius: 999px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .12); margin-top: -6px;
}
.s3-label.pick { pointer-events: auto; cursor: pointer; }
.s3-label.pick:hover { border-color: var(--gold); box-shadow: 0 4px 14px rgba(15, 23, 42, .18); }
.s3-label::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 8px; height: 8px; background: inherit; border-right: 1px solid rgba(15, 23, 42, .08); border-bottom: 1px solid rgba(15, 23, 42, .08); transform: translateX(-50%) rotate(45deg); }
.lbl-hall em { font-style: normal; color: #a97a20; margin-left: 6px; font-size: 10.5px; font-weight: 700; }
.lbl-land { background: rgba(255, 255, 255, .82); font-weight: 500; font-size: 11px; color: #334155; }
.lbl-metro { background: #d6403b; color: #fff; border-color: transparent; }
.lbl-park { font-size: 11px; }
.lbl-park .p { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 5px; background: #2563eb; color: #fff; font-size: 10px; font-weight: 800; margin-right: 5px; vertical-align: -3px; }
.lbl-ghost { background: rgba(232, 240, 251, .9); border: 1px dashed #6b8fc7; color: #33507e; font-weight: 600; }
.lbl-route { background: #b8862b; color: #fff; border-color: transparent; font-size: 12px; }
.lbl-route small { color: rgba(255, 255, 255, .8); }
.lbl-route.metro { background: #d6403b; }
.lbl-route .dot-metro { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #fff; margin-right: 5px; vertical-align: 1px; }
.lbl-venue { font: 700 14px/1.2 var(--display); padding: 8px 15px; border-radius: 12px; background: #0f172a; color: #fff; border-color: transparent; letter-spacing: -.01em; }
.lbl-venue::after { display: none; }
.lbl-zone { font-size: 10.5px; background: rgba(15, 23, 42, .78); color: #fff; border-color: transparent; font-weight: 600; }
.lbl-ent { background: #16a34a; color: #fff; font-size: 10.5px; border-color: transparent; }
.lbl-pav { font-size: 12px; }
.lbl-pav i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.lbl-pav.dim { opacity: .45; }
.lbl-alert { background: #dc2626; color: #fff; border-color: transparent; animation: s3pulse 1.6s infinite; font-weight: 800; letter-spacing: .04em; }
@keyframes s3pulse { 50% { box-shadow: 0 0 0 7px rgba(220, 38, 38, .2); } }

/* ---------- HUD ---------- */
.s3-hud {
  position: absolute; right: 12px; top: 12px; z-index: 5; display: flex; flex-direction: column; gap: 2px; padding: 4px;
  background: rgba(255, 255, 255, .86); border: 1px solid rgba(15, 23, 42, .08); border-radius: 14px; box-shadow: 0 6px 20px rgba(15, 23, 42, .12); backdrop-filter: blur(10px);
}
:root[data-theme="dark"] .s3-hud { background: rgba(17, 26, 46, .82); border-color: rgba(255, 255, 255, .08); }
.s3-hud button { width: 34px; height: 30px; border-radius: 9px; border: 0; background: transparent; color: var(--text2); cursor: pointer; display: grid; place-items: center; font: 700 11px var(--font); }
.s3-hud button svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.s3-hud button:hover { background: var(--panel3); color: var(--text); }
.s3-hud-sep { height: 1px; background: var(--line); margin: 3px 4px; }
.s3-auto .s3-hud [data-cam=auto] { color: #fff; background: var(--gold); }
.s3-hint {
  position: absolute; left: 12px; bottom: 12px; z-index: 4; font-size: 11.5px; color: var(--text2); pointer-events: none;
  background: rgba(255, 255, 255, .82); border: 1px solid rgba(15, 23, 42, .06); padding: 5px 10px; border-radius: 9px; backdrop-filter: blur(8px);
}
:root[data-theme="dark"] .s3-hint { background: rgba(17, 26, 46, .8); border-color: rgba(255, 255, 255, .06); }
.s3-tip {
  position: absolute; left: 0; top: 0; z-index: 8; pointer-events: none; background: #0f172a; color: #f8fafc;
  padding: 9px 12px; border-radius: 12px; font-size: 12.5px; line-height: 1.5; max-width: 290px; box-shadow: 0 12px 30px rgba(15, 23, 42, .3);
}
.s3-tip small { color: #aab4c5; }
.s3-tip b { color: #fff; }
.s3-overlay { position: absolute; z-index: 5; }
.s3-legend {
  left: 12px; top: 12px; background: rgba(255, 255, 255, .9); color: var(--text2); border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 12px; padding: 10px 12px; font-size: 11.5px; display: grid; gap: 5px; backdrop-filter: blur(10px); max-width: 250px; box-shadow: 0 6px 20px rgba(15, 23, 42, .1); font-weight: 500;
}
:root[data-theme="dark"] .s3-legend { background: rgba(17, 26, 46, .85); border-color: rgba(255, 255, 255, .08); }
.s3-legend span { display: inline-flex; align-items: center; gap: 7px; }
.s3-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.s3-badge {
  right: 64px; top: 12px; background: #0f172a; color: #fff; border-radius: 10px; padding: 7px 11px; font: 600 12px var(--mono); box-shadow: 0 6px 18px rgba(15, 23, 42, .2);
}
.s3-fallback { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 6px; z-index: 9; color: var(--muted); padding: 20px; }
.s3-fallback b { color: var(--text); font-size: 15px; }
.s3-fallback[hidden] { display: none; }
.s3-compact .s3-hint { display: none; }
.s3-compact .s3-hud { transform: scale(.86); transform-origin: top right; }
@media (max-width: 760px) {
  .s3-hint { display: none; }
  .s3-badge { display: none; }
  .s3-legend { font-size: 10.5px; max-width: 58%; padding: 8px 10px; }
  .s3-hud { right: 8px; top: 8px; }
  .s3-hud button { width: 32px; height: 28px; }
}
.lbl-hall { font-size: 10.5px; padding: 3px 8px; }
.lbl-hall em { margin-left: 4px; }
.lbl-venue .lbl-logo { width: 19px; height: 19px; vertical-align: -4px; margin-right: 8px; display: inline-block; }
