    /* ── Prussian Blue Variables ─────────────────────────── */
    :root {
      --bg:      #020d1c;
      --panel:   rgba(2, 16, 38, 0.62);
      --border:  rgba(22, 72, 168, 0.22);
      --border2: rgba(22, 72, 168, 0.42);
      --text:    #93bade;
      --muted:   #2c5270;
      --dim:     #162e45;
      --bright:  #d6eaff;
      --accent:  #1a52c0;
      --accent2: #2467e0;
      --ok:      #27b568;
      --warn:    #c87c18;
      --err:     #c42e2e;
      --font:    'Inter', system-ui, sans-serif;
      --mono:    'JetBrains Mono', 'Courier New', monospace;
      --blur:    blur(26px) saturate(1.8);
      --r:       10px;
      --pw:      245px;
      --rpw:     100px;
      --pt:      0.34s;
    }

    /* ── Reset ───────────────────────────────────────────── */
    *, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
    html, body { height: 100%; }
    html {
      /* Bumped from the browser default (16px) so every rem-based size used
         throughout the UI grows proportionally without per-rule edits. */
      font-size: 18px;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      text-rendering: optimizeLegibility;
    }
    body { background: var(--bg); color: var(--text); font-family: var(--font); overflow: hidden; }
    [hidden] { display: none !important; }
    canvas { display: block; position: fixed; inset: 0; width: 100%; height: 100%; }
    button { font-family: var(--font); cursor: pointer; background: none; border: none; outline: none; }
    input  { font-family: var(--mono); outline: none; }
    svg.defs { display: none; }
    .ic {
      display: inline-block; width: 14px; height: 14px;
      stroke: currentColor; fill: none;
      stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
      vertical-align: middle; flex-shrink: 0; overflow: visible;
    }

    /* ── Panel — floating card ───────────────────────────── */
    #panel {
      position: fixed; top: 70px; left: 14px;
      width: var(--pw); height: calc(100vh - 140px);
      background: var(--panel);
      backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
      border: 1px solid var(--border);
      border-radius: 14px;
      display: flex; flex-direction: column;
      z-index: 30;
      transform: translateX(0);
      opacity: 1;
      transition: transform var(--pt) cubic-bezier(0.4, 0, 0.2, 1),
                  opacity 0.38s ease;
      will-change: transform, opacity;
      min-width: 180px; max-width: 520px;
    }
    #panel.collapsed { transform: translateX(calc(-1 * (var(--pw) + 18px))); }

    /* Resize handle (sibling element, absolutely positioned) */
    #panel-resizer {
      position: absolute; top: 0; right: 0; width: 6px; height: 100%;
      cursor: col-resize; z-index: 31; border-radius: 0 14px 14px 0;
      transition: background 0.2s;
    }
    #panel.collapsed ~ #panel-resizer { display: none; }
    #panel-resizer:hover, #panel-resizer.dragging { background: rgba(36, 103, 224, 0.35); }

    /* Hover-reveal edge strips */
    #panel-edge {
      position: fixed; left: 0; top: 0; width: 14px; height: 100%;
      z-index: 29; display: none; cursor: e-resize;
    }
    body.panel-unpinned #panel-edge { display: block; }
    #rpanel-edge {
      position: fixed; right: 0; top: 0; width: 14px; height: 100%;
      z-index: 29; display: none; cursor: w-resize;
    }
    body.rpanel-unpinned #rpanel-edge { display: block; }

    /* ── Panel header ─────────────────────────────────────── */
    #panel-head {
      padding: 12px 12px 10px;
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
      display: flex; flex-direction: column; gap: 8px;
    }
    .panel-head-row { display: flex; align-items: center; gap: 6px; }
    .panel-head-row-top { justify-content: space-between; }
    .logo-block { min-width: 0; width: 100%; }
    .logo      { font: 700 1.15rem var(--font); color: var(--bright); letter-spacing: .10em; line-height: 1; }
    .logo-full { font: 500 .78rem var(--font); color: var(--text); letter-spacing: .01em; line-height: 1.3; }
    .logo-lab  { font: 500 .62rem var(--font); color: var(--muted); letter-spacing: .10em; text-transform: uppercase; margin-top: 3px; }

    /* ── About watermark (bottom of about card) ─────────── */
    #about-watermark {
      display: flex; align-items: center; justify-content: center; gap: 14px;
      margin-top: 20px; padding-top: 16px;
      border-top: 1px solid var(--border);
      pointer-events: none; user-select: none;
    }
    #wm-cgv {
      width: 32px; height: 32px;
      opacity: 0.6; object-fit: contain;
      filter: brightness(1.5) saturate(0.4);
    }
    #wm-eye {
      width: 100px; height: 70px;
      opacity: 0.6; object-fit: contain;
      filter: brightness(1.8) saturate(0.4);
    }

    .head-btns { display: flex; gap: 3px; flex-shrink: 0; }
    .icon-btn {
      width: 26px; height: 26px;
      display: flex; align-items: center; justify-content: center;
      border-radius: 6px; color: var(--muted);
      transition: color .14s, background .14s;
    }
    .icon-btn:hover { color: var(--bright); background: rgba(255,255,255,.06); }
    .icon-btn.on { color: var(--accent2); background: rgba(36,103,224,.14); }

    /* ── Mode bar ─────────────────────────────────────────── */
    #mode-bar {
      display: flex; gap: 4px; padding: 8px 10px;
      border-bottom: 1px solid var(--border); flex-shrink: 0;
    }
    .mbtn {
      flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
      padding: 6px 4px;
      border: 1px solid var(--border); border-radius: var(--r);
      color: var(--muted); font: 500 .72rem var(--font); letter-spacing: .04em;
      transition: all .14s;
    }
    .mbtn:hover { color: var(--text); border-color: rgba(36,103,224,.40); }
    .mbtn.on { background: rgba(26,82,192,.16); border-color: var(--accent); color: #7ab8ff; }

    /* ── Sample section ──────────────────────────────────── */
    #sample-sec {
      flex: 1; overflow-y: auto; min-height: 0;
      padding: 10px; display: flex; flex-direction: column; gap: 0;
    }
    #sample-sec::-webkit-scrollbar { width: 3px; }
    #sample-sec::-webkit-scrollbar-thumb { background: rgba(36,103,224,.22); border-radius: 2px; }
    #sample-list-msg {
      font-size: .62rem; color: var(--muted); padding: 6px 0; text-align: center;
    }
    .sample-item {
      display: flex; align-items: center; gap: 6px;
      padding: 8px 8px; border-radius: 4px;
      border: 1px solid transparent;
      font: 400 .66rem var(--mono); color: var(--text); cursor: pointer;
      transition: all .12s; background: transparent;
      text-align: left; width: 100%;
      margin-bottom: 7px;
    }
    #sample-list { display: flex; flex-direction: column; gap: 0; }
    @media (hover: hover) {
      .sample-item:hover:not(.cur) { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.08); }
    }
    .sample-item.cur  { background: rgba(26,82,192,.18); border-color: var(--accent); color: var(--text); }
    .sample-item-icon { flex-shrink: 0; opacity: .55; }
    .sample-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    /* ── Live section ─────────────────────────────────────── */
    #live-sec { display: flex; flex-direction: column; flex: 1; overflow: hidden; min-height: 0; }
    #live-bar {
      display: flex; align-items: center; gap: 7px;
      padding: 8px 12px; font-size: .66rem; color: var(--muted);
      border-bottom: 1px solid var(--border); flex-shrink: 0;
    }
    .ldot {
      width: 6px; height: 6px; border-radius: 50%;
      background: var(--muted); flex-shrink: 0; transition: background .3s;
    }
    .ldot.ok  { background: var(--ok);  box-shadow: 0 0 5px var(--ok); }
    .ldot.err { background: var(--err); }
    .ldot.dl  { background: var(--warn); }
    .ldot.pulse { animation: pulse 1.4s ease-in-out infinite; }
    @keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.2} }
    #live-txt { flex: 1; }
    #live-ctrl { display: flex; gap: 3px; }
    .ctrl-btn {
      width: 22px; height: 22px;
      display: flex; align-items: center; justify-content: center;
      border: 1px solid var(--border); border-radius: 4px; color: var(--muted);
      transition: all .14s;
    }
    .ctrl-btn:hover { color: var(--bright); border-color: rgba(255,255,255,.25); }
    #evt-list { flex: 1; overflow-y: auto; padding: 4px 6px; }
    #evt-list::-webkit-scrollbar { width: 3px; }
    #evt-list::-webkit-scrollbar-thumb { background: rgba(36,103,224,.22); border-radius: 2px; }
    .erow {
      display: flex; align-items: center; gap: 6px;
      padding: 8px 8px; border-radius: 5px; cursor: pointer;
      border: 1px solid transparent; transition: all .12s; margin-bottom: 8px;
    }
    @media (hover: hover) {
      .erow:hover:not(.cur) { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.08); }
    }
    .erow.cur  { background: rgba(26,82,192,.18); border-color: var(--accent); }
    .einfo { flex: 1; min-width: 0; }
    .ename { font: 500 .67rem var(--mono); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .etime { font-size: .60rem; color: var(--muted); margin-top: 2px; }
    .edl {
      width: 22px; height: 22px;
      display: flex; align-items: center; justify-content: center;
      border: 1px solid var(--border); border-radius: 4px;
      color: var(--muted); flex-shrink: 0; transition: all .14s;
    }
    .edl:hover { color: var(--accent2); border-color: var(--accent2); }

    /* ── Local section ────────────────────────────────────── */
    #local-sec {
      flex: 1; overflow-y: auto; min-height: 0;
      padding: 10px; display: flex; flex-direction: column; gap: 7px;
    }
    #local-sec::-webkit-scrollbar { width: 3px; }
    #local-sec::-webkit-scrollbar-thumb { background: rgba(36,103,224,.22); border-radius: 2px; }
    .file-pick-btn {
      display: flex; align-items: center; justify-content: center; gap: 7px;
      width: 100%; padding: 9px 12px; flex-shrink: 0;
      background: rgba(26,82,192,.10); border: 1px solid rgba(26,82,192,.38);
      border-radius: var(--r); color: #7ab8ff;
      font: 500 .68rem var(--font); letter-spacing: .07em;
      cursor: pointer; user-select: none; transition: background .15s;
    }
    .file-pick-btn:hover { background: rgba(26,82,192,.22); }
    .file-pick-btn.alt {
      background: rgba(255,255,255,.03); border-color: var(--border); color: var(--muted);
    }
    .file-pick-btn.alt:hover { color: var(--text); background: rgba(255,255,255,.07); }
    input[type="file"] { display: none; }
    .or-divider {
      display: flex; align-items: center; gap: 8px; flex-shrink: 0;
      font: 400 .57rem var(--font); color: var(--dim); letter-spacing: .10em; text-transform: uppercase;
    }
    .or-divider::before, .or-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
    #local-list {
      flex: 1; overflow-y: auto; min-height: 0;
      border: 1px solid var(--border); border-radius: var(--r); padding: 3px;
    }
    #local-list::-webkit-scrollbar { width: 3px; }
    #local-list::-webkit-scrollbar-thumb { background: rgba(36,103,224,.22); border-radius: 2px; }
    .lrow {
      display: flex; align-items: center; gap: 6px;
      padding: 8px 8px; border-radius: 4px; cursor: pointer;
      border: 1px solid transparent; transition: all .12s; margin-bottom: 7px;
    }
    @media (hover: hover) {
      .lrow:hover:not(.cur) { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.08); }
    }
    .lrow.cur  { background: rgba(26,82,192,.18); border-color: var(--accent); }
    .lrow-name { flex: 1; font: 400 .66rem var(--mono); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .lrow-size { font: 400 .60rem var(--mono); color: var(--muted); flex-shrink: 0; }

    /* ── Log section ──────────────────────────────────────── */
    #log-sec {
      flex-shrink: 0; border-top: 1px solid var(--border);
      display: flex; flex-direction: column; max-height: 140px; min-height: 32px;
      transition: max-height 0.28s cubic-bezier(0.4,0,0.2,1),
                  min-height 0.28s cubic-bezier(0.4,0,0.2,1);
      overflow: hidden;
    }
    #log-head {
      display: flex; align-items: center; justify-content: space-between;
      padding: 5px 12px; flex-shrink: 0; border-bottom: 1px solid var(--border);
      transition: border-color 0.2s;
    }
    #log-head span { font: 500 .63rem var(--font); color: var(--muted); letter-spacing: .09em; text-transform: uppercase; }
    .badge {
      font: 600 .62rem var(--mono); color: var(--accent2);
      background: rgba(36,103,224,.12); border: 1px solid rgba(36,103,224,.28);
      border-radius: 10px; padding: 1px 7px;
    }
    #log-body {
      flex: 1; display: flex; flex-direction: column;
      overflow: hidden; min-height: 0;
      max-height: 200px; opacity: 1;
      transition: max-height 0.28s cubic-bezier(0.4,0,0.2,1),
                  opacity 0.22s ease;
    }
    #log-list { flex: 1; overflow-y: auto; padding: 3px 6px 4px; min-height: 0; }
    /* Collapsed: log body folds up completely, head stays visible */
    #log-sec.log-collapsed {
      max-height: 32px; min-height: 32px;
    }
    #log-sec.log-collapsed #log-head { border-bottom-color: transparent; }
    #log-sec.log-collapsed #log-body {
      max-height: 0; opacity: 0; pointer-events: none;
    }
    #log-min-icon { transition: transform 0.24s cubic-bezier(0.4,0,0.2,1); }
    #log-sec.log-collapsed #log-min-icon { transform: rotate(180deg); }
    #log-list::-webkit-scrollbar { width: 3px; }
    #log-list::-webkit-scrollbar-thumb { background: rgba(36,103,224,.22); border-radius: 2px; }
    .logrow {
      font: 400 .63rem var(--mono); color: var(--muted); padding: 2px 4px;
      border-left: 2px solid transparent; margin-bottom: 1px;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .logrow.ok   { color: var(--ok);   border-color: var(--ok); }
    .logrow.warn { color: var(--warn); border-color: var(--warn); }
    .logrow.err  { color: var(--err);  border-color: var(--err); }
    .logrow.info { color: var(--text); border-color: var(--accent); }

    /* ── Status bar ───────────────────────────────────────── */
    #statusbar {
      padding: 7px 12px; font-size: .63rem; color: var(--muted);
      line-height: 1.6; min-height: 30px; flex-shrink: 0;
      border-top: 1px solid var(--border);
      display: flex; align-items: center; gap: 8px;
    }
    #status-txt {
      flex: 1; min-width: 0;
      overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
      display: inline-flex; align-items: center; gap: 6px;
    }
    #statusbar #req-badge { flex-shrink: 0; }
    /* Event metadata pills inside the statusbar */
    .ev-dt {
      font: 500 .66rem var(--mono); color: var(--bright);
      letter-spacing: .02em; flex-shrink: 0;
    }
    .ev-meta {
      font: 400 .58rem var(--font); color: var(--muted);
      letter-spacing: .03em; flex-shrink: 0;
    }
    .ev-meta b {
      font: 500 .60rem var(--mono); color: var(--text);
      font-weight: 500;
    }
    .ev-sep { color: var(--dim); flex-shrink: 0; font-size: .7rem; }
    .ok   { color: var(--ok); }
    .warn { color: var(--warn); }
    .err  { color: var(--err); }

    /* ── About overlay ────────────────────────────────────── */
    #about-overlay {
      position: fixed; inset: 0; z-index: 100;
      display: flex; align-items: center; justify-content: center;
      background: rgba(1, 6, 16, 0.78); backdrop-filter: blur(8px);
      opacity: 0; pointer-events: none; transition: opacity 0.26s ease;
      padding: 20px;
    }
    #about-overlay.open { opacity: 1; pointer-events: auto; }
    .about-card {
      background: linear-gradient(160deg, rgba(4,14,34,.98) 0%, rgba(2,9,24,.98) 100%);
      border: 1px solid var(--border2); border-radius: 16px;
      padding: 24px 28px; max-width: 440px; width: 100%;
      max-height: calc(100vh - 40px);
      overflow-y: auto;
      box-shadow: 0 24px 70px rgba(0,0,0,.72), inset 0 1px 0 rgba(255,255,255,.04);
      display: flex; flex-direction: column;
    }
    .about-card::-webkit-scrollbar { width: 4px; }
    .about-card::-webkit-scrollbar-thumb { background: rgba(36,103,224,.28); border-radius: 2px; }
    .about-title {
      font: 600 1.05rem var(--font); color: var(--bright);
      margin-bottom: 4px; letter-spacing: .01em;
    }
    .about-sub {
      font: 500 .58rem var(--font); color: var(--accent2);
      margin-bottom: 18px; letter-spacing: .16em; text-transform: uppercase;
    }
    .about-body {
      font: 400 .70rem var(--font); color: var(--text); line-height: 1.7;
    }
    .about-body p { margin-bottom: 4px; }
    .about-body strong { color: var(--bright); font-weight: 500; }
    .about-meta {
      margin-top: 14px; padding: 10px 12px;
      background: rgba(36,103,224,.06);
      border-left: 2px solid var(--accent2);
      border-radius: 0 6px 6px 0;
      font-size: .66rem; line-height: 1.55;
    }
    .about-meta strong {
      display: block; font: 600 .54rem var(--font);
      color: var(--muted); letter-spacing: .10em; text-transform: uppercase;
      margin-bottom: 3px;
    }
    .about-lab {
      margin-top: 14px; padding-top: 12px;
      border-top: 1px solid var(--border);
      font-size: .62rem; color: var(--muted); line-height: 1.7;
    }
    .about-sponsors-hdr {
      margin-top: 14px; margin-bottom: 8px;
      font: 600 .54rem var(--font); color: var(--muted);
      letter-spacing: .12em; text-transform: uppercase;
    }
    .about-card .sponsor-grid {
      display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
      padding: 10px 12px; background: rgba(36,103,224,.05);
      border: 1px solid var(--border); border-radius: 8px;
    }
    .about-close {
      display: flex; align-items: center; justify-content: center; gap: 6px;
      margin-top: 18px; padding: 8px 20px;
      background: rgba(36,103,224,.10);
      border: 1px solid var(--border2); border-radius: 20px;
      color: var(--text); font: 500 .62rem var(--font); letter-spacing: .09em;
      cursor: pointer; transition: all .16s;
      align-self: center;
    }
    .about-close:hover {
      color: var(--bright); background: rgba(36,103,224,.20);
      border-color: var(--accent2);
    }

    /* About — mobile (landscape) tightening */
    @media (orientation: landscape) and (max-height: 520px) {
      #about-overlay { padding: 10px; }
      .about-card {
        padding: 14px 18px; max-width: 560px;
        max-height: calc(100vh - 20px);
      }
      .about-title { font-size: .88rem; margin-bottom: 2px; }
      .about-sub { font-size: .60rem; margin-bottom: 10px; letter-spacing: .14em; }
      .about-body { font-size: .62rem; line-height: 1.55; }
      .about-meta { margin-top: 10px; padding: 7px 10px; font-size: .58rem; }
      .about-meta strong { font-size: .58rem; margin-bottom: 2px; }
      .about-lab { margin-top: 10px; padding-top: 9px; font-size: .56rem; line-height: 1.55; }
      .about-close { margin-top: 12px; padding: 6px 16px; font-size: .56rem; }
      #about-watermark { margin-top: 12px; padding-top: 10px; }
      #wm-cgv { width: 24px; height: 24px; }
      #wm-eye { width: 72px; height: 50px; }
    }

    /* ── Right retractable panel — floating slim card ───── */
    #rpanel-wrap {
      position: fixed; top: 14px; right: 14px;
      display: flex; flex-direction: column; gap: 8px;
      z-index: 30;
      transform: translateX(0);
      opacity: 1;
      transition: transform var(--pt) cubic-bezier(0.4, 0, 0.2, 1),
                  opacity 0.38s ease;
      will-change: transform, opacity;
    }
    #rpanel-wrap.collapsed { transform: translateX(calc(var(--rpw) + 18px)); }
    #rpanel, #rpanel2 {
      width: var(--rpw);
      background: var(--panel);
      backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
      border: 1px solid var(--border);
      border-radius: 12px;
      display: flex; flex-direction: column;
      overflow-y: auto;
      box-shadow: 4px 4px 32px rgba(0,0,0,.45);
    }
    #rpanel { max-height: calc(100vh - 28px); }
    #rpanel2 { max-height: calc(100vh - 28px); }
    #rpanel::-webkit-scrollbar { width: 3px; }
    #rpanel::-webkit-scrollbar-thumb { background: rgba(36,103,224,.22); border-radius: 2px; }

    /* ── Detector tab bar ────────────────────────────────── */
    #det-tab-bar {
      display: flex; flex-direction: column; flex-shrink: 0;
      border-bottom: 1px solid var(--border);
    }
    .det-tab {
      flex: none; padding: 5px 8px;
      font: 600 .62rem var(--mono); letter-spacing: .04em;
      color: var(--muted); border: none; text-align: center;
      border-left: 2px solid transparent;
      cursor: pointer; transition: color .14s, border-color .14s, background .14s;
    }
    .det-tab:hover { color: var(--text); }
    .det-tab.on {
      color: var(--bright);
      border-left-color: var(--tab-col, var(--accent2));
      background: rgba(36,103,224,.06);
    }

    /* ── Detector pane — slim compact layout ───���─────────── */
    .det-pane {
      flex: 1; display: flex; flex-direction: column;
      align-items: center; justify-content: center;
      gap: 3px; padding: 6px 0 8px;
    }
    .pane-det-row {
      display: flex; align-items: center; gap: 5px; margin-bottom: 1px;
    }
    .pane-det-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
    .pane-det-name {
      font: 500 .62rem var(--font); color: var(--text); letter-spacing: .03em;
    }
    .slbl {
      font: 400 .60rem var(--font); letter-spacing: .13em;
      color: var(--muted); text-transform: uppercase; text-align: center;
    }
    .sval { font: 400 .62rem var(--mono); color: var(--muted); text-align: center; }
    .strak {
      position: relative; width: 12px; height: 160px;
      border-radius: 6px; cursor: ns-resize; user-select: none; touch-action: none;
      border: 1px solid rgba(255,255,255,.13);
      box-shadow: inset 0 1px 8px rgba(0,0,0,.50);
    }
    .sthumb {
      position: absolute; left: -8px; right: -8px; height: 3px;
      border-radius: 2px; background: rgba(255,255,255,.96);
      box-shadow: 0 0 10px rgba(255,255,255,.90), 0 0 4px rgba(255,255,255,.60);
      pointer-events: none; top: 50%;
    }
    .thr-input {
      width: 68px; padding: 3px 4px;
      background: rgba(2,11,28,.90); border: 1px solid var(--border);
      border-radius: 4px; color: var(--text); font: 400 .62rem var(--mono);
      text-align: center; transition: border-color .15s;
    }
    .thr-input:focus { border-color: var(--accent2); color: var(--bright); }
    .thr-input::placeholder { color: var(--dim); }
    .cluster-filter-btn {
      width: 78px; padding: 4px 6px;
      background: rgba(255,255,255,.05);
      border: 1px solid rgba(255,255,255,.10);
      border-radius: 6px;
      color: var(--muted);
      font: 600 .58rem var(--mono);
      letter-spacing: .08em;
      text-transform: uppercase;
      cursor: pointer;
      transition: background .15s, border-color .15s, color .15s, box-shadow .15s, opacity .15s;
    }
    .cluster-filter-btn:hover { color: var(--text); border-color: rgba(255,255,255,.18); }
    .cluster-filter-btn.on {
      color: var(--muted);
      background: rgba(255,255,255,.05);
      border-color: rgba(255,255,255,.10);
      box-shadow: none;
    }
    #pane-cluster.cluster-filter-disabled .sval,
    #pane-cluster.cluster-filter-disabled .slbl,
    #pane-cluster.cluster-filter-disabled .thr-input,
    #pane-cluster.cluster-filter-disabled .strak {
      opacity: .38;
    }
    #pane-cluster.cluster-filter-disabled .strak {
      cursor: default;
    }

    /* ── Ghost switches (no text inside buttons) ─────────── */
    .ghost-switches-wrap {
      flex: 1; display: flex; flex-direction: column; justify-content: center;
      width: 100%;
    }
    .gswitch-row {
      display: flex; align-items: center; gap: 10px; padding: 11px 16px;
      border-bottom: 1px solid var(--border); transition: background .13s;
    }
    .gswitch-row:last-child { border-bottom: none; }
    .gswitch-row:hover { background: rgba(36,103,224,.06); }
    .gswitch-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
    .gswitch-lbl {
      flex: 1; font: 600 .58rem var(--mono); letter-spacing: .06em; color: var(--muted);
    }
    /* CSS-only toggle pill — no text inside */
    .gswitch {
      position: relative; width: 28px; height: 15px; flex-shrink: 0;
      background: var(--dim); border-radius: 8px;
      border: 1px solid rgba(255,255,255,.07);
      cursor: pointer; transition: background .18s;
    }
    .gswitch::after {
      content: ''; position: absolute; top: 2px; left: 2px;
      width: 9px; height: 9px; border-radius: 50%;
      background: var(--muted); transition: transform .18s, background .18s;
    }
    .gswitch.on { background: var(--gswitch-col, var(--accent2)); border-color: transparent; }
    .gswitch.on::after { transform: translateX(13px); background: #fff; }
    /* Ghost colour picker */
    .ghost-cpick-wrap { position:relative; cursor:pointer; display:flex; align-items:center; }
    .ghost-cpick-wrap input[type=color] {
      position:absolute; width:0; height:0; opacity:0; pointer-events:none;
    }
    .ghost-cpick-swatch {
      width:22px; height:22px; border-radius:5px; border:1px solid rgba(255,255,255,.18);
      flex-shrink:0; transition:border-color .15s;
    }
    .ghost-cpick-wrap:hover .ghost-cpick-swatch { border-color:rgba(255,255,255,.5); }

    /* ── Bottom-center toolbar ────────────────────────────── */
    #toolbar {
      position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
      z-index: 9000;
      display: flex; align-items: center; gap: 3px; padding: 5px 10px;
      background: rgba(2, 9, 24, 0.55);
      backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
      border: 1px solid var(--border); border-radius: 26px;
      opacity: 0.22; transition: opacity 0.36s ease;
    }
    #toolbar:hover { opacity: 1; }
    .tbtn {
      position: relative;
      width: 32px; height: 32px; background: transparent;
      border: 1px solid transparent; border-radius: 8px;
      color: var(--muted);
      display: flex; align-items: center; justify-content: center;
      cursor: pointer; transition: all .16s;
    }
    .tbtn:hover { color: var(--bright); border-color: rgba(36,103,224,.38); background: rgba(26,82,192,.10); }
    .tbtn.on { color: #7ab8ff; border-color: rgba(26,82,192,.48); background: rgba(26,82,192,.16); }
    .tbtn-sep { width: 1px; height: 18px; background: var(--border); margin: 0 2px; flex-shrink: 0; }
    /* Tabler icon size inside buttons */
    .tbtn .ti { font-size: 15px; line-height: 1; }
    /* Text-label detector toggle buttons */
    .tbtn-label { width: auto; padding: 0 7px; min-width: 32px;
      font-size: 10px; font-weight: 600; letter-spacing: .04em; font-family: var(--mono); }

    /* ── Language dropdown ────────────────────────────────── */
    #lang-menu {
      position: fixed; z-index: 50;
      display: flex; flex-direction: column; gap: 2px; padding: 6px;
      background: rgba(2, 9, 24, 0.68);
      backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
      border: 1px solid var(--border2); border-radius: 10px;
      box-shadow: 0 8px 28px rgba(0,0,0,.55);
      opacity: 0; transform: translateY(6px); pointer-events: none;
      transition: opacity 0.15s ease, transform 0.15s ease;
    }
    #lang-menu.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
    .lang-opt {
      display: flex; align-items: center; gap: 9px; padding: 7px 12px;
      border-radius: 6px; color: var(--muted); font: 400 .68rem var(--font);
      transition: all .13s; white-space: nowrap;
    }
    .lang-opt:hover { color: var(--bright); background: rgba(36,103,224,.12); }
    .lang-opt.on { color: #7ab8ff; background: rgba(26,82,192,.16); }
    .fi { width: 18px; height: 14px; flex-shrink: 0; border-radius: 2px; }

    /* ── Button hint tooltip ─────────────────────────────── */
    #btn-tip {
      position: fixed; z-index: 200; pointer-events: none;
      padding: 5px 11px;
      background: rgba(2, 9, 22, 0.97);
      border: 1px solid var(--border2); border-radius: 5px;
      font: 400 .61rem var(--font); color: var(--bright); letter-spacing: .01em;
      white-space: nowrap;
      box-shadow: 0 4px 16px rgba(0,0,0,.55);
      opacity: 0; transform: translateY(4px);
      transition: opacity 0.13s ease, transform 0.13s ease;
    }
    #btn-tip.show { opacity: 1; transform: translateY(0); }
    /* Multi-line hint used by the collision-info statusbar */
    #stat-hint {
      position: fixed; z-index: 200; pointer-events: none;
      padding: 9px 13px;
      background: rgba(2, 9, 22, 0.97);
      border: 1px solid var(--border2); border-radius: 7px;
      font: 400 .64rem var(--font); color: var(--bright); letter-spacing: .01em;
      box-shadow: 0 6px 20px rgba(0,0,0,.6);
      opacity: 0; transform: translateY(4px);
      transition: opacity 0.15s ease, transform 0.15s ease;
      max-width: 320px;
      display: grid; grid-template-columns: auto 1fr; gap: 4px 12px;
    }
    #stat-hint.show { opacity: 1; transform: translateY(0); }
    #stat-hint .sh-key { color: var(--muted); font-size: .58rem; letter-spacing: .06em; text-transform: uppercase; }
    #stat-hint .sh-val { color: var(--bright); font-family: var(--mono); font-size: .62rem; word-break: break-all; }
    #statusbar { cursor: default; }

    /* ── Hover tooltip (cell info) ───────────────────────── */
    #tip {
      position: fixed; pointer-events: none; z-index: 25;
      padding: 11px 14px;
      background: rgba(2,11,28,.95);
      backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
      border: 1px solid var(--border); border-radius: var(--r);
      box-shadow: 0 4px 24px rgba(0,0,0,.55); white-space: nowrap;
    }
    #tip-cell   { font: 600 1.0rem var(--font); color: var(--bright); margin-bottom: 2px; }
    #tip-coords { font: 400 0.72rem var(--mono); color: var(--muted); margin-bottom: 4px; }
    .tdiv { border: none; border-top: 1px solid var(--border); margin: 5px 0; }
    .trow { display: flex; justify-content: space-between; gap: 20px; margin-top: 3px; }
    .tkey { font: 400 .58rem var(--font); color: var(--muted); text-transform: uppercase; letter-spacing: .09em; align-self: center; }
    .tval { font: 500 .69rem var(--mono); color: var(--bright); }

    /* ── Collision info HUD (top-left corner) ────────────── */
    #collision-hud {
      position: fixed; top: 10px; left: 10px; z-index: 9998;
      display: grid; grid-template-columns: auto 1fr; gap: 2px 8px;
      font-family: monospace; font-size: 11px;
      color: #66ccff; opacity: 0.45;
      pointer-events: none; user-select: none;
      line-height: 1.55;
    }
    #collision-hud[hidden] { display: none !important; }
    #collision-hud .ch-key { color: #66ccff; opacity: 0.6; font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
    #collision-hud .ch-val { color: #66ccff; font-size: 11px; }

    /* ── Cinema mode ──────────────────────────────────────── */
    body.cinema #panel       { opacity: 0 !important; pointer-events: none; }
    body.cinema #toolbar     { opacity: 0 !important; pointer-events: none; }
    body.cinema #rpanel-wrap { opacity: 0 !important; pointer-events: none; }
    body.cinema #tip         { display: none; }
    #cinema-exit {
      position: fixed; bottom: 64px; left: 50%; transform: translateX(-50%);
      z-index: 50;
      display: flex; align-items: center; gap: 6px; padding: 7px 18px;
      background: rgba(2, 9, 24, 0.62); backdrop-filter: var(--blur);
      border: 1px solid rgba(255,255,255,.10); border-radius: 22px;
      color: rgba(185,215,255,.40); font: 400 .60rem var(--font);
      letter-spacing: .11em; text-transform: uppercase; cursor: pointer;
      opacity: 0; pointer-events: none;
      transition: opacity 0.38s ease, color 0.20s, border-color 0.20s;
    }
    body.cinema #cinema-exit { opacity: 0.45; pointer-events: auto; }
    #cinema-exit:hover { opacity: 1 !important; color: #d8eeff; border-color: rgba(255,255,255,.28); }

    /* ── Mobile-only helpers ─────────────────────────────── */
    /* Elements marked .mobile-only are hidden on desktop; shown on mobile
       landscape (handled inside the mobile media query below). */
    .mobile-only { display: none !important; }
    .mobile-only-inline { display: none !important; }

    /* ── Mobile (landscape-only optimization) ─────────────── */
    /* Target landscape phones/small tablets. Portrait is NOT optimized;
       user is expected to rotate to landscape. */
    @media (orientation: landscape) and (max-height: 520px) {
      :root { --pw: 220px; --rpw: 130px; }

      .mobile-only { display: flex !important; }
      .desktop-only { display: none !important; }

      /* ─── Left panel ─────────────────────────────────── */
      /* Shortened so the statusbar + dl-progress at the bottom sit above the
         toolbar/toggle-pill (which float at bottom: 8-10px, ~52px tall). */
      #panel {
        top: 0; left: 0; height: calc(100vh - 58px);
        border-radius: 0 12px 12px 0;
        box-shadow: 6px 0 30px rgba(0,0,0,.65);
      }
      #panel.collapsed { transform: translateX(calc(-1 * var(--pw))); }
      #panel-resizer { display: none; }

      /* Compact header: keep only the logo mark + ext-links + head-btns on one row.
         Hide the long subtitles (Calorimeter Geometry Viewer / NIPSCERN · ATLAS). */
      #panel-head {
        padding: 6px 8px;
        gap: 4px;
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
      }
      .panel-head-row { display: contents; }
      .logo-full, .logo-lab { display: none; }
      .logo-block { display: none; }
      .logo { font-size: .82rem; }
      #ext-links-top { flex: 1; display: flex; gap: 4px; justify-content: flex-end; border: 0; padding: 0; }
      #ext-links-top a { width: 22px; height: 22px; border: 0; font-size: 13px; }
      #ext-links-top a .ti { font-size: 13px; }
      .head-btns { gap: 2px; }

      /* Mode bar: tighter */
      #mode-bar { padding: 5px 6px; gap: 3px; }
      .mbtn { padding: 6px 3px; font-size: .60rem; letter-spacing: .02em; }

      /* Statusbar: compact, badge stays inline at the right */
      #statusbar { padding: 5px 9px; font-size: .55rem; min-height: 24px; gap: 6px; }
      #statusbar #req-badge { font-size: .55rem; padding: 0 6px; }

      /* Touch targets */
      .tbtn { width: 34px; height: 34px; border-radius: 8px; }
      .tbtn .ti { font-size: 14px; }
      .icon-btn { width: 28px; height: 28px; }
      .ctrl-btn { width: 28px; height: 28px; }
      .edl      { width: 28px; height: 28px; }

      /* ─── Toolbar ───────────────────────────────────── */
      #toolbar {
        bottom: 8px; padding: 4px 8px; gap: 2px;
        max-width: calc(100vw - 24px);
        border-radius: 20px;
        transform: translateX(-50%) translateY(calc(100% + 60px));
        opacity: 0;
        pointer-events: none;
      }
      #toolbar.tb-visible {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
        pointer-events: auto;
      }
      #btn-toolbar-close, #toolbar-close-sep { display: none !important; }

      /* ─── Right panel: cluster on top, detectors below, stacked ────── */
      /* Both panels visible simultaneously. If total content exceeds the
         viewport height, the wrap itself scrolls so the user can reach both. */
      #rpanel-wrap {
        top: 8px; right: 8px;
        gap: 8px;
        max-height: calc(100vh - 74px);
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
      }
      #rpanel-wrap::-webkit-scrollbar { width: 3px; }
      #rpanel-wrap::-webkit-scrollbar-thumb { background: rgba(36,103,224,.22); border-radius: 2px; }
      #rpanel-wrap.collapsed { transform: translateX(calc(var(--rpw) + 12px)); }

      #rpanel, #rpanel2 {
        max-height: none;
        flex-shrink: 0;
        border-radius: 12px;
        width: var(--rpw);
      }
      /* Cluster tab stays desktop-only (cluster lives in its own panel here). */
      #tab-cluster { display: none !important; }

      /* Right-panel pane contents — keep vertical sliders compact */
      .strak { height: 110px; }
      .pane-det-name { font-size: .58rem; }
      .slbl { font-size: .58rem; }
      .sval { font-size: .57rem; }
      .thr-input { width: 72px; font-size: .58rem; }
      .cluster-filter-btn { width: 86px; font-size: .58rem; }

      /* ─── Misc ──────────────────────────────────────── */
      #log-sec { max-height: 80px; }

      /* Hide very-large screenshot options */
      .shot-res[data-w="3840"],
      .shot-res[data-w="7680"],
      .shot-res[data-w="10240"] { display: none; }

      #cinema-exit { bottom: 56px; }

      /* Bigger edge-tap zones on mobile (opens left/right panels). Always
         visible when the corresponding panel is collapsed. */
      #panel-edge, #rpanel-edge {
        width: 32px;
        display: block !important;
        touch-action: manipulation;
      }
      /* When a panel is pinned (open), hide its edge strip so it doesn't
         block touches on the panel's own interactive controls. */
      body:not(.panel-unpinned) #panel-edge { display: none !important; }
      body:not(.rpanel-unpinned) #rpanel-edge { display: none !important; }
    }

    /* Extremely narrow landscape — drop separators */
    @media (orientation: landscape) and (max-height: 520px) and (max-width: 720px) {
      .tbtn-sep { display: none; }
      #toolbar { gap: 1px; }
    }

    /* Rotate-to-landscape hint — hidden by default, shown only on portrait phones */
    #rotate-hint { display: none; }

    /* Portrait phone: show a rotate-to-landscape hint, minimal UI */
    @media (orientation: portrait) and (max-width: 700px) {
      #panel, #rpanel, #toolbar, #btn-toolbar-toggle, #statusbar,
      #layers-panel, #settings-panel { display: none !important; }
      #rotate-hint {
        position: fixed; inset: 0; z-index: 3000;
        display: flex; flex-direction: column;
        align-items: center; justify-content: center; gap: 22px;
        background: var(--bg); color: var(--text);
        padding: 30px; text-align: center;
      }
      .rotate-hint-gif {
        width: 140px; height: 140px;
        background-color: var(--bright);
        -webkit-mask: url('../assets/rotate_phone.gif') center / contain no-repeat;
                mask: url('../assets/rotate_phone.gif') center / contain no-repeat;
        filter: drop-shadow(0 4px 16px rgba(0,0,0,.4));
      }
      .rotate-hint-text {
        font: 500 .86rem var(--font); letter-spacing: .04em;
        max-width: 280px; line-height: 1.5;
      }
    }

    /* Touch-friendly: bigger hit area for slider on touch */
    @media (pointer: coarse) {
      .strak { width: 18px; border-radius: 9px; }
      .sthumb { left: -12px; right: -12px; height: 3px; }
      .ctrl-btn, .edl { min-width: 36px; min-height: 36px; }
    }

    /* ── Screenshot dialog ───────────────────────────────── */
    #shot-overlay {
      position: fixed; inset: 0; z-index: 110;
      display: flex; align-items: center; justify-content: center;
      background: rgba(1, 6, 16, 0.80); backdrop-filter: blur(8px);
      opacity: 0; pointer-events: none;
      transition: opacity 0.22s ease;
    }
    #shot-overlay.open { opacity: 1; pointer-events: auto; }
    .shot-card {
      background: rgba(2, 9, 24, 0.97);
      border: 1px solid var(--border2); border-radius: 14px;
      padding: 24px 26px; max-width: 420px; width: 94%;
      box-shadow: 0 20px 60px rgba(0,0,0,.70);
    }
    .shot-title {
      font: 600 .92rem var(--font); color: var(--bright);
      margin-bottom: 4px;
    }
    .shot-sub {
      font: 400 .62rem var(--font); color: var(--muted);
      margin-bottom: 18px; line-height: 1.5;
    }
    .shot-grid {
      display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px;
      margin-bottom: 18px;
    }
    .shot-res {
      display: flex; flex-direction: column; align-items: center; gap: 3px;
      padding: 10px 6px;
      background: rgba(26,82,192,.08); border: 1px solid var(--border);
      border-radius: 8px; color: var(--text);
      font: 600 .72rem var(--font); letter-spacing: .04em;
      cursor: pointer; transition: all .15s;
    }
    .shot-res span { font: 400 .56rem var(--mono); color: var(--muted); }
    .shot-res:hover { background: rgba(26,82,192,.20); border-color: var(--accent); color: var(--bright); }
    .shot-res:hover span { color: var(--text); }
    .shot-res.active { background: rgba(26,82,192,.28); border-color: var(--accent2); color: #7ab8ff; }
    .shot-res.active span { color: var(--text); }
    .shot-opt {
      display: flex; align-items: center; gap: 12px;
      padding: 11px 13px; margin-bottom: 12px;
      background: rgba(26,82,192,.06); border: 1px solid var(--border);
      border-radius: 10px;
      color: var(--text); line-height: 1.35;
      cursor: pointer; transition: all .16s;
      user-select: none;
    }
    .shot-opt:hover { border-color: rgba(36,103,224,.45); background: rgba(26,82,192,.12); }
    .shot-opt input[type="checkbox"] {
      position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0;
    }
    /* Custom checkmark */
    .shot-opt .shot-check {
      width: 20px; height: 20px; flex-shrink: 0;
      display: inline-flex; align-items: center; justify-content: center;
      border: 1.5px solid rgba(36,103,224,.55);
      border-radius: 6px;
      background: rgba(2,9,24,.55);
      color: transparent;
      transition: background .18s, border-color .18s, color .18s, transform .12s;
    }
    .shot-opt .shot-check svg { width: 14px; height: 14px; }
    .shot-opt:hover .shot-check { border-color: var(--accent2); }
    .shot-opt input[type="checkbox"]:checked + .shot-check {
      background: linear-gradient(135deg, var(--accent2), #4a9eff);
      border-color: var(--accent2);
      color: #ffffff;
      box-shadow: 0 0 0 3px rgba(36,103,224,.18), 0 2px 10px rgba(36,103,224,.35);
      transform: scale(1.03);
    }
    .shot-opt input[type="checkbox"]:focus-visible + .shot-check {
      box-shadow: 0 0 0 3px rgba(36,103,224,.35);
    }
    .shot-opt-text {
      display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0;
    }
    .shot-opt-title {
      font: 600 .68rem var(--font); color: var(--bright); letter-spacing: .02em;
    }
    .shot-opt-sub {
      font: 400 .58rem var(--font); color: var(--muted); line-height: 1.4;
    }
    #shot-progress {
      text-align: center; padding: 10px 0 6px;
      font: 400 .68rem var(--mono); color: var(--warn);
      display: flex; align-items: center; justify-content: center; gap: 8px;
      visibility: hidden; /* always reserves space; .running makes it visible */
    }
    #shot-progress.running { visibility: visible; }
    .shot-spinner {
      width: 14px; height: 14px;
      border: 2px solid var(--border); border-top-color: var(--warn);
      border-radius: 50%; animation: spin .7s linear infinite; flex-shrink: 0;
    }
    @keyframes spin { to { transform: rotate(360deg); } }
    .shot-actions {
      display: flex; justify-content: flex-end; gap: 8px;
    }
    .shot-cancel {
      padding: 7px 18px;
      border: 1px solid var(--border); border-radius: 20px;
      color: var(--muted); font: 500 .62rem var(--font); letter-spacing: .08em;
      cursor: pointer; transition: all .16s;
    }
    .shot-cancel:hover { color: var(--bright); border-color: var(--accent); }
    .shot-save {
      padding: 7px 18px;
      background: rgba(26,82,192,.24); border: 1px solid var(--accent);
      border-radius: 20px;
      color: #7ab8ff; font: 500 .62rem var(--font); letter-spacing: .08em;
      cursor: pointer; transition: all .16s;
    }
    .shot-save:hover { background: rgba(26,82,192,.40); color: var(--bright); }
    .shot-save:disabled { opacity: 0.4; cursor: default; }

    /* ── External links strip (own row below title) ───── */
    #ext-links-top {
      display: flex; align-items: center; gap: 4px;
      flex-shrink: 0; justify-content: flex-start;
      flex-wrap: wrap;
    }
    #ext-links-top a {
      width: 26px; height: 26px;
      display: flex; align-items: center; justify-content: center;
      border: 1px solid var(--border); border-radius: 6px;
      color: var(--muted); text-decoration: none;
      transition: color .14s, background .14s, border-color .14s, transform .12s;
    }
    #ext-links-top a:hover {
      color: var(--bright); background: rgba(36,103,224,.14);
      border-color: rgba(36,103,224,.40);
      transform: translateY(-1px);
    }
    #ext-links-top a .ti { font-size: 14px; }
    /* Highlighted documentation links */
    #ext-links-top a.docs {
      color: #7ab8ff;
      border-color: rgba(36,103,224,.55);
      background: linear-gradient(135deg, rgba(36,103,224,.22), rgba(26,82,192,.08));
      box-shadow: 0 0 0 1px rgba(36,103,224,.08) inset, 0 2px 8px rgba(26,82,192,.18);
    }
    #ext-links-top a.docs:hover {
      color: var(--bright);
      border-color: var(--accent2);
      background: linear-gradient(135deg, rgba(36,103,224,.34), rgba(26,82,192,.18));
      box-shadow: 0 0 0 1px rgba(36,103,224,.14) inset, 0 4px 14px rgba(26,82,192,.34);
    }

    /* ── Carousel (local file playback) ──────────────────── */
    #carousel-bar {
      flex-shrink: 0; padding: 8px 10px;
      border: 1px solid var(--border); border-radius: var(--r);
      background: rgba(26,82,192,.06);
      display: flex; flex-direction: column; gap: 6px;
    }
    .carousel-row {
      display: flex; align-items: center; gap: 6px;
    }
    #carousel-status {
      flex: 1; font: 500 .62rem var(--mono); color: var(--accent2);
      text-align: center; letter-spacing: .04em;
    }
    /* Delay selector row */
    .carousel-delay-row {
      display: flex; align-items: center; justify-content: space-between; gap: 4px;
    }
    .carousel-delay-label {
      font: 400 .57rem var(--font); color: var(--muted); flex-shrink: 0;
    }
    .carousel-delay-steps {
      display: flex; gap: 3px;
    }
    .cdstep {
      padding: 2px 7px; border-radius: 5px;
      border: 1px solid var(--border); color: var(--muted);
      font: 500 .57rem var(--mono); cursor: pointer; transition: all .12s;
    }
    .cdstep:hover { color: var(--text); border-color: rgba(36,103,224,.45); background: rgba(26,82,192,.10); }
    .cdstep.on { color: #7ab8ff; border-color: var(--accent); background: rgba(26,82,192,.18); }

    /* ── Layers / Ghost (geometry toggle) floating panel ─────────── */
    #layers-panel, #ghost-panel {
      position: fixed; z-index: 50;
      padding: 10px 12px 12px;
      background: rgba(2, 9, 24, 0.68);
      backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
      border: 1px solid var(--border2); border-radius: 12px;
      box-shadow: 0 10px 32px rgba(0,0,0,.60);
      min-width: 200px;
      max-height: calc(100vh - 80px); overflow-y: auto;
      opacity: 0; transform: translateY(8px); pointer-events: none;
      transition: opacity 0.17s ease, transform 0.17s ease;
    }
    #layers-panel.open, #ghost-panel.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
    .layers-head {
      display: flex; align-items: center; justify-content: space-between;
      margin-bottom: 8px; padding-bottom: 8px;
      border-bottom: 1px solid var(--border);
    }
    .layers-title {
      font: 600 .63rem var(--font); color: var(--text);
      letter-spacing: .08em; text-transform: uppercase;
    }
    .layers-quick {
      display: flex; gap: 4px;
    }
    .layers-qbtn {
      padding: 2px 8px; border-radius: 5px;
      border: 1px solid var(--border); color: var(--muted);
      font: 500 .58rem var(--font); letter-spacing: .04em;
      cursor: pointer; transition: all .13s;
    }
    .layers-qbtn:hover { color: var(--bright); border-color: rgba(36,103,224,.45); background: rgba(26,82,192,.12); }
    .layer-row {
      display: flex; align-items: center; gap: 10px;
      padding: 8px 4px; border-radius: 7px;
      border: 1px solid transparent; transition: background .12s;
      cursor: default;
    }
    .layer-row:hover { background: rgba(36,103,224,.07); border-color: rgba(36,103,224,.14); }
    .layer-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
    .layer-info { flex: 1; min-width: 0; }
    .layer-name { font: 600 .65rem var(--mono); color: var(--bright); letter-spacing: .04em; }
    .layer-sub  { font: 400 .58rem var(--font); color: var(--muted); margin-top: 1px; }

    /* ── Live empty state ─────────────────────────────────── */
    #live-empty {
      flex: 1; display: flex; flex-direction: column;
      align-items: center; justify-content: center;
      gap: 14px; padding: 24px 16px;
      pointer-events: none;
    }
    .empty-illus {
      width: 110px; height: auto; opacity: 0.28;
      filter: saturate(0.3) brightness(1.4);
    }
    .empty-msg {
      font: 400 .64rem var(--font); color: var(--muted);
      text-align: center; line-height: 1.6; max-width: 180px;
    }

    /* ── Loading overlay ──────────────────────────────────── */
    #loading-overlay {
      position: fixed; inset: 0; z-index: 10000;
      display: flex; align-items: center; justify-content: center;
      background: var(--bg);
      transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    }
    #loading-overlay.done { opacity: 0; pointer-events: none; }
    .loading-card {
      display: flex; flex-direction: column; align-items: center;
      gap: 0; user-select: none;
    }
    .loading-logo {
      width: 56px; height: 56px;
      margin-bottom: 20px;
    }
    .loading-title {
      font: 700 2.2rem var(--font); color: var(--bright);
      letter-spacing: .18em; margin-bottom: 4px;
    }
    .loading-sub {
      font: 400 .68rem var(--font); color: var(--text);
      letter-spacing: .08em; margin-bottom: 3px;
    }
    .loading-lab {
      font: 500 .54rem var(--font); color: var(--muted);
      letter-spacing: .16em; text-transform: uppercase;
      margin-bottom: 36px;
    }
    .loading-bar-track {
      width: 220px; height: 2px;
      background: var(--dim); border-radius: 2px;
      overflow: hidden; margin-bottom: 14px;
    }
    .loading-bar-fill {
      height: 100%; width: 0%; border-radius: 2px;
      background: linear-gradient(90deg, var(--accent) 0%, #4a9eff 100%);
      box-shadow: 0 0 8px rgba(36, 103, 224, 0.6);
      position: relative; overflow: hidden;
    }
    .loading-bar-fill::after {
      content: '';
      position: absolute; inset: 0;
      background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.22) 50%, transparent 100%);
      animation: bar-shimmer 1.6s ease-in-out infinite;
      transform: translateX(-100%);
    }
    @keyframes bar-shimmer {
      0%   { transform: translateX(-100%); }
      100% { transform: translateX(200%); }
    }
    .loading-msg {
      font: 400 .60rem var(--mono); color: var(--muted);
      letter-spacing: .06em; min-height: 1.4em;
      transition: opacity 0.2s;
    }

    /* ── Log vertical resize handle ──────────────────────── */
    #log-resize {
      height: 5px; flex-shrink: 0; cursor: ns-resize;
      background: transparent; transition: background 0.15s;
      position: relative;
    }
    #log-resize:hover, #log-resize.dragging { background: rgba(36,103,224,.20); }
    #log-resize::after {
      content: ''; position: absolute;
      left: 50%; top: 50%; transform: translate(-50%,-50%);
      width: 26px; height: 3px; border-radius: 2px;
      background: rgba(36,103,224,.30);
    }

    /* ── Download progress stages ────────────────────────── */
    #dl-progress {
      padding: 5px 10px 6px; flex-shrink: 0;
      border-top: 1px solid var(--border);
    }
    .dl-stages { display: flex; align-items: center; gap: 3px; margin-bottom: 4px; flex-wrap: nowrap; overflow: hidden; }
    .dl-stage  { display: flex; align-items: center; gap: 3px; font: 500 .60rem var(--mono); color: var(--muted); transition: color .25s; white-space: nowrap; }
    .dl-stage.active { color: var(--accent2); }
    .dl-stage.done   { color: var(--ok); }
    .dl-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); flex-shrink: 0; transition: background .25s; }
    .dl-stage.active .dl-dot { background: var(--accent2); animation: pulse 0.8s ease-in-out infinite; }
    .dl-stage.done   .dl-dot { background: var(--ok); animation: none; }
    .dl-arrow { color: var(--border2); font-size: .58rem; }
    #dl-bar-track { height: 2px; background: rgba(36,103,224,.10); border-radius: 1px; overflow: hidden; }
    #dl-bar-fill  { height: 100%; background: linear-gradient(90deg,var(--accent),var(--accent2)); border-radius: 1px; width: 0%; transition: width .35s ease; }

    /* ── Session log branding ───────────────────────────── */
    #log-brand {
      display: flex; align-items: center; gap: 6px;
      font: 500 .58rem var(--mono); color: rgba(36,103,224,.45);
      letter-spacing: .06em;
    }
    #log-brand .lb-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent2); }
    #log-brand.live .lb-dot { animation: pulse .9s ease-in-out infinite; }

    /* ── Settings panel ───────────────────────────────────── */
    #settings-panel {
      position: fixed; z-index: 50; width: 290px;
      background: rgba(2, 9, 24, 0.97);
      backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
      border: 1px solid var(--border2); border-radius: 12px;
      box-shadow: 0 10px 36px rgba(0,0,0,.65);
      opacity: 0; transform: translateY(8px); pointer-events: none;
      transition: opacity 0.17s ease, transform 0.17s ease;
      overflow: hidden; max-height: 80vh; overflow-y: auto;
    }
    #settings-panel.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
    #settings-panel::-webkit-scrollbar { width: 3px; }
    #settings-panel::-webkit-scrollbar-thumb { background: rgba(36,103,224,.22); border-radius: 2px; }
    .sett-section { padding: 10px 14px 12px; border-bottom: 1px solid var(--border); }
    .sett-section:last-child { border-bottom: none; }
    .sett-hdr { font: 600 .60rem var(--font); color: var(--muted); letter-spacing: .09em; text-transform: uppercase; margin-bottom: 9px; }
    .sett-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; gap: 8px; }
    .sett-info { flex: 1; min-width: 0; }
    .sett-label { font: 400 .64rem var(--font); color: var(--text); }
    .sett-sub   { font: 400 .57rem var(--font); color: var(--muted); margin-top: 1px; }
    /* sponsor logos */
    .sponsor-grid { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-top: 4px; }
    .sponsor-img  { height: 42px; width: auto; max-width: 60px; object-fit: contain; opacity: .6; filter: brightness(.9); transition: opacity .18s; }
    .sponsor-img:hover { opacity: 1; }
    .sponsor-atlas { height: 26px; max-width: 70px; }
    /* shortcuts list */
    .sk-grid { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; }
    .sk-key  { font: 600 .57rem var(--mono); color: var(--bright); background: rgba(36,103,224,.12); border: 1px solid rgba(36,103,224,.28); border-radius: 4px; padding: 1px 6px; text-align: center; white-space: nowrap; }
    .sk-desc { font: 400 .60rem var(--font); color: var(--muted); display: flex; align-items: center; }

    /* ── Mobile toolbar toggle (landscape only) ───────────── */
    #btn-toolbar-toggle {
      display: none; position: fixed; bottom: 10px; left: 50%;
      transform: translateX(-50%) translateY(0);
      z-index: 46; background: rgba(2,9,24,.94);
      backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
      border: 1px solid var(--border2); border-radius: 20px;
      padding: 6px 16px;
      align-items: center; justify-content: center; gap: 6px;
      color: var(--text); font: 500 .62rem var(--font);
      box-shadow: 0 4px 18px rgba(0,0,0,.55);
      transition: background .15s, bottom 0.28s cubic-bezier(0.4,0,0.2,1),
                  transform 0.28s cubic-bezier(0.4,0,0.2,1);
    }
    #btn-toolbar-toggle i { font-size: 13px; }
    #btn-toolbar-toggle:hover { background: rgba(26,82,192,.18); }
    /* When toolbar is open the toggle slides up above it (acts as close) */
    #btn-toolbar-toggle.tb-open { bottom: 58px; }
    #btn-toolbar-toggle.tb-open i.ti-layout-navbar { transform: rotate(180deg); }
    #btn-toolbar-toggle i.ti-layout-navbar { transition: transform 0.28s ease; }
    /* Toolbar transition on mobile */
    #toolbar { transition: transform 0.28s cubic-bezier(0.4,0,0.2,1), opacity 0.28s ease; }
    /* Default: hide the in-toolbar close button (only shown in mobile landscape) */
    #btn-toolbar-close, #toolbar-close-sep { display: none; }
    /* Show toggle only in landscape small screens */
    @media (orientation: landscape) and (max-height: 520px) {
      #btn-toolbar-toggle { display: flex; }
    }

    /* ── Standalone download/load progress (Live & Local) ── */
    #dl-progress {
      flex-shrink: 0;
      padding: 8px 10px;
      border-top: 1px solid var(--border);
      background: rgba(2,9,24,.55);
    }
    #dl-progress[hidden] { display: none; }
    .dl-stages {
      display: flex; align-items: center; gap: 4px;
      font: 500 .54rem var(--font); color: var(--muted);
      letter-spacing: .04em; margin-bottom: 6px;
      flex-wrap: wrap;
    }
    .dl-stage {
      display: flex; align-items: center; gap: 3px;
      transition: color .15s;
    }
    .dl-dot {
      width: 6px; height: 6px; border-radius: 50%;
      background: rgba(255,255,255,.18);
      transition: background .15s, box-shadow .15s;
    }
    .dl-stage.active { color: var(--accent2); }
    .dl-stage.active .dl-dot {
      background: var(--accent2);
      box-shadow: 0 0 6px var(--accent2);
      animation: pulse .9s ease-in-out infinite;
    }
    .dl-stage.done { color: var(--ok); }
    .dl-stage.done .dl-dot { background: var(--ok); }
    .dl-arrow { color: var(--dim); font-size: .6rem; }
    #dl-bar-track {
      height: 4px; background: rgba(255,255,255,.06);
      border-radius: 2px; overflow: hidden;
    }
    #dl-bar-fill {
      height: 100%; width: 0%;
      background: linear-gradient(90deg, var(--accent), var(--accent2));
      transition: width .25s ease;
    }
    /* Local-mode tint for distinguishing source */
    #dl-progress.local #dl-bar-fill {
      background: linear-gradient(90deg, #5a8c2a, #8fd64a);
    }
    #dl-progress.local .dl-stage.active { color: #8fd64a; }
    #dl-progress.local .dl-stage.active .dl-dot {
      background: #8fd64a; box-shadow: 0 0 6px #8fd64a;
    }

    /* Carousel single row */
    #carousel-bar .carousel-row {
      display: flex; align-items: center; gap: 6px; flex-wrap: nowrap;
    }
    #carousel-bar #carousel-status {
      flex: 1; min-width: 0;
      font: 500 .60rem var(--mono); color: var(--accent2);
      text-align: center; letter-spacing: .04em;
    }
    #carousel-bar .carousel-delay-steps { display: flex; gap: 2px; flex-shrink: 0; }
    #carousel-bar .cdstep { padding: 2px 5px; font-size: .55rem; }

    /* Local drag & drop highlight */
    #local-sec.dragover {
      outline: 2px dashed var(--accent2);
      outline-offset: -6px;
      background: rgba(36,103,224,.08);
    }

    /* Req badge (now lives inline with statusbar) */

    /* ── Background color picker popover ─────────────────── */
    #bgcolor-popover {
      position: fixed; z-index: 60; width: 260px;
      padding: 14px 14px 12px;
      background: rgba(2, 9, 24, 0.98);
      backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
      border: 1px solid var(--border2); border-radius: 12px;
      box-shadow: 0 14px 40px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.04);
      opacity: 0; transform: translateY(8px) scale(0.98);
      pointer-events: none;
      transition: opacity 0.17s ease, transform 0.17s ease;
    }
    #bgcolor-popover.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
    .bgcp-head {
      display: flex; align-items: center; justify-content: space-between;
      margin-bottom: 10px; padding-bottom: 8px;
      border-bottom: 1px solid var(--border);
    }
    .bgcp-title {
      font: 600 .62rem var(--font); color: var(--text);
      letter-spacing: .10em; text-transform: uppercase;
    }
    .bgcp-close {
      width: 20px; height: 20px; display: flex; align-items: center;
      justify-content: center; border-radius: 4px; color: var(--muted);
      background: transparent; border: none; cursor: pointer;
      transition: all .14s;
    }
    .bgcp-close:hover { color: var(--bright); background: rgba(255,255,255,.08); }
    /* SV rectangle + vertical hue strip */
    .bgcp-canvas-row {
      display: flex; gap: 10px; margin-bottom: 12px; height: 150px;
    }
    .bgcp-sv {
      flex: 1; position: relative; border-radius: 8px; overflow: hidden;
      border: 1px solid rgba(255,255,255,.10);
      cursor: crosshair; touch-action: none;
      background: #ff0000;
      background-image:
        linear-gradient(to top, #000 0%, rgba(0,0,0,0) 100%),
        linear-gradient(to right, #fff 0%, rgba(255,255,255,0) 100%);
    }
    .bgcp-sv-cursor {
      position: absolute; width: 14px; height: 14px;
      border-radius: 50%;
      border: 2px solid #fff;
      box-shadow: 0 0 0 1px rgba(0,0,0,.55), 0 2px 4px rgba(0,0,0,.6);
      transform: translate(-50%, -50%); pointer-events: none;
      left: 50%; top: 50%;
    }
    .bgcp-hue {
      width: 16px; position: relative; border-radius: 8px; overflow: hidden;
      border: 1px solid rgba(255,255,255,.10);
      cursor: ns-resize; touch-action: none;
      background: linear-gradient(to bottom,
        #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%,
        #0000ff 67%, #ff00ff 83%, #ff0000 100%);
    }
    .bgcp-hue-cursor {
      position: absolute; left: -3px; right: -3px; height: 6px;
      border-radius: 3px;
      background: rgba(255,255,255,.95);
      border: 1px solid rgba(0,0,0,.6);
      box-shadow: 0 1px 3px rgba(0,0,0,.55);
      transform: translateY(-50%); pointer-events: none;
      top: 0;
    }
    .bgcp-preview {
      display: flex; gap: 10px; align-items: center; margin-bottom: 10px;
    }
    .bgcp-swatch {
      width: 40px; height: 32px; flex-shrink: 0;
      border-radius: 8px;
      border: 1px solid rgba(255,255,255,.10);
      box-shadow: inset 0 0 0 2px rgba(255,255,255,.05);
      background: #020d1c;
    }
    .bgcp-hex {
      flex: 1; min-width: 0; box-sizing: border-box;
      padding: 7px 10px; border-radius: 6px;
      background: rgba(26,82,192,.08);
      border: 1px solid var(--border);
      font: 500 .72rem var(--mono); color: var(--bright);
      text-transform: uppercase; letter-spacing: .06em;
      transition: border-color .14s, background .14s;
    }
    .bgcp-hex:focus { border-color: var(--accent2); background: rgba(26,82,192,.14); }
    .bgcp-presets-hdr {
      margin-top: 10px; margin-bottom: 6px;
      font: 600 .54rem var(--font); color: var(--muted);
      letter-spacing: .10em; text-transform: uppercase;
    }
    .bgcp-presets {
      display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap;
    }
    .bgcp-preset {
      width: 24px; height: 24px; border-radius: 6px;
      border: 1px solid rgba(255,255,255,.10);
      cursor: pointer; transition: transform .12s, border-color .14s, box-shadow .14s;
      position: relative;
    }
    .bgcp-preset:hover {
      transform: scale(1.08); border-color: var(--accent2);
      box-shadow: 0 2px 8px rgba(36,103,224,.35);
    }
    .bgcp-preset.active {
      border-color: var(--accent2);
      box-shadow: 0 0 0 2px rgba(36,103,224,.45);
    }
    .bgcp-reset {
      width: 100%; padding: 8px 12px; border-radius: 8px;
      background: rgba(26,82,192,.14);
      border: 1px solid var(--accent);
      color: #7ab8ff;
      font: 600 .62rem var(--font); letter-spacing: .06em;
      cursor: pointer; transition: all .15s;
    }
    .bgcp-reset:hover {
      background: rgba(26,82,192,.28);
      color: var(--bright);
      border-color: var(--accent2);
    }

    /* ── Cinema mode: smooth right panel fade-out ────────── */
    body.cinema #rpanel-wrap {
      opacity: 0 !important;
      pointer-events: none;
      transform: translateX(calc(var(--rpw) + 40px));
    }
    body.cinema #panel {
      opacity: 0 !important;
      pointer-events: none;
      transform: translateX(calc(-1 * (var(--pw) + 40px)));
    }
