    /* ── page fill so sim canvas can go full-height ── */
    .app-layout  { height: 100vh; overflow: hidden; }
    .sb-content  { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

    /* ════════════════════════════════
       HOME VIEW
    ════════════════════════════════ */
    #lab-home { flex: 1; overflow-y: auto; padding: 36px 28px 80px; }

    .lab-hero {
      display: flex; align-items: center; gap: 20px;
      margin-bottom: 36px;
    }
    .lab-hero-icon {
      width: 64px; height: 64px; border-radius: 20px; flex-shrink: 0;
      background: linear-gradient(135deg, rgba(155,93,229,.35), rgba(6,214,224,.25));
      border: 1.5px solid rgba(255,255,255,.12);
      display: flex; align-items: center; justify-content: center;
    }
    .lab-hero-icon svg { width: 30px; height: 30px; stroke: var(--violet); stroke-width: 1.5; }
    .lab-hero-title {
      font-family: 'Unbounded', sans-serif; font-size: 1.55rem; font-weight: 800;
      letter-spacing: -0.02em; margin-bottom: 5px;
    }
    .lab-hero-sub { font-size: 0.9rem; color: var(--text-2); font-weight: 500; }

    /* category filter */
    .lab-filters {
      display: flex; gap: 6px; margin-bottom: 28px; flex-wrap: wrap;
    }
    .lab-filter {
      padding: 6px 18px; border-radius: 99px;
      border: 1.5px solid var(--border-h);
      background: var(--surface); color: var(--text-2);
      font-family: 'Manrope', sans-serif; font-size: 0.82rem; font-weight: 700;
      cursor: pointer; transition: all .16s;
    }
    .lab-filter:hover { border-color: rgba(155,93,229,.4); color: var(--violet); }
    .lab-filter.active { background: var(--text); color: #fff; border-color: var(--text); }

    /* sim grid */
    .sim-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
      gap: 20px;
    }

    .sim-card {
      background: var(--surface);
      border: 1.5px solid var(--border);
      border-radius: 20px;
      overflow: hidden;
      cursor: pointer;
      transition: border-color .18s, box-shadow .18s, transform .18s;
      position: relative;
    }
    .sim-card:hover {
      border-color: var(--violet);
      box-shadow: 0 8px 32px rgba(155,93,229,.18);
      transform: translateY(-2px);
    }
    .sim-card.soon { cursor: default; opacity: .65; }
    .sim-card.soon:hover { transform: none; box-shadow: none; border-color: var(--border); }

    .sim-preview {
      width: 100%; height: 140px; display: block;
      background: #0D0D1A;
    }

    .sim-body { padding: 18px 20px 20px; }
    .sim-cat {
      display: inline-flex; align-items: center; gap: 5px;
      font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
      padding: 3px 10px; border-radius: 99px; margin-bottom: 10px;
    }
    .sim-cat.math { background: rgba(155,93,229,.12); color: var(--violet); }
    .sim-cat.phys { background: rgba(6,214,224,.1);  color: var(--cyan); }

    .sim-title {
      font-family: 'Unbounded', sans-serif; font-size: 0.9rem; font-weight: 800;
      margin-bottom: 6px; letter-spacing: -.01em;
    }
    .sim-desc { font-size: 0.82rem; color: var(--text-2); line-height: 1.55; }

    .sim-soon-badge {
      position: absolute; top: 12px; right: 12px;
      background: rgba(15,23,42,.7); color: rgba(255,255,255,.55);
      font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
      padding: 3px 9px; border-radius: 99px; backdrop-filter: blur(6px);
      border: 1px solid rgba(255,255,255,.1);
    }

    /* ════════════════════════════════
       SIM VIEW (graph)
    ════════════════════════════════ */
    #lab-sim {
      display: none;
      flex: 1; min-height: 0;
      flex-direction: column;
    }
    #lab-sim.open { display: flex; }

    /* top bar */
    .sim-topbar {
      flex-shrink: 0;
      display: flex; align-items: center; gap: 12px;
      padding: 10px 18px;
      background: var(--surface);
      border-bottom: 1.5px solid var(--border);
    }
    .sim-back {
      display: flex; align-items: center; gap: 6px;
      padding: 6px 14px; border-radius: 99px;
      border: 1.5px solid var(--border-h);
      background: transparent; color: var(--text-2);
      font-family: 'Manrope', sans-serif; font-size: 0.82rem; font-weight: 700;
      cursor: pointer; transition: all .15s;
    }
    .sim-back:hover { border-color: var(--violet); color: var(--violet); }
    .sim-back svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2.2; flex-shrink: 0; }

    .sim-topbar-title {
      font-family: 'Unbounded', sans-serif; font-size: 0.88rem; font-weight: 800;
      flex: 1;
    }

    .sim-zoom-btns { display: flex; gap: 4px; }
    .zoom-btn {
      min-width: 32px; width: auto; height: 32px; border-radius: 10px;
      border: 1.5px solid var(--border-h);
      background: transparent; color: var(--text-2);
      cursor: pointer; font-size: .8rem; font-weight: 700;
      padding: 0 9px; white-space: nowrap;
      display: flex; align-items: center; justify-content: center; gap: 4px;
      transition: all .15s;
    }
    .zoom-btn:hover { border-color: var(--violet); color: var(--violet); background: rgba(155,93,229,.07); }
    .zoom-btn svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2.2; }

    /* sim body */
    .sim-body-wrap {
      flex: 1; min-height: 0;
      display: flex;
    }

    /* left panel */
    .graph-panel {
      width: 280px; flex-shrink: 0;
      background: var(--surface);
      border-right: 1.5px solid var(--border);
      display: flex; flex-direction: column;
      overflow-y: auto;
      padding: 16px 14px;
      gap: 6px;
    }

    .gp-section-title {
      font-family: 'Unbounded', sans-serif; font-size: 0.62rem; font-weight: 800;
      color: var(--text-3); text-transform: uppercase; letter-spacing: .08em;
      display: flex; align-items: center; gap: 8px; margin: 4px 0 8px;
    }
    .gp-section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

    /* function rows */
    .fn-row {
      display: flex; align-items: center; gap: 8px;
      padding: 8px 10px; border-radius: 12px;
      border: 1.5px solid var(--border);
      background: rgba(15,23,42,.03);
      transition: border-color .15s;
    }
    .fn-label {
      font-family: 'Manrope', monospace; font-size: 0.85rem; font-weight: 700;
      color: var(--fn-color, var(--violet)); flex-shrink: 0; letter-spacing: .01em;
    }
    .fn-row:focus-within { border-color: var(--fn-color, var(--violet)); }

    .fn-dot {
      width: 12px; height: 12px; border-radius: 50%;
      flex-shrink: 0;
      background: var(--fn-color, var(--violet));
      box-shadow: 0 0 6px var(--fn-color, var(--violet));
    }
    .fn-input {
      flex: 1; border: none; outline: none; background: transparent;
      font-family: 'Manrope', monospace; font-size: 0.88rem; font-weight: 600;
      color: var(--text); padding: 0; min-width: 0;
    }
    .fn-input::placeholder { color: var(--text-3); font-weight: 500; }

    /* KaTeX live preview */
    .fn-preview {
      min-height: 20px; padding: 3px 4px 3px 36px;
      font-size: 0.82rem; line-height: 1.5;
      color: rgba(255,255,255,.65);
      overflow: hidden; display: none;
    }
    .fn-preview.has-content { display: block; }
    .fn-preview .katex { color: rgba(255,255,255,.8); font-size: 1em; }
    .fn-err {
      font-size: 0.68rem; color: var(--pink); font-weight: 600;
      padding: 2px 0 0 22px; display: none;
    }
    .fn-err.show { display: block; }

    /* presets */
    .presets-wrap { display: flex; flex-wrap: wrap; gap: 5px; }
    .preset-btn {
      padding: 4px 11px; border-radius: 8px;
      border: 1.5px solid var(--border-h);
      background: transparent; color: var(--text-2);
      font-family: 'Manrope', monospace; font-size: 0.75rem; font-weight: 700;
      cursor: pointer; transition: all .14s;
    }
    .preset-btn:hover {
      border-color: var(--violet); color: var(--violet);
      background: rgba(155,93,229,.07);
    }

    /* info / actions */
    .gp-btn {
      display: flex; align-items: center; justify-content: center; gap: 7px;
      padding: 9px 14px; border-radius: 12px;
      border: 1.5px solid var(--border-h);
      background: transparent; color: var(--text-2);
      font-family: 'Manrope', sans-serif; font-size: 0.82rem; font-weight: 700;
      cursor: pointer; transition: all .15s; width: 100%;
    }
    .gp-btn:hover { border-color: var(--violet); color: var(--violet); background: rgba(155,93,229,.06); }
    .gp-btn svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; flex-shrink: 0; }

    /* stereo param sliders */
    .stereo-sl-row { margin-bottom: 6px; }
    .stereo-sl-row label { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--text-2); margin-bottom: 2px; }
    .stereo-sl-row label span { color: var(--violet); font-weight: 700; }
    .stereo-sl-row input[type=range] { width: 100%; accent-color: var(--violet); }
    .stereo-fig-btn.active, .stereo-toggle.active, .stereo-sect-btn.active, .stereo-sect-type.active {
      border-color: var(--violet) !important; color: var(--violet) !important; background: rgba(155,93,229,.1) !important;
    }

    /* stereo panel redesign */
    .stereo-panel {
      width: 230px; flex-shrink: 0;
      background: var(--surface);
      border-right: 1.5px solid var(--border);
      display: flex; flex-direction: column;
      overflow-y: auto; padding: 10px 10px;
    }
    .stereo-fig-grid {
      display: grid; grid-template-columns: 1fr 1fr; gap: 3px;
      margin-bottom: 4px;
    }
    .st-fig-btn {
      display: flex; align-items: center; gap: 5px;
      padding: 6px 8px; border-radius: 9px;
      border: 1.5px solid var(--border);
      background: transparent; color: var(--text-2);
      font-family: 'Manrope', sans-serif; font-size: 0.68rem; font-weight: 700;
      cursor: pointer; transition: all .13s; white-space: nowrap; overflow: hidden;
    }
    .st-fig-btn svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 2; flex-shrink: 0; fill: none; }
    .st-fig-btn:hover { border-color: rgba(155,93,229,.4); color: var(--violet); background: rgba(155,93,229,.06); }
    .st-fig-btn.active { border-color: var(--violet); color: var(--violet); background: rgba(155,93,229,.12); }
    .st-fig-btn-wide { grid-column: span 2; }

    .st-tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin-bottom: 4px; }
    .st-tool-btn {
      display: flex; align-items: center; gap: 5px;
      padding: 6px 8px; border-radius: 9px;
      border: 1.5px solid var(--border);
      background: transparent; color: var(--text-2);
      font-family: 'Manrope', sans-serif; font-size: 0.68rem; font-weight: 700;
      cursor: pointer; transition: all .13s; white-space: nowrap; overflow: hidden;
    }
    .st-tool-btn svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2; flex-shrink: 0; fill: none; }
    .st-tool-btn:hover { border-color: rgba(155,93,229,.4); color: var(--violet); background: rgba(155,93,229,.06); }
    .st-tool-btn.active { border-color: var(--violet); color: var(--violet); background: rgba(155,93,229,.12); }
    .st-tool-btn-wide { grid-column: span 2; }

    .st-action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin-bottom: 2px; }
    .st-action-btn {
      padding: 5px 6px; border-radius: 8px;
      border: 1px solid var(--border);
      background: transparent; color: var(--text-2);
      font-family: 'Manrope', sans-serif; font-size: 0.65rem; font-weight: 600;
      cursor: pointer; transition: all .13s; text-align: center;
    }
    .st-action-btn:hover { border-color: rgba(239,71,111,.4); color: #ef476f; background: rgba(239,71,111,.06); }

    .st-toggle-row {
      display: flex; align-items: center; justify-content: space-between;
      padding: 4px 2px; cursor: pointer; transition: background .13s; border-radius: 7px;
    }
    .st-toggle-row:hover { background: rgba(255,255,255,.03); }
    .st-toggle-label {
      font-size: 0.7rem; font-weight: 600; color: var(--text-2);
      display: flex; align-items: center; gap: 5px;
    }
    .st-toggle-label svg { width: 11px; height: 11px; stroke: currentColor; stroke-width: 2; opacity: .6; fill: none; }
    .st-toggle {
      width: 26px; height: 14px; border-radius: 7px;
      background: rgba(255,255,255,.1); border: 1.5px solid var(--border-h);
      position: relative; transition: background .15s; flex-shrink: 0; cursor: pointer;
    }
    .st-toggle::after {
      content: ''; position: absolute; left: 2px; top: 50%;
      transform: translateY(-50%);
      width: 8px; height: 8px; border-radius: 50%;
      background: rgba(255,255,255,.4); transition: all .15s;
    }
    .st-toggle.on { background: var(--violet); border-color: var(--violet); }
    .st-toggle.on::after { left: calc(100% - 10px); background: #fff; }

    .st-n-ctrl {
      display: flex; align-items: center; gap: 5px;
      border: 1.5px solid var(--border); border-radius: 9px;
      padding: 4px 6px;
    }
    .st-n-btn {
      width: 20px; height: 20px; border-radius: 5px;
      border: 1px solid var(--border-h);
      background: transparent; color: var(--text-2);
      cursor: pointer; display: flex; align-items: center; justify-content: center;
      transition: background .12s;
    }
    .st-n-btn svg { width: 11px; height: 11px; stroke: currentColor; }
    .st-n-btn:hover { background: rgba(155,93,229,.1); }
    .st-n-val { font-size: 0.75rem; font-weight: 700; color: var(--text); min-width: 14px; text-align: center; }
    .st-n-label { font-size: 0.68rem; color: var(--text-3); flex: 1; }
    #stereo-unfold-btn.active, #stereo-measure-btn.active,
    #stereo-point-btn.active, #stereo-connect-btn.active,
    #stereo-mark-tick-btn.active, #stereo-mark-par-btn.active,
    #stereo-derive-mid-btn.active, #stereo-derive-fc-btn.active, #stereo-derive-alt-btn.active, #stereo-derive-cen-btn.active,
    #stereo-angle-edge-btn.active, #stereo-angle-lp-btn.active, #stereo-angle-dih-btn.active, #stereo-angle-pp-btn.active, #stereo-angle-skew-btn.active {
      border-color: var(--violet) !important; color: var(--violet) !important; background: rgba(155,93,229,.12) !important;
    }

    .gp-preset-group { margin-bottom: 8px; }
    .gp-preset-label {
      font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
      letter-spacing: .06em; color: var(--text-3);
      margin: 6px 0 4px;
    }

    /* canvas area */
    .graph-canvas-outer {
      flex: 1; min-width: 0; min-height: 0;
      display: flex; flex-direction: column;
    }
    .graph-canvas-wrap {
      flex: 1; min-height: 0; position: relative;
    }
    #graph-canvas { display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

    /* info bar */
    .graph-info-bar {
      flex-shrink: 0;
      display: flex; align-items: center; gap: 20px;
      padding: 8px 18px;
      background: #0D0D1A;
      border-top: 1px solid rgba(255,255,255,.07);
      font-family: 'Manrope', monospace; font-size: 0.8rem;
      color: rgba(255,255,255,.4);
      min-height: 36px;
    }
    .info-coord { display: flex; align-items: center; gap: 6px; }
    .info-coord .ic-label { color: rgba(255,255,255,.25); }
    .info-coord .ic-val { color: rgba(255,255,255,.7); font-weight: 700; min-width: 52px; }
    .info-fn-val { display: flex; align-items: center; gap: 6px; }
    .info-fn-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
    .info-fn-val .ic-val { color: rgba(255,255,255,.7); font-weight: 700; min-width: 60px; }
    .info-hint { margin-left: auto; font-size: 0.72rem; color: rgba(255,255,255,.2); }

    /* ════════════════════════════════
       PROJECTILE SIM
    ════════════════════════════════ */
    .sim-proj-wrap {
      flex: 1; min-height: 0;
      display: flex; flex-direction: column; overflow: hidden;
    }

    /* left panel (shared base with .graph-panel) */
    .proj-panel {
      width: 260px; flex-shrink: 0;
      background: var(--surface);
      border-right: 1.5px solid var(--border);
      display: flex; flex-direction: column;
      overflow-y: auto; padding: 16px 14px; gap: 6px;
    }

    /* canvas */
    .proj-canvas-outer {
      flex: 1; min-width: 0; position: relative;
    }
    .proj-canvas-outer canvas {
      display: block; position: absolute; top: 0; left: 0;
      width: 100%; height: 100%;
    }

    /* sliders */
    .param-block  { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
    .param-header { display: flex; justify-content: space-between; align-items: baseline; }
    .param-name   { font-size: 0.8rem; font-weight: 700; color: var(--text-2); }
    .param-val    {
      font-family: 'Manrope', monospace; font-size: 0.82rem; font-weight: 800;
      color: var(--violet); min-width: 70px; text-align: right;
    }
    .param-slider {
      -webkit-appearance: none; appearance: none;
      width: 100%; height: 4px; border-radius: 4px;
      background: var(--border-h); outline: none; cursor: pointer;
    }
    .param-slider::-webkit-slider-thumb {
      -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
      background: var(--violet); box-shadow: 0 0 6px rgba(155,93,229,.5);
      cursor: pointer;
    }
    .param-slider::-moz-range-thumb {
      width: 16px; height: 16px; border-radius: 50%; border: none;
      background: var(--violet); cursor: pointer;
    }

    /* preset chips for projectile */
    .proj-preset-chip {
      padding: 5px 10px; border-radius: 8px; font-size: 0.75rem; font-weight: 700;
      border: 1.5px solid var(--border-h); background: transparent;
      color: var(--text-2); cursor: pointer; transition: all .15s; white-space: nowrap;
    }
    .proj-preset-chip:hover { border-color: var(--violet); color: var(--violet); background: rgba(155,93,229,.06); }

    /* opticsbench instrument preset chips — reuse proj-preset-chip style */
    .ob-preset-chip {
      padding: 4px 10px; border-radius: 7px; font-size: 0.72rem; font-weight: 700;
      border: 1.5px solid var(--border-h); background: transparent;
      color: var(--text-2); cursor: pointer; transition: all .15s; white-space: nowrap;
    }
    .ob-preset-chip:hover { border-color: var(--cyan); color: var(--cyan); background: rgba(103,232,249,.07); }
    .ob-preset-chip.active { border-color: var(--cyan); color: var(--cyan); background: rgba(103,232,249,.12); }
    .ob-preset-chip.ob-preset-clear { border-color: #333; color: #666; }
    .ob-preset-chip.ob-preset-clear:hover { border-color: #EF476F; color: #EF476F; background: rgba(239,71,111,.07); }

    /* stats bar */
    .proj-stats-bar {
      flex-shrink: 0; display: flex; align-items: stretch;
      background: #0D0D1A; border-top: 1px solid rgba(255,255,255,.07);
      min-height: 48px;
    }
    .pstat {
      flex: 1; display: flex; flex-direction: column;
      align-items: center; justify-content: center;
      gap: 2px; padding: 6px 8px;
      border-right: 1px solid rgba(255,255,255,.06);
    }
    .pstat:last-child { border-right: none; }
    .pstat-label { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: rgba(255,255,255,.3); }
    .pstat-val   { font-family: 'Manrope', monospace; font-size: 0.9rem; font-weight: 800; color: rgba(255,255,255,.85); }
    #csbar-v4, #csbar-v6 { font-size: 0.60rem; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    /* play button highlight */
    .zoom-btn.active { border-color: var(--violet); color: var(--violet); background: rgba(155,93,229,.12); }

    /* ── launch button ── */
    .proj-launch-btn {
      width: 100%; padding: 14px 18px;
      border-radius: 16px; border: none;
      background: linear-gradient(135deg, #7c3aed 0%, #9B5DE5 45%, #F15BB5 100%);
      color: #fff;
      font-family: 'Unbounded', sans-serif; font-size: 0.8rem; font-weight: 800;
      letter-spacing: .04em; text-transform: uppercase;
      cursor: pointer;
      display: flex; align-items: center; justify-content: center; gap: 10px;
      box-shadow: 0 4px 24px rgba(155,93,229,.45), 0 0 0 0 rgba(155,93,229,.3);
      transition: transform .15s, box-shadow .15s;
      position: relative; overflow: hidden;
    }
    .proj-launch-btn::before {
      content: ''; position: absolute; inset: 0;
      background: linear-gradient(135deg, rgba(255,255,255,.15) 0%, transparent 60%);
      pointer-events: none;
    }
    .proj-launch-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 32px rgba(155,93,229,.6), 0 0 0 3px rgba(155,93,229,.15);
    }
    .proj-launch-btn:active { transform: translateY(0); }
    .proj-launch-btn.paused {
      background: linear-gradient(135deg, #0891b2 0%, #06D6E0 100%);
      box-shadow: 0 4px 24px rgba(6,214,224,.35);
    }
    .proj-launch-btn.done {
      background: linear-gradient(135deg, #15803d 0%, #22c55e 100%);
      box-shadow: 0 4px 24px rgba(34,197,94,.35);
    }
    .proj-reset-btn {
      width: 100%; padding: 8px;
      border-radius: 10px;
      border: 1.5px solid var(--border-h);
      background: transparent; color: var(--text-3);
      font-family: 'Manrope', sans-serif; font-size: 0.75rem; font-weight: 700;
      cursor: pointer; transition: all .15s;
      display: flex; align-items: center; justify-content: center; gap: 7px;
    }
    .proj-reset-btn:hover { border-color: var(--violet); color: var(--violet); }

    /* speed slider — cyan thumb */
    #sl-speed::-webkit-slider-thumb {
      background: var(--cyan);
      box-shadow: 0 0 6px rgba(6,214,224,.5);
    }
    #sl-speed::-moz-range-thumb { background: var(--cyan); }

    /* graphs panel canvas (Feature 2) */
    .proj-graphs-canvas {
      display: block; width: 100%; height: 200px;
    }

    /* dual-throw slider — cyan thumb */
    .proj-dual-slider::-webkit-slider-thumb {
      background: #00E6FF;
      box-shadow: 0 0 6px rgba(0,230,255,.5);
    }
    .proj-dual-slider::-moz-range-thumb { background: #00E6FF; }

    /* magnetic canvas */
    #mag-canvas {
      display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
      cursor: crosshair;
    }

    /* mode buttons */
    .mag-mode-btn {
      flex: 1; padding: 8px 6px; border-radius: 10px;
      border: 1.5px solid var(--border-h);
      background: transparent; color: var(--text-2);
      font-family: 'Manrope', sans-serif; font-size: 0.75rem; font-weight: 700;
      cursor: pointer; transition: all .15s;
      display: flex; align-items: center; justify-content: center; gap: 6px;
    }
    .mag-mode-btn:hover { border-color: var(--violet); color: var(--text); }
    .mag-mode-btn.active {
      background: rgba(155,93,229,.15); border-color: var(--violet); color: #fff;
    }

    /* triangle canvas */
    #tri-canvas {
      display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    }

    /* molecular physics canvases */
    #gas-canvas, #brownian-canvas, #states-canvas, #diffusion-canvas, #reactions-canvas {
      display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    }

    /* chemistry sim-cat badge */
    .sim-cat.chem { background: rgba(52,211,153,.1); color: #34d399; }
    /* biology sim-cat badge */
    .sim-cat.bio  { background: rgba(34,211,153,.1); color: #22d399; }
    /* phase dot navigator */
    .cd-phase-nav { display:flex; align-items:center; justify-content:center; gap:6px; padding:6px 0; flex-wrap:wrap; }
    .cd-phase-dot { width:8px; height:8px; border-radius:50%; background:var(--border-h,rgba(255,255,255,.15)); cursor:pointer; transition:background .2s,transform .2s; flex-shrink:0; }
    .cd-phase-dot.active { background:#22d399; transform:scale(1.5); }

    /* ── triangle panel components ── */
    .tri-layer-row {
      display: flex; align-items: center; gap: 8px;
      padding: 7px 10px; border-radius: 10px;
      border: 1.5px solid var(--border);
      background: rgba(15,23,42,.03);
      cursor: pointer; user-select: none;
      transition: border-color .15s, background .15s;
    }
    .tri-layer-row:hover { background: rgba(155,93,229,.05); border-color: rgba(155,93,229,.3); }
    .tri-layer-row.active { background: rgba(155,93,229,.08); border-color: rgba(155,93,229,.4); }

    .tri-dot {
      width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
    }
    .tri-layer-name {
      font-size: 0.78rem; font-weight: 700; color: var(--text); flex: 1;
    }
    .tri-layer-hint {
      font-size: 0.68rem; font-weight: 700; opacity: 0.8;
    }
    .tri-toggle {
      width: 28px; height: 16px; border-radius: 99px;
      background: var(--border-h); flex-shrink: 0;
      position: relative; transition: background .2s;
    }
    .tri-toggle::after {
      content: ''; position: absolute; top: 2px; left: 2px;
      width: 12px; height: 12px; border-radius: 50%;
      background: #fff; transition: transform .2s;
    }
    .tri-layer-row.active .tri-toggle { background: var(--violet); }
    .tri-layer-row.active .tri-toggle::after { transform: translateX(12px); }

    .tri-stats-grid {
      display: grid; grid-template-columns: 26px 1fr; gap: 3px 8px;
      padding: 0 4px;
    }
    .tri-stat-k {
      font-family: 'Manrope', monospace; font-size: 0.78rem; font-weight: 800;
      display: flex; align-items: center;
    }
    .tri-stat-v {
      font-family: 'Manrope', monospace; font-size: 0.82rem; font-weight: 700;
      color: var(--text); padding: 2px 6px;
      border-radius: 6px; background: rgba(15,23,42,.08);
    }

    /* ── trig circle buttons ── */
    .trig-fn-btn {
      padding: 6px 14px; border-radius: 8px;
      background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.10);
      color: #aaa; font-size: 13px; font-weight: 700; cursor: pointer;
      font-family: 'Manrope', sans-serif; transition: .15s;
    }
    .trig-fn-btn:hover { background: rgba(var(--fc-rgb,155,93,229),0.15); border-color: var(--fc,var(--violet)); color: var(--fc,var(--violet)); }
    .trig-fn-btn.active { background: rgba(var(--fc-rgb,155,93,229),0.18); border-color: var(--fc,var(--violet)); color: var(--fc,var(--violet)); box-shadow: 0 0 8px rgba(var(--fc-rgb,155,93,229),0.3); }

    /* ── responsive ── */
    @media (max-width: 768px) {
      #lab-home { padding: 20px 16px 60px; }
      .sim-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
      .graph-panel { width: 220px; }
      /* Touch-friendly button targets (min 44px) */
      .zoom-btn { width: auto; min-width: 44px; height: 44px; padding: 0 12px; border-radius: 12px; }
      .sim-back { padding: 10px 16px; min-height: 44px; }
      .theory-toggle-btn { width: 44px; height: 44px; border-radius: 12px; }
    }
    @media (max-width: 540px) {
      .sim-grid { grid-template-columns: 1fr; }
      .sim-body-wrap { flex-direction: column; }
      .graph-panel { width: 100%; height: auto; border-right: none; border-bottom: 1.5px solid var(--border); max-height: 220px; }
    }

  /* Circuit tool buttons */
  .circ-tool-btn.active {
    background: rgba(155,93,229,0.25) !important;
    border-color: var(--violet) !important;
    color: #c4b5fd !important;
  }
  .circ-top-btn.active { background: rgba(155,93,229,0.35) !important; color: #c4b5fd !important; }

  /* Flask selection buttons */
  .flask-metal-btn.active, .flask-acid-btn.active {
    background: rgba(75,205,155,0.20) !important;
    border-color: #4BCD9B !important;
    color: #7BF5A4 !important;
  }

  /* Reaction mode buttons */
  .reac-mode-btn.active {
    background: rgba(6,214,224,0.18) !important;
    border-color: var(--cyan) !important;
    color: var(--cyan) !important;
  }

  /* Newton law/scene buttons */
  .nlaw-btn.active {
    background: rgba(6,214,224,0.18) !important;
    border-color: var(--cyan) !important;
    color: var(--cyan) !important;
  }
  .nscene-btn.active {
    background: rgba(241,91,181,0.15) !important;
    border-color: var(--pink) !important;
    color: var(--pink) !important;
  }

  /* ── wave mode buttons ── */
  .wave-mode-btn {
    flex: 1; padding: 7px 4px; border-radius: 10px;
    border: 1.5px solid var(--border-h);
    background: transparent; color: var(--text-2);
    font-family: 'Manrope', sans-serif; font-size: 0.72rem; font-weight: 700;
    cursor: pointer; transition: all .15s; text-align: center;
  }
  .wave-mode-btn:hover { border-color: var(--violet); color: var(--text); }
  .wave-mode-btn.active {
    background: rgba(155,93,229,.15) !important;
    border-color: var(--violet) !important; color: #fff !important;
  }
  .wave-n-btn.active {
    background: rgba(255,209,102,.15) !important;
    border-color: #FFD166 !important; color: #FFD166 !important; /* amber — wave harmonic, intentional palette */
  }

  /* ── theory panel (overlay right sidebar) ── */
  #lab-sim { position: relative; }
  .theory-panel {
    position: absolute; right: 0; top: 0; bottom: 0; z-index: 55;
    width: 320px;
    background: var(--surface);
    border-left: 1.5px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(.4,0,.2,1);
    display: flex; flex-direction: column;
    box-shadow: -4px 0 24px rgba(0,0,0,0.12);
  }
  .theory-panel.open { transform: translateX(0); }
  .theory-panel-inner {
    padding: 20px 16px; overflow-y: auto; flex: 1;
    display: flex; flex-direction: column; gap: 16px;
  }
  .tp-title {
    font-family: 'Unbounded', sans-serif; font-size: 0.72rem; font-weight: 800;
    color: var(--text-3); text-transform: uppercase; letter-spacing: .06em;
    display: flex; align-items: center; gap: 8px;
  }
  .tp-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }
  .tp-section { margin-bottom: 4px; }
  .tp-section-head {
    font-size: 0.76rem; font-weight: 800; color: var(--violet);
    margin-bottom: 6px; display: flex; align-items: center; gap: 6px;
  }
  .tp-formula {
    background: rgba(155,93,229,0.06); border: 1px solid rgba(155,93,229,0.12);
    border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
    font-size: 0.88rem; text-align: center;
  }
  .tp-formula .katex { font-size: 1em; }
  .tp-text {
    font-size: 0.78rem; color: var(--text-2); line-height: 1.6; margin-bottom: 8px;
  }
  .tp-var-list { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
  .tp-var {
    font-size: 0.74rem; color: var(--text-2); display: flex; gap: 6px;
    padding: 3px 0; border-bottom: 1px dashed rgba(255,255,255,0.04);
  }
  .tp-var b { color: var(--text); font-weight: 700; min-width: 24px; }
  .theory-toggle-btn {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    width: 32px; height: 32px; border-radius: 10px;
    border: 1.5px solid var(--border-h); background: transparent; color: var(--text-2);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; z-index: 2;
  }
  .theory-toggle-btn:hover { border-color: var(--violet); color: var(--violet); background: rgba(155,93,229,0.07); }
  .theory-toggle-btn svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 2.2; }
  @media (max-width: 768px) {
    .theory-panel.open { width: 100%; position: absolute; right: 0; top: 0; bottom: 0; z-index: 60; }
  }

  /* ── embed mode (loaded in iframe, no sidebar/topbar) ── */
  .embed-mode { height: 100vh; }
  .embed-mode .sb-content { height: 100vh; margin-left: 0 !important; }
  .embed-mode #lab-sim { flex: 1; }
  .embed-mode .sim-body-wrap { height: 100vh; }
  .embed-mode .graph-panel { max-height: 100vh; }

  /* ════════════════════════════════
     GEOMETRY SIM STYLES
  ════════════════════════════════ */
  .geo-panel {
    width: 210px; flex-shrink: 0;
    background: var(--surface);
    border-right: 1.5px solid var(--border);
    display: flex; flex-direction: column;
    overflow-y: auto; padding: 12px 10px; gap: 4px;
  }
  .geo-tool-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
    margin-bottom: 4px;
  }
  .geo-tool-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 9px; border-radius: 10px;
    border: 1.5px solid var(--border);
    background: transparent; color: var(--text-2);
    font-family: 'Manrope', sans-serif; font-size: 0.73rem; font-weight: 700;
    cursor: pointer; transition: all .14s; white-space: nowrap;
  }
  .geo-tool-btn svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 2.2; flex-shrink: 0; }
  .geo-tool-btn:hover { border-color: rgba(155,93,229,.4); color: var(--violet); background: rgba(155,93,229,.06); }
  .geo-tool-btn.active { border-color: var(--violet); color: var(--violet); background: rgba(155,93,229,.12); }

  .geo-tool-wide {
    grid-column: span 2;
  }

  .geo-ngon-ctrl {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    border: 1.5px solid var(--border); border-radius: 10px;
    padding: 4px 6px;
  }
  .geo-ngon-btn {
    width: 22px; height: 22px; border-radius: 6px;
    border: 1px solid var(--border-h);
    background: transparent; color: var(--text-2);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background .12s;
  }
  .geo-ngon-btn svg { width: 12px; height: 12px; stroke: currentColor; }
  .geo-ngon-btn:hover { background: rgba(155,93,229,.1); }
  #geo-ngon-n {
    font-size: 0.78rem; font-weight: 700; color: var(--text);
    min-width: 18px; text-align: center;
  }

  .geo-toggle-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 5px 4px; border-radius: 8px; cursor: pointer;
    transition: background .13s;
  }
  .geo-toggle-row:hover { background: rgba(255,255,255,.04); }
  .geo-toggle-label {
    font-size: 0.73rem; font-weight: 600; color: var(--text-2);
    display: flex; align-items: center; gap: 6px;
  }
  .geo-toggle-label svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2; opacity: .7; }

  /* ════════════════════════════════
     CHEMSANDBOX — EQUATION OVERLAY
  ════════════════════════════════ */
  .chemsand-eq-overlay {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    min-width: 340px;
    max-width: min(660px, calc(100% - 28px));
    background: rgba(6, 6, 18, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1.5px solid rgba(255, 255, 255, 0.10);
    border-radius: 16px;
    padding: 12px 18px 13px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    z-index: 20;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.28s ease;
  }
  .chemsand-eq-overlay.visible {
    opacity: 1;
  }

  .chemsand-eq-type {
    font-family: 'Manrope', sans-serif;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .09em;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 6px;
    padding: 1px 8px;
    align-self: flex-start;
    margin-bottom: 2px;
  }

  .chemsand-eq-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .chemsand-eq-label {
    font-family: 'Manrope', sans-serif;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: rgba(255,255,255,.35);
  }

  .chemsand-eq-text {
    font-family: 'JetBrains Mono', 'Fira Mono', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.95);
    word-break: break-word;
  }

  /* full ionic — slightly dimmer, smaller */
  .chemsand-eq-text--full {
    font-size: 0.78rem;
    font-weight: 500;
    color: rgba(155, 200, 255, 0.75);
  }

  /* net ionic — highlighted */
  .chemsand-eq-text--net {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--cyan, #06D6E0);
    text-shadow: 0 0 12px rgba(6,214,224,.35);
  }

  /* separator between rows */
  .chemsand-eq-row + .chemsand-eq-row {
    border-top: 1px solid rgba(255,255,255,.06);
    padding-top: 6px;
  }
  .geo-toggle {
    width: 28px; height: 16px; border-radius: 8px;
    background: rgba(255,255,255,.1); border: 1.5px solid var(--border-h);
    position: relative; transition: background .15s; flex-shrink: 0;
  }
  .geo-toggle::after {
    content: ''; position: absolute; left: 2px; top: 50%;
    transform: translateY(-50%);
    width: 9px; height: 9px; border-radius: 50%;
    background: rgba(255,255,255,.4); transition: all .15s;
  }
  .geo-toggle.on { background: var(--violet); border-color: var(--violet); }
  .geo-toggle.on::after { left: calc(100% - 11px); background: #fff; }

  .geo-info-box {
    background: rgba(155,93,229,.07); border: 1px solid rgba(155,93,229,.15);
    border-radius: 10px; padding: 8px 10px; margin-top: 4px;
    font-size: 0.72rem; line-height: 1.55; color: var(--text-2);
  }
  .geo-info-box .geo-info-key { color: var(--violet); font-weight: 700; }

  .geo-stat-row {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.7rem; padding: 2px 0;
    border-bottom: 1px dashed rgba(255,255,255,.05);
    color: var(--text-2);
  }
  .geo-stat-row:last-child { border: none; }
  .geo-stat-row b { color: var(--text); font-weight: 700; }

  .geo-canvas-outer {
    flex: 1; min-width: 0; position: relative; background: #0a0718;
  }
  .geo-canvas-outer canvas {
    display: block; position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
  }

  .geo-hint-bar {
    position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
    background: rgba(10,7,24,.82); border: 1px solid rgba(255,255,255,.1);
    border-radius: 20px; padding: 4px 14px;
    font-size: 0.7rem; color: rgba(255,255,255,.5);
    pointer-events: none; white-space: nowrap;
    backdrop-filter: blur(6px);
  }
  .geo-del-confirm {
    display: none; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
    gap: 8px; align-items: center; white-space: nowrap;
    background: rgba(18,10,32,.96); border: 1px solid rgba(155,93,229,.35);
    border-radius: 10px; padding: 8px 12px; z-index: 20;
    backdrop-filter: blur(8px); box-shadow: 0 4px 20px rgba(0,0,0,.6);
    font-size: 0.72rem; color: rgba(255,255,255,.8);
  }
  .geo-del-confirm.visible { display: flex; }
  .geo-del-confirm span { margin-right: 2px; }
  .geo-del-btn {
    padding: 3px 9px; border-radius: 6px; border: 1px solid;
    font-size: 0.7rem; cursor: pointer; font-family: inherit;
    transition: background .15s;
  }
  .geo-del-btn-soft  { border-color: rgba(74,222,128,.4); color: #4ADE80; background: rgba(74,222,128,.08); }
  .geo-del-btn-soft:hover  { background: rgba(74,222,128,.18); }
  .geo-del-btn-hard  { border-color: rgba(248,113,113,.4); color: #f87171; background: rgba(248,113,113,.08); }
  .geo-del-btn-hard:hover  { background: rgba(248,113,113,.18); }
  .geo-del-btn-cancel{ border-color: rgba(255,255,255,.15); color: rgba(255,255,255,.5); background: transparent; }
  .geo-del-btn-cancel:hover{ background: rgba(255,255,255,.06); }

  /* ── Задачник (challenge panel) ── */
  .geo-challenge-toggle {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 9px; border-radius: 10px;
    border: 1.5px solid rgba(74,222,128,.35);
    background: rgba(74,222,128,.05); color: #4ADE80;
    font-family: 'Manrope', sans-serif; font-size: 0.73rem; font-weight: 700;
    cursor: pointer; transition: all .14s; width: 100%; margin-top: 6px;
  }
  .geo-challenge-toggle:hover { background: rgba(74,222,128,.12); border-color: rgba(74,222,128,.6); }
  .geo-challenge-toggle svg { width: 13px; height: 13px; stroke: currentColor; flex-shrink: 0; }
  .geo-challenge-toggle .chall-count {
    margin-left: auto; font-size: 0.68rem; opacity: .75;
  }

  .geo-challenge-panel {
    position: absolute; top: 0; right: 0; bottom: 0;
    width: 300px; background: rgba(12,8,24,.97);
    border-left: 1.5px solid rgba(74,222,128,.2);
    display: flex; flex-direction: column;
    z-index: 15; transform: translateX(100%);
    transition: transform .22s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
  }
  .geo-challenge-panel.open { transform: translateX(0); }

  .geo-chall-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 14px 10px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
  }
  .geo-chall-header-title {
    font-family: 'Unbounded', sans-serif; font-size: 0.78rem; font-weight: 800;
    color: #4ADE80; letter-spacing: .05em;
  }
  .geo-chall-close {
    width: 26px; height: 26px; border-radius: 6px;
    border: 1px solid rgba(255,255,255,.12); background: transparent;
    color: rgba(255,255,255,.5); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .13s;
  }
  .geo-chall-close:hover { background: rgba(255,255,255,.06); color: #fff; }
  .geo-chall-close svg { width: 13px; height: 13px; stroke: currentColor; }

  .geo-chall-list {
    flex: 1; overflow-y: auto; padding: 10px 12px;
    display: flex; flex-direction: column; gap: 8px;
  }

  .geo-chall-item {
    border-radius: 12px; border: 1.5px solid var(--border);
    background: rgba(255,255,255,.02); overflow: hidden;
    transition: border-color .15s;
  }
  .geo-chall-item.chall-current { border-color: rgba(74,222,128,.4); }
  .geo-chall-item.chall-done    { border-color: rgba(74,222,128,.25); }
  .geo-chall-item.chall-locked  { opacity: .45; pointer-events: none; }

  .geo-chall-head {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 11px; cursor: pointer;
  }
  .geo-chall-status {
    width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
    border: 1.5px solid rgba(255,255,255,.15);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.65rem; font-weight: 800;
    color: rgba(255,255,255,.3); background: rgba(255,255,255,.04);
  }
  .chall-current .geo-chall-status {
    border-color: #4ADE80; color: #4ADE80; background: rgba(74,222,128,.1);
  }
  .chall-done .geo-chall-status {
    border-color: #4ADE80; background: rgba(74,222,128,.18);
  }
  .geo-chall-name {
    font-size: 0.73rem; font-weight: 700; color: var(--text-2);
    flex: 1; min-width: 0;
  }
  .chall-current .geo-chall-name { color: var(--text); }
  .chall-done    .geo-chall-name { color: rgba(74,222,128,.8); }

  .geo-chall-body {
    padding: 0 11px 10px; display: none;
  }
  .geo-chall-item.chall-current .geo-chall-body,
  .geo-chall-item.geo-chall-expanded .geo-chall-body { display: block; }

  .geo-chall-desc {
    font-size: 0.72rem; line-height: 1.55; color: rgba(255,255,255,.55);
    margin-bottom: 9px;
  }
  .geo-chall-actions { display: flex; gap: 6px; }
  .geo-chall-btn {
    flex: 1; padding: 6px 0; border-radius: 8px; border: 1.5px solid;
    font-family: 'Manrope', sans-serif; font-size: 0.7rem; font-weight: 700;
    cursor: pointer; transition: all .13s; text-align: center;
  }
  .geo-chall-btn-check {
    border-color: rgba(74,222,128,.4); color: #4ADE80; background: rgba(74,222,128,.07);
  }
  .geo-chall-btn-check:hover  { background: rgba(74,222,128,.18); }
  .geo-chall-btn-reset {
    border-color: rgba(255,255,255,.12); color: rgba(255,255,255,.45); background: transparent;
    flex: 0 0 auto; padding: 6px 9px;
  }
  .geo-chall-btn-reset:hover { background: rgba(255,255,255,.06); color: rgba(255,255,255,.7); }

  .geo-chall-hint {
    font-size: 0.68rem; color: #FBBF24; margin-top: 7px; line-height: 1.45;
    display: none;
  }
  .geo-chall-hint.visible { display: block; }

  .geo-chall-feedback {
    font-size: 0.7rem; font-weight: 700; margin-top: 6px; min-height: 14px;
    transition: color .2s;
  }
  .geo-chall-feedback.ok  { color: #4ADE80; }
  .geo-chall-feedback.err { color: #f87171; }

  @keyframes chall-success-fade {
    0%   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    60%  { opacity: 1; transform: translate(-50%, -60%) scale(1.08); }
    100% { opacity: 0; transform: translate(-50%, -70%) scale(1.12); }
  }
  .geo-chall-success-label {
    position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%);
    font-family: 'Unbounded', sans-serif; font-size: 1.6rem; font-weight: 800;
    color: #4ADE80; pointer-events: none; z-index: 25;
    text-shadow: 0 0 30px rgba(74,222,128,.7), 0 2px 6px rgba(0,0,0,.8);
    animation: chall-success-fade 2.2s ease-out forwards;
  }

  /* ── Logic Circuits truth table ── */
  .logic-tt {
    border-collapse: collapse;
    font-size: 0.76rem;
    color: rgba(255,255,255,0.75);
  }
  .logic-tt th {
    padding: 3px 10px;
    background: rgba(155,93,229,0.15);
    color: var(--violet);
    font-weight: 700;
    border: 1px solid rgba(255,255,255,0.08);
    text-align: center;
  }
  .logic-tt td {
    padding: 2px 10px;
    border: 1px solid rgba(255,255,255,0.06);
    text-align: center;
  }
  .logic-tt-cur td {
    background: rgba(155,93,229,0.18);
    font-weight: 700;
  }

/* ════════════════════════════════════════════════════════════════════════════
   UX MICRO-INTERACTIONS — appended block
   All additions are scoped to lab.html UI; individual sim JS files untouched.
   ════════════════════════════════════════════════════════════════════════════ */

/* ── 1. BUTTON STATES ────────────────────────────────────────────────────────
   Snappy hover/active/disabled for all interactive controls in the lab shell.
   Uses cubic-bezier(0.16,1,0.3,1) — fast-out-slow-in for a spring-like feel.
   ─────────────────────────────────────────────────────────────────────────── */
.zoom-btn,
.proj-preset-chip,
.geo-tool-btn,
.sb-tool-btn {
  transition: transform .12s cubic-bezier(0.16,1,0.3,1),
              filter .12s cubic-bezier(0.16,1,0.3,1),
              border-color .12s, color .12s, background .12s,
              box-shadow .12s;
}
.zoom-btn:hover,
.proj-preset-chip:hover,
.geo-tool-btn:hover,
.sb-tool-btn:hover {
  transform: scale(1.025);
  filter: brightness(1.08);
}
.zoom-btn:active,
.proj-preset-chip:active,
.geo-tool-btn:active,
.sb-tool-btn:active {
  transform: scale(0.96);
  filter: brightness(0.92);
}
.zoom-btn:disabled,
.proj-preset-chip:disabled,
.geo-tool-btn:disabled,
.sb-tool-btn:disabled,
.zoom-btn[disabled],
.proj-preset-chip[disabled],
.geo-tool-btn[disabled],
.sb-tool-btn[disabled] {
  opacity: .45;
  filter: grayscale(.6);
  cursor: not-allowed;
  pointer-events: none;
}

/* .sim-card already has transition; add scale micro-interaction */
.sim-card:not(.soon):hover { transform: translateY(-2px) scale(1.012); }
.sim-card:not(.soon):active { transform: scale(0.985); filter: brightness(0.97); }

/* ── 2. SLIDER POLISH ────────────────────────────────────────────────────────
   Custom track + thumb for all range inputs inside .proj-panel.
   Track: 4px, filled-gradient from left to thumb position via background-size trick.
   Thumb: 16px circle, cyan/violet, shadow, scale on hover/active.
   ─────────────────────────────────────────────────────────────────────────── */
.proj-panel input[type=range],
.param-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(
    to right,
    var(--violet) 0%,
    var(--violet) var(--sl-pct, 50%),
    rgba(255,255,255,.15) var(--sl-pct, 50%),
    rgba(255,255,255,.15) 100%
  );
  outline: none;
  cursor: pointer;
  transition: background .12s;
}
.proj-panel input[type=range]::-webkit-slider-thumb,
.param-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 0 0 3px rgba(155,93,229,.25), 0 2px 6px rgba(0,0,0,.35);
  cursor: pointer;
  transition: transform .12s cubic-bezier(0.16,1,0.3,1),
              box-shadow .12s;
}
.proj-panel input[type=range]:hover::-webkit-slider-thumb,
.param-slider:hover::-webkit-slider-thumb {
  transform: scale(1.15);
  box-shadow: 0 0 0 4px rgba(155,93,229,.3), 0 3px 8px rgba(0,0,0,.4);
}
.proj-panel input[type=range]:active::-webkit-slider-thumb,
.param-slider:active::-webkit-slider-thumb {
  transform: scale(0.95);
}
.proj-panel input[type=range]::-moz-range-thumb,
.param-slider::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%; border: none;
  background: var(--violet);
  box-shadow: 0 0 0 3px rgba(155,93,229,.25), 0 2px 6px rgba(0,0,0,.35);
  cursor: pointer;
  transition: transform .12s cubic-bezier(0.16,1,0.3,1);
}
.proj-panel input[type=range]:hover::-moz-range-thumb,
.param-slider:hover::-moz-range-thumb { transform: scale(1.15); }
.proj-panel input[type=range]:active::-moz-range-thumb,
.param-slider:active::-moz-range-thumb { transform: scale(0.95); }

/* ── 3. FOCUS RINGS (accessibility) ─────────────────────────────────────────
   :focus-visible only — mouse clicks don't show the ring.
   ─────────────────────────────────────────────────────────────────────────── */
.zoom-btn:focus-visible,
.proj-preset-chip:focus-visible,
.geo-tool-btn:focus-visible,
.sb-tool-btn:focus-visible,
.sim-card:focus-visible,
.lab-filter:focus-visible,
.gp-btn:focus-visible,
.sim-back:focus-visible,
.proj-launch-btn:focus-visible,
.proj-reset-btn:focus-visible,
.param-slider:focus-visible,
.proj-panel input[type=range]:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}

/* ── 4. TOOLTIP SYSTEM (CSS-only, zero JS) ───────────────────────────────────
   Usage: add class="tt-host" data-tt="Your tooltip text" to any element.
   Tooltip appears above the element after a 400ms delay on hover.
   Arrow points downward. Dark overlay with white text, 8px radius.
   ─────────────────────────────────────────────────────────────────────────── */
.tt-host {
  position: relative;
}
.tt-host::after {
  content: attr(data-tt);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(20,20,30,.95);
  color: #fff;
  font-family: 'Manrope', sans-serif;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease, transform .15s ease;
  transition-delay: 0s;
  z-index: 9000;
}
.tt-host:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  transition-delay: 400ms;
}
/* arrow */
.tt-host::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  border: 5px solid transparent;
  border-top-color: rgba(20,20,30,.95);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease, transform .15s ease;
  transition-delay: 0s;
  z-index: 9001;
}
.tt-host:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  transition-delay: 400ms;
}

/* ── 5. SIM FADE TRANSITION ──────────────────────────────────────────────────
   .sim-fading is toggled by lab-glue.js around openSim() calls.
   The sim body wrap fades out (150ms) then new sim fades in (200ms).
   ─────────────────────────────────────────────────────────────────────────── */
#lab-sim {
  transition: opacity .2s ease;
}
#lab-sim.sim-fading {
  opacity: 0;
  pointer-events: none;
}

/* ── 6. MARCHING ANTS SELECTION ──────────────────────────────────────────────
   Opt-in: apply class="sim-selected-ants" to any SVG stroke element.
   Downstream sims (geometry, circuit, logic) can use this.
   ─────────────────────────────────────────────────────────────────────────── */
@keyframes ant-march {
  to { stroke-dashoffset: -28; }
}
.sim-selected-ants {
  stroke-dasharray: 4 3;
  animation: ant-march 800ms linear infinite;
}

/* ── 7. LOADING SKELETON ─────────────────────────────────────────────────────
   Opt-in: apply .sim-loading-skel to any container while a sim initialises.
   Shimmer moves left-to-right. Remove the class when the sim is ready.
   ─────────────────────────────────────────────────────────────────────────── */
@keyframes skel-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}
.sim-loading-skel {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,.04) 25%,
    rgba(255,255,255,.10) 50%,
    rgba(255,255,255,.04) 75%
  );
  background-size: 800px 100%;
  animation: skel-shimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
  min-height: 40px;
}

/* ── 8. EMPTY STATE PATTERN ──────────────────────────────────────────────────
   Usage:
     <div class="sim-empty-state">
       <svg class="sim-empty-icon" ...>...</svg>
       <div class="sim-empty-title">Title</div>
       <div class="sim-empty-desc">Description text</div>
       <button class="sim-empty-cta">Action</button>  <!-- optional -->
     </div>
   ─────────────────────────────────────────────────────────────────────────── */
.sim-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-3);
  opacity: .72;
}
.sim-empty-icon {
  width: 48px; height: 48px;
  stroke: var(--text-3);
  stroke-width: 1.4;
  fill: none;
  opacity: .6;
  display: block;
}
.sim-empty-title {
  font-family: 'Unbounded', sans-serif;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-2);
}
.sim-empty-desc {
  font-size: 0.82rem;
  line-height: 1.55;
  max-width: 280px;
}
.sim-empty-cta {
  margin-top: 4px;
  padding: 8px 20px;
  border-radius: 99px;
  border: 1.5px solid var(--violet);
  background: transparent;
  color: var(--violet);
  font-family: 'Manrope', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.sim-empty-cta:hover {
  background: var(--violet);
  color: #fff;
}

/* ── 9. TOAST UPGRADE — progress bar ────────────────────────────────────────
   The existing lsToast already slides in from right and stacks.
   This adds a thin auto-dismiss progress bar at the bottom of each toast.
   JS in lab-glue.js injects .ls-toast-progress with --toast-dur CSS var.
   ─────────────────────────────────────────────────────────────────────────── */
@keyframes toast-progress {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}
.ls-toast {
  position: relative;
  overflow: hidden;
}
.ls-toast-bar {
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  width: 100%;
  background: rgba(255,255,255,.45);
  transform-origin: left center;
  animation: toast-progress var(--toast-dur, 3.5s) linear forwards;
  border-radius: 0 0 14px 14px;
}

/* ── 10. CURSOR STATES ───────────────────────────────────────────────────────
   Default canvas cursor for projector-style sims.
   Sims can toggle .cur-* classes on .proj-canvas-outer or canvas itself.
   ─────────────────────────────────────────────────────────────────────────── */
.proj-canvas-outer canvas { cursor: crosshair; }

.cur-grab     { cursor: grab !important; }
.cur-grabbing { cursor: grabbing !important; }
.cur-cell     { cursor: cell !important; }
.cur-pointer  { cursor: pointer !important; }
.cur-cross    { cursor: crosshair !important; }
.cur-move     { cursor: move !important; }

/* ── Periodic Table — Visual Modes (Wave B) ─────────────────── */
#ptbl-vmodes-bar {
  user-select: none;
}
#ptbl-vmodes-bar .ptbl-vm-btn:hover {
  background: rgba(155,93,229,0.18) !important;
  color: #e0e0ff !important;
  border-color: rgba(155,93,229,0.4) !important;
}
#ptbl-vmodes-bar .ptbl-vm-btn:active {
  transform: scale(0.97);
}
#ptbl-heat-legend {
  align-items: center;
  gap: 4px;
}
#ptbl-heat-grad {
  image-rendering: crisp-edges;
}
#ptbl-3d-canvas {
  outline: none;
  cursor: grab;
}
#ptbl-3d-canvas:active {
  cursor: grabbing;
}
#ptbl-trend-canvas {
  z-index: 5;
  transition: opacity 0.3s ease;
}
#ptbl-3d-tip {
  max-width: 200px;
  line-height: 1.4;
  white-space: nowrap;
}

/* Draggable canvas elements within sims */
[draggable="true"] canvas,
canvas[data-draggable] { cursor: grab; }
[draggable="true"] canvas:active,
canvas[data-draggable]:active { cursor: grabbing; }

/* ── 11. VIEW TRANSITIONS ────────────────────────────────────────────────────
   If browser supports View Transitions API, openSim is wrapped in
   document.startViewTransition() in lab-glue.js (see below comment).
   ::view-transition-* rules control the cross-fade animation.
   Fallback: manual .sim-fading class (rule 5 above).
   ─────────────────────────────────────────────────────────────────────────── */
@supports (view-transition-name: none) {
  @view-transition { navigation: none; }

  ::view-transition-old(sim-view),
  ::view-transition-new(sim-view) {
    animation-duration: 200ms;
    animation-timing-function: ease;
  }
  ::view-transition-old(sim-view) {
    animation-name: sim-vt-out;
  }
  ::view-transition-new(sim-view) {
    animation-name: sim-vt-in;
  }
}

@keyframes sim-vt-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}
@keyframes sim-vt-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Assign view-transition-name so only the sim area morphs */
#lab-sim {
  view-transition-name: sim-view;
}

/* ═══ Optical Bench — wavelength slider ═══ */
#ob-wavelength-bar {
  min-height: 34px;
}
#ob-wavelength-bar input[type=range] {
  height: 4px;
  background: linear-gradient(to right,
    #8000ff 0%, #0000ff 10%, #00ffff 30%,
    #00ff00 50%, #ffff00 65%, #ff8000 80%, #ff0000 100%);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

/* ═══ Spectrometer panel ═══ */
#ob-spectrometer-panel {
  overflow: hidden;
}
#ob-spectrometer-canvas {
  border: 1px solid #1a1a2e;
  border-radius: 4px;
  background: #0a0a18;
}

/* ═══ OB_FX Effects panel ═══ */
.ob-fx-panel {
  flex-shrink: 0;
  background: #0d0d1e;
  border-bottom: 1px solid #1e1e32;
}
.ob-fx-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: .72rem;
  font-weight: 700;
  color: #888;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.ob-fx-summary::-webkit-details-marker { display: none; }
.ob-fx-summary:hover { color: var(--cyan); }
.ob-fx-summary .ic { fill: currentColor; opacity: 0.7; flex-shrink: 0; }
.ob-fx-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 6px 12px 8px;
}
.ob-fx-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .72rem;
  color: #bbb;
  cursor: pointer;
  white-space: nowrap;
}
.ob-fx-label:hover { color: #fff; }
.ob-fx-label input[type=checkbox] {
  accent-color: var(--cyan);
  width: 13px;
  height: 13px;
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════
   PERIODIC TABLE — Tabbed Card V2
   ═══════════════════════════════════════════════════════════ */

/* ── Card wrapper ── */
.ptbl-card-v2 {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: color-mix(in srgb, var(--el-col, #7B8EF7) 10%, #0D0D1A 90%);
  border-radius: 0;
  overflow: hidden;
}

/* ── Close button ── */
.ptbl-card-close {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 10;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 5px;
  cursor: pointer;
  color: rgba(255,255,255,0.5);
  transition: background .12s, color .12s;
  padding: 0;
}
.ptbl-card-close:hover { background: rgba(255,255,255,0.14); color: #fff; }
.ptbl-card-close .ic { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2.2; }

/* ── Hero section ── */
.ptbl-hero {
  position: relative;
  text-align: center;
  padding: 28px 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
  overflow: hidden;
}
.ptbl-hero-z {
  position: absolute;
  top: 8px;
  left: 10px;
  font-size: .82rem;
  font-weight: 700;
  color: rgba(255,255,255,0.55);
  line-height: 1;
}
.ptbl-hero-sym {
  font-size: clamp(2.4rem, 14vw, 4.4rem);
  font-weight: 900;
  color: var(--el-col, #7B8EF7);
  line-height: 1.05;
  letter-spacing: -1px;
  display: block;
  overflow: visible;
}
.ptbl-hero-name {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-top: 2px;
}
.ptbl-hero-mass {
  font-size: .72rem;
  color: rgba(255,255,255,0.4);
  margin-top: 1px;
}
.ptbl-hero-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 9px;
  border-radius: 12px;
  border: 1px solid;
  font-size: .68rem;
  font-weight: 600;
}

/* ── Tab bar ── */
.ptbl-tabs {
  display: flex;
  overflow-x: auto;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  scrollbar-width: none;
}
.ptbl-tabs::-webkit-scrollbar { display: none; }

.ptbl-tab {
  flex-shrink: 0;
  padding: 6px 9px;
  font-size: .67rem;
  font-weight: 600;
  color: rgba(255,255,255,0.4);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color .12s, border-color .12s;
  white-space: nowrap;
}
.ptbl-tab:hover { color: rgba(255,255,255,0.75); }
.ptbl-tab.active {
  color: var(--el-col, #7B8EF7);
  border-bottom-color: var(--el-col, #7B8EF7);
}

/* ── Tab body ── */
.ptbl-tab-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  font-size: .76rem;
  color: #ccc;
  transition: opacity .2s;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

/* ── Shared helpers ── */
.ptbl-quick-label {
  font-size: .67rem;
  color: rgba(255,255,255,0.4);
  display: block;
  margin-bottom: 1px;
}
.ptbl-quick-val { font-weight: 600; color: #e0e0e0; font-size: .76rem; }
.ptbl-empty { color: rgba(255,255,255,0.3); font-size: .75rem; font-style: italic; }
.ptbl-summary { color: #bbb; font-size: .75rem; line-height: 1.5; margin-bottom: 8px; }

/* ── Overview tab ── */
.ptbl-overview { }
.ptbl-quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.ptbl-quick-item {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 6px;
  padding: 6px 8px;
}

/* ── Properties tab ── */
.ptbl-prop-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .73rem;
}
.ptbl-prop-table td, .ptbl-prop-table th {
  padding: 4px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  vertical-align: top;
}
.ptbl-prop-table td:first-child {
  color: rgba(255,255,255,0.45);
  padding-right: 6px;
  white-space: nowrap;
}
.ptbl-prop-table td:last-child { color: #ddd; }
.ptbl-prop-table th {
  color: rgba(255,255,255,0.35);
  font-size: .67rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Electronics tab ── */
.ptbl-electronics { }
.ptbl-bohr-inline-wrap {
  background: rgba(0,0,0,0.3);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}
.ptbl-el-config {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 6px;
  padding: 6px 8px;
}
.ptbl-el-config-code {
  display: block;
  margin-top: 2px;
  font-size: .75rem;
  color: var(--el-col, #7B8EF7);
  word-break: break-all;
}

/* ── Isotopes tab ── */
.ptbl-iso-table thead th { text-align: left; }
.ptbl-iso-avg {
  margin-top: 6px;
  font-size: .73rem;
  color: rgba(255,255,255,0.55);
  text-align: right;
}

/* ── History tab ── */
.ptbl-history { }
.ptbl-timeline-card {
  background: rgba(255,255,255,0.05);
  border-left: 3px solid var(--el-col, #7B8EF7);
  border-radius: 4px;
  padding: 8px 10px;
  margin-bottom: 10px;
}
.ptbl-timeline-year {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--el-col, #7B8EF7);
  line-height: 1;
}
.ptbl-timeline-who { font-size: .78rem; color: #ccc; margin-top: 2px; }
.ptbl-timeline-country { font-size: .7rem; color: rgba(255,255,255,0.4); margin-top: 1px; }
.ptbl-hist-text { font-size: .75rem; color: #bbb; line-height: 1.55; }
.ptbl-etymology {
  margin-top: 8px;
  padding: 6px 8px;
  background: rgba(255,255,255,0.03);
  border-radius: 5px;
  font-size: .73rem;
  color: #bbb;
  line-height: 1.5;
}

/* ── Applications tab ── */
.ptbl-app-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.ptbl-app-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 8px;
  font-size: .64rem;
  color: #bbb;
  min-width: 48px;
  text-align: center;
  transition: background .12s;
}
.ptbl-app-chip:hover { background: rgba(255,255,255,0.10); }
.ptbl-app-chip .ic {
  width: 18px;
  height: 18px;
  stroke: var(--el-col, #7B8EF7);
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ptbl-app-desc { font-size: .74rem; color: #bbb; line-height: 1.55; margin-top: 4px; }

/* ── Biology tab ── */
.ptbl-bio-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid;
  font-size: .73rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.ptbl-bio-role { font-size: .74rem; color: #bbb; line-height: 1.55; }
.ptbl-bio-toxicity {
  margin-top: 6px;
  font-size: .73rem;
  color: rgba(255,255,255,0.55);
}

/* ── Minerals tab ── */
.ptbl-mineral-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 8px;
}
.ptbl-mineral-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 5px;
  padding: 5px 8px;
}
.ptbl-mineral-name { color: #ddd; font-size: .75rem; }
.ptbl-mineral-formula {
  font-size: .7rem;
  color: var(--el-col, #7B8EF7);
  background: rgba(255,255,255,0.05);
  padding: 1px 5px;
  border-radius: 4px;
}
.ptbl-mineral-sources { font-size: .74rem; color: #bbb; }

/* ── Spectrum tab ── */
.ptbl-spectrum { }
.ptbl-spec-lines-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.ptbl-spec-tag {
  padding: 2px 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  font-size: .68rem;
  color: #bbb;
  font-variant-numeric: tabular-nums;
}

/* ── Flame tab ── */
.ptbl-flame { text-align: center; padding: 10px 0; }
.ptbl-flame-swatch {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 10px;
}
.ptbl-flame-label { font-size: .78rem; color: #ddd; font-weight: 600; }
.ptbl-flame-desc { font-size: .73rem; color: #aaa; line-height: 1.55; margin-top: 6px; text-align: left; }

/* ── Reactions tab ── */
.ptbl-reactions { display: flex; flex-direction: column; gap: 8px; }
.ptbl-reaction-item {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 6px;
  padding: 7px 9px;
}
.ptbl-reaction-label { font-size: .68rem; color: rgba(255,255,255,0.4); margin-bottom: 3px; }
.ptbl-reaction-eq { font-size: .78rem; font-weight: 600; font-family: 'Courier New', monospace; }
.ptbl-reaction-note { font-size: .68rem; color: rgba(255,255,255,0.3); font-style: italic; margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════
   GEOMETRY PANEL — modern layout (collapsible)
   ═══════════════════════════════════════════════════════════ */
.geo-panel-modern {
  width: 260px !important;
  padding: 10px 10px !important;
  gap: 6px !important;
  overflow-x: hidden !important;
}
.geo-panel-modern .geo-tool-btn {
  font-size: .76rem;
  padding: 6px 7px;
  white-space: normal;
  text-align: left;
  line-height: 1.15;
  min-width: 0;
  word-break: break-word;
}
.geo-panel-modern .geo-tool-grid {
  min-width: 0;
}
.geo-panel-modern .geo-tool-wide {
  grid-column: 1 / -1;
}

/* sticky quick-access bar */
.geo-quick-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 6px;
  margin-bottom: 8px;
  background: rgba(155,93,229,0.08);
  border: 1px solid rgba(155,93,229,0.25);
  border-radius: 10px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.geo-quick-bar .geo-tool-btn {
  padding: 6px 8px;
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.12);
  font-size: .78rem;
}

/* accordion */
.geo-acc {
  border: 1px solid var(--border);
  border-radius: 9px;
  margin-bottom: 5px;
  background: rgba(255,255,255,0.02);
  flex: 0 0 auto;
}
.geo-acc > summary {
  cursor: pointer;
  list-style: none;
  padding: 7px 11px 7px 27px;
  font-family: 'Unbounded', sans-serif;
  font-size: .72rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .04em;
  text-transform: uppercase;
  position: relative;
  user-select: none;
  transition: background .15s;
}
.geo-acc > summary:hover { background: rgba(255,255,255,0.04); }
.geo-acc > summary::-webkit-details-marker { display: none; }
.geo-acc > summary::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 4.5px solid currentColor;
  border-top: 3.5px solid transparent;
  border-bottom: 3.5px solid transparent;
  transform: translateY(-50%);
  transition: transform .18s;
  opacity: .6;
}
.geo-acc[open] > summary::before {
  transform: translateY(-50%) rotate(90deg);
}
.geo-acc-body {
  padding: 8px 10px 10px;
  border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════
   DYNAMICS PANEL — modern layout
   ═══════════════════════════════════════════════════════════ */
.dyn-panel-modern {
  font-size: .82rem;
}
.dyn-panel-modern .gp-section-title {
  font-size: .72rem;
  margin: 10px 0 8px;
}
.dyn-mode-bar {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 6px;
}
.dyn-mode-bar .mag-mode-btn {
  flex: 1;
  font-size: .8rem;
  padding: 6px 4px;
  border: none;
}
.dyn-mode-bar .mag-mode-btn.active {
  background: rgba(155,93,229,0.18);
  color: var(--violet);
  border: 1px solid rgba(155,93,229,0.45);
}

/* tool grid 3 col */
.dyn-tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 5px;
  margin-bottom: 12px;
}
.dyn-tool-grid .mag-mode-btn {
  font-size: .8rem;
  padding: 7px 4px;
  flex-direction: column;
  gap: 2px;
}
.dyn-tool-grid .mag-mode-btn .ic { width: 14px; height: 14px; }

/* row helpers */
.dyn-row-2 {
  display: flex;
  gap: 5px;
  margin-bottom: 12px;
}
.dyn-row-2 .mag-mode-btn { flex: 1; font-size: .8rem; padding: 7px 6px; }
.dyn-row-4 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 4px;
}
.dyn-row-4 .mag-mode-btn { font-size: .78rem; padding: 6px 0; }

/* check lists */
.dyn-checks {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 10px;
}
.dyn-checks label,
.dyn-check-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
  color: var(--text-2);
  cursor: pointer;
  line-height: 1.3;
}
.dyn-checks input[type="checkbox"],
.dyn-check-inline input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--violet);
  flex-shrink: 0;
}

/* accordion sections */
.dyn-acc {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  background: rgba(255,255,255,0.02);
  flex: 0 0 auto;
}
.dyn-acc > summary { border-radius: 10px; }
.dyn-acc[open] > summary { border-radius: 10px 10px 0 0; }
.geo-acc > summary { border-radius: 9px; }
.geo-acc[open] > summary { border-radius: 9px 9px 0 0; }
.dyn-acc > summary {
  cursor: pointer;
  list-style: none;
  padding: 9px 12px 9px 30px;
  font-family: 'Unbounded', sans-serif;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .04em;
  text-transform: uppercase;
  position: relative;
  user-select: none;
  transition: background .15s;
}
.dyn-acc > summary:hover { background: rgba(255,255,255,0.04); }
.dyn-acc > summary::-webkit-details-marker { display: none; }
.dyn-acc > summary::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transform: translateY(-50%);
  transition: transform .18s;
  opacity: .65;
}
.dyn-acc[open] > summary::before {
  transform: translateY(-50%) rotate(90deg);
}
.dyn-acc-body {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
}

/* preset categories */
.dyn-preset-cat {
  font-size: .72rem;
  font-weight: 700;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 12px 0 6px;
}
.dyn-preset-cat:first-child { margin-top: 2px; }
.dyn-preset-grp {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.dyn-preset-grp .proj-preset-chip {
  font-size: .78rem;
  padding: 5px 11px;
}

/* hint box at bottom */
.dyn-panel-modern .param-name { font-size: .82rem; }
.dyn-panel-modern .param-val  { font-size: .84rem; }

/* ── GraphPanel toggle button active state ── */
#btn-pend-graphs.active,
#btn-coll-graphs.active,
#btn-newton-graphs.active,
#btn-sandbox-graphs.active,
#btn-hydro-graphs.active {
  background: rgba(6,214,224,0.22) !important;
  border-color: #06D6E0 !important;
  box-shadow: 0 0 8px rgba(6,214,224,0.3);
}

/* ═══════════════════════════════════════════════════════════
   ELECTROLYSIS PANEL — modern layout
   ═══════════════════════════════════════════════════════════ */
.elec-panel-modern {
  font-size: .82rem;
  padding: 8px 10px 12px;
}
.elec-panel-modern .param-name { font-size: .82rem; }
.elec-panel-modern .param-val  { font-size: .85rem; }

/* Quick bar — play/reset row */
.elec-quick-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.elec-quick-bar .mag-mode-btn {
  flex: 1;
  font-size: .82rem;
  padding: 8px 6px;
  font-weight: 600;
}

/* Accordion sections */
.elec-acc {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.02);
  flex: 0 0 auto;
}
.elec-acc > summary {
  cursor: pointer;
  list-style: none;
  padding: 9px 12px 9px 30px;
  font-family: 'Unbounded', sans-serif;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .04em;
  text-transform: uppercase;
  position: relative;
  user-select: none;
  transition: background .15s;
  border-radius: 10px;
}
.elec-acc[open] > summary { border-radius: 10px 10px 0 0; }
.elec-acc > summary:hover { background: rgba(255,255,255,0.04); }
.elec-acc > summary::-webkit-details-marker { display: none; }
.elec-acc > summary::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transform: translateY(-50%);
  transition: transform .18s;
  opacity: .65;
}
.elec-acc[open] > summary::before {
  transform: translateY(-50%) rotate(90deg);
}
.elec-acc-body {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
}
.elec-acc-body .mag-mode-btn {
  font-size: .80rem;
  padding: 7px 4px;
}
.elec-acc-body .mag-mode-btn.active {
  background: rgba(155,93,229,0.18);
  color: var(--violet);
  border: 1px solid rgba(155,93,229,0.45);
}

/* Graph active button state */
#btn-elec-graphs.active {
  background: rgba(6,214,224,0.22) !important;
  border-color: #06D6E0 !important;
  box-shadow: 0 0 8px rgba(6,214,224,0.3);
}

/* ═══════════════════════════════════════════════════════════
   RACE SIM — Гонка с задачами (кинематика 1D)
   ═══════════════════════════════════════════════════════════ */
.race-sim-host {
  flex-direction: column;
}

.race-root {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #0b0b1a;
  font-family: 'Manrope', system-ui, sans-serif;
  overflow: hidden;
}

/* Question bar */
.race-question-bar {
  flex: 0 0 auto;
  padding: 10px 16px 8px;
  background: rgba(155,93,229,0.07);
  border-bottom: 1px solid rgba(155,93,229,0.18);
  font-size: .88rem;
  color: rgba(255,255,255,0.88);
  line-height: 1.45;
}

.race-question-text {
  display: block;
}

/* Body: panel + scene */
.race-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Left panel */
.race-panel {
  width: 280px;
  flex: 0 0 280px;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(255,255,255,0.018);
  border-right: 1px solid var(--border);
  padding: 10px 11px 14px;
  font-size: .82rem;
  color: rgba(255,255,255,0.92);
  display: flex;
  flex-direction: column;
  gap: 0;
}
.race-panel .param-block { margin-bottom: 8px; }
.race-panel .param-name { font-size: .78rem; color: rgba(255,255,255,0.85); }
.race-panel .param-val  { font-size: .82rem; min-width: 55px; color: rgba(255,255,255,0.95); }
.race-panel .race-acc > summary { color: rgba(255,255,255,0.95) !important; }
.race-panel .dyn-checks label { color: rgba(255,255,255,0.85); }

/* Quick bar */
.race-quick-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.race-quick-bar .mag-mode-btn {
  flex: 1;
  font-size: .80rem;
  padding: 8px 4px;
  font-weight: 600;
}

/* Accordion */
.race-acc {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.02);
  flex: 0 0 auto;
}
.race-acc > summary {
  cursor: pointer;
  list-style: none;
  padding: 9px 12px 9px 30px;
  font-family: 'Unbounded', sans-serif;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .04em;
  text-transform: uppercase;
  position: relative;
  user-select: none;
  transition: background .15s;
  border-radius: 10px;
}
.race-acc[open] > summary { border-radius: 10px 10px 0 0; }
.race-acc > summary:hover { background: rgba(255,255,255,0.04); }
.race-acc > summary::-webkit-details-marker { display: none; }
.race-acc > summary::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transform: translateY(-50%);
  transition: transform .18s;
  opacity: .65;
}
.race-acc[open] > summary::before {
  transform: translateY(-50%) rotate(90deg);
}
.race-acc-body {
  padding: 8px 10px 10px;
  border-top: 1px solid var(--border);
}

/* Scenario cards */
.race-scenarios-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.race-scene-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1.5px solid transparent;
  background: rgba(255,255,255,0.025);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  min-width: 0;
}
.race-scene-card:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(155,93,229,0.25);
}
.race-scene-card.active {
  border-color: rgba(155,93,229,0.55);
  background: rgba(155,93,229,0.1);
}
.race-scene-icons {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}
.race-scene-info {
  flex: 1;
  min-width: 0;
}
.race-scene-title {
  font-size: .85rem;
  font-weight: 700;
  color: rgba(255,255,255,0.96);
  line-height: 1.4;
  word-break: break-word;
}
.race-scene-card.active .race-scene-title { color: #fff; }

/* Mover param card */
.race-mover-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 11px 6px;
  margin-bottom: 10px;
  background: rgba(255,255,255,0.02);
}
.race-mover-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: .88rem;
  color: rgba(255,255,255,0.95);
}

/* Scene: canvas + graph + answer */
.race-scene-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.race-canvas-outer {
  flex: 1;
  position: relative;
  min-height: 0;
  overflow: hidden;
}
.race-track-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Graph area */
.race-graph-wrap {
  flex: 0 0 120px;
  border-top: 1px solid var(--border);
  background: rgba(8,8,20,0.92);
  overflow: hidden;
}
.race-graph-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Answer bar */
.race-answer-bar {
  flex: 0 0 auto;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.018);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.race-answer-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1;
}
.race-ans-label {
  font-size: .82rem;
  color: rgba(255,255,255,0.75);
  display: flex;
  align-items: center;
  gap: 6px;
}
.race-ans-inp {
  width: 80px;
  padding: 5px 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-h);
  border-radius: 6px;
  color: var(--text);
  font-family: 'Manrope', sans-serif;
  font-size: .85rem;
}
.race-ans-inp:focus {
  outline: none;
  border-color: rgba(155,93,229,0.55);
  background: rgba(155,93,229,0.07);
}
.race-answer-btns {
  display: flex;
  gap: 8px;
}
.race-check-btn {
  background: rgba(155,93,229,0.15) !important;
  border-color: rgba(155,93,229,0.4) !important;
  color: var(--violet) !important;
}
.race-check-btn:hover {
  background: rgba(155,93,229,0.28) !important;
}

/* Verdict */
.race-verdict {
  width: 100%;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: .83rem;
  line-height: 1.5;
}
.race-verdict-ok {
  background: rgba(74,222,128,0.12);
  border: 1px solid rgba(74,222,128,0.35);
  color: #4ADE80;
}
.race-verdict-err {
  background: rgba(239,71,111,0.12);
  border: 1px solid rgba(239,71,111,0.35);
  color: #EF476F;
}
.race-ok  { color: #4ADE80; margin-right: 8px; }
.race-err { color: #EF476F; margin-right: 8px; }

/* Stats bar */
.race-stats-bar {
  flex: 0 0 auto;
  display: flex;
  gap: 0;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.race-stats-bar .pstat {
  flex: 1;
  text-align: center;
  padding: 6px 4px;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.race-stats-bar .pstat:last-child { border-right: none; }
.race-stats-bar .pstat-label {
  font-size: .72rem;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 3px;
  line-height: 1.2;
}
.race-stats-bar .pstat-val {
  font-size: .9rem;
  font-weight: 700;
  font-family: 'Unbounded', sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
