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

  body {
    width: 100vw;
    height: 100vh;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Menlo', 'Monaco', 'SF Mono', 'Courier New', monospace;
  }

  .desktop {
    width: min(1280px, 100vw);
    height: min(1000px, 100vh);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
  }

  .window {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow:
      0 0 0 0.5px rgba(0,0,0,0.18),
      0 2px 4px rgba(0,0,0,0.10),
      0 8px 24px rgba(0,0,0,0.16),
      0 24px 64px rgba(0,0,0,0.14);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  @keyframes slideUp {
    from { transform: translateY(80px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }


  /* Title Bar */
  .titlebar {
    height: 38px;
    background: linear-gradient(180deg, #ececec 0%, #e0e0e0 100%);
    border-bottom: 1px solid #c0c0c0;
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
    user-select: none;
  }

  .titlebar-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12.5px;
    font-weight: 500;
    color: #4a4a4a;
    letter-spacing: 0.01em;
    white-space: nowrap;
  }

  /* Traffic lights */
  .traffic {
    display: flex;
    gap: 8px;
    align-items: center;
    z-index: 1;
  }

  .btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    cursor: default;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .btn-close {
    background: radial-gradient(circle at 40% 35%, #ff7b72, #e0443b);
    box-shadow: 0 0 0 0.5px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.3);
  }
  .btn-min {
    background: radial-gradient(circle at 40% 35%, #ffd55e, #e5a800);
    box-shadow: 0 0 0 0.5px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.3);
  }
  .btn-max {
    background: radial-gradient(circle at 40% 35%, #6fda6f, #28a428);
    box-shadow: 0 0 0 0.5px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.3);
  }

  /* Tabs bar */
  .tabbar {
    height: 32px;
    background: #e5e5e5;
    border-bottom: 1px solid #c8c8c8;
    display: flex;
    align-items: flex-end;
    padding: 0 12px;
    gap: 2px;
    flex-shrink: 0;
  }

  .tab {
    height: 26px;
    padding: 0 16px;
    border-radius: 6px 6px 0 0;
    font-size: 11.5px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: default;
    color: #888;
    background: transparent;
  }

  .tab.active {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #c8c8c8;
    border-bottom: 1px solid #f5f5f5;
    font-weight: 500;
  }

  .tab-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #aaa;
  }
  .tab.active .tab-dot {
    background: #3d8af7;
  }

  /* Terminal body */
  .terminal-body {
    flex: 1;
    background: #f5f5f5;
    padding: 14px 16px;
    overflow-y: auto;
    overflow-x: hidden;
    font-size: 16px;
    line-height: 1.65;
    color: #1a1a1a;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
  }

  .terminal-body::-webkit-scrollbar { width: 8px; }
  .terminal-body::-webkit-scrollbar-track { background: transparent; }
  .terminal-body::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

  /* Terminal text styles */
  .line { display: flex; flex-wrap: wrap; align-items: baseline; margin-bottom: 0; white-space: pre-wrap; word-break: break-all; }

  .prompt-user  { color: #28a745; font-weight: 600; }
  .prompt-at    { color: #888; }
  .prompt-host  { color: #0077cc; font-weight: 600; }
  .prompt-path  { color: #8b5cf6; font-weight: 500; }
  .prompt-sym   { color: #555; }
  .cmd          { color: #1a1a1a; }
  .cmd-keyword  { color: #c8522a; font-weight: 600; }
  .cmd-flag     { color: #0077cc; }
  .cmd-string   { color: #2e7d32; }
  .cmd-path     { color: #8b5cf6; }

  .output       { color: #333; }
  .output-dim   { color: #888; }
  .output-blue  { color: #0077cc; }
  .output-green { color: #28a745; font-weight: 500; }
  .output-red   { color: #d32f2f; }
  .output-yellow{ color: #b37400; }
  .output-bold  { font-weight: 600; color: #1a1a1a; }

  .blank { height: 6px; }

  /* Input line with cursor */
  .input-line {
    display: flex;
    align-items: baseline;
    margin-top: 0;
  }

  .cursor {
    display: inline-block;
    width: 9px;
    height: 18px;
    background: #1a1a1a;
    margin-left: 1px;
    vertical-align: text-bottom;
    animation: blink 1.1s step-start infinite;
  }

  @keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
  }

  /* Three-panel layout */
  .app-panels {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #1e1e2e;
    overflow: hidden;
  }

  .panel-top {
    height: 38%;
    background: #1e1e2e;
    border-bottom: 1.5px solid #2a2a3e;
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 4px;
    padding: 16px 18px;
    overflow-y: auto;
  }

  .folder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: 80px;
    padding: 8px 4px 7px;
    border-radius: 8px;
    cursor: default;
    transition: background 0.15s;
  }

  .folder:hover { background: rgba(160,124,255,0.12); }
  .folder.selected { background: rgba(160,124,255,0.22); }

  .folder-icon { width: 42px; height: 34px; }
  .folder-icon svg { width: 100%; height: 100%; }

  .folder-name {
    font-size: 11px;
    color: #c0c0d8;
    text-align: center;
    line-height: 1.3;
    word-break: break-word;
    font-family: -apple-system, 'Helvetica Neue', sans-serif;
  }

  .panel-bottom {
    flex: 1;
    display: flex;
    overflow: hidden;
  }

  .panel-left {
    flex: 1;
    background: #1e1e2e;
    border-right: 1.5px solid #2a2a3e;
    display: flex;
    flex-direction: column;
    padding: 16px 14px;
    gap: 6px;
    overflow-y: auto;
  }

  .panel-left-empty {
    color: #3a3a55;
    font-size: 12px;
    font-family: -apple-system, 'Helvetica Neue', sans-serif;
    margin: auto;
    text-align: center;
    user-select: none;
  }

  .file-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 7px;
    cursor: default;
    transition: background 0.15s;
    border: 1px solid #2a2a3e;
    background: #191926;
    font-family: -apple-system, 'Helvetica Neue', sans-serif;
  }

  .file-option:hover { background: #222238; border-color: #3a3a55; }

  .file-option-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
  }

  .file-option-icon.sch  { background: #1a3a5c; }
  .file-option-icon.lay  { background: #1a3a2a; }
  .file-option-icon.vhdl { background: #3a1a4a; }
  .file-option-icon.vlog { background: #3a2a10; }

  .file-option-label {
    font-size: 13px;
    font-weight: 500;
    color: #c0c0d8;
    letter-spacing: 0.01em;
  }

  .file-option-ext {
    margin-left: auto;
    font-size: 10px;
    color: #555577;
    letter-spacing: 0.05em;
  }

  .panel-section-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #444466;
    text-transform: uppercase;
    padding: 0 2px 4px;
    font-family: -apple-system, 'Helvetica Neue', sans-serif;
    border-bottom: 1px solid #222234;
    margin-bottom: 2px;
  }

  .panel-right {
    flex: 1;
    background: #1e1e2e;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
  }

  /* ── Preview area ── */
  .preview-empty {
    color: #2e2e44;
    font-size: 12px;
    font-family: -apple-system, 'Helvetica Neue', sans-serif;
    text-align: center;
    user-select: none;
  }

  .preview-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: fadeInPreview 0.25s ease both;
  }

  @keyframes fadeInPreview {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .preview-header {
    padding: 8px 14px;
    border-bottom: 1px solid #2a2a3e;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #555577;
    text-transform: uppercase;
    font-family: -apple-system, 'Helvetica Neue', sans-serif;
    flex-shrink: 0;
  }

  .preview-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
  }

  /* Schematic SVG preview */
  .sch-preview svg { width: 100%; height: 100%; }

  /* Code preview (VHDL / Verilog) */
  .code-preview {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    font-family: 'Menlo', 'Monaco', monospace;
    font-size: 11px;
    line-height: 1.6;
    color: #a0a0c0;
    scrollbar-width: thin;
    scrollbar-color: #2a2a3e transparent;
    white-space: pre;
  }

  .code-preview .kw  { color: #c792ea; }
  .code-preview .ty  { color: #82aaff; }
  .code-preview .str { color: #c3e88d; }
  .code-preview .cm  { color: #546e7a; }
  .code-preview .nm  { color: #ffcb6b; }

  /* Layout GDS grid */
  .layout-preview svg { width: 100%; height: 100%; }


  /* ── Floating file window ── */
  .file-windows-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 200;
  }

  .file-win {
    position: absolute;
    width: 700px;
    height: 500px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow:
      0 0 0 0.5px rgba(0,0,0,0.3),
      0 8px 24px rgba(0,0,0,0.25),
      0 32px 80px rgba(0,0,0,0.35);
    pointer-events: all;
    animation: winPop 0.45s cubic-bezier(0.22,1,0.36,1) both;
    font-family: -apple-system, 'Helvetica Neue', sans-serif;
  }

  @keyframes winPop {
    from { opacity: 0; transform: scale(0.92) translateY(20px); }
    to   { opacity: 1; transform: scale(1)    translateY(0); }
  }

  .file-win-titlebar {
    height: 38px;
    background: linear-gradient(180deg, #3a3a3c 0%, #2c2c2e 100%);
    border-bottom: 1px solid #1a1a1a;
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
    cursor: default;
    user-select: none;
  }

  .file-win-titlebar.dragging { cursor: grabbing; }

  .file-win-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: 500;
    color: #d0d0d0;
    white-space: nowrap;
  }

  .file-win-body {
    flex: 1;
    background: #13131f;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .file-win-body .preview-wrap  { height: 100%; }
  .file-win-body .preview-header { font-size: 11px; }
  .file-win-body .preview-content { flex: 1; overflow: auto; }
  .file-win-body .code-preview { font-size: 12px; padding: 8px; }
  .file-win-body .sch-preview svg { width: 100%; height: 100%; }


  /* ── Transistor properties popup ── */
  .mos-props {
    position: fixed;
    width: 260px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 0 0.5px rgba(0,0,0,0.4), 0 8px 32px rgba(0,0,0,0.5);
    font-family: -apple-system, 'Helvetica Neue', sans-serif;
    z-index: 300;
    pointer-events: all;
    animation: winPop 0.3s cubic-bezier(0.22,1,0.36,1) both;
  }

  .mos-props-title {
    -webkit-user-select: none;
    user-select: none;
  }

  .mos-props-title {
    height: 34px;
    background: linear-gradient(180deg, #3a3a3c, #2c2c2e);
    border-bottom: 1px solid #111;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
    cursor: default;
    user-select: none;
    position: relative;
  }

  .mos-props-title span {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11.5px;
    font-weight: 500;
    color: #d0d0d0;
    white-space: nowrap;
  }

  .mos-props-body {
    background: #1a1a2c;
    padding: 12px 14px 14px;
  }

  .mos-props-type {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
  }

  .mos-props-type.nmos { background: #1a3a5c; color: #5a9cf5; }
  .mos-props-type.pmos { background: #3a1a4a; color: #c792ea; }

  .mos-props-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid #252535;
    font-size: 11.5px;
  }

  .mos-props-row:last-child { border-bottom: none; }

  .mos-props-label { color: #666688; }

  .mos-props-val {
    color: #c0c0e0;
    font-family: 'Menlo', monospace;
    font-size: 11px;
    background: #111122;
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid #2a2a3e;
    cursor: text;
    min-width: 80px;
    text-align: right;
  }

  .mos-props-val:focus {
    outline: none;
    border-color: #a07cff;
    color: #fff;
  }

  .mos-props-section {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #444466;
    margin: 10px 0 4px;
  }


  /* ── Zoom on schematic ── */
  .sch-zoomable { cursor: grab; overflow: hidden; width: 100%; height: 100%; }
  .sch-zoomable.grabbing { cursor: grabbing; }
  .sch-zoomable svg { transform-origin: 0 0; transition: none; }

  /* ── DRC log ── */
  .drc-log {
    width: 100%; height: 100%;
    font-family: 'Menlo','Monaco',monospace;
    font-size: 11px;
    line-height: 1.7;
    color: #a0a0c0;
    white-space: pre;
    overflow-y: auto;
    padding: 12px 14px;
    background: #13131f;
  }
  .drc-ok   { color: #50d890; }
  .drc-warn { color: #e0a020; }
  .drc-err  { color: #e06060; }
  .drc-hdr  { color: #a07cff; font-weight: bold; }

  /* ── Simulation setup window ── */
  .sim-win {
    position: fixed;
    width: 480px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 0 0.5px rgba(0,0,0,0.35), 0 12px 40px rgba(0,0,0,0.55);
    font-family: -apple-system,'Helvetica Neue',sans-serif;
    z-index: 350;
    pointer-events: all;
    animation: winPop 0.35s cubic-bezier(0.22,1,0.36,1) both;
    background: #1a1a2c;
  }
  .sim-win-titlebar {
    height: 38px;
    background: linear-gradient(180deg,#3a3a3c,#2c2c2e);
    border-bottom: 1px solid #111;
    display: flex; align-items: center; padding: 0 12px; gap: 8px;
    flex-shrink: 0; cursor: default; user-select: none; position: relative;
  }
  .sim-win-titlebar span {
    position: absolute; left: 50%; transform: translateX(-50%);
    font-size: 12px; font-weight: 500; color: #d0d0d0; white-space: nowrap;
  }
  .sim-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
  .sim-section { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; color: #555577; text-transform: uppercase; margin-bottom: 4px; }
  .sim-row { display: flex; align-items: center; gap: 10px; font-size: 12px; color: #a0a0c0; }
  .sim-row label { width: 110px; flex-shrink: 0; }
  .sim-select, .sim-input {
    flex: 1; background: #111122; border: 1px solid #2a2a3e; border-radius: 6px;
    color: #c0c0e0; font-size: 11.5px; font-family: 'Menlo',monospace;
    padding: 5px 9px; outline: none;
  }
  .sim-select:focus, .sim-input:focus { border-color: #a07cff; }
  .sim-checkbox-row { display: flex; gap: 8px; flex-wrap: wrap; }
  .sim-check {
    display: flex; align-items: center; gap: 5px;
    background: #111122; border: 1px solid #2a2a3e; border-radius: 6px;
    padding: 4px 10px; font-size: 11px; color: #9090b0; cursor: pointer;
  }
  .sim-check input { accent-color: #a07cff; }
  .sim-check.checked { border-color: #a07cff; color: #c792ea; background: #1e1a30; }
  .sim-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 0 16px 14px; }
  .sim-btn {
    padding: 6px 18px; border-radius: 7px; font-size: 12px; font-weight: 500;
    cursor: pointer; border: none;
  }
  .sim-btn.cancel { background: #2a2a3e; color: #888; }
  .sim-btn.run    { background: #5a3fcf; color: #fff; }
  .sim-btn.run:hover { background: #6b4fe0; }

  /* ── Results / waveform window ── */
  .results-win {
    position: fixed;
    width: 620px; height: 420px;
    border-radius: 12px; overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: 0 0 0 0.5px rgba(0,0,0,0.35), 0 12px 40px rgba(0,0,0,0.55);
    font-family: -apple-system,'Helvetica Neue',sans-serif;
    z-index: 350; pointer-events: all;
    animation: winPop 0.35s cubic-bezier(0.22,1,0.36,1) both;
    background: #13131f;
  }
  .results-titlebar {
    height: 38px;
    background: linear-gradient(180deg,#3a3a3c,#2c2c2e);
    border-bottom: 1px solid #111;
    display: flex; align-items: center; padding: 0 12px; gap: 8px;
    flex-shrink: 0; cursor: default; user-select: none; position: relative;
  }
  .results-titlebar span {
    position: absolute; left: 50%; transform: translateX(-50%);
    font-size: 12px; font-weight: 500; color: #d0d0d0; white-space: nowrap;
  }
  .results-tabs {
    display: flex; gap: 0; border-bottom: 1px solid #1e1e30;
    background: #111120; flex-shrink: 0;
  }
  .results-tab {
    padding: 7px 18px; font-size: 11.5px; color: #666688; cursor: pointer;
    border-bottom: 2px solid transparent;
  }
  .results-tab.active { color: #c792ea; border-bottom-color: #a07cff; }
  .results-content { flex: 1; overflow: hidden; }
  .waveform-canvas { width: 100%; height: 100%; display: block; }

  /* ── Sim file option ── */
  .file-option-icon.sim { background: #1a3a3a; }

  /* ── Theme toggle ── */
  .theme-toggle {
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    width: 36px; height: 20px; border-radius: 10px;
    background: #2a2a3e; cursor: pointer; transition: background 0.3s;
    border: 1px solid #3a3a55;
  }
  .theme-toggle.light-mode { background: #b8d4f0; border-color: #8ab0d0; }
  .theme-toggle::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 14px; height: 14px; border-radius: 50%;
    background: #666; transition: all 0.3s;
  }
  .theme-toggle.light-mode::after { left: 18px; background: #fff; }

  /* ── Light theme for app panels ── */
  .app-panels.light { background: #f0f0f5; }
  .panel-top.light  { background: #f0f0f5; border-bottom-color: #d0d0e0; }
  .panel-left.light { background: #f5f5fa; border-right-color: #d0d0e0; }
  .panel-right.light{ background: #f5f5fa; }
  .panel-left.light .panel-section-title { color: #9090b0; }
  .panel-left.light .file-option  { background: #eeeef5; border-color: #d0d0e0; }
  .panel-left.light .file-option-label { color: #333; }
  .panel-left.light .file-option-ext   { color: #888; }
  .panel-left.light .panel-left-empty  { color: #bbb; }
  .panel-right.light .preview-empty    { color: #bbb; }
  .folder.light .folder-name           { color: #1a1a2e; font-weight: 600; }
  .panel-top.light .folder-name        { color: #1a1a2e; font-weight: 600; }

  /* Light theme — file-option icons */
  .light .file-option-icon.sch  { background: #bcd8f5; color: #1a6ab0; }
  .light .file-option-icon.lay  { background: #b8e8cc; color: #1a7a40; }
  .light .file-option-icon.vhdl { background: #e0c8f0; color: #7030a0; }
  .light .file-option-icon.vlog { background: #f5ddb8; color: #8a4a00; }
  .light .file-option-icon.sim  { background: #b8e8e8; color: #0a6a6a; }


  /* ── Schematic toolbar (shown in full file-win only) ── */
  .sch-toolbar {
    height: 34px;
    background: #161624;
    border-bottom: 1px solid #1e1e30;
    display: flex;
    align-items: center;
    padding: 0 10px;
    gap: 6px;
    flex-shrink: 0;
    user-select: none;
  }
  .sch-tool-btn {
    height: 24px;
    padding: 0 10px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid #2a2a3e;
    background: #1e1e30;
    color: #9090b0;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
  }
  .sch-tool-btn:hover { background: #252540; border-color: #3a3a55; color: #c0c0d8; }
  .sch-tool-btn.primary { background: #2a1e50; border-color: #5a3fcf; color: #a07cff; }
  .sch-tool-btn.primary:hover { background: #341e60; }
  .sch-tool-sep { width: 1px; height: 18px; background: #2a2a3e; margin: 0 3px; }
  .sch-breadcrumb {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    color: #444466;
  }
  .sch-bc-item {
    color: #6060a0;
    cursor: pointer;
  }
  .sch-bc-item:hover { color: #a07cff; text-decoration: underline; }
  .sch-bc-cur { color: #a0a0c0; }
  .sch-bc-sep { color: #333355; }

  /* ── Import element dialog ── */
  .import-win {
    position: fixed;
    width: 540px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 0 0.5px rgba(0,0,0,0.4), 0 12px 40px rgba(0,0,0,0.6);
    font-family: -apple-system,'Helvetica Neue',sans-serif;
    z-index: 360;
    pointer-events: all;
    animation: winPop 0.3s cubic-bezier(0.22,1,0.36,1) both;
    background: #1a1a2c;
  }
  .import-titlebar {
    height: 38px;
    background: linear-gradient(180deg,#3a3a3c,#2c2c2e);
    border-bottom: 1px solid #111;
    display: flex; align-items: center; padding: 0 12px; gap: 8px;
    flex-shrink: 0; cursor: default; user-select: none; position: relative;
  }
  .import-titlebar span {
    position: absolute; left: 50%; transform: translateX(-50%);
    font-size: 12px; font-weight: 500; color: #d0d0d0;
  }
  .import-body {
    display: flex;
    height: 360px;
    overflow: hidden;
  }
  .import-sidebar {
    width: 160px;
    background: #111120;
    border-right: 1px solid #1e1e30;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
  }
  .import-lib-hdr {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #333355;
    padding: 10px 12px 4px;
  }
  .import-lib-item {
    padding: 7px 12px;
    font-size: 12px;
    color: #6060a0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
  }
  .import-lib-item:hover { background: #1a1a30; color: #a0a0c0; }
  .import-lib-item.active { background: #1e1a35; color: #a07cff; }
  .import-lib-icon { font-size: 14px; }
  .import-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .import-search {
    padding: 10px 12px;
    border-bottom: 1px solid #1e1e30;
    flex-shrink: 0;
  }
  .import-search input {
    width: 100%;
    background: #111122;
    border: 1px solid #2a2a3e;
    border-radius: 6px;
    color: #c0c0e0;
    font-size: 11.5px;
    padding: 5px 10px;
    outline: none;
    font-family: inherit;
  }
  .import-search input:focus { border-color: #a07cff; }
  .import-panels {
    flex: 1;
    display: flex;
    overflow: hidden;
  }
  .import-elem-list {
    width: 180px;
    border-right: 1px solid #1e1e30;
    overflow-y: auto;
    flex-shrink: 0;
  }
  .import-elem-item {
    padding: 7px 12px;
    font-size: 11.5px;
    color: #7070a0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid #141422;
  }
  .import-elem-item:hover { background: #1a1a30; color: #c0c0d8; }
  .import-elem-item.active { background: #1e1a35; color: #c792ea; }
  .import-elem-badge {
    font-size: 9px;
    background: #252540;
    border: 1px solid #3a3a55;
    color: #6060a0;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: auto;
  }
  .import-elem-badge.nmos { background: #1a2a3a; border-color: #3a6a8a; color: #5a9cf5; }
  .import-elem-badge.pmos { background: #2a1a3a; border-color: #6a3a8a; color: #c792ea; }
  .import-elem-badge.pass { background: #1a3a1a; border-color: #3a6a3a; color: #50d890; }
  .import-props-panel {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
  }
  .import-props-title {
    font-size: 13px;
    font-weight: 600;
    color: #c0c0e0;
    margin-bottom: 4px;
  }
  .import-props-desc {
    font-size: 10.5px;
    color: #555577;
    margin-bottom: 12px;
    line-height: 1.5;
  }
  .import-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid #1e1e30;
    flex-shrink: 0;
  }

  /* ── Netlist window ── */
  .netlist-win {
    position: fixed;
    width: 520px; height: 400px;
    border-radius: 12px; overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: 0 0 0 0.5px rgba(0,0,0,0.4), 0 12px 40px rgba(0,0,0,0.6);
    font-family: -apple-system,'Helvetica Neue',sans-serif;
    z-index: 360; pointer-events: all;
    animation: winPop 0.3s cubic-bezier(0.22,1,0.36,1) both;
    background: #13131f;
  }
  .netlist-titlebar {
    height: 38px;
    background: linear-gradient(180deg,#3a3a3c,#2c2c2e);
    border-bottom: 1px solid #111;
    display: flex; align-items: center; padding: 0 12px; gap: 8px;
    flex-shrink: 0; cursor: default; user-select: none; position: relative;
  }
  .netlist-titlebar span {
    position: absolute; left: 50%; transform: translateX(-50%);
    font-size: 12px; font-weight: 500; color: #d0d0d0;
  }
  .netlist-toolbar {
    height: 30px;
    background: #111120;
    border-bottom: 1px solid #1e1e30;
    display: flex; align-items: center; padding: 0 10px; gap: 8px;
    flex-shrink: 0;
  }
  .netlist-code {
    flex: 1;
    overflow-y: auto;
    font-family: 'Menlo','Monaco',monospace;
    font-size: 11px;
    line-height: 1.7;
    color: #a0a0c0;
    white-space: pre;
    padding: 12px 16px;
    background: #0e0e1a;
  }
  .nl-comment { color: #546e7a; }
  .nl-kw      { color: #c792ea; }
  .nl-id      { color: #82aaff; }
  .nl-val     { color: #c3e88d; }
  .nl-node    { color: #ffcb6b; }

  /* ── Element placement ghost ── */
  .sch-ghost {
    position: absolute;
    pointer-events: none;
    opacity: 0.65;
    z-index: 10;
  }
  .sch-preview.placing { cursor: crosshair !important; }
  .sch-preview.wiring  { cursor: crosshair !important; }

  /* ── Wire mode button active state ── */
  .sch-tool-btn.active {
    background: #1e1a35 !important;
    border-color: #a07cff !important;
    color: #c792ea !important;
  }
  .sch-tool-btn.passed {
    background: #0e2a1a !important;
    border-color: #50d890 !important;
    color: #50d890 !important;
  }
  .sch-tool-btn.failed {
    background: #2a0e0e !important;
    border-color: #e06060 !important;
    color: #e06060 !important;
  }
  .sch-tool-btn.warned {
    background: #2a1e0a !important;
    border-color: #e0a020 !important;
    color: #e0a020 !important;
  }

  /* ── Placed element drag handle ── */
  .sch-placed {
    position: absolute;
    cursor: move;
    user-select: none;
  }
  .sch-placed:hover > svg rect[data-ic],
  .sch-placed:hover > svg polygon {
    filter: brightness(1.3);
  }

  /* ── Wire overlay canvas ── */
  .sch-wire-canvas {
    position: absolute;
    top: 0; left: 0;
    pointer-events: none;
    z-index: 5;
  }

  /* ── Layout cross-highlight ── */
  .layout-highlight {
    position: absolute;
    pointer-events: none;
    border-radius: 3px;
    border: 2px solid transparent;
    box-shadow: 0 0 0 0 transparent;
    transition: opacity 0.25s, box-shadow 0.25s;
    opacity: 0;
    z-index: 4;
  }
  .layout-highlight.active {
    opacity: 1;
  }
  .layout-highlight.nmos {
    background: rgba(90, 156, 245, 0.18);
    border-color: #5a9cf5;
    box-shadow: 0 0 12px 3px rgba(90,156,245,0.4);
  }
  .layout-highlight.pmos {
    background: rgba(199, 146, 234, 0.18);
    border-color: #c792ea;
    box-shadow: 0 0 12px 3px rgba(199,146,234,0.4);
  }

  /* ── DRC/LVS results panel ── */
  .drc-win {
    position: fixed;
    width: 480px; height: 380px;
    border-radius: 12px; overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: 0 0 0 0.5px rgba(0,0,0,0.4), 0 12px 40px rgba(0,0,0,0.6);
    font-family: -apple-system,'Helvetica Neue',sans-serif;
    z-index: 360; pointer-events: all;
    animation: winPop 0.3s cubic-bezier(0.22,1,0.36,1) both;
    background: #13131f;
  }
  .drc-win-titlebar {
    height: 38px;
    background: linear-gradient(180deg,#3a3a3c,#2c2c2e);
    border-bottom: 1px solid #111;
    display: flex; align-items: center; padding: 0 12px; gap: 8px;
    flex-shrink: 0; cursor: default; user-select: none; position: relative;
  }
  .drc-win-titlebar span {
    position: absolute; left: 50%; transform: translateX(-50%);
    font-size: 12px; font-weight: 500; color: #d0d0d0; white-space: nowrap;
  }
  .drc-win-tabs {
    display: flex; border-bottom: 1px solid #1e1e30;
    background: #111120; flex-shrink: 0;
  }
  .drc-win-tab {
    padding: 7px 18px; font-size: 11.5px; color: #666688; cursor: pointer;
    border-bottom: 2px solid transparent; user-select: none;
  }
  .drc-win-tab.active { color: #c792ea; border-bottom-color: #a07cff; }
  .drc-win-toolbar {
    height: 30px; background: #0f0f1e;
    border-bottom: 1px solid #1a1a2c;
    display: flex; align-items: center; padding: 0 10px; gap: 8px;
    flex-shrink: 0;
  }
  .drc-status-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  }
  .drc-status-dot.pass  { background: #50d890; box-shadow: 0 0 6px #50d890; }
  .drc-status-dot.error { background: #e06060; box-shadow: 0 0 6px #e06060; }
  .drc-status-dot.warn  { background: #e0a020; box-shadow: 0 0 6px #e0a020; }
  .drc-status-dot.idle  { background: #333355; }
  .drc-win-log {
    flex: 1; overflow-y: auto;
    font-family: 'Menlo','Monaco',monospace;
    font-size: 11px; line-height: 1.8;
    color: #a0a0c0; white-space: pre;
    padding: 10px 14px;
    background: #0e0e1a;
  }

  /* ── Info sidebar ── */
  .info-tab {
    position: fixed;
    left: 0; top: 50%;
    transform: translateY(-50%);
    z-index: 600;
    display: flex;
    align-items: stretch;
    max-height: 90vh;
  }
  .info-tab-handle {
    width: 28px;
    background: linear-gradient(180deg, #2a1e50, #1e1a35);
    border: 1px solid #3a3060;
    border-left: none;
    border-radius: 0 8px 8px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    gap: 4px;
    padding: 14px 0;
    transition: background 0.2s;
    box-shadow: 2px 0 12px rgba(0,0,0,0.4);
  }
  .info-tab-handle:hover { background: linear-gradient(180deg, #3a2e60, #2e2a50); }
  .info-tab-handle-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: #a07cff;
    text-transform: uppercase;
    font-family: -apple-system, sans-serif;
    user-select: none;
  }
  .info-tab-handle-icon {
    font-size: 13px;
    color: #a07cff;
    transition: transform 0.3s;
  }
  .info-tab.open .info-tab-handle-icon { transform: rotate(180deg); }

  .info-panel {
    width: 0;
    overflow: hidden;
    transition: width 0.35s cubic-bezier(0.22,1,0.36,1);
    background: #13131f;
    border: 1px solid #2a2a3e;
    border-left: none;
    border-radius: 0 12px 12px 0;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
  }
  .info-tab.open .info-panel { width: 300px; }

  .info-panel-inner {
    width: 300px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px 18px;
    font-family: -apple-system, 'Helvetica Neue', sans-serif;
    scrollbar-width: thin;
    scrollbar-color: #2a2a3e transparent;
  }
  .info-panel-inner::-webkit-scrollbar { width: 4px; }
  .info-panel-inner::-webkit-scrollbar-track { background: transparent; }
  .info-panel-inner::-webkit-scrollbar-thumb { background: #2a2a3e; border-radius: 2px; }
  .info-panel-inner::-webkit-scrollbar-thumb:hover { background: #3a3a55; }

  .info-panel-title {
    font-size: 14px;
    font-weight: 700;
    color: #c0c0e0;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .info-panel-subtitle {
    font-size: 10px;
    color: #444466;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 16px;
  }
  .info-divider {
    height: 1px;
    background: #1e1e30;
    margin: 14px 0;
  }
  .info-section-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #7060aa;
    margin-bottom: 10px;
    border-left: 2px solid #a07cff;
    padding-left: 7px;
  }
  .info-feature {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: flex-start;
  }
  .info-feature-icon {
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 1px;
  }
  .info-feature-text {
    font-size: 11.5px;
    color: #7070a0;
    line-height: 1.5;
  }
  .info-feature-text strong { color: #a0a0c0; font-weight: 600; }
  .info-badge {
    display: inline-block;
    font-size: 9.5px;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.04em;
    margin: 2px 2px 0 0;
  }
  .info-badge.purple { background: #2a1e50; color: #a07cff; border: 1px solid #3a2e60; }
  .info-badge.blue   { background: #1a2a4a; color: #5a9cf5; border: 1px solid #2a3a5a; }
  .info-badge.green  { background: #0e2a1a; color: #50d890; border: 1px solid #1a3a2a; }
  .info-badge.orange { background: #2a1a0a; color: #e0a020; border: 1px solid #3a2a1a; }

  .info-shortcut {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid #141422;
    font-size: 11px;
  }
  .info-shortcut:last-child { border-bottom: none; }
  .info-shortcut-action { color: #6060a0; }
  .info-shortcut-key {
    background: #1e1e30;
    border: 1px solid #2a2a40;
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 10px;
    color: #8080b0;
    font-family: monospace;
  }
  .info-version {
    margin-top: auto;
    padding-top: 14px;
    font-size: 9.5px;
    color: #2a2a40;
    text-align: center;
    font-family: monospace;
  }

  /* ── Disclaimer bubble ── */
  .disclaimer-bubble {
    position: fixed;
    top: 18px;
    right: 18px;
    width: 270px;
    background: #1a1a2c;
    border: 1px solid #3a3060;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(160,124,255,0.1);
    z-index: 700;
    font-family: -apple-system, 'Helvetica Neue', sans-serif;
    animation: winPop 0.4s cubic-bezier(0.22,1,0.36,1) both;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.22,1,0.36,1);
  }
  .disclaimer-bubble.minimized {
    width: 160px;
  }
  .disclaimer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: linear-gradient(135deg, #2a1e50, #1e1a35);
    border-bottom: 1px solid #2a2a40;
    cursor: pointer;
    user-select: none;
  }
  .disclaimer-header-left {
    display: flex;
    align-items: center;
    gap: 7px;
  }
  .disclaimer-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #e0a020;
    box-shadow: 0 0 6px #e0a020;
    flex-shrink: 0;
    animation: pulse-dot 2s ease-in-out infinite;
  }
  @keyframes pulse-dot {
    0%,100% { opacity: 1; }
    50%      { opacity: 0.4; }
  }
  .disclaimer-label {
    font-size: 11px;
    font-weight: 700;
    color: #c792ea;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }
  .disclaimer-toggle {
    font-size: 12px;
    color: #555577;
    transition: transform 0.3s;
    flex-shrink: 0;
  }
  .disclaimer-bubble.minimized .disclaimer-toggle {
    transform: rotate(180deg);
  }
  .disclaimer-body {
    padding: 12px 14px 14px;
    overflow: hidden;
    max-height: 300px;
    transition: max-height 0.3s cubic-bezier(0.22,1,0.36,1), padding 0.3s;
  }
  .disclaimer-bubble.minimized .disclaimer-body {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
  .disclaimer-item {
    display: flex;
    gap: 8px;
    margin-bottom: 9px;
    align-items: flex-start;
  }
  .disclaimer-item:last-child { margin-bottom: 0; }
  .disclaimer-item-icon {
    font-size: 13px;
    flex-shrink: 0;
    margin-top: 1px;
  }
  .disclaimer-item-text {
    font-size: 11px;
    color: #b0b0cc;
    line-height: 1.55;
  }
  .disclaimer-item-text strong {
    color: #e0e0f0;
    font-weight: 600;
  }
  .disclaimer-footer {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #1e1e30;
    font-size: 10px;
    color: #6060a0;
    text-align: center;
    font-style: italic;
  }

  /* ── Collapsible info features ── */
  .info-feature-toggle {
    display: flex;
    gap: 10px;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: 3px 0;
  }
  .info-feature-toggle:hover .info-feature-text strong { color: #c792ea; }
  .info-feature-arrow {
    margin-left: auto;
    font-size: 9px;
    color: #333355;
    transition: transform 0.25s;
    flex-shrink: 0;
  }
  .info-feature.open .info-feature-arrow { transform: rotate(180deg); color: #a07cff; }
  .info-feature-detail {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.22,1,0.36,1);
    padding-left: 28px;
  }
  .info-feature.open .info-feature-detail { max-height: 200px; }
  .info-feature-detail-text {
    font-size: 11px;
    color: #8080aa;
    line-height: 1.6;
    padding: 6px 0 4px;
    border-left: 2px solid #2a2a40;
    padding-left: 10px;
    margin-top: 2px;
  }
  .info-feature-detail-text em { color: #a07cff; font-style: normal; }
  .info-feature-detail-text strong { color: #b0b0cc; }

  /* ── Collapsible info sections ── */
  .info-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    margin-bottom: 0;
    padding: 5px 0;
  }
  .info-section-header:hover .info-section-title { color: #a07cff; }
  .info-section-chevron {
    font-size: 9px;
    color: #333355;
    transition: transform 0.25s;
    flex-shrink: 0;
  }
  .info-section-block.open .info-section-chevron { transform: rotate(180deg); color: #a07cff; }
  .info-section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.22,1,0.36,1);
  }
  .info-section-block.open .info-section-content { max-height: 900px; }
  .info-section-block { margin-bottom: 4px; }
  /* Selection indicator */
  .sel { background: #c2d9ff; border-radius: 2px; }

  /* ── App window overlay ── */
  .overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 100;
  }

  .app-window {
    width: 860px;
    height: 620px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow:
      0 0 0 0.5px rgba(0,0,0,0.22),
      0 4px 12px rgba(0,0,0,0.12),
      0 16px 48px rgba(0,0,0,0.22),
      0 40px 100px rgba(0,0,0,0.18);
    opacity: 0;
    transform: scale(0.94) translateY(24px);
    transition: opacity 0.55s cubic-bezier(0.22,1,0.36,1),
                transform 0.55s cubic-bezier(0.22,1,0.36,1);
    font-family: -apple-system, 'Helvetica Neue', sans-serif;
  }

  .app-window.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
  }

  /* App title bar */
  .app-titlebar {
    height: 40px;
    background: linear-gradient(180deg, #3a3a3c 0%, #2c2c2e 100%);
    border-bottom: 1px solid #1a1a1a;
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
    user-select: none;
  }

  .app-titlebar-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    font-weight: 500;
    color: #e0e0e0;
    letter-spacing: 0.01em;
    white-space: nowrap;
  }

  /* App body: sidebar + main */
  .app-body {
    flex: 1;
    display: flex;
    background: #1e1e2e;
    overflow: hidden;
  }

  /* Sidebar */
  .app-sidebar {
    width: 200px;
    background: #17172a;
    border-right: 1px solid #2a2a3e;
    display: flex;
    flex-direction: column;
    padding: 12px 0;
    flex-shrink: 0;
  }

  .sidebar-section {
    padding: 6px 16px 2px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #555577;
    text-transform: uppercase;
  }

  .sidebar-item {
    padding: 7px 16px;
    font-size: 12.5px;
    color: #9090b0;
    cursor: default;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 0;
  }

  .sidebar-item.active {
    background: #2a2a45;
    color: #c8b8ff;
  }

  .sidebar-item .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #555577;
    flex-shrink: 0;
  }
  .sidebar-item.active .dot { background: #a07cff; }

  /* Main content */
  .app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* Toolbar */
  .app-toolbar {
    height: 40px;
    background: #1a1a2e;
    border-bottom: 1px solid #2a2a3e;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 10px;
    flex-shrink: 0;
  }

  .tool-btn {
    height: 26px;
    padding: 0 12px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 500;
    color: #9090b0;
    background: #24243a;
    border: 1px solid #33334a;
    cursor: default;
    display: flex;
    align-items: center;
    gap: 5px;
  }

  .tool-btn.primary {
    background: #5a3fcf;
    border-color: #7055e0;
    color: #fff;
  }

  .tool-sep { flex: 1; }

  .tool-status {
    font-size: 11px;
    color: #50d890;
    display: flex;
    align-items: center;
    gap: 5px;
  }

  .tool-status::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #50d890;
    display: inline-block;
  }

  /* Canvas area */
  .app-canvas {
    flex: 1;
    background: #13131f;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
  }

  /* Chip grid graphic */
  .chip-graphic {
    position: relative;
    width: 320px;
    height: 260px;
  }

  .chip-body {
    position: absolute;
    inset: 40px;
    background: linear-gradient(135deg, #252538, #1a1a2e);
    border: 1.5px solid #5a3fcf;
    border-radius: 8px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 4px;
    padding: 12px;
  }

  .chip-cell {
    border-radius: 3px;
    background: #2a2a45;
  }

  .chip-cell.active { background: #5a3fcf; opacity: 0.85; }
  .chip-cell.hot    { background: #a07cff; opacity: 0.9; }
  .chip-cell.dim    { background: #1e1e30; }

  /* Pin rows */
  .chip-pins-top, .chip-pins-bottom {
    position: absolute;
    left: 60px; right: 60px;
    display: flex;
    justify-content: space-around;
  }
  .chip-pins-top    { top: 28px; }
  .chip-pins-bottom { bottom: 28px; }

  .chip-pins-left, .chip-pins-right {
    position: absolute;
    top: 60px; bottom: 60px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
  }
  .chip-pins-left  { left: 28px; }
  .chip-pins-right { right: 28px; }

  .pin {
    width: 10px; height: 5px;
    background: #888;
    border-radius: 1px;
  }
  .chip-pins-left .pin,
  .chip-pins-right .pin {
    width: 5px; height: 10px;
  }

  /* Heatmap legend */
  .heatmap-legend {
    position: absolute;
    bottom: 18px;
    right: 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
  }

  .legend-label {
    font-size: 10px;
    color: #555577;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
  }

  .legend-bar {
    width: 80px;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, #1e1e30, #5a3fcf, #a07cff, #e06060);
  }

  .legend-ticks {
    width: 80px;
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: #555577;
  }

  /* Bottom status bar */
  .app-statusbar {
    height: 24px;
    background: #13131f;
    border-top: 1px solid #1e1e2e;
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 20px;
    font-size: 11px;
    color: #555577;
    flex-shrink: 0;
  }

  .status-item { display: flex; align-items: center; gap: 4px; }
  .status-item.ok { color: #50d890; }

  /* ── Language popup & switcher ── */
  .lang-overlay {
    display: none; position: fixed; inset: 0; z-index: 10000;
    background: rgba(10,8,22,0.72); backdrop-filter: blur(4px);
    align-items: center; justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  }
  .lang-overlay.visible { display: flex; }
  .lang-popup {
    background: #1e1a35; border: 1px solid #5a3fcf; border-radius: 14px;
    padding: 32px 36px; text-align: center; max-width: 460px; width: 90%;
    box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  }
  .lang-popup h2 { color: #e8e4ff; font-size: 1.25rem; margin-bottom: 10px; }
  .lang-popup p { color: #9a94c0; font-size: 0.85rem; line-height: 1.6; margin-bottom: 24px; }
  .lang-popup-buttons { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
  .lang-popup-buttons button {
    background: transparent; border: 1px solid #5a3fcf; color: #c792ea;
    padding: 10px 16px; border-radius: 8px; font-size: 0.85rem; cursor: pointer;
    transition: background 0.2s, color 0.2s;
  }
  .lang-popup-buttons button:hover { background: #5a3fcf; color: #fff; }
  .lang-sw { display: inline-flex; border: 1px solid #4a4a66; border-radius: 6px; overflow: hidden; }
  .lang-sw button {
    background: transparent; border: none; border-right: 1px solid #4a4a66;
    color: #9a9ab8; font-size: 10.5px; font-weight: 600; padding: 3px 7px; cursor: pointer;
    font-family: inherit;
  }
  .lang-sw button:last-child { border-right: none; }
  .lang-sw button:hover { color: #fff; }
  .lang-sw button.active { background: #5a3fcf; color: #fff; }
  .back-home {
    position: fixed; top: 8px; left: 16px; z-index: 900;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 12px; font-weight: 600; color: #c792ea; text-decoration: none;
    background: #1e1a35; border: 1px solid #5a3fcf; border-radius: 999px; padding: 5px 12px;
    transition: background 0.2s, color 0.2s;
  }
  .back-home:hover { background: #5a3fcf; color: #fff; }
  .lang-sw-app { position: absolute; right: 62px; top: 50%; transform: translateY(-50%); }
  .lang-sw.lang-sw-info { display: flex; width: max-content; margin: 4px 0 14px; }

  /* ── Small-screen notice ── */
  .small-screen {
    display: none; position: fixed; inset: 0; z-index: 9999;
    background: rgba(10,8,22,0.82); backdrop-filter: blur(4px);
    align-items: center; justify-content: center; padding: 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  }
  .small-screen.visible { display: flex; }
  .small-screen-card {
    background: #1e1a35; border: 1px solid #5a3fcf; border-radius: 14px;
    padding: 28px 24px; text-align: center; max-width: 380px; width: 100%;
    box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  }
  .small-screen-icon { font-size: 34px; color: #c792ea; margin-bottom: 10px; }
  .small-screen-card h2 { color: #e8e4ff; font-size: 1.2rem; margin-bottom: 10px; }
  .small-screen-card p { color: #9a94c0; font-size: 0.9rem; line-height: 1.55; margin-bottom: 22px; }
  .small-screen-card button {
    display: block; width: 100%; background: #5a3fcf; color: #fff; border: none; border-radius: 8px;
    padding: 12px; font-size: 0.95rem; font-weight: 600; cursor: pointer; margin-bottom: 14px;
  }
  .small-screen-card a { color: #c792ea; font-size: 0.85rem; text-decoration: none; }
