    :root {
      --bg-dark: #0a0e14;
      --bg-panel: #0f141c;
      --bg-card: #151b24;
      --bg-hover: #1c2430;
      --border-dim: #1f2937;
      --border-bright: #374151;
      --accent-cyan: #00f0ff;
      --accent-green: #00ff88;
      --accent-amber: #ffb700;
      --accent-purple: #c084fc;
      --accent-laser: #00ff66;
      --accent-coral: #ff5566;
      --text-main: #f1f5f9;
      --text-muted: #94a3b8;
      --text-dim: #64748b;
      --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Courier New', monospace;
      --plot-ml: 40px;
      --plot-mr: 16px;
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      user-select: none;
    }

    body {
      background-color: var(--bg-dark);
      color: var(--text-main);
      font-family: var(--font-mono);
      font-size: calc(13px * var(--fs));
      line-height: 1.4;
      height: 100vh;
      width: 100vw;
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    header.lab-header {
      height: calc(44px * var(--fs));
      background: var(--bg-panel);
      border-bottom: 1px solid var(--border-dim);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 16px;
      flex-shrink: 0;
      z-index: 10;
      gap: 12px;
    }

    .brand-group {
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
      overflow: visible;
    }

    .brand-badge {
      background: rgba(217, 119, 6, 0.12);
      border: 1px solid var(--accent-green);
      color: var(--accent-green);
      padding: 3px 8px;
      border-radius: 4px;
      font-size: calc(11px * var(--fs));
      font-weight: 700;
      letter-spacing: 0.08em;
      white-space: nowrap;
      flex-shrink: 0;
      cursor: pointer;
      user-select: none;
      -webkit-user-select: none;
      transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease, transform 0.1s ease;
    }

    .brand-badge:hover,
    .brand-badge:focus-visible {
      background: rgba(217, 119, 6, 0.22);
      border-color: #55ffaa;
      color: #ffffff;
      box-shadow: 0 0 10px rgba(217, 119, 6, 0.5), inset 0 0 6px rgba(217, 119, 6, 0.2);
      outline: none;
    }

    .brand-badge:active {
      transform: scale(0.96);
      background: rgba(217, 119, 6, 0.3);
      box-shadow: 0 0 4px rgba(217, 119, 6, 0.6);
    }

    .brand-titles {
      display: flex;
      flex-direction: column;
      justify-content: center;
      min-width: 0;
      overflow: hidden;
    }

    .brand-title {
      font-size: calc(12.5px * var(--fs));
      font-weight: 700;
      letter-spacing: 0.04em;
      color: #fff;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .brand-sub {
      font-size: calc(10px * var(--fs));
      color: var(--text-dim);
      letter-spacing: 0.02em;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    /* Przycisk wprowadzenia w nagłówku */
    .btn-header-intro {
      background: rgba(245, 158, 11, 0.08);
      border: 1px solid var(--accent-cyan);
      color: var(--accent-cyan);
      font-family: inherit;
      font-size: calc(11px * var(--fs));
      font-weight: 600;
      padding: 4px 10px;
      border-radius: 4px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 6px;
      transition: all 0.15s ease;
      white-space: nowrap;
      margin-left: 6px;
      flex-shrink: 0;
    }

    .btn-header-intro:hover {
      background: rgba(245, 158, 11, 0.22);
      box-shadow: 0 0 10px rgba(245, 158, 11, 0.35);
      color: #fff;
    }

    .mobile-tabs {
      display: none;
      background: var(--bg-card);
      border: 1px solid var(--border-bright);
      border-radius: 6px;
      padding: 2px;
      gap: 3px;
      flex-shrink: 0;
    }

    .btn-tab {
      background: transparent;
      border: none;
      color: var(--text-muted);
      font-family: inherit;
      font-size: calc(11px * var(--fs));
      font-weight: 600;
      padding: 4px 9px;
      border-radius: 4px;
      cursor: pointer;
      transition: all 0.15s ease;
      white-space: nowrap;
      display: flex;
      align-items: center;
      gap: 4px;
    }

    .btn-tab.active {
      background: rgba(245, 158, 11, 0.15);
      color: var(--accent-cyan);
      font-weight: 700;
      box-shadow: 0 0 8px rgba(245, 158, 11, 0.25);
    }

    .system-status {
      display: flex;
      align-items: center;
      gap: 12px;
      font-size: calc(11px * var(--fs));
      color: var(--text-muted);
      flex-shrink: 0;
    }

    .status-item {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .led-indicator {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--accent-green);
      box-shadow: 0 0 8px var(--accent-green);
      transition: background 0.3s, box-shadow 0.3s;
    }

    .led-indicator.amber {
      background: var(--accent-amber);
      box-shadow: 0 0 8px var(--accent-amber);
    }

    .btn-header-action {
      background: var(--bg-card);
      border: 1px solid var(--border-dim);
      color: var(--accent-cyan);
      font-family: inherit;
      font-size: calc(11px * var(--fs));
      font-weight: 600;
      padding: 4px 10px;
      border-radius: 4px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 6px;
      transition: all 0.15s ease;
      white-space: nowrap;
    }

    .btn-header-action:hover {
      background: var(--bg-hover);
      border-color: var(--accent-cyan);
      box-shadow: 0 0 8px rgba(245, 158, 11, 0.25);
    }

    .workbench-layout {
      flex: 1;
      display: grid;
      grid-template-columns: 1fr min(calc(420px * var(--fs)), 46vw);
      height: calc(100vh - calc(44px * var(--fs)));
      overflow: hidden;
    }

    .viewport-column {
      display: flex;
      flex-direction: column;
      position: relative;
      height: 100%;
      border-right: 1px solid var(--border-dim);
      background: #06090e;
      overflow: hidden;
    }

    .gl-viewport-wrapper {
      flex: 1 1 0;
      position: relative;
      min-height: 0;
      overflow: hidden;
      background: #03060a;
    }

    #gl-canvas {
      width: 100%;
      height: 100%;
      display: block;
    }

    .viewport-hud {
      position: absolute;
      top: 12px;
      left: 12px;
      background: rgba(15, 20, 28, 0.88);   /* W6: bez backdrop-filter (rozmycie animowanego obrazu w każdej klatce); tło nadpisuje theme.css */
      border: 1px solid var(--border-dim);
      border-radius: 6px;
      padding: 8px 12px;
      display: flex;
      flex-direction: column;
      gap: 4px;
      pointer-events: none;
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
      z-index: 5;
    }

    .hud-row {
      display: flex;
      justify-content: space-between;
      gap: 16px;
      font-size: calc(11px * var(--fs));
    }

    .hud-label {
      color: var(--text-dim);
    }

    .hud-value {
      color: var(--accent-cyan);
      font-weight: 600;
    }

    .viewport-reticle {
      position: absolute;
      top: 12px;
      right: 12px;
      display: flex;
      gap: 6px;
      pointer-events: none;
      z-index: 5;
    }

    .reticle-badge {
      white-space: nowrap;   /* M10: plakietka nie łamie się ani nie zachodzi na sąsiednią; przy braku miejsca – rt-wrap */
      flex-shrink: 0;
      background: rgba(10, 14, 20, 0.7);
      border: 1px solid var(--border-bright);
      padding: 3px 8px;
      font-size: calc(10px * var(--fs));
      color: var(--accent-amber);
      border-radius: 4px;
    }

    .reticle-badge.detector-badge {
      color: var(--accent-purple);
      border-color: rgba(192, 132, 252, 0.4);
    }

    .reticle-badge.mc-badge {
      color: var(--accent-green);
      border-color: rgba(217, 119, 6, 0.4);
      background: rgba(217, 119, 6, 0.08);
    }

    /* Desktop vertical split proportions */
    @media (min-width: 901px) {
      .gl-viewport-wrapper {
        flex: 0 0 var(--split-top-h, 50%) !important;
        min-height: 160px !important;
      }
      .detector-section {
        flex: 1 1 0 !important;
        min-height: 302px !important;
      }
      .workbench-splitter {
        height: 8px;
        margin: -4px 0;
        position: relative;
        z-index: 25;
        flex-shrink: 0;
        cursor: row-resize;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        user-select: none;
        -webkit-user-select: none;
        touch-action: none;
      }
      .workbench-splitter::after {
        content: "";
        position: absolute;
        inset: -6px 0;
        z-index: 1;
      }
      .workbench-splitter .splitter-rail {
        position: absolute;
        left: 0;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        height: 1px;
        background: transparent;
        transition: background 0.15s ease, box-shadow 0.15s ease;
      }
      .workbench-splitter:hover .splitter-rail,
      .workbench-splitter.is-dragging .splitter-rail {
        background: var(--accent-amber);
        box-shadow: 0 0 8px rgba(245, 158, 11, 0.7);
      }
      .workbench-splitter .splitter-grip {
        position: absolute;
        top: 50%;
        left: calc(var(--plot-ml, 40px) + (100% - var(--plot-ml, 40px) - var(--plot-mr, 16px)) / 2);
        transform: translate(-50%, -50%);
        z-index: 2;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        width: 48px;
        height: 6px;
        background: #0d121a;
        border: 1px solid var(--border-bright);
        border-radius: 3px;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
        transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
      }
      .workbench-splitter .grip-dot {
        width: 3px;
        height: 3px;
        border-radius: 50%;
        background: var(--text-dim);
        transition: background 0.15s ease;
      }
      .workbench-splitter:hover .splitter-grip,
      .workbench-splitter.is-dragging .splitter-grip {
        border-color: var(--accent-amber);
        box-shadow: 0 0 10px rgba(245, 158, 11, 0.5), inset 0 0 4px rgba(245, 158, 11, 0.2);
        background: #15120a;
      }
      .workbench-splitter:hover .grip-dot,
      .workbench-splitter.is-dragging .grip-dot {
        background: var(--accent-amber);
      }
      body.is-resizing-v {
        cursor: row-resize !important;
        user-select: none !important;
      }
      body.is-resizing-v iframe,
      body.is-resizing-v canvas {
        pointer-events: none !important;
      }
    }
    @media (max-width: 900px) {
      .workbench-splitter {
        display: none !important;
      }
    }
    body.is-cinema .workbench-splitter {
      display: none !important;
    }

    .detector-section {
      flex: 1 1 0;
      min-height: 0;
      border-top: 1px solid var(--border-dim);
      background: var(--bg-panel);
      display: flex;
      flex-direction: column;
      position: relative;
      overflow: hidden;
    }

    .detector-toolbar {
      height: calc(34px * var(--fs));
      flex-shrink: 0;
      background: #0b0f16;
      border-bottom: 1px solid var(--border-dim);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 12px;
      font-size: calc(11px * var(--fs));
      font-weight: 600;
      letter-spacing: 0.05em;
      color: var(--text-muted);
      overflow-x: auto;
    }

    .detector-toolbar::-webkit-scrollbar {
      display: none;
    }

    .detector-telemetry-row {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-shrink: 0;
    }

    .telemetry-chip {
      background: #111823;
      border: 1px solid var(--border-dim);
      border-radius: 3px;
      padding: 2px 7px;
      font-size: calc(10px * var(--fs));
      display: flex;
      align-items: center;
      gap: 5px;
      white-space: nowrap;
    }

    .telemetry-chip span.label {
      color: var(--text-dim);
    }

    .telemetry-chip span.val {
      color: var(--accent-cyan);
      font-weight: 700;
    }

    .caliper-btn-group {
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }

    .btn-caliper-toggle {
      background: #16202c;
      border: 1px solid var(--border-bright);
      color: var(--text-muted);
      font-family: inherit;
      font-size: calc(10px * var(--fs));
      font-weight: 700;
      padding: 3px 9px;
      border-radius: 4px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 6px;
      transition: all 0.15s ease;
      white-space: nowrap;
    }

    .btn-caliper-toggle:hover {
      border-color: var(--accent-amber);
      color: var(--text-main);
    }

    .btn-caliper-toggle.active {
      background: rgba(255, 183, 0, 0.15);
      border-color: var(--accent-amber);
      color: var(--accent-amber);
      box-shadow: 0 0 10px rgba(255, 183, 0, 0.25);
    }

    .ccd-strip-container {
      height: 88px;
      flex-shrink: 0;
      background: #020408;
      border-bottom: 1px solid var(--border-dim);
      position: relative;
      overflow: hidden;
      transition: box-shadow 0.3s ease, border-color 0.3s ease;
    }

    #ccd-canvas {
      /* 9b: pasek fosforowy pod obszarem wykresu – te same marginesy co oś wykresu (--plot-ml = 40 px · skala tekstu,
         --plot-mr = 16 px, ustawiane w renderGraph), więc każda pozycja x w mm wypada w tej samej kolumnie pikseli
         na pasku i na wykresie. Odwzorowanie trafień na pasek (pełna szerokość płótna = ±zakres) bez zmian. */
      width: calc(100% - var(--plot-ml, 40px) - var(--plot-mr, 16px));
      margin-left: var(--plot-ml, 40px);
      height: 100%;
      display: block;
      box-shadow: -1px 0 0 var(--border-dim), 1px 0 0 var(--border-dim);
    }

    /* M5: pionowy ruch palca nad wykresem przewija stronę; przeciąganie znacznika suwmiarki blokuje to w JS */
    #graph-canvas {
      touch-action: pan-y;
    }

    /* M5: dymek po przeciwnej stronie niż palec (dotyk w prawej połowie wykresu) */
    .graph-hud-overlay.hud-left {
      left: 10px;
      right: auto;
    }

    .ccd-optical-axis-marker {
      position: absolute;
      top: 0;
      bottom: 0;
      left: calc(var(--plot-ml, 40px) + (100% - var(--plot-ml, 40px) - var(--plot-mr, 16px)) / 2 - 0.5px);   /* 9b: środek obszaru wykresu (linia 1 px wyśrodkowana) */
      width: 1px;
      background: rgba(245, 158, 11, 0.5);
      pointer-events: none;
      box-shadow: 0 0 4px var(--accent-cyan);
    }

    .ccd-label-overlay {
      position: absolute;
      bottom: 4px;
      left: 8px;
      font-size: calc(9.5px * var(--fs));
      color: var(--text-dim);
      pointer-events: none;
      letter-spacing: 0.05em;
      display: flex;
      align-items: center;
      gap: 6px;
      background: rgba(4, 7, 12, 0.7);
      padding: 2px 6px;
      border-radius: 3px;
    }

    /* B-2 (regresja M4): krótki podpis paska tylko na telefonie i tablecie (≤ 900 px) – na desktopie długi */
    .ccd-label-overlay .ccd-label-short {
      display: none;
    }

    .graph-container {
      flex: 1 1 0;
      min-height: 0;
      position: relative;
      background: #05080e;
      overflow: hidden;
      cursor: crosshair;
    }

    #graph-canvas {
      width: 100%;
      height: 100%;
      display: block;
    }

    .graph-hud-overlay {
      position: absolute;
      top: 8px;
      right: 10px;
      background: rgba(10, 15, 23, 0.96);   /* W6: bez backdrop-filter */
      border: 1px solid var(--border-bright);
      border-radius: 4px;
      padding: 6px 10px;
      font-size: calc(10px * var(--fs));
      display: flex;
      flex-direction: column;
      gap: 3px;
      pointer-events: none;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
      z-index: 5;
    }

    .graph-hud-row {
      display: flex;
      justify-content: space-between;
      gap: 14px;
    }

    .graph-legend-overlay {
      position: absolute;
      top: 8px;
      left: 12px;
      display: flex;
      gap: 10px;
      pointer-events: none;
      font-size: calc(10px * var(--fs));
      background: rgba(10, 15, 23, 0.85);
      padding: 4px 8px;
      border-radius: 4px;
      border: 1px solid rgba(255, 255, 255, 0.08);
      z-index: 5;
      flex-wrap: wrap;
    }

    /* ukryta pozycja legendy (I_lower poza szerokim widmem): [hidden] przegrywał z display: flex */
    .legend-item[hidden] {
      display: none !important;
    }

    .legend-item {
      display: flex;
      align-items: center;
      gap: 6px;
      pointer-events: auto;
      border-radius: 3px;
      padding: 1px 3px;
      transition: background-color 0.2s;
    }

    .legend-item:hover {
      background: rgba(255, 255, 255, 0.05);
    }

    .legend-line {
      width: 14px;
      height: 2px;
      border-radius: 1px;
    }

    .legend-line.dashed {
      border-top: 2px dashed var(--accent-amber);
      background: transparent;
      height: 0;
    }

    .legend-line.er-plus {
      background: #f0abfc;
    }

    .legend-line.er-minus {
      border-top: 2px dashed #5eead4;
      background: transparent;
      height: 0;
    }

    /* 8d: podgrupy scenariuszy – nagłówek-przycisk, treść zwijana (bez animacji wysokości) */
    .preset-sub { display: flex; flex-direction: column; gap: 6px; }
    .preset-sub-body { display: flex; flex-direction: column; gap: 6px; }
    .preset-sub.is-collapsed > .preset-sub-body { display: none; }
    .preset-sub-toggle {
      display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; column-gap: 6px;
      width: 100%; min-height: 28px; margin: 4px 0 0; padding: 2px 0;
      background: none; border: 0; border-bottom: 1px solid rgba(229, 133, 43, 0.18);
      color: var(--text-muted); font: inherit; text-align: left; cursor: pointer;
    }
    .preset-sub-toggle:hover { color: var(--accent-cyan); }
    .preset-sub-toggle:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 2px; border-radius: 3px; }
    .preset-sub-toggle .presets-subhead { margin: 0; }
    .preset-sub-chev { width: calc(10px * var(--fs)); font-size: calc(10px * var(--fs)); transition: transform 0.15s ease; }
    .preset-sub.is-collapsed .preset-sub-chev { transform: rotate(-90deg); }
    .preset-sub-sum {
      min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right;
      font-size: calc(10px * var(--fs)); color: var(--text-muted); font-variant-numeric: tabular-nums;
    }
    .preset-sub-sum.has-active { color: var(--accent-amber); }
    @media (max-width: 600px) { .preset-sub-toggle { min-height: 44px; } }

    .presets-subhead {
      margin: 6px 0 0;
      font-size: calc(10px * var(--fs));
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--text-muted);
    }

    .eraser-body {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-top: 6px;
    }

    .eraser-body[hidden] {
      display: none;
    }

    .eraser-note,
    .eraser-status,
    .eraser-balance-label {
      font-size: calc(10px * var(--fs));
      color: var(--text-muted);
    }

    .eraser-quick {
      margin-top: 6px;
    }

    .eraser-badge {
      color: #f0abfc !important;
      border-color: rgba(240, 171, 252, 0.45) !important;
    }

    .legend-line.ref {
      border-top: 2px dotted #e2e8f0;
      background: transparent;
      height: 0;
    }

    /* F1 (18.11.2026): dopasowanie modelu do histogramu – krzywa i blok wyniku (odczyt: kropka dziesiętna w obu językach) */
    .legend-line.fit {
      border-top: 2px dashed #fb7185;
      background: transparent;
      height: 0;
    }

    .fit-out {
      margin: 2px 0 4px;
      padding: 5px 7px;
      border: 1px solid var(--border-dim);
      border-left: 2px solid #fb7185;
      border-radius: 3px;
      background: var(--bg-card);
      font-size: calc(10px * var(--fs));
      line-height: 1.45;
      color: var(--text-main);
      font-variant-numeric: tabular-nums;
      overflow-wrap: anywhere;
      white-space: pre-wrap;
    }

    .fit-out .fit-head {
      color: #fb7185;
      font-weight: 700;
    }

    .fit-out .fit-stale,
    .fit-out .fit-msg {
      color: var(--accent-amber);
      margin: 0;
    }

    .share-link-out {
      width: 100%;
      margin-top: 4px;
      background: var(--bg-card);
      border: 1px solid var(--border-dim);
      color: var(--text-main);
      font-family: var(--font-mono);
      font-size: calc(10px * var(--fs));
      padding: 3px 6px;
      border-radius: 3px;
    }

    .legend-line.incoh {
      border-top: 2px dashed #a78bfa;
      background: transparent;
      height: 0;
    }

    /* L1 (7a): przełącznik segmentowy (szczeliny; później także gumka) – wygląd jak przyciski rozdzielczości */
    .seg-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      flex-wrap: wrap;
    }

    .seg-buttons {
      display: flex;
      flex-wrap: wrap;
      gap: 4px;
    }

    .btn-seg {
      background: var(--bg-card);
      border: 1px solid var(--border-dim);
      color: var(--text-muted);
      font-family: inherit;
      font-size: calc(10px * var(--fs));
      padding: 3px 7px;
      border-radius: 3px;
      cursor: pointer;
      text-align: center;
      transition: all 0.15s ease;
    }

    .btn-seg:hover {
      background: var(--bg-hover);
      color: var(--text-main);
      border-color: var(--border-bright);
    }

    .btn-seg.active {
      background: rgba(245, 158, 11, 0.12);
      border-color: var(--accent-cyan);
      color: var(--accent-cyan);
      font-weight: 700;
    }

    .btn-seg:focus-visible {
      outline: 1px solid var(--accent-cyan);
      outline-offset: 1px;
    }

    .btn-seg:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    .legend-line.hist {
      background: rgba(203, 213, 225, 0.7);
      border: 1px solid #cbd5e1;
      height: 6px;
      width: 12px;
    }

    .caliper-hud-card {
      position: absolute;
      bottom: 8px;
      right: 10px;
      background: rgba(14, 20, 30, 0.98);   /* W6: bez backdrop-filter */
      border: 1px solid var(--accent-amber);
      border-radius: 6px;
      padding: 7px 12px;
      display: flex;
      flex-direction: column;
      gap: 4px;
      font-size: calc(10px * var(--fs));
      box-shadow: 0 0 16px rgba(255, 183, 0, 0.15);
      z-index: 6;
      min-width: calc(200px * var(--fs));
    }

    .caliper-hud-title {
      font-weight: 700;
      color: var(--accent-amber);
      letter-spacing: 0.06em;
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 2px;
    }

    .caliper-row {
      display: flex;
      justify-content: space-between;
      gap: 12px;
    }

    .sidebar-column {
      background: var(--bg-panel);
      display: flex;
      flex-direction: column;
      height: 100%;
      overflow-y: auto;
      overflow-x: hidden;
    }

    .sidebar-column::-webkit-scrollbar {
      width: 6px;
    }

    .sidebar-column::-webkit-scrollbar-track {
      background: var(--bg-panel);
    }

    .sidebar-column::-webkit-scrollbar-thumb {
      background: var(--border-bright);
      border-radius: 3px;
    }

    .sidebar-header {
      padding: 12px 16px;
      border-bottom: 1px solid var(--border-dim);
      background: #0c1017;
    }

    .sidebar-title {
      font-size: calc(12px * var(--fs));
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--accent-cyan);
    }

    .sidebar-desc {
      font-size: calc(11px * var(--fs));
      color: var(--text-dim);
      margin-top: 2px;
    }

    .param-group {
      padding: 12px 16px;
      border-bottom: 1px solid var(--border-dim);
      display: flex;
      flex-direction: column;
      gap: 10px;
      transition: background-color 0.3s ease, border-left-color 0.3s ease;
    }

    /* 10a (w Paczce 2 „9n”): kod barw grup – znacznik przy tytule i etykieta po prawej w jednym kolorze grupy (luminofory kineskopów i barwy
       już niesione przez aplikację: fiolet D² paska komplementarności, fuksja I₊ gumki); tytuły zostają w kolorze tekstu */
    .param-group.gc-0 { --gc: #f59e0b; }   /* scenariusze – bursztyn P3 (barwa przewodnia) */
    .param-group.gc-1 { --gc: #6fd68f; }   /* detekcja kwantowa – zieleń luminoforu P1 */
    .param-group.gc-2 { --gc: #9db4dc; }   /* geometria układu – stalowy błękit P4 */
    .param-group.gc-3 { --gc: #5ec8e5; }   /* parametry wiązki – cyjan P7 */
    .param-group.gc-4 { --gc: #a78bfa; }   /* informacja kwantowa – fiolet D² */
    .param-group.gc-5 { --gc: #f0abfc; }   /* gumka kwantowa – fuksja I₊ */
    .param-group[class*="gc-"] .group-title::before { background: var(--gc); }
    .group-tag { font-size: calc(10px * var(--fs)); color: var(--gc, var(--text-dim)); }

    /* 9j: wszystkie grupy panelu wyglądają tak samo – bez osobnego lewego paska i tła dla scenariuszy (presets-group)
       i detekcji (highlight-mc); barwę grupy niesie znacznik przy tytule (.group-title::before). Klasy zostają (JS). */

    .group-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .group-title {
      font-size: calc(12px * var(--fs));
      font-weight: 700;
      letter-spacing: 0.06em;
      color: var(--text-muted);
      text-transform: uppercase;
      display: flex;
      align-items: center;
      gap: 7px;
    }

    .group-title::before {
      content: '';
      display: inline-block;
      width: calc(5px * var(--fs));
      height: calc(15px * var(--fs));
      background: var(--accent-cyan);
      border-radius: 2.5px;
    }

    .group-title.cyan::before {
      background: var(--accent-cyan);
    }

    .group-title.purple::before {
      background: var(--accent-purple);
    }

    .group-title.green::before {
      background: var(--accent-green);
    }

    /* 7b+ (C): zwijane grupy panelu – nagłówek jest przyciskiem; domyślnie wszystko rozwinięte (bez zapamiętywania) */
    .group-toggle {
      display: grid;
      grid-template-columns: auto minmax(0, 1fr);
      align-items: center;
      column-gap: 6px;
      row-gap: 2px;
      flex: 0 1 auto;
      min-width: 0;
      min-height: 28px;
      margin: -4px 0;
      padding: 2px 0;
      background: none;
      border: 0;
      color: inherit;
      font: inherit;
      text-align: left;
      cursor: pointer;
    }
    .group-toggle:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 2px; border-radius: 3px; }
    .group-header > .group-toggle ~ * { flex: 0 0 auto; white-space: nowrap; margin-left: 8px; }
    .group-header > .group-toggle { margin-right: auto; }   /* P3 (30.10.2026): znacznik grupy i [?] razem przy prawej krawędzi – jak w kicie */
    .group-chev {
      flex: 0 0 auto;
      width: calc(11px * var(--fs));
      color: var(--text-muted);
      font-size: calc(11px * var(--fs));
      transition: transform 0.15s ease;
    }
    .param-group.is-collapsed .group-chev { transform: rotate(-90deg); }
    .group-summary {
      display: none;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-size: calc(10.5px * var(--fs));
      color: var(--text-muted);
      font-variant-numeric: tabular-nums;
    }
    .param-group.is-collapsed .group-summary { display: block; }
    .group-summary { grid-column: 2; }
    .param-group.is-collapsed > .group-body { display: none; }
    .param-group.is-collapsed { gap: 0; }
    .group-body { display: flex; flex-direction: column; gap: 10px; }
    /* 7b+ (B): panel „Interferometr gwiazdowy” – widoczny tylko przy źródle „Tarcza” */
    .stellar-panel {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-top: 4px;
      padding: 10px 10px 8px;
      border: 1px solid var(--border-bright);
      border-radius: 4px;
      background: rgba(255, 255, 255, 0.02);
    }
    .stellar-panel[hidden] { display: none; }
    .stellar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
    .stellar-title { font-size: calc(11px * var(--fs)); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
    .stellar-obj { display: flex; align-items: center; gap: 8px; font-size: calc(11px * var(--fs)); color: var(--text-muted); }
    .stellar-obj select {
      flex: 1 1 auto;
      min-width: 0;
      min-height: 28px;
      background: #0b0e14;
      color: var(--text-main, #e2e8f0);
      border: 1px solid var(--border-bright);
      border-radius: 3px;
      font-family: var(--font-mono);
      font-size: calc(11px * var(--fs));
    }
    .stellar-src { font-size: calc(10px * var(--fs)); color: var(--text-dim); line-height: 1.35; }
    .stellar-grid { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; row-gap: 2px; font-size: calc(10.5px * var(--fs)); font-variant-numeric: tabular-nums; }
    .stellar-grid dt { color: var(--text-dim); }
    .stellar-grid dd { margin: 0; color: var(--text-main, #e2e8f0); text-align: right; white-space: nowrap; }
    .stellar-plot { width: 100%; height: 110px; display: block; }
    .stellar-note { font-size: calc(10px * var(--fs)); color: var(--text-muted); line-height: 1.35; }
    .stellar-note.is-warn { color: var(--warn, #f59e0b); }
    @media (max-width: 600px) {
      .stellar-obj select { min-height: 44px; }
      .stellar-plot { height: 120px; }
    }

    .groups-toggle-all {
      margin-top: 6px;
      padding: 2px 8px;
      min-height: 24px;
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid var(--border-bright);
      border-radius: 3px;
      color: var(--text-muted);
      font-family: var(--font-mono);
      font-size: calc(10px * var(--fs));
      cursor: pointer;
    }
    .groups-toggle-all:hover { color: var(--accent-cyan); }
    .groups-toggle-all:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 2px; }
    @media (max-width: 600px) {
      .group-toggle { min-height: 44px; margin: -8px 0 0; }
      .groups-toggle-all { min-height: 36px; position: relative; }
      .groups-toggle-all::after { content: ''; position: absolute; inset: -4px 0; }
    }

    .presets-grid {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    /* P3 (30.10.2026): zdanie nad listą scenariuszy – jak w kicie (.lab-derived, Black Hole) */
    .presets-note {
      color: var(--text-muted);
      font-size: calc(10px * var(--fs));
      line-height: 1.4;
      letter-spacing: 0.02em;
    }

    .preset-row {
      display: flex;
      gap: 6px;
      align-items: stretch;
      width: 100%;
    }

    .btn-scenario {
      flex: 1;
      min-width: 0;
      background: var(--bg-card);
      border: 1px solid var(--border-dim);
      color: var(--text-main);
      font-family: inherit;
      font-size: calc(11px * var(--fs));
      padding: 6px 10px;
      border-radius: 4px;
      cursor: pointer;
      display: flex;
      justify-content: space-between;
      align-items: center;
      text-align: left;
      transition: all 0.15s ease;
    }

    .btn-scenario:hover {
      background: var(--bg-hover);
      border-color: var(--accent-cyan);
      transform: translateX(2px);
    }

    .btn-scenario.active {
      border-color: var(--accent-cyan);
      background: rgba(245, 158, 11, 0.10);
      color: var(--accent-cyan);
      font-weight: 700;
      box-shadow: 0 0 8px rgba(245, 158, 11, 0.18), inset 0 0 6px rgba(245, 158, 11, 0.06);
    }

    .scenario-title {
      font-weight: 600;
    }

    .scenario-tag {
      font-size: calc(9.5px * var(--fs));
      color: var(--text-dim);
      font-weight: 400;
    }

    .btn-scenario.active .scenario-tag {
      color: var(--accent-cyan);
    }

    /* 8f: scenariusz zmieniony ręcznie (suwak, przełącznik szczelin lub źródła, link) – obramowanie przerywane */
    .btn-scenario.active.is-modified {
      border-style: dashed;
      background: rgba(245, 158, 11, 0.04);
    }

    .scenario-arrow {
      color: #9E8155;
      font-size: calc(12px * var(--fs));
      margin-left: 6px;
      flex-shrink: 0;
    }

    .preset-inspect-btn {
      width: calc(32px * var(--fs));
      min-width: calc(32px * var(--fs));
      height: auto;
      font-size: calc(11px * var(--fs));
      font-weight: 700;
      border-radius: 4px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: var(--bg-card);
      border: 1px solid var(--border-dim);
      color: var(--text-dim);
      cursor: pointer;
      transition: all 0.15s ease;
      margin: 0;
    }

    .preset-inspect-btn:hover {
      color: var(--accent-cyan);
      border-color: var(--accent-cyan);
      background: rgba(245, 158, 11, 0.12);
      box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
    }

    .control-item {
      display: flex;
      flex-direction: column;
      gap: 5px;
      border-radius: 4px;
      padding: 4px;
      margin: -4px;
      transition: background-color 0.2s ease;
    }

    .control-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: calc(11px * var(--fs));
    }

    .control-label {
      font-size: calc(11px * var(--fs));
      color: var(--text-main);
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .symbol-tag {
      color: var(--accent-amber);
      font-style: italic;
      font-weight: 600;
    }

    .control-readout {
      background: var(--bg-dark);
      border: 1px solid var(--border-dim);
      padding: 2px 6px;
      border-radius: 4px;
      color: var(--accent-cyan);
      font-weight: 600;
      font-size: calc(11px * var(--fs));
      min-width: calc(60px * var(--fs));
      text-align: right;
      transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
    }

    .control-readout.active-pulse-purple {
      color: var(--accent-purple);
      border-color: var(--accent-purple);
      box-shadow: 0 0 6px rgba(192, 132, 252, 0.4);
    }

    .control-readout.active-pulse-amber {
      color: var(--accent-amber);
      border-color: var(--accent-amber);
      box-shadow: 0 0 6px rgba(255, 183, 0, 0.4);
    }

    .control-readout.active-pulse-green {
      color: var(--accent-green);
      border-color: var(--accent-green);
      box-shadow: 0 0 6px rgba(217, 119, 6, 0.4);
    }

    input[type="range"] {
      -webkit-appearance: none;
      appearance: none;
      width: 100%;
      height: 6px;
      background: var(--bg-card);
      border-radius: 3px;
      outline: none;
      border: 1px solid var(--border-dim);
      cursor: pointer;
    }

    input[type="range"]::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 14px;
      height: 14px;
      border-radius: 3px;
      background: var(--accent-cyan);
      box-shadow: 0 0 6px var(--accent-cyan);
      cursor: pointer;
      transition: transform 0.1s, background-color 0.1s;
    }

    input[type="range"]::-webkit-slider-thumb:hover {
      transform: scale(1.15);
      background: #fff;
    }

    input[type="range"].slider-green::-webkit-slider-thumb {
      background: var(--accent-green);
      box-shadow: 0 0 6px var(--accent-green);
    }

    .color-chip-preview {
      display: inline-block;
      width: 12px;
      height: 12px;
      border-radius: 2px;
      vertical-align: middle;
      border: 1px solid rgba(255, 255, 255, 0.3);
      box-shadow: 0 0 8px currentColor;
    }

    .formula-hud-card {
      background: #090e17;
      border: 1px solid var(--border-bright);
      border-radius: 6px;
      padding: 9px 11px;
      display: flex;
      flex-direction: column;
      gap: 7px;
      box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.5);
      transition: border-color 0.25s, box-shadow 0.25s;
    }

    .formula-line {
      font-size: calc(11px * var(--fs));
      color: #94a3b8;
      background: rgba(15, 20, 28, 0.6);
      padding: 4px 7px;
      border-radius: 4px;
      border-left: 3px solid var(--accent-cyan);
      white-space: nowrap;
      overflow-x: auto;
    }

    .formula-line.secondary {
      border-left-color: var(--accent-purple);
      font-size: calc(10px * var(--fs));
    }

    .math-token {
      transition: color 0.2s, text-shadow 0.2s, background-color 0.2s;
      cursor: pointer;
      border-bottom: 1px dotted rgba(255, 255, 255, 0.35);
      padding: 0 2px;
      border-radius: 2px;
    }

    .math-token:hover {
      background: rgba(245, 158, 11, 0.15);
      color: var(--accent-cyan);
    }

    .glow-amber {
      color: var(--accent-amber) !important;
      text-shadow: 0 0 8px var(--accent-amber);
    }

    .glow-purple {
      color: var(--accent-purple) !important;
      text-shadow: 0 0 8px var(--accent-purple);
    }

    .quantum-state-banner {
      background: rgba(15, 20, 28, 0.9);
      border: 1px solid var(--border-dim);
      border-radius: 4px;
      padding: 5px 8px;
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: calc(10px * var(--fs));
      font-weight: 700;
      letter-spacing: 0.04em;
    }

    .state-led {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--accent-green);
      box-shadow: 0 0 6px var(--accent-green);
      flex-shrink: 0;
    }

    .comp-meters {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 5px;
    }

    .comp-metric {
      background: var(--bg-dark);
      padding: 4px 7px;
      border-radius: 4px;
      border: 1px solid var(--border-dim);
      cursor: pointer;
      transition: border-color 0.15s, background-color 0.15s;
    }

    .comp-metric:hover {
      border-color: var(--accent-cyan);
      background: rgba(245, 158, 11, 0.04);
    }

    .comp-metric-label {
      font-size: calc(9px * var(--fs));
      color: var(--text-dim);
      margin-bottom: 2px;
    }

    .comp-metric-val {
      font-size: calc(11.5px * var(--fs));
      font-weight: 700;
    }

    .relation-bar-track {
      height: 6px;
      background: var(--bg-dark);
      border-radius: 3px;
      overflow: hidden;
      position: relative;
      border: 1px solid var(--border-dim);
    }

    .relation-bar-fill-d {
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      background: var(--accent-purple);
      transition: width 0.15s ease-out;
    }

    .grating-info .is-warn { color: var(--warn, #f59e0b); }
    .relation-bar-track.is-na { display: none; }
    .relation-bar-row { display: flex; align-items: center; gap: 8px; }   /* 9g′ */
    .relation-bar-row .relation-bar-track { flex: 1 1 auto; }
    .relation-bar-row[hidden] { display: none; }
    .relation-bar-fill-p {   /* 7b: część D² pochodząca z przewidywalności P² – zakreskowana */
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      background: repeating-linear-gradient(135deg, rgba(5, 8, 14, 0.6) 0 2px, transparent 2px 4px);
      transition: width 0.15s ease-out;
    }

    .formula-pd {
      margin: 6px 0 4px;
      font-size: calc(10px * var(--fs));
      color: var(--accent-purple);
      cursor: pointer;
    }

    .source-row {
      margin-top: 6px;
    }

    .relation-bar-fill-v {
      position: absolute;
      right: 0;
      top: 0;
      bottom: 0;
      background: var(--accent-green);
      transition: width 0.15s ease-out;
    }

    .photon-counter-card {
      background: #080d14;
      border: 1px solid rgba(217, 119, 6, 0.3);
      border-radius: 6px;
      padding: 10px 12px;
      display: flex;
      flex-direction: column;
      gap: 4px;
      box-shadow: 0 0 16px rgba(217, 119, 6, 0.06);
      transition: border-color 0.25s, box-shadow 0.25s;
    }

    .counter-top-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .counter-label {
      font-size: calc(10px * var(--fs));
      font-weight: 700;
      color: var(--text-muted);
      letter-spacing: 0.06em;
    }

    .counter-display {
      font-size: calc(26px * var(--fs));
      font-weight: 800;
      color: var(--accent-green);
      text-shadow: 0 0 10px rgba(217, 119, 6, 0.4);
      letter-spacing: 0.12em;
      line-height: 1.1;
      font-variant-numeric: tabular-nums;
    }

    .counter-submetrics {
      display: flex;
      justify-content: space-between;
      font-size: calc(10px * var(--fs));
      color: var(--text-dim);
      margin-top: 2px;
    }

    .counter-submetrics span.active {
      color: var(--accent-cyan);
    }

    .rate-presets {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 4px;
      margin-top: 2px;
    }

    .btn-preset {
      background: var(--bg-card);
      border: 1px solid var(--border-dim);
      color: var(--text-muted);
      font-family: inherit;
      font-size: calc(10px * var(--fs));
      padding: 4px 0;
      border-radius: 3px;
      cursor: pointer;
      text-align: center;
      transition: all 0.15s ease;
    }

    .btn-preset:hover {
      background: var(--bg-hover);
      color: var(--text-main);
      border-color: var(--border-bright);
    }

    .btn-preset.active {
      background: rgba(217, 119, 6, 0.15);
      border-color: var(--accent-green);
      color: var(--accent-cyan);   /* B-2: #d97706 na zielonkawym tle miał 4,4:1 */
      font-weight: 700;
    }

    .mode-toggle-group {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 6px;
      background: var(--bg-dark);
      padding: 3px;
      border-radius: 6px;
      border: 1px solid var(--border-dim);
    }

    .mode-btn {
      background: transparent;
      border: none;
      color: var(--text-muted);
      font-family: inherit;
      font-size: calc(11px * var(--fs));
      font-weight: 600;
      padding: 6px 8px;
      border-radius: 4px;
      cursor: pointer;
      transition: all 0.15s ease;
    }

    .mode-btn.active {
      background: var(--bg-card);
      color: var(--accent-cyan);
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
      border: 1px solid var(--border-bright);
    }

    .mode-btn.mc-active {
      color: var(--accent-green);
      border-color: var(--accent-green);
      background: rgba(217, 119, 6, 0.12);
    }

    .playback-row {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 6px;
    }

    .btn-action {
      background: var(--bg-card);
      border: 1px solid var(--border-dim);
      color: var(--text-main);
      font-family: inherit;
      font-size: calc(11px * var(--fs));
      font-weight: 600;
      padding: 7px 8px;
      border-radius: 4px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      transition: background 0.15s, border-color 0.15s;
    }

    .btn-action:hover {
      background: var(--bg-hover);
      border-color: var(--accent-cyan);
    }

    .btn-action.mc-primary {
      background: rgba(217, 119, 6, 0.12);
      border-color: var(--accent-green);
      color: var(--accent-green);
    }

    .btn-action.mc-primary:hover {
      background: rgba(217, 119, 6, 0.22);
    }

    /* W1: rozdzielczość widoku fali */
    .res-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      flex-wrap: wrap;
    }

    .res-buttons {
      display: grid;
      grid-template-columns: repeat(4, auto);
      gap: 4px;
    }

    .btn-res {
      background: var(--bg-card);
      border: 1px solid var(--border-dim);
      color: var(--text-muted);
      font-family: inherit;
      font-size: calc(10px * var(--fs));
      padding: 3px 7px;
      border-radius: 3px;
      cursor: pointer;
      text-align: center;
      font-variant-numeric: tabular-nums;
      transition: all 0.15s ease;
    }

    .btn-res:hover {
      background: var(--bg-hover);
      color: var(--text-main);
      border-color: var(--border-bright);
    }

    .btn-res.active {
      background: rgba(245, 158, 11, 0.12);
      border-color: var(--accent-cyan);
      color: var(--accent-cyan);
      font-weight: 700;
    }

    .btn-res:focus-visible {
      outline: 1px solid var(--accent-cyan);
      outline-offset: 1px;
    }

    .options-row {
      display: flex;
      flex-direction: column;
      gap: 6px;
      font-size: calc(11px * var(--fs));
      color: var(--text-muted);
      margin-top: 2px;
    }

    .checkbox-label {
      display: flex;
      align-items: center;
      gap: 8px;
      cursor: pointer;
      font-size: calc(11px * var(--fs));
    }

    .checkbox-label input[type="checkbox"] {
      -webkit-appearance: none;
      appearance: none;
      width: 14px;
      height: 14px;
      flex-shrink: 0;
      border-radius: 3px;
      margin: 0;
      cursor: pointer;
      position: relative;
      background-color: rgba(217, 119, 6, 0.08);
      border: 1px solid rgba(217, 119, 6, 0.38);
      transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
      background-position: center;
      background-repeat: no-repeat;
      background-size: 70% 70%;
    }

    .checkbox-label:hover input[type="checkbox"]:not(:checked),
    .checkbox-label input[type="checkbox"]:hover:not(:checked) {
      background-color: rgba(217, 119, 6, 0.18);
      border-color: var(--accent-green);
      box-shadow: 0 0 6px rgba(217, 119, 6, 0.35);
    }

    .checkbox-label input[type="checkbox"]:focus-visible {
      outline: 2px solid var(--accent-green);
      outline-offset: 1px;
    }

    .checkbox-label input[type="checkbox"]:checked {
      background-color: var(--accent-green);
      border-color: var(--accent-green);
      box-shadow: 0 0 8px rgba(217, 119, 6, 0.4);
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2308110c' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5l3 3 6.5-6.5'/%3E%3C/svg%3E");
    }

    .btn-inspect {
      width: calc(14px * var(--fs));
      height: calc(14px * var(--fs));
      min-width: calc(14px * var(--fs));
      min-height: calc(14px * var(--fs));
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid var(--border-bright);
      border-radius: 3px;
      color: var(--text-dim);
      font-family: var(--font-mono);
      font-size: calc(9.5px * var(--fs));
      font-weight: 700;
      line-height: calc(12px * var(--fs));
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0;
      margin-left: 6px;
      vertical-align: middle;
      transition: all 0.15s ease;
      flex-shrink: 0;
    }

    .btn-inspect:hover {
      color: var(--accent-cyan);
      border-color: var(--accent-cyan);
      background: rgba(245, 158, 11, 0.12);
      box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
    }

    /* Boczna szuflada kompendium (Theory Drawer) */

    #theory-drawer {
      position: fixed;
      top: 0;
      right: 0;
      bottom: 0;
      width: calc(440px * var(--fs));
      max-width: 100vw;
      background: #0d131c;
      border-left: 1px solid var(--accent-cyan);
      box-shadow: -8px 0 24px rgba(0, 0, 0, 0.7);
      z-index: 100;
      display: flex;
      flex-direction: column;
      transform: translateX(100%);
      transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    }

    #theory-drawer.open {
      transform: translateX(0);
    }

    /* etap 5b: informacja, gdy karty EN jeszcze się wczytują albo plik się nie wczytał */

    /* etap 5c: sekcja „Więcej” w karcie Kompendium */

    .state-text {
      display: flex;
      flex-direction: column;
      gap: 1px;
      min-width: 0;
    }

    #state-cause {
      color: var(--text-dim);
      font-weight: 400;
    }

    #state-cause[hidden] {
      display: none;
    }

    /* ========================================================
       4. STYLE MODALA POWITALNEGO (WELCOME MODAL)
       ======================================================== */
    .modal-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(5, 8, 14, 0.85);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      z-index: 2000;
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
      transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
      padding: 16px;
    }

    .modal-backdrop.open {
      opacity: 1;
      visibility: visible;
      pointer-events: auto;
    }

    .welcome-body-content {
      flex: 1;
      overflow-y: auto;
      padding: 24px;
      display: flex;
      flex-direction: column;
      gap: 20px;
      font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      font-size: calc(13.5px * var(--fs));
      line-height: 1.6;
      color: #cbd5e1;
    }

    .welcome-body-content::-webkit-scrollbar {
      width: 6px;
    }

    .welcome-body-content::-webkit-scrollbar-track {
      background: #0d131c;
    }

    .welcome-body-content::-webkit-scrollbar-thumb {
      background: var(--border-bright);
      border-radius: 3px;
    }

    .intro-section-card {
      background: #111823;
      padding: 18px 20px;
      border: 1px solid var(--border-dim);
      border-radius: 6px;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .intro-section-card h3 {
      font-size: calc(14px * var(--fs));
      font-weight: 700;
      color: #fff;
      margin: 0;
      display: flex;
      align-items: center;
      gap: 8px;
      font-family: var(--font-mono);
    }

    .welcome-checkbox-label {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: calc(11px * var(--fs));
      color: var(--text-dim);
      cursor: pointer;
      user-select: none;
    }

    .welcome-checkbox-label input[type="checkbox"] {
      -webkit-appearance: none;
      appearance: none;
      width: 14px;
      height: 14px;
      flex-shrink: 0;
      border-radius: 3px;
      margin: 0;
      cursor: pointer;
      position: relative;
      background-color: rgba(245, 158, 11, 0.08);
      border: 1px solid rgba(245, 158, 11, 0.38);
      transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
      background-position: center;
      background-repeat: no-repeat;
      background-size: 70% 70%;
    }

    .welcome-checkbox-label:hover input[type="checkbox"]:not(:checked),
    .welcome-checkbox-label input[type="checkbox"]:hover:not(:checked) {
      background-color: rgba(245, 158, 11, 0.18);
      border-color: var(--accent-cyan);
      box-shadow: 0 0 6px rgba(245, 158, 11, 0.35);
    }

    .welcome-checkbox-label input[type="checkbox"]:focus-visible {
      outline: 2px solid var(--accent-cyan);
      outline-offset: 1px;
    }

    .welcome-checkbox-label input[type="checkbox"]:checked {
      background-color: var(--accent-cyan);
      border-color: var(--accent-cyan);
      box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2308110c' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5l3 3 6.5-6.5'/%3E%3C/svg%3E");
    }

    @keyframes pulseParamHighlight {
      0% {
        box-shadow: 0 0 0px var(--accent-cyan);
        border-color: var(--border-bright);
      }
      50% {
        box-shadow: 0 0 16px var(--accent-cyan), inset 0 0 8px rgba(245, 158, 11, 0.25);
        border-color: var(--accent-cyan);
        background-color: rgba(245, 158, 11, 0.08);
      }
      100% {
        box-shadow: 0 0 0px var(--accent-cyan);
        border-color: var(--border-bright);
      }
    }

    .param-highlight {
      animation: pulseParamHighlight 1.5s ease-in-out !important;
      border-color: var(--accent-cyan) !important;
    }

    #lab-toast {
      position: fixed;
      bottom: 20px;
      left: 20px;
      background: rgba(15, 20, 28, 0.95);
      border: 1px solid var(--accent-cyan);
      border-radius: 6px;
      padding: 9px 14px;
      font-size: calc(11px * var(--fs));
      color: var(--text-main);
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
      z-index: 1000;
      opacity: 0;
      transform: translateY(10px);
      transition: opacity 0.25s ease, transform 0.25s ease;
      pointer-events: none;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    #lab-toast.show {
      opacity: 1;
      transform: translateY(0);
    }

    /* E5 (18.11.2026): przycisk w komunikacie („↶ Cofnij” po ▶ Wypróbuj) – klikalny tylko przy widocznym komunikacie */
    #lab-toast .toast-action {
      pointer-events: none;
      margin-left: 6px;
      background: var(--bg-card);
      border: 1px solid var(--accent-cyan);
      color: var(--accent-cyan);
      font-family: inherit;
      font-size: calc(11px * var(--fs));
      font-weight: 700;
      padding: 4px 10px;
      min-height: 28px;
      border-radius: 3px;
      cursor: pointer;
    }

    #lab-toast.show .toast-action {
      pointer-events: auto;
    }

    #gl-error-overlay {
      position: absolute;
      inset: 0;
      background: rgba(10, 14, 20, 0.95);
      display: none;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 24px;
      text-align: center;
      z-index: 100;
    }

    .gl-err-detail {   /* 9i: treść błędu shadera i nazwa GPU (do zgłoszenia) */
      text-align: left; white-space: pre-wrap; word-break: break-word; max-height: 30vh; overflow: auto;
      font-size: calc(10px * var(--fs)); color: var(--text-muted); background: rgba(0,0,0,0.35); padding: 8px; border-radius: 4px; margin: 0;
      user-select: text;
    }
    .gl-lite-note {   /* 9i: lżejszy shader – ta konfiguracja nie ma widoku fali */
      position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5; max-width: 80%;
      padding: 10px 14px; border: 1px solid var(--accent-amber, #f59e0b); border-radius: 6px; background: rgba(10,14,20,0.9);
      color: var(--text-main, #e5e7eb); font-size: calc(12px * var(--fs)); text-align: center; pointer-events: none;
    }
    #gl-error-overlay .error-card { max-height: 100%; overflow: auto; }   /* 9i: na telefonie karta wyższa niż widok fali */
    @media (max-width: 600px) { #gl-error-overlay { padding: 8px; } #gl-error-overlay .error-card { padding: 10px; } #gl-error-overlay h2 { font-size: calc(15px * var(--fs)); } }
    .error-card {
      border: 1px solid #ff4444;
      background: rgba(255, 68, 68, 0.08);
      border-radius: 8px;
      padding: 20px;
      max-width: 480px;
    }

    @media (max-width: 1200px) {
      .hide-tablet {
        display: none !important;
      }
    }

    @media (max-width: 900px) {
      header.lab-header {
        padding: 0 10px;
      }

      .brand-sub {
        display: none !important;
      }

      .hide-mobile {
        display: none !important;
      }

      .header-action-text {
        display: none;
      }

      .mobile-tabs {
        display: flex;
      }

      .workbench-layout {
        display: flex !important;
        flex-direction: column;
        width: 100vw;
        height: calc(100vh - 44px);
      }

      .workbench-layout.show-controls .viewport-column {
        display: none !important;
      }

      .workbench-layout.show-controls .sidebar-column {
        display: flex !important;
        width: 100% !important;
        height: 100% !important;
        overflow-y: auto !important;
      }

      .workbench-layout:not(.show-controls) .sidebar-column {
        display: none !important;
      }

      .workbench-layout:not(.show-controls) .viewport-column {
        display: flex !important;
        width: 100% !important;
        height: 100% !important;
        border-right: none;
      }
    }

    /* --- Language switch (PL / EN) --- */
    .lang-switch {
      display: inline-flex;
      align-items: stretch;
      flex-shrink: 0;
      background: #0d1117;
      border: 1px solid var(--border-bright, #283548);
      border-radius: 4px;
      overflow: hidden;
    }

    .lang-btn {
      background: transparent;
      border: none;
      color: var(--text-muted);
      font-family: inherit;
      font-size: calc(11px * var(--fs));
      font-weight: 700;
      letter-spacing: 0.06em;
      line-height: 1.2;
      padding: 4px 9px;
      cursor: pointer;
      transition: all 0.15s ease;
      -webkit-tap-highlight-color: transparent;
    }

    .lang-btn:focus {
      outline: none;
    }

    .lang-btn + .lang-btn {
      border-left: 1px solid rgba(255, 183, 0, 0.2);
    }

    .lang-btn:hover {
      color: #fff;
      background: #141a24;
    }

    .lang-btn.active {
      background: rgba(245, 158, 11, 0.15);
      color: var(--accent-cyan);
      box-shadow: inset 0 0 8px rgba(56, 189, 248, 0.25);
    }

    .lang-btn:focus-visible {
      outline: 1px solid var(--accent-cyan);
      outline-offset: -2px;
    }

    /* --- Firefox (Gecko): suwaki --- */
    input[type="range"]::-moz-range-thumb {
      box-sizing: border-box;
      width: 14px;
      height: 14px;
      border: none;
      border-radius: 3px;
      background: var(--accent-cyan);
      box-shadow: 0 0 6px var(--accent-cyan);
      cursor: pointer;
      transition: transform 0.1s, background-color 0.1s;
    }

    input[type="range"]::-moz-range-thumb:hover {
      transform: scale(1.15);
      background: #fff;
    }

    input[type="range"].slider-green::-moz-range-thumb {
      background: var(--accent-green);
      box-shadow: 0 0 6px var(--accent-green);
    }

    input[type="range"]::-moz-range-track {
      background: transparent;
      border: none;
    }

    input[type="range"]::-moz-range-progress {
      background: transparent;
    }

    @supports (-moz-appearance: none) {
      input[type="range"] {
        overflow: visible;
      }
    }

    /* --- Firefox (Gecko): paski przewijania (Chromium zachowuje ::-webkit-scrollbar) --- */
    @supports not selector(::-webkit-scrollbar) {
      .detector-toolbar {
        scrollbar-width: none;
      }

      .sidebar-column {
        scrollbar-width: thin;
        scrollbar-color: var(--border-bright) var(--bg-panel);
      }

      .welcome-body-content {
        scrollbar-width: thin;
        scrollbar-color: var(--border-bright) #0d131c;
      }

      .formula-line,
      .formula-line.secondary {
        scrollbar-width: thin;
        scrollbar-color: var(--border-bright) transparent;
      }
    }

    /* --- Rozmiar czcionki (tylko widok desktop, >900 px) --- */
    :root {
      --fs: 1;
    }

    @media (min-width: 901px) {
      html[data-font-scale="90"] { --fs: 0.9; }   /* 8g: mniejszy stopień (małe ekrany) */
      html[data-font-scale="115"] { --fs: 1.15; }
      html[data-font-scale="130"] { --fs: 1.3; }
      html[data-font-scale="150"] { --fs: 1.5; }
    }

    .fs-switch {
      display: inline-flex;
      align-items: stretch;
      flex-shrink: 0;
      background: #0d1117;
      border: 1px solid var(--border-bright, #283548);
      border-radius: 4px;
      overflow: hidden;
    }

    .fs-btn {
      background: transparent;
      border: none;
      color: var(--text-muted);
      font-family: inherit;
      font-size: calc(11px * var(--fs));
      font-weight: 700;
      line-height: 1.2;
      padding: 4px 8px;
      cursor: pointer;
      transition: all 0.15s ease;
    }

    .fs-btn:hover:not(:disabled) {
      color: #fff;
      background: #141a24;
    }

    .fs-btn:disabled {
      opacity: 0.35;
      cursor: default;
    }

    .fs-btn:focus-visible {
      outline: 1px solid var(--accent-cyan);
      outline-offset: -2px;
    }

    .fs-value {
      display: inline-flex;
      align-items: center;
      min-width: 3.4em;
      justify-content: center;
      font-size: calc(10px * var(--fs));
      font-weight: 700;
      color: var(--accent-cyan);
      border-left: 1px solid var(--border-bright, #283548);
      border-right: 1px solid var(--border-bright, #283548);
      font-variant-numeric: tabular-nums;
    }

    .sidebar-header {
      position: relative;
    }

    .fs-switch.fs-in-sidebar {   /* 9g′: w wierszu nagłówka (dawniej absolutnie w rogu) */
      flex: none;
    }
    .sidebar-header {   /* 9g′: dwa wiersze – tytuł | skala czcionki, opis | „Zwiń grupy” */
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      grid-template-areas: "title fs" "desc btn";
      align-items: center;
      column-gap: 12px;
      row-gap: 4px;
      padding-top: 10px;
      padding-bottom: 10px;
    }
    .sidebar-head-row { display: contents; }
    .sidebar-header .sidebar-title { grid-area: title; }
    .sidebar-header .fs-in-sidebar { grid-area: fs; }
    .sidebar-header .sidebar-desc { grid-area: desc; margin-top: 0; }
    .sidebar-header .groups-toggle-all { grid-area: btn; margin-top: 0; align-self: center; white-space: nowrap; }

    .fs-in-sidebar .fs-btn {
      padding: 2px 7px;
    }
    /* 10a (w Paczce 2 „9m”): gdy przycisk „Zwiń grupy” jest szerszy (np. EN „Collapse groups”), przełącznik rozciąga się do szerokości kolumny –
       nadmiar dzielony po równo między A−, wartość i A+ (wcześniej cały trafiał za „A+”); bez nadmiaru szerokości jak dotąd */
    .fs-in-sidebar > .fs-btn,
    .fs-in-sidebar > .fs-value { flex: 1 1 auto; }

    @media (min-width: 901px) {
      html[data-font-scale]:not([data-font-scale="90"]) .detector-toolbar,
      .detector-toolbar.tb-wrap {
        height: auto;
        min-height: calc(34px * var(--fs));
        flex-wrap: wrap;
        justify-content: space-between;
        row-gap: 4px;
        padding-top: 4px;
        padding-bottom: 4px;
        overflow: visible;
      }

      html[data-font-scale]:not([data-font-scale="90"]) .detector-telemetry-row,
      .detector-toolbar.tb-wrap .detector-telemetry-row {
        flex-wrap: wrap;
        margin-left: auto;
      }

      html[data-font-scale]:not([data-font-scale="90"]) .viewport-reticle,
      .viewport-reticle.rt-wrap {
        flex-wrap: wrap;
        justify-content: flex-end;
        left: 12px;
        row-gap: 4px;
      }
    }

    html.fs-notrans *,
    html.fs-notrans *::before,
    html.fs-notrans *::after {
      transition: none !important;
    }

    /* M10: nagłówek przy braku miejsca – kolejne stopnie (dodawane przez fitHeader, łącznie): 1 skróty, 2 opis WebGL2
       (zostaje kropka), 3 tryb detektora, 4 napisy przy ikonach, 5 podtytuł; tytuł łamie się do 2 wierszy zamiast ucinania. */
    @media (min-width: 901px) {
      header.lab-header.hdr-c1 .status-item.status-shortcuts,
      header.lab-header.hdr-c2 #backend-status,
      header.lab-header.hdr-c3 .status-item.status-detector,
      header.lab-header.hdr-c4 .header-action-text,
      header.lab-header.hdr-c5 .brand-sub {
        display: none;
      }

      header.lab-header.hdr-c5 .brand-title {
        white-space: normal;
        line-height: 1.15;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
      }
    }

    @media (max-width: 900px) {
      .fs-switch {
        display: none !important;
      }
    }

    .dlambda-derived {
      margin-top: 6px;
      font-size: calc(10px * var(--fs));
      line-height: 1.4;
      color: var(--text-muted);
      font-variant-numeric: tabular-nums;
      letter-spacing: 0.02em;
    }

    .dlambda-derived strong {
      color: var(--accent-amber);
      font-weight: 600;
    }

    .legend-line.dotted {
      background: repeating-linear-gradient(90deg, var(--accent-amber) 0 2px, transparent 2px 5px);
    }

    @media (prefers-reduced-motion: reduce) {
      *,
      *::before,
      *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
      }
    }
  
/* 9d: panel Kompendium – wybór tematu nie jest już ucinany („Scenarius…”): pole tematu dostaje co najmniej ok. 24 znaki,
   a przyciski „Otwórz w Wiedzy” i łącze przechodzą w razie potrzeby do drugiego wiersza (wyrównane do prawej) */
/* 9j / 10a (w Paczce 2 „9l”): nagłówek Kompendium (każda szerokość) w dwóch wierszach jak okno Wiedza: tytuł i ×, potem menu tematu i „↗ Wiedza”
   – bez etykiety „TEMAT:”, bez podtytułu i bez przycisku łącza (link do karty jest nadal w oknie Wiedza) */
/* =====================================================================
   ETAP 9d – własny zestaw ikon (wariant B: linia 2 px + wypełnienie 20% głównego kształtu, siatka 24×24).
   Ikona = <span class="qi qi-nazwa">: kolor tekstu (currentColor) przez maskę SVG – bez plików, bez skryptu, bez kosztu
   na klatkę; działa też w treści generowanej (przewodnik). Strzałki i znaki typograficzne (→ ➜ ↗ ✕ ⏸ ↺) zostają tekstem.
   ===================================================================== */
.qi {
  display: inline-block;
  flex: none;
  width: 1.2em;
  height: 1.2em;
  vertical-align: -0.24em;
  background-color: currentColor;
  -webkit-mask: var(--qi) center / contain no-repeat;
  mask: var(--qi) center / contain no-repeat;
}
.qi-knowledge { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath fill='%23000' fill-opacity='.2' d='M12 6.6C10 5 7 4.6 3.5 5.1v13.1c3.5-.5 6.5 0 8.5 1.5 2-1.5 5-2 8.5-1.5V5.1C17 4.6 14 5 12 6.6z'/%3E%3Cpath d='M12 6.6v13'/%3E%3C/svg%3E"); }
.qi-compendium { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7.5 4.5h11a1.5 1.5 0 0 1 1.5 1.5v11'/%3E%3Crect fill='%23000' fill-opacity='.2' x='4' y='7.5' width='13' height='13' rx='1.5'/%3E%3Cpath d='M7 12h7M7 15.5h4.5'/%3E%3C/svg%3E"); }
.qi-apparatus { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.5 3v5.5M10.5 10.5v3M10.5 15.5V21'/%3E%3Cpath d='M3.5 7v10M6.5 7v10'/%3E%3Cpath d='M14 8.5a5 5 0 0 1 0 7M17.5 6a9 9 0 0 1 0 12'/%3E%3C/svg%3E"); }
.qi-controls { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h9.5M18.5 7H20M4 17h3.5M12.5 17H20'/%3E%3Ccircle fill='%23000' fill-opacity='.2' cx='16' cy='7' r='2.5'/%3E%3Ccircle fill='%23000' fill-opacity='.2' cx='10' cy='17' r='2.5'/%3E%3C/svg%3E"); }
.qi-export { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect fill='%23000' fill-opacity='.2' x='3.5' y='4.5' width='17' height='13' rx='1.5'/%3E%3Cpath d='M3.5 14l4.5-4 3.5 3 3-2.5 6 5'/%3E%3Cpath d='M12 17.5v3.5M9.5 19l2.5 2 2.5-2'/%3E%3C/svg%3E"); }
.qi-caliper { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect fill='%23000' fill-opacity='.2' x='3' y='8' width='18' height='8' rx='1'/%3E%3Cpath d='M7 8v3M11 8v4.5M15 8v3M19 8v2'/%3E%3C/svg%3E"); }
.qi-search { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle fill='%23000' fill-opacity='.2' cx='10.5' cy='10.5' r='6'/%3E%3Cpath d='M15 15l5.5 5.5'/%3E%3C/svg%3E"); }
.qi-link { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1'/%3E%3Cpath d='M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1'/%3E%3C/svg%3E"); }
.qi-scenario { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.5 3.5h5'/%3E%3Cpath fill='%23000' fill-opacity='.2' d='M10.5 3.5v5.2L5.3 18.2a1.5 1.5 0 0 0 1.3 2.3h10.8a1.5 1.5 0 0 0 1.3-2.3L13.5 8.7V3.5'/%3E%3Cpath d='M7.6 14.5h8.8'/%3E%3C/svg%3E"); }
.qi-wave { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 12c1.6-4.2 3.2-4.2 4.8 0s3.2 4.2 4.8 0 3.2-4.2 4.8 0 3.1 4.2 4.6 0'/%3E%3C/svg%3E"); }
.qi-quanta { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='2.3' fill='%23000'/%3E%3Cpath d='M12 3.5v3M12 17.5v3M3.5 12h3M17.5 12h3M6.3 6.3l2 2M15.7 15.7l2 2M17.7 6.3l-2 2M8.3 15.7l-2 2'/%3E%3C/svg%3E"); }
.qi-rain { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3.5v4M12 6v4.5M18 3v4M9 13v4M15 12.5v4.5'/%3E%3Ccircle fill='%23000' cx='6' cy='9.6' r='1.3'/%3E%3Ccircle fill='%23000' cx='12' cy='12.6' r='1.3'/%3E%3Ccircle fill='%23000' cx='18' cy='9.1' r='1.3'/%3E%3Ccircle fill='%23000' cx='9' cy='19.1' r='1.3'/%3E%3Ccircle fill='%23000' cx='15' cy='19.1' r='1.3'/%3E%3C/svg%3E"); }
.qi-myth { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath fill='%23000' fill-opacity='.2' d='M13 2.8L5 13.5h6L10 21.2l8-10.7h-6L13 2.8z'/%3E%3C/svg%3E"); }
.qi-warning { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath fill='%23000' fill-opacity='.2' d='M12 3.8L2.6 19.8h18.8L12 3.8z'/%3E%3Cpath d='M12 10v4.3M12 17.1v.1'/%3E%3C/svg%3E"); }
.qi-reference { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 19c2.5-9 5-13 7-13s3 5 4.5 7 3.5-1 6.5-5'/%3E%3Cpath d='M3 20.5h18' stroke-opacity='.55'/%3E%3Ccircle fill='%23000' fill-opacity='.2' cx='10' cy='6' r='2'/%3E%3C/svg%3E"); }
.qi-eraser { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12h5.5'/%3E%3Cpath d='M8.5 12l4.5-5h4.5M8.5 12l4.5 5h4.5'/%3E%3Cpath d='M15.5 4.8l2.3 2.2-2.3 2.2M15.5 14.8l2.3 2.2-2.3 2.2'/%3E%3C/svg%3E"); }
.qi-slits { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v5M12 10v4M12 16v5'/%3E%3Crect fill='%23000' fill-opacity='.2' x='9.5' y='13' width='5' height='4' rx='1'/%3E%3Cpath d='M4 9h4.5M15.5 9H20'/%3E%3C/svg%3E"); }
.qi-source { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle fill='%23000' fill-opacity='.2' cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2.5V5M12 19v2.5M2.5 12H5M19 12h2.5M5.3 5.3l1.8 1.8M16.9 16.9l1.8 1.8M18.7 5.3l-1.8 1.8M7.1 16.9l-1.8 1.8'/%3E%3C/svg%3E"); }
.qi-info { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle fill='%23000' fill-opacity='.2' cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 11v5.5M12 7.8v.1'/%3E%3C/svg%3E"); }
.qi-cinema { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9V5h4M16 5h4v4M20 15v4h-4M8 19H4v-4'/%3E%3Crect fill='%23000' fill-opacity='.2' x='8' y='8.5' width='8' height='7' rx='1'/%3E%3C/svg%3E"); }
.qi-monitor { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect fill='%23000' fill-opacity='.2' x='3' y='3.5' width='18' height='13' rx='2.5'/%3E%3Crect x='6.5' y='6.5' width='11' height='7' rx='1'/%3E%3Cpath d='M8 20.5h8M12 16.5v4'/%3E%3C/svg%3E"); }
.qi-fullscreen { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5'/%3E%3Cpath d='M4 4l5.5 5.5M20 4l-5.5 5.5M4 20l5.5-5.5M20 20l-5.5-5.5'/%3E%3C/svg%3E"); }
.qi-pause { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect fill='%23000' fill-opacity='.2' x='6' y='5' width='4' height='14' rx='1.5'/%3E%3Crect fill='%23000' fill-opacity='.2' x='14' y='5' width='4' height='14' rx='1.5'/%3E%3C/svg%3E"); }
.qi-play { --qi: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath fill='%23000' fill-opacity='.2' d='M7 5.5v13a1 1 0 0 0 1.55.83l10-6.5a1 1 0 0 0 0-1.66l-10-6.5A1 1 0 0 0 7 5.5z'/%3E%3C/svg%3E"); }


/* 9f: scenariusz 18 – panel „Źródła” zamiast kontrolek bez znaczenia w tym trybie */
body:not(.mix-on) .mix-only { display: none !important; }
body.mix-on .mix-hide { display: none !important; }
#ctrl-mix .mix-row { border: 1px solid var(--border-dim); border-radius: 6px; padding: 6px 8px 4px; margin: 6px 0; background: rgba(255, 255, 255, 0.015); }
#ctrl-mix .mix-row-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#ctrl-mix .mix-name { font-size: calc(11px * var(--fs)); font-weight: 600; letter-spacing: 0.02em; color: var(--text-main); }
#ctrl-mix .mix-pre { display: flex; gap: 2px; margin-left: auto; }
#ctrl-mix .mix-pre .btn-seg { min-width: calc(22px * var(--fs)); padding: 1px 4px; font-size: calc(10.5px * var(--fs)); }
#ctrl-mix .mix-row-head .control-readout { min-width: calc(52px * var(--fs)); text-align: right; }
#ctrl-mix input.mix-lam { width: 100%; margin: 6px 0 4px; }
#ctrl-mix .mix-n { display: flex !important; align-items: center; gap: 8px; margin: 2px 0 2px; }
#ctrl-mix .mix-n > .control-label { flex: none; font-size: calc(10.5px * var(--fs)); color: var(--text-muted); }
#ctrl-mix .mix-n .seg-buttons { flex: 1 1 auto; display: flex; flex-wrap: nowrap; gap: 3px; }
#ctrl-mix .mix-n .seg-buttons .btn-seg { flex: 1 1 0; min-width: calc(24px * var(--fs)); padding-left: 0; padding-right: 0; text-align: center; }
#ctrl-mix .mix-note { font-size: calc(10.5px * var(--fs)); color: var(--text-dim); margin-top: 6px; line-height: 1.45; }
@media (pointer: coarse) {   /* 9f: cele dotyku 44 px w panelu „Źródła” */
  #ctrl-mix .btn-seg { min-height: 44px; }
  #ctrl-mix .mix-pre { gap: 4px; }
  #ctrl-mix .mix-pre .btn-seg { min-width: 40px; }
  #ctrl-mix input.mix-lam { min-height: 32px; }
}
/* =====================================================================
   ETAP 9e – tryb kinowy (wzorzec rodziny laboratoriów): widok fali, ekran fosforowy i wykres na całą powierzchnię,
   bez nagłówka, panelu sterowania i plakietek; na dole jeden wiersz z najważniejszymi danymi (efekt pisania) i przyciskami.
   Wejście: przycisk w nagłówku albo F; wyjście: Esc, ✕, F. Bez kosztu na klatkę (zmienia się tylko układ; pasek
   odświeżany co 0,5 s, tylko tekst). W obudowie CRT wypełnia ekran kineskopu, po EXPAND całe okno.
   ===================================================================== */
#cinema-bar { display: none; }
body.is-cinema { --cine-bar: calc(30px * var(--fs)); }
body.is-cinema header.lab-header,
body.is-cinema .sidebar-column,
body.is-cinema .viewport-hud,
body.is-cinema .viewport-reticle,
body.is-cinema .view-status-line,
body.is-cinema .detector-toolbar,
body.is-cinema .ccd-label-overlay,
body.is-cinema .graph-legend-overlay,
body.is-cinema .graph-hud-overlay,
body.is-cinema #lab-toast,
body.is-cinema #lab-drawer { display: none !important; }
body.is-cinema {
  box-sizing: border-box !important;
  height: 100vh !important;
  height: 100dvh !important;
  padding-bottom: var(--cine-bar) !important;
  overflow: hidden !important;
}
body.is-cinema .workbench-layout {
  display: grid !important;
  grid-template-columns: 1fr !important;
  grid-template-rows: minmax(0, 1fr) !important;
  flex: 1 1 0 !important;
  min-height: 0 !important;
  height: auto !important;
}
body.is-cinema .viewport-column {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  border-right: none !important;
  overflow: hidden !important;
}
body.is-cinema .gl-viewport-wrapper { flex: 1.5 1 0 !important; min-height: 0 !important; height: auto !important; }
body.is-cinema .detector-section { flex: 1 1 0 !important; min-height: 0 !important; height: auto !important; overflow: hidden !important; }
body.is-cinema .graph-container { flex: 1 1 0 !important; min-height: 0 !important; height: auto !important; }
body.is-cinema #cinema-bar {
  display: flex;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: var(--cine-bar);
  z-index: 60;
  align-items: center;
  gap: 10px;
  padding: 0 8px 0 14px;
  background: #05080d;
  border-top: 1px solid var(--border-dim);
  font-family: var(--font-mono);
  font-size: calc(11.5px * var(--fs));
  color: var(--accent-amber);
  letter-spacing: 0.04em;
}
#cinema-bar .cb-text { flex: 1 1 55%; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#cinema-bar .cb-live { flex: 0 1 auto; min-width: 0; color: var(--accent-cyan); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#cinema-bar .cb-caret { display: inline-block; width: 0.6em; color: var(--accent-amber); animation: cbBlink 1s steps(1) infinite; }
@keyframes cbBlink { 50% { opacity: 0; } }
#cinema-bar .cb-btns { display: flex; gap: 4px; flex: none; transition: opacity 0.3s ease; }
#cinema-bar button {
  width: calc(26px * var(--fs)); height: calc(24px * var(--fs));
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text-main);
  border: 1px solid var(--border-dim); border-radius: 4px;
  font: inherit; cursor: pointer; padding: 0;
}
#cinema-bar button:hover, #cinema-bar button:focus-visible { border-color: var(--accent-amber); color: var(--accent-amber); outline: none; }
body.is-cinema.cine-idle #cinema-bar .cb-btns { opacity: 0; }
body.is-cinema.cine-idle, body.is-cinema.cine-idle * { cursor: none !important; }
@media (max-width: 600px) {
  #btn-cinema { order: 5; }   /* telefon: przycisk za PL/EN – nagłówek [Wiedza][zakładki][PL|EN][kino] */
}
@media (pointer: coarse) {
  body.is-cinema { --cine-bar: 44px; }
  #cinema-bar button { width: 40px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) { #cinema-bar .cb-caret { animation: none; } }
@media (max-height: 520px) { body.is-cinema .gl-viewport-wrapper { flex: 1 1 0 !important; } }   /* telefon poziomo: więcej miejsca dla wykresu */
.btn-cinema .qi { font-size: 1.05em; }

/* Q-3 / D-R1 (17.11.2026): warianty widoku głównego. Przy wariancie innym niż FALA warstwa wariantu przykrywa miejsce widoku
   fali, a elementy widoku fali (płótno, HUD, plakietki, komunikaty shadera) są ukryte. Przełącznik – tylko przy ≥ 2 wariantach. */
#viewport-container[data-view] > #gl-canvas,
#viewport-container[data-view] > .viewport-hud,
#viewport-container[data-view] > .viewport-reticle,
#viewport-container[data-view] > #gl-lite-note,
#viewport-container[data-view] > #gl-error-overlay { visibility: hidden; }
#viewport-container > .view-layer { position: absolute; inset: 0; z-index: 2; overflow: hidden; background: var(--bg-dark); }
#viewport-container > .view-layer[hidden] { display: none; }
/* przełącznik widoków: trzy osobne przyciski, każdy z doklejonym „?” (karta widoku) – wzór: przycisk suwmiarki na telefonie
   (uwagi Łukasza 17.11.2026); aktywny – bursztynowa ramka i tło całej pary */
.view-switch { position: absolute; z-index: 6; top: 10px; left: 12px; display: inline-flex; align-items: center; gap: 8px; }   /* lewy górny róg – plakietki widoku fali są po prawej */
.view-switch .vs-item { display: inline-flex; align-items: stretch; height: calc(28px * var(--fs, 1)); border: 1px solid var(--border-bright); border-radius: 3px;
  background: rgba(10, 8, 4, 0.92); overflow: hidden; transition: border-color .15s ease, background .15s ease, box-shadow .15s ease; }
.view-switch .vs-item:hover { border-color: var(--accent-amber); }
.view-switch .vs-item.active { border-color: var(--accent-amber); background: rgba(40, 28, 6, 0.94); box-shadow: 0 0 8px rgba(255, 183, 0, 0.25); }
.view-switch [role=tab] { font: inherit; font-size: calc(11px * var(--fs, 1)); font-weight: 700; letter-spacing: .06em; color: var(--text-muted);
  background: transparent; border: 0; padding: 0 12px; cursor: pointer; white-space: nowrap; }
.view-switch [role=tab]:hover { color: var(--text-main); }
.view-switch .vs-item.active [role=tab] { color: var(--accent-amber); }
.view-switch .btn-inspect.vs-help { width: calc(24px * var(--fs, 1)); min-width: calc(24px * var(--fs, 1)); height: auto; min-height: 0; margin: 0; padding: 0;
  border: 0; border-left: 1px solid var(--border-bright); border-radius: 0; background: rgba(18, 16, 12, 0.95); color: var(--accent-cyan); font-size: calc(11px * var(--fs, 1)); box-shadow: none; }
.view-switch .btn-inspect.vs-help:hover { color: var(--accent-amber); background: rgba(245, 158, 11, 0.12); }
.view-switch .vs-item.active .btn-inspect.vs-help { background: transparent; border-left-color: rgba(255, 183, 0, 0.40); color: var(--accent-amber); }
.view-switch button:focus-visible { outline: 1px solid var(--accent-cyan); outline-offset: -2px; }
/* telefon: przełącznik w linii stanu pod widokiem (17b), jako pierwszy element wiersza */
.view-switch.in-line { position: static; flex: 0 0 auto; margin-right: 6px; align-self: center; }
@media (max-width: 600px) {   /* jak przycisk suwmiarki w pasku detektora; 24 px i „?” 26 px – efektywny obszar dotyku ≥ 500 px² (10a): linia stanu
     przewija się w poziomie, więc ::after nie wychodzi poza nią */
  .view-switch.in-line { gap: 4px; }   /* 19.11.2026 (W4): cztery zakładki z „?” mieszczą się w 360 px (check_touch_targets) */
  .view-switch.in-line .vs-item { height: 24px; }
  .view-switch.in-line [role=tab] { padding: 0 5px; font-size: 10px; letter-spacing: 0; }
  .view-switch.in-line .btn-inspect.vs-help { width: 24px; min-width: 24px; font-size: 11px; } }

/* Widok „STANOWISKO” (W1 17.11.2026; ŁAWA v4 20.11.2026, D-L1–D-L8): silnik stołu z kitu (src/kit/bench/view.ts, 17d-lawa.js).
   Warstwy w .bench-scene: SVG przyrządów, płótno światła (mix-blend screen), SVG podpisów; kolumna wstawek i odczytów po prawej. */
#bench-layer { background: radial-gradient(ellipse at 30% 20%, #10141a 0%, #07080a 70%); }
#bench-layer .bench-scene { position: absolute; top: 40px; left: 0; right: 0; bottom: 20px; outline: none; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; overflow: hidden; }
#bench-layer .bench-scene.is-zoomed { touch-action: none; }   /* przybliżony rysunek: palec przesuwa kadr w obu osiach */
#bench-layer .bench-scene.is-dragging { cursor: grabbing; }
#bench-layer .bench-scene:focus-visible { box-shadow: inset 0 0 0 1px var(--accent-amber); }
#bench-layer .bench-scene > svg, #bench-layer .bench-scene > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#bench-layer .bench-light { pointer-events: none; mix-blend-mode: screen; }
#bench-layer .bench-labels { pointer-events: none; overflow: visible; }
#bench-layer .bench-labels .bench-lab { pointer-events: auto; }
#bench-layer .bench-scene:not(.lod-fine) .dt { display: none; }   /* drobne części tylko przy dostatecznej skali (poziom szczegółów) */
#bench-layer .bench-el { cursor: pointer; outline: none; }
#bench-layer .bench-scene.is-dragging .bench-el { cursor: grabbing; }
#bench-layer .bench-el.is-hot { filter: brightness(1.5); }
#bench-layer .bench-lab.is-off { visibility: hidden; }   /* telefon: podpis przecięty krawędzią kadru */
#bench-layer .bench-lab:focus-visible .bp-name { text-decoration: underline; }
/* rozmiar pisma podpisów – atrybut font-size (skala zależna od kadru, labels.ts kitu); we wstawkach – stały */
#bench-layer .bp-name { font-family: var(--font-mono); font-weight: 700; fill: #f2c06a; }
#bench-layer .bp-sub { font-family: var(--font-mono); fill: #a88a5e; }
#bench-layer .bench-insets .bp-name { font-size: 10.5px; }
#bench-layer .bench-insets .bp-sub { font-size: 9px; }
#bench-layer .bp-lead { stroke: #a88a5e; stroke-opacity: 0.5; fill: none; }
#bench-layer .bp-dot { fill: #b0926a; }
#bench-layer .bench-zoom { position: absolute; right: 8px; bottom: 26px; display: flex; gap: 4px; align-items: center; z-index: 2; }
#bench-layer .bench-zoom button { width: 28px; height: 26px; padding: 0; font: 700 14px/1 var(--font-mono); color: var(--text-muted);
  background: rgba(10, 8, 4, 0.88); border: 1px solid var(--border-bright); border-radius: 3px; cursor: pointer; }
#bench-layer .bench-zoom button:hover, #bench-layer .bench-zoom button:focus-visible { color: var(--accent-amber); border-color: var(--accent-amber); outline: none; }
#bench-layer .bench-lvl { min-width: 3.4em; text-align: right; font: 600 10.5px var(--font-mono); color: var(--text-muted); }
@media (pointer: coarse) { #bench-layer .bench-zoom button { width: 38px; height: 36px; font-size: 17px; } }
#bench-layer .bench-insets { position: absolute; right: 10px; top: 46px; bottom: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 1; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; }
#bench-layer .bench-insets[hidden] { display: none; }
#bench-layer .bench-insets svg { display: block; flex: none; }
#bench-layer .bench-inset { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 8px; background: rgba(7, 8, 10, 0.92); border: 1px solid #5f4c2c; border-radius: 3px; cursor: pointer; }
#bench-layer .bench-inset:hover, #bench-layer .bench-inset:focus-visible { border-color: var(--accent-amber); outline: none; }
#bench-layer .bi-cap { display: flex; flex-direction: column; align-self: stretch; font: var(--bi-fs, 11px) / 1.35 var(--font-mono); color: #a88a5e; min-width: 0; overflow-wrap: anywhere; }
#bench-layer .bi-cap b { color: #f2c06a; font-weight: 700; }
/* odczyty: w kolumnie wstawek (komputer, D-L7); na telefonie – dwie kolumny pod rysunkiem */
#bench-layer .bench-readouts { padding: 6px 8px; background: rgba(10, 8, 4, 0.9); border: 1px solid var(--border-bright); border-radius: 3px; font: var(--bi-fs, 11px) var(--font-mono); flex: none; }
#bench-layer .bench-readouts div { display: flex; justify-content: space-between; gap: 12px; line-height: 1.55; }
#bench-layer .bench-readouts span { color: var(--text-muted); }
#bench-layer .bench-readouts b { color: var(--accent-amber); font-weight: 600; }
#bench-layer .bench-readouts small { display: block; margin-top: 2px; color: var(--text-dim); font-size: 0.85em; }
#bench-layer > .bench-readouts { position: absolute; left: 10px; top: 48px; min-width: 190px; }
#bench-layer .bench-note { position: absolute; left: 10px; right: 10px; bottom: 4px; color: var(--text-dim);
  font: calc(9.5px * var(--fs, 1)) var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#bench-layer.is-failed .bench-scene { display: none; }
#bench-layer.is-phone .bench-scene { top: 22px; bottom: 66px; }
#bench-layer.is-phone > .bench-readouts { left: 6px; right: 120px; top: auto; bottom: 6px; min-width: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; padding: 4px 6px; font-size: 10px; }
#bench-layer.is-phone .bench-readouts small { display: none; }
#bench-layer.is-phone .bench-readouts div { white-space: nowrap; gap: 6px; }
#bench-layer.is-phone .bench-note { top: 4px; bottom: auto; font-size: 8.5px; }
#bench-layer.is-phone .bench-zoom { right: 4px; bottom: 8px; top: auto; }   /* w dolnej linii obok odczytów – nie zasłania podpisów */
#bench-layer.is-phone .bench-lvl { display: none; }
#bench-layer.is-phone .bench-zoom button { width: 34px; height: 30px; }

/* W2 (17.11.2026, D-R8): wariant widoku „W SKALI” – obraz natężenia (płótno, piksele obliczone w Workerze) i osie (drugie płótno). */
#scale-layer { background: var(--bg-dark); }
#scale-layer .sv-img { position: absolute; image-rendering: auto; }
#scale-layer .sv-axes { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#scale-layer .sv-near { position: absolute; image-rendering: auto; }
#scale-layer .sv-near-btn { position: absolute; z-index: 2; min-height: 40px; padding: 3px 2px; white-space: pre-line; line-height: 1.25;
  background: rgba(10, 8, 4, 0.88); color: var(--accent-amber); border: 1px solid var(--border-bright); border-radius: 3px; font: calc(9.5px * var(--fs, 1)) var(--font-mono); cursor: pointer; }
#scale-layer .sv-near-btn:hover, #scale-layer .sv-near-btn:focus-visible { border-color: var(--accent-amber); }
#scale-layer .sv-near-pop { position: absolute; z-index: 3; left: 70px; top: 60px; max-width: 420px; padding: 10px 12px; background: #0a0b0d;
  border: 1px solid var(--accent-amber); border-radius: 3px; color: #e8d5ad; font: calc(10.5px * var(--fs, 1)) / 1.45 var(--font-mono); }
#scale-layer .sv-near-pop p { margin: 0 0 8px; }
@media (max-width: 600px) { #scale-layer .sv-near-pop { left: 6px; right: 6px; top: 30px; max-width: none; } }
#scale-layer .sv-near-pop button { min-height: 32px; padding: 4px 12px; background: #1a1408; color: var(--accent-amber); border: 1px solid var(--border-bright); border-radius: 3px; font: inherit; cursor: pointer; }
#scale-layer .sv-status { position: absolute; left: 10px; right: 10px; bottom: 4px; color: var(--accent-amber);
  font: calc(9.5px * var(--fs, 1)) var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* przełącznik wariantów na telefonie: obszar dotyku 44 px wysokości (niewidoczne powiększenie w pionie, bez zachodzenia na sąsiednie zakładki) */
@media (max-width: 600px) { .view-switch .vs-item { overflow: visible; } .view-switch button { position: relative; }
  .view-switch button::after { content: ""; position: absolute; left: 0; right: 0; top: -3px; bottom: -3px; } }   /* linia stanu przewija się w poziomie – większe wyjście i tak byłoby przycięte */


/* Zdjęcia przyrządów ławy w kartach Kompendium (src/kit/main.js addPhotos, src/kit/bench-photos.js) */
.qol-card-photo { margin: 10px 0 12px; }
.qol-card-photo img { display: block; width: auto; height: auto; max-width: 100%; max-height: min(42vh, 360px); margin: 0 auto; border: 1px solid var(--border-bright, #3a2f1c); border-radius: 2px; background: #000; }
.qol-card-photo figcaption { margin-top: 6px; font: calc(10.5px * var(--fs, 1)) / 1.45 var(--font-mono); color: var(--text-muted, #a88a5e); }
.qol-card-photo .qol-card-credit { color: var(--text-dim, #7a6237); }
.qol-card-photo a { color: inherit; text-decoration: underline; }
.qol-card-drawing svg { display: block; width: 100%; max-width: 420px; height: auto; max-height: 260px; margin: 0 auto; background: #07080a; border: 1px solid var(--border-bright, #3a2f1c); border-radius: 2px; }

/* W4 (19.11.2026): widok WSKAZY – rysunek, pasek wyboru x (przeciąganie, dotyk, strzałki), przycisk pasków szczelin, uwagi */
#phasor-layer { background: var(--bg-dark); }
#phasor-layer .ph-cv { position: absolute; inset: 0 0 52px 0; width: 100%; height: calc(100% - 52px); }
#phasor-layer .ph-strip { position: absolute; left: 12px; right: 12px; bottom: 6px; height: 44px; cursor: ew-resize; touch-action: none;
  border: 1px solid var(--border-dim); border-radius: 3px; }
#phasor-layer .ph-strip:focus-visible { outline: 1px solid var(--accent-cyan); outline-offset: 1px; }
#phasor-layer .ph-strip-cv { position: absolute; inset: 0; width: 100%; height: 100%; }
#phasor-layer .ph-arc-btn { position: absolute; z-index: 2; top: 10px; right: 12px; min-height: 28px; padding: 3px 10px; background: rgba(10, 8, 4, 0.92);
  color: var(--accent-amber); border: 1px solid var(--border-bright); border-radius: 3px; font: inherit; font-size: calc(11px * var(--fs, 1)); cursor: pointer; }
#phasor-layer .ph-arc-btn[aria-pressed=true] { border-color: var(--accent-amber); background: rgba(40, 28, 6, 0.94); }
#phasor-layer .ph-note { position: absolute; left: 14px; right: 14px; bottom: 54px; color: #a88a5e; font-size: calc(10px * var(--fs, 1)); line-height: 1.35; pointer-events: none; }
@media (max-width: 600px) {
  #phasor-layer .ph-arc-btn { top: 6px; right: 6px; min-height: 32px; }
  #phasor-layer .ph-note { font-size: 9px; }
}

/* „Prawdziwy detektor” (19.11.2026): obraz kamery w pasku detektora – te same kolumny co pasek fosforowy i wykres */
#cam-canvas { position: absolute; top: 0; bottom: 0; left: var(--plot-ml, 40px); width: calc(100% - var(--plot-ml, 40px) - var(--plot-mr, 16px)); height: 100%;
  image-rendering: pixelated; background: #020408; z-index: 1; }
#cam-canvas[hidden] { display: none; }
.ccd-strip-container .cam-info { position: absolute; z-index: 2; top: 3px; right: calc(var(--plot-mr, 16px) + 4px); max-width: 70%; padding: 1px 6px; border-radius: 3px;
  background: rgba(4, 7, 12, 0.78); color: var(--accent-amber); font-size: calc(9px * var(--fs)); letter-spacing: 0.03em; pointer-events: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ccd-strip-container .cam-info[hidden] { display: none; }
.ccd-strip-container.cam-on .ccd-label-overlay { z-index: 2; }
@media (max-width: 600px) { .ccd-strip-container .cam-info { top: auto; bottom: 3px; max-width: 62%; font-size: 8px; } }
.ccd-strip-container.cam-on .ccd-label-overlay { display: none; }
