/* ============================================================================================================================================================
   MCU-LAB.CSS - Simulatore di microcontrollore (26/11/2026). Barra, finestre e menu: stile del simulatore di circuiti (circuiti-lab.css, classi cl*).
   Tema scuro (predefinito) e chiaro: data-tema="chiaro" sul contenitore. File UTF-8.
   ============================================================================================================================================================ */
.mcu { --mc-bg: transparent; --mc-card: #14181f; --mc-pn: #14181f; --mc-pn2: #1b212b; --mc-bd: rgba(255,255,255,.14); --mc-tx: #e8edf4; --mc-mu: #9fb0c4; --mc-ac: #4f8dfd; --mc-ok: #4ade80; --mc-warn: #fbbf24; --mc-bad: #f87171;
  --mc-chip: #0f1318; --mc-pcb: #0e131a; --mc-wire: #5b6b80; --mc-led: #ff3b30; --mc-code: #0e1218; --mc-pin: #f5c542; --mc-stub: #7b8798;
  --tk-c: #6b7a90; --tk-s: #fbbf24; --tk-m: #f472b6; --tk-n: #fbbf24; --tk-k: #c084fc; --tk-t: #60a5fa; --tk-q: #4ade80; --tk-f: #67e8f9;
  --mu-h: 640px; text-align: left; }
.mcu[data-tema="chiaro"] { --mc-card: #ffffff; --mc-pn: #ffffff; --mc-pn2: #eef1f6; --mc-bd: #d3dbe6; --mc-tx: #1f2937; --mc-mu: #64748b; --mc-ac: #2563eb; --mc-ok: #15803d; --mc-warn: #b45309; --mc-bad: #b91c1c;
  --mc-chip: #2b3340; --mc-pcb: #fbfcfe; --mc-wire: #8b97a8; --mc-led: #e11d12; --mc-code: #fbfcfe; --mc-pin: #c2410c; --mc-stub: #6b7787;
  --tk-c: #6b7a90; --tk-s: #b45309; --tk-m: #be185d; --tk-n: #b45309; --tk-k: #7e22ce; --tk-t: #1d4ed8; --tk-q: #15803d; --tk-f: #0e7490; }
.mcu *, .mcu *::before, .mcu *::after { box-sizing: border-box; }
.mcu input[type=text], .mcu select { color: inherit; }
.mcu input:focus-visible, .mcu select:focus-visible, .mcTa:focus-visible, .muSplit:focus-visible { outline: 2px solid var(--mc-ac); outline-offset: 1px; }
.mcu .clBar .clBtn[disabled] { opacity: .4; cursor: default; }

/* disposizione: codice a sinistra, scheda a destra, divisore trascinabile (predefinito 50 / 50) */
.muMain { display: flex; align-items: stretch; width: 100%; height: var(--mu-h); min-height: 420px; --mu-split: 50%; }
.muLeft { flex: 0 0 calc(var(--mu-split) - 5px); min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.muRight { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; overflow: auto; }
.muSplit { flex: 0 0 10px; margin: 0 0; cursor: col-resize; position: relative; touch-action: none; border-radius: 6px; }
.muSplit::after { content: ""; position: absolute; left: 4px; top: 0; bottom: 0; width: 2px; background: var(--mc-bd); border-radius: 2px; transition: background .15s; }
.muSplit::before { content: ""; position: absolute; left: 1px; top: calc(50% - 18px); width: 8px; height: 36px; border-radius: 4px; background: var(--mc-pn2); border: 1px solid var(--mc-bd); z-index: 1; }
.muSplit:hover::after, .muDragging .muSplit::after, .muSplit:focus-visible::after { background: var(--mc-ac); }
.muDragging, .muDragging * { cursor: col-resize !important; user-select: none !important; }
.muCard { background: var(--mc-card); border: 1px solid var(--mc-bd); border-radius: 12px; overflow: hidden; min-width: 0; }
.muCode { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.muCon { flex: 0 0 auto; display: flex; flex-direction: column; padding: 8px 8px 8px; }
.muCardH { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-bottom: 1px solid var(--mc-bd); font-size: .8rem; color: var(--mc-mu); }
.muFile { font: 600 .82rem ui-monospace, Consolas, monospace; padding: 3px 10px; border-radius: 8px; color: var(--mc-ac); background: rgba(79,141,253,.14); border: 1px solid rgba(79,141,253,.4); }
.muStatus { padding: 4px 10px; border-top: 1px solid var(--mc-bd); font-size: .78rem; color: var(--mc-mu); min-height: 26px; }
.muBoard { position: relative; flex: 1 1 auto; min-height: 220px; background: var(--mc-pcb); padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.muBoardIn { flex: 1 1 auto; min-width: 0; min-height: 0; position: relative; overflow: hidden; }
.muAn { flex: 0 0 auto; padding: 8px 10px; }
.mcNoCode .muLeft, .mcNoCode .muSplit { display: none; }
.mcNoCon .muCon { display: none; }
.mcNoPanel .muAn { display: none; }
@media (max-width: 760px) {
  .muMain { flex-direction: column; height: auto; min-height: 0; gap: 8px; }
  .muLeft { flex: none; } .muRight { flex: none; overflow: visible; } .muSplit { display: none; }
  .mcEd { height: 300px; } .muBoard { min-height: 260px; }
}
.cl.xFs .muMain { height: calc(100vh - 70px); }
.cl.xFs .muMain { min-height: 0; }

/* editor */
.mcEd { display: flex; height: 380px; background: var(--mc-code); border: 1px solid var(--mc-bd); border-radius: 10px; overflow: hidden; font: 13px/20px ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }
.mcGut { flex: none; width: 42px; overflow: hidden; background: var(--mc-pn2); color: var(--mc-mu); text-align: right; user-select: none; padding-top: 8px; }
.mcGut div { padding-right: 8px; height: 20px; }
.mcGut .mcErr { background: rgba(248,113,113,.28); color: var(--mc-bad); font-weight: 700; } .mcGut .mcCur { background: rgba(79,141,253,.25); color: var(--mc-ac); font-weight: 700; }
.mcCw { position: relative; flex: 1 1 auto; min-width: 0; overflow: hidden; }
.mcPre, .mcTa, .mcHlL { position: absolute; left: 0; top: 0; margin: 0; padding: 8px 10px; font: inherit; tab-size: 2; white-space: pre; border: 0; }
.mcPre { right: 0; pointer-events: none; color: var(--mc-tx); } .mcPre code { font: inherit; }
.mcHlL { right: 0; padding: 8px 0 0; pointer-events: none; width: 100%; }
.mcHlL div { position: absolute; left: 0; right: 0; height: 20px; }
.mcHlL .mcLnErr { background: rgba(248,113,113,.18); } .mcHlL .mcLnCur { background: rgba(79,141,253,.18); }
.mcTa { right: 0; bottom: 0; width: 100%; height: 100%; resize: none; overflow: auto; background: transparent; color: transparent; caret-color: var(--mc-tx); outline: none; -webkit-text-fill-color: transparent; }
.mcTa::selection { background: rgba(79,141,253,.35); -webkit-text-fill-color: transparent; }
.tk-c { color: var(--tk-c); font-style: italic; } .tk-s { color: var(--tk-s); } .tk-m { color: var(--tk-m); } .tk-n { color: var(--tk-n); } .tk-k { color: var(--tk-k); font-weight: 600; } .tk-t { color: var(--tk-t); } .tk-q { color: var(--tk-q); } .tk-f { color: var(--tk-f); }

/* console e sfide */
.mcTabs { display: flex; align-items: center; gap: 4px; }
.mcTabs button[data-tab] { border: 1px solid var(--mc-bd); border-bottom: 0; border-radius: 8px 8px 0 0; background: var(--mc-pn2); color: var(--mc-mu); padding: 6px 12px; cursor: pointer; font: inherit; }
.mcTabs button[data-tab].on { background: var(--mc-pn); color: var(--mc-tx); font-weight: 600; }
.mcClr { margin-left: auto; border: 0; background: none; color: var(--mc-mu); cursor: pointer; padding: 4px; }
.mcPane { height: 170px; overflow: auto; background: var(--mc-pn); border: 1px solid var(--mc-bd); border-radius: 0 10px 10px 10px; margin-top: -9px; padding: 8px 10px; font: 13px/1.5 ui-monospace, Consolas, monospace; }
.mcPane[hidden] { display: none; }
.mcSer { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; color: var(--mc-tx); }
.mcMsg { padding: 3px 8px; margin: 3px 0; border-radius: 6px; font: 13px/1.4 system-ui, sans-serif; }
.mc-err { background: rgba(248,113,113,.16); color: var(--mc-bad); border-left: 3px solid var(--mc-bad); } .mc-warn { background: rgba(251,191,36,.14); color: var(--mc-warn); border-left: 3px solid var(--mc-warn); }
.mcGo { cursor: pointer; }
.mcSerIn { display: flex; gap: 6px; } .mcSerI { flex: 1 1 auto; min-width: 0; }
.mcChL { list-style: none; margin: 0; padding: 0; font: 13px/1.4 system-ui, sans-serif; }
.mcCh { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--mc-bd); }
.mcCh p { margin: 2px 0 0; color: var(--mc-mu); }
.mcChI { flex: none; width: 22px; height: 22px; border: 2px solid var(--mc-bd); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.mcCh.ok .mcChI { background: var(--mc-ok); border-color: var(--mc-ok); }


/* area di lavoro: tavolozza, microcontrollore, componenti, fili */
/* pulsante + e finestra dei componenti */
.mcAddBtn { position: absolute; z-index: 5; left: 10px; top: 10px; display: flex; align-items: center; gap: 7px; padding: 5px 11px 5px 8px; border-radius: 10px; border: 1px solid var(--mc-ac); background: var(--mc-pn); color: var(--mc-ac); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.28); }
.mcAddBtn:hover, .mcAddBtn:focus-visible { background: var(--mc-ac); color: #fff; outline: none; }
.mcAddBtn svg { width: 34px; height: 26px; }
.mcAddZ { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.mcAddC { fill: currentColor; } .mcAddP { fill: none; stroke: var(--mc-pn); stroke-width: 2.2; stroke-linecap: round; }
.mcAddBtn:hover .mcAddP, .mcAddBtn:focus-visible .mcAddP { stroke: var(--mc-ac); }
/* 27/11/2026: finestra piu' larga, testi piu' piccoli, tutte le versioni dei componenti */
.clModalBox:has(.mcPalG) { width: min(1240px, 96vw); max-width: 96vw; }
.mcPalB { max-height: 82vh; overflow: auto; }
.mcPalG { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }
.mcPalI { border: 1px solid var(--mc-bd); background: var(--mc-pn2); border-radius: 10px; padding: 5px 3px 6px; cursor: pointer; color: var(--mc-tx); font: inherit; font-size: 11px; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.mcPalI:hover, .mcPalI:focus-visible { border-color: var(--mc-ac); background: var(--mc-pn); outline: none; box-shadow: 0 0 0 2px var(--mc-ac) inset; }
.mcPalS { width: 84px; height: 56px; pointer-events: none; }
.mcPalI span { text-align: center; line-height: 1.2; }
.mcSvg { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; touch-action: none; outline: none; }
.mcSvg:focus-visible { outline: 2px solid var(--mc-ac); outline-offset: -2px; }
.mcSvg text { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
.mcBg { cursor: default; } .mcGridDot { fill: var(--mc-mu); opacity: .38; }
.mcChip { fill: var(--mc-chip); stroke: #6b7a90; stroke-width: 2; } .mcChipNotch { fill: none; stroke: #6b7a90; stroke-width: 2; }
.mcChipT { fill: #e8edf4; font-size: 26px; font-weight: 700; letter-spacing: .08em; text-anchor: middle; } .mcChipS { fill: #9fb0c4; font-size: 11px; text-anchor: middle; }
.mcu[data-tema="chiaro"] .mcChipT { fill: #fff; } .mcu[data-tema="chiaro"] .mcChipS { fill: #cbd5e1; }
.mcStub { fill: none; stroke: var(--mc-stub); stroke-width: 2.5; stroke-linecap: round; }
.mcPinN { fill: #e8edf4; font-size: 11px; font-weight: 600; } .mcPinG { fill: #aab6c6; font-size: 11px; font-weight: 600; } .mcVcc { fill: #ff8a80; font-size: 11px; font-weight: 700; }
.mcu[data-tema="chiaro"] .mcPinN { fill: #fff; } .mcu[data-tema="chiaro"] .mcPinG { fill: #cbd5e1; } .mcu[data-tema="chiaro"] .mcVcc { fill: #fecaca; }
.mcPDot { fill: #4b5563; } .mcPDot.mid { fill: var(--mc-warn); } .mcPDot.on { fill: var(--mc-ok); }
.mcTermG { cursor: crosshair; } .mcTermHit { fill: transparent; }
.mcTerm { fill: var(--mc-pn); stroke: var(--mc-mu); stroke-width: 1.6; transition: r .08s; } .mcTermM { fill: #1b212b; stroke: var(--mc-pin); }
.mcTermG.on .mcTerm { fill: var(--mc-ac); stroke: var(--mc-ac); }
.mcTermG:hover .mcTerm { fill: var(--mc-warn); stroke: var(--mc-warn); r: 5.6; }
.mcComp { cursor: pointer; outline: none; }
.mcHit { fill: transparent; }
.mcComp .mcHi { fill: var(--mc-ac); fill-opacity: .13; stroke: var(--mc-ac); stroke-width: 1.6; opacity: 0; pointer-events: none; transition: opacity .1s; }
.mcComp:hover .mcHi { opacity: 1; } .mcComp.sel .mcHi { opacity: 1; stroke-dasharray: 5 3; fill-opacity: .08; }
.mcWireHit { stroke: transparent; stroke-width: 12; fill: none; cursor: pointer; }
.mcWire { stroke: var(--mc-wire); stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; fill: none; pointer-events: none; transition: stroke-width .08s; }
.mcWireG:hover .mcWire { stroke-width: 5; filter: brightness(1.2); }
.mcWirePrev { stroke: var(--mc-ac); stroke-dasharray: 5 4; pointer-events: none; }
.mcCL { fill: var(--mc-mu); font-size: 10.5px; font-weight: 600; pointer-events: none; }
.mcSl { cursor: ew-resize; } .mcSlT { stroke: var(--mc-bd); stroke-width: 4; stroke-linecap: round; } .mcSlK { fill: var(--mc-ac); stroke: var(--mc-card); stroke-width: 1.5; }
.mcSl:hover .mcSlK { r: 7; } .mcSlV { fill: var(--mc-tx); font-size: 10px; font-weight: 700; pointer-events: none; font-variant-numeric: tabular-nums; }
.mcTip { position: absolute; z-index: 6; pointer-events: none; background: var(--mc-pn2); border: 1px solid var(--mc-bd); color: var(--mc-tx); padding: 3px 9px; border-radius: 7px; font: 600 12px system-ui, sans-serif; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.3); font-variant-numeric: tabular-nums; }
/* componenti */
.ptLeg { stroke: var(--mc-wire); stroke-width: 2.6; stroke-linecap: round; }
.ptSym { stroke: var(--mc-tx); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; } .ptSym.ptFill { fill: var(--mc-tx); } .ptThin { stroke-width: 1.4; } .ptThick { stroke-width: 3.4; } .ptAr { stroke: var(--mc-warn); }
.ptTx { fill: var(--mc-tx); font-size: 11px; } .ptTxS { fill: var(--mc-mu); font-size: 9.5px; font-weight: 700; } .ptTxXS { fill: #cbd5e1; font-size: 6.5px; font-weight: 700; } .ptTxW { fill: #fff; font-size: 9.5px; font-weight: 700; }
.ptResB { fill: #dcc29a; stroke: #8a6a3f; stroke-width: 1.2; } .ptLensB { fill: none; stroke-width: 1.8; } .ptBurn { stroke: var(--mc-warn); stroke-width: 2.4; fill: none; stroke-linecap: round; }
.ptPotB { fill: #3b6fb5; fill-opacity: .55; stroke: #3b6fb5; stroke-width: 1.5; } .ptBtnB { fill: var(--mc-pn2); stroke: var(--mc-tx); stroke-width: 1.6; }
.ptCap { fill: #d94a3f; stroke: #7f1d1d; stroke-width: 1.6; cursor: pointer; } .ptCap.on { fill: #a3281f; } .ptDot { fill: var(--mc-tx); }
.ptLdrB { fill: var(--mc-pn2); stroke: var(--mc-tx); stroke-width: 1.8; } .ptNtcB { fill: var(--mc-pn2); stroke: var(--mc-tx); stroke-width: 1.8; }
.ptTo92 { fill: #2a2f38; stroke: var(--mc-mu); stroke-width: 1.6; }
.ptBuzB { fill: #262a31; stroke: var(--mc-mu); stroke-width: 2; } .ptBuzC { fill: #0f1216; stroke: var(--mc-mu); } .ptArc { stroke: var(--mc-warn); stroke-width: 2.6; opacity: 0; }
/*MOT*/
.ptSrvB { fill: #2b6cb0; stroke: #1e4e85; stroke-width: 1.5; } .ptSrvH { fill: #e5e7eb; stroke: #9ca3af; } .ptHorn { fill: #f3f4f6; stroke: #6b7280; }
.ptUsrB { fill: #1e6fd9; stroke: #14509e; stroke-width: 1.5; } .ptUsrC { fill: #cfd5dd; stroke: #7a8594; stroke-width: 1.5; } .ptUsrM { fill: #2a2f38; }
.ptQc { fill: none; stroke: var(--mc-tx); stroke-width: 1.8; }
.ptSegB { fill: #1a1d22; stroke: var(--mc-mu); stroke-width: 1.5; } .ptSegOff { fill: #34383f; } .ptSegOffC { fill: #34383f; }
.mcNotes [data-note] { cursor: move; }
/* finestre dei componenti e dei fili */
.mcCm { min-width: min(380px, 86vw); }
.mcRow2 { display: grid; grid-template-columns: minmax(96px, 36%) 1fr; gap: 10px; align-items: center; margin: 9px 0; font-size: .9rem; color: var(--mc-mu); }
.mcRow2 > span:first-child { color: var(--mc-tx); } .mcRow2 select, .mcRow2 input[type=number] { width: 100%; min-width: 0; height: 34px; padding: 0 8px; border: 1px solid var(--mc-bd); border-radius: 8px; background: var(--mc-pn2); font: inherit; }
.mcNum { display: flex; gap: 6px; } .mcNum input { flex: 1 1 auto; } .mcNum .mcUn { flex: 0 0 74px; }
.mcRng { display: flex; align-items: center; gap: 10px; } .mcRng input[type=range] { flex: 1 1 auto; min-width: 0; accent-color: var(--mc-ac); }
.mcRv { min-width: 62px; text-align: right; font-weight: 700; color: var(--mc-tx); font-variant-numeric: tabular-nums; }
.mcLive { margin-top: 10px; padding: 7px 10px; border-radius: 8px; background: var(--mc-pn2); border: 1px solid var(--mc-bd); font-size: .86rem; color: var(--mc-tx); font-variant-numeric: tabular-nums; min-height: 2em; }
.mcSwat { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 10px; }
.mcSw { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--mc-bd); cursor: pointer; padding: 0; color: var(--mc-tx); font: inherit; }
.mcSw:not([style]) { width: auto; border-radius: 15px; padding: 0 12px; background: var(--mc-pn2); }
.mcSw.on { outline: 2px solid var(--mc-ac); outline-offset: 2px; }
/* console: nascondi / mostra */
.mcHideC svg, .muConBar svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muConBar { display: none; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--mc-bd); background: var(--mc-pn); color: var(--mc-tx); border-radius: 10px; cursor: pointer; font: inherit; text-align: left; }
.muConBar:hover { border-color: var(--mc-ac); }
.mcNoCon .muConBar { display: flex; }


/* analizzatore */
.mcAnH { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--mc-mu); font-size: .85rem; }
.mcAn { width: 100%; height: 150px; display: block; margin-top: 6px; }

/* finestre dentro la scheda */
.mcu .clModalB .clNm { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--cl-line); border-radius: 8px; background: var(--cl-field); font: inherit; }
@media (prefers-reduced-motion: reduce) { .mcu * { transition: none !important; animation: none !important; } }
.mcAnn { fill: var(--mc-warn); font-size: 13px; font-weight: 600; cursor: move; paint-order: stroke; stroke: var(--mc-pcb); stroke-width: 3px; }
.mcu .mcAnW { width: auto; min-width: 74px; height: 30px; padding: 0 8px; border: 1px solid var(--mc-bd); border-radius: 8px; background: var(--mc-pn2); font: inherit; font-size: .82rem; }
.mcu .mcSerI { flex: 1 1 auto; min-width: 0; height: 34px; padding: 0 10px; border: 1px solid var(--mc-bd); border-radius: 8px; background: var(--mc-pn2); font: inherit; }
.mcu .mcSerIn { margin-top: 8px; }
.muCode .mcEd { flex: 1 1 auto; height: auto; min-height: 140px; border: 0; border-radius: 0; }
.muCode .mcCw { height: 100%; }
@media (max-width: 760px) { .muCode .mcEd { flex: none; height: 300px; } }
.ptLvHit { stroke: transparent; stroke-width: 18; fill: none; stroke-linecap: round; cursor: pointer; }

.ptMotB { fill: #8a94a3; stroke: var(--mc-tx); stroke-width: 2.2; } .ptMotRing { fill: #c5ccd6; stroke: #6b7686; stroke-width: 1.2; } .ptMotScr { fill: #6b7686; }
.ptMotBlur { fill: var(--mc-warn); } .ptBlade { fill: #ffd166; stroke: #8a5a00; stroke-width: 1; stroke-linejoin: round; } .ptMotHub { fill: #3a4452; stroke: #1c222b; stroke-width: 1; }
.ptMotArr { fill: none; stroke: var(--mc-ok); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.mcWiring .mcSvg { cursor: crosshair; } .mcWiring .mcTerm { r: 5; stroke-width: 1.4; } .mcWiring .mcTermG:hover .mcTerm { fill: var(--mc-ac); r: 6.5; }

/* circuito avviato: tutto ancorato (niente spostamenti, fili, nuovi componenti) */
.mcLocked .mcComp, .mcLocked .mcTermG, .mcLocked .mcNotes [data-note], .mcLocked .mcAnn { cursor: default; }
.mcLocked .mcComp .ptLvHit, .mcLocked .mcComp .ptCap, .mcLocked .mcComp .mcSl { cursor: pointer; }
.mcLocked .mcComp .mcSl { cursor: ew-resize; }
.mcLocked .mcTermG:hover .mcTerm { r: 3.6; fill: inherit; }
.mcAddBtn.lk { opacity: .45; cursor: not-allowed; filter: grayscale(.6); }
.mcAddBtn.lk:hover { background: transparent; color: inherit; }

/* ---- nuovi componenti: display LCD, RTC, DHT, LED RGB, PIR, rele', 74HC595, tastierino, batteria ---- */
.mcChipX { fill: #7dd3fc; font-size: 8.5px; font-weight: 700; }
.mcSerLed { fill: #3a2f12; stroke: #6b5a2a; stroke-width: 1; } .mcSerLed.on { fill: #fbbf24; stroke: #fde68a; }
.ptTxXSW { fill: #e5e7eb; font-size: 6.5px; font-weight: 700; } .ptTxXXS { fill: #374151; font-size: 5px; font-weight: 700; text-anchor: middle; } .ptTxXXSW { fill: #cbd5e1; font-size: 5.5px; font-weight: 700; text-anchor: middle; }
.ptLcdPcb { fill: #1f6b3a; stroke: #0f3f21; stroke-width: 1.5; } .ptLcdBz { fill: #15171b; stroke: #0b0c0f; }
.ptI2cB { fill: #1e3a8a; stroke: #172554; stroke-width: 1; }
.ptLcdScrG { fill: #a6c94c; } .ptLcdScrB { fill: #2f5fe0; }
.ptLcdCellG { fill: #97ba40; opacity: .55; } .ptLcdCellB { fill: #3a6cf0; opacity: .6; }
.ptLcdChG { fill: #1d2a0a; font: 700 13px ui-monospace, "Cascadia Mono", Consolas, monospace; } .ptLcdChB { fill: #f1f5ff; font: 700 13px ui-monospace, "Cascadia Mono", Consolas, monospace; }
.ptLcdPxG { fill: #1d2a0a; } .ptLcdPxB { fill: #f1f5ff; }
.ptRtcB { fill: #1d4ed8; stroke: #1e3a8a; stroke-width: 1.5; } .ptChip { fill: #111827; stroke: #374151; } .ptCoin { fill: #d1d5db; stroke: #6b7280; stroke-width: 1.2; }
.ptDhtB { fill: #3b82f6; stroke: #1d4ed8; stroke-width: 1.3; } .ptDhtW { fill: #f3f4f6; stroke: #9ca3af; stroke-width: 1.3; } .ptDhtH { fill: #0b1220; opacity: .55; }
.ptPirB { fill: #166534; stroke: #14532d; stroke-width: 1.3; } .ptPirD { fill: #f8fafc; stroke: #cbd5e1; stroke-width: 1.2; } .ptPirL { stroke: #cbd5e1; stroke-width: .8; fill: none; }
.ptPirHit { cursor: pointer; } .ptPirLed { fill: #3f1d1d; } .ptPirLed.on { fill: #ef4444; }
.ptRlyPcb { fill: #1e40af; stroke: #172554; stroke-width: 1.5; } .ptRlyBox { fill: #2563eb; stroke: #93c5fd; stroke-width: 1; } .ptRlyLed { fill: #3f1d1d; } .ptRlyLed.on { fill: #ef4444; }
.ptIc { fill: #1f2328; stroke: #4b5563; stroke-width: 1.3; } .ptIcN { fill: none; stroke: #4b5563; } .ptSrDot { fill: #374151; } .ptSrDot.on { fill: #22c55e; }
.ptKpB { fill: #1f2937; stroke: #4b5563; stroke-width: 1.5; } .ptKey { cursor: pointer; }
.ptKeyB { fill: #e5e7eb; stroke: #9ca3af; } .ptKeyB.ptKeyL { fill: #fecaca; } .ptKeyB.on { fill: #60a5fa; stroke: #1d4ed8; } .ptKeyT { fill: #111827; font-size: 11px; font-weight: 700; text-anchor: middle; pointer-events: none; }
.ptBatB { fill: #374151; stroke: #9ca3af; stroke-width: 1.3; }

/* ---- microcontrollore realistico (contenitore DIP, nomi e funzioni dei piedini scritti dentro) ---- */
.mcChip { fill: url(#mcEpoxy); stroke: #0b0c0e; stroke-width: 1; }
.mcChipSh { fill: #000; opacity: .45; } .mcChipHl { fill: none; stroke: #fff; stroke-opacity: .06; }
.mcChipNotch { fill: #0d0e11; stroke: #2c3038; stroke-width: 1; } .mcChipDot { fill: #14161a; stroke: #2a2e35; }
.mcChipT, .mcu[data-tema="chiaro"] .mcChipT { fill: #8b919b; font: 700 14px ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .1em; text-anchor: middle; }
.mcChipT.mcChipTs { font-size: 10px; }
.mcChipS, .mcu[data-tema="chiaro"] .mcChipS { fill: #5d636d; font: 9px ui-monospace, Consolas, monospace; text-anchor: middle; }
.mcLeg { fill: url(#mcTin); }
.mcPinN, .mcu[data-tema="chiaro"] .mcPinN { fill: #e5e7eb; font-size: 12px; font-weight: 700; }
.mcPinG, .mcu[data-tema="chiaro"] .mcPinG { fill: #9ca3af; font-size: 12px; font-weight: 700; }
.mcVcc, .mcu[data-tema="chiaro"] .mcVcc { fill: #fca5a5; font-size: 12px; font-weight: 700; }
.mcPinS { fill: #fcd34d; font-size: 11px; font-weight: 700; }
.mcTag { opacity: .92; } .mcTgP { fill: #f97316; } .mcTgC { fill: #a855f7; } .mcTgA { fill: #22c55e; } .mcTgI { fill: #eab308; }
.mcTagT { fill: #fff; font-size: 8px; font-weight: 700; text-anchor: middle; pointer-events: none; }
.mcChipPick { position: absolute; z-index: 5; left: 146px; top: 10px; display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 10px; border: 1px solid var(--mc-bd); background: var(--mc-pn); font-size: 12px; font-weight: 600; color: var(--mc-mu); }
.mcChipPick select { font: inherit; font-weight: 700; color: var(--mc-tx); background: transparent; border: 0; cursor: pointer; padding: 2px; }
.mcChipPick select:disabled { opacity: .55; cursor: not-allowed; }
.mcChipPick select option { color: #111; }
.mcChipPick > span { display: none; } .mcChipPick { padding: 3px 4px 3px 8px; }

/* intervallo dei sensori e tasti - / + (visibili con il componente selezionato) */
.mcSlR { fill: var(--mc-mu); font-size: 8px; font-weight: 600; pointer-events: none; font-variant-numeric: tabular-nums; }
.mcStb { display: none; cursor: pointer; } .mcComp.sel .mcStb { display: block; }
.mcStbC { fill: var(--mc-card); stroke: var(--mc-bd); stroke-width: 1.4; } .mcStbP { stroke: var(--mc-tx); stroke-width: 1.8; stroke-linecap: round; fill: none; pointer-events: none; }
.mcStb:hover .mcStbC { stroke: var(--mc-ac); } .mcStb:active .mcStbC { fill: var(--mc-ac); }
.mcKbB { fill: var(--mc-pn2); stroke: var(--mc-bd); stroke-width: 1; } .mcKbT { fill: var(--mc-tx); font-size: 8.5px; font-weight: 700; pointer-events: none; }
.mcKeyIn { cursor: pointer; text-align: center; font-weight: 700; min-width: 110px; } .mcKeyIn:focus { outline: 2px solid var(--mc-ac); }
.mcKeyClr { margin-left: 6px; }

/* alimentazione e corto circuito */
.mcPwr { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 6; max-width: min(92%, 560px); padding: 6px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 700; line-height: 1.35; text-align: center; pointer-events: none; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.mcPwr.warn { background: #3a2c06; color: #fbbf24; border: 1px solid #b7791f; } .mcPwr.bad { background: #3b0d12; color: #fca5a5; border: 1px solid #dc2626; animation: mcPwrPulse 1s ease-in-out infinite; }
.mcu[data-tema="chiaro"] .mcPwr.warn { background: #fff4d6; color: #8a5a00; border-color: #e0a400; } .mcu[data-tema="chiaro"] .mcPwr.bad { background: #fee2e2; color: #991b1b; border-color: #dc2626; }
@keyframes mcPwrPulse { 50% { box-shadow: 0 0 0 4px rgba(220,38,38,.28); } }
.mcNoPwr .mcChip { opacity: .72; } .mcNoPwr .mcChipHl { opacity: .5; }
.mcWireShort .mcWire { stroke: #ef4444 !important; stroke-width: 3.4; animation: mcShortFl .6s linear infinite; filter: drop-shadow(0 0 4px #ef4444); }
@keyframes mcShortFl { 50% { stroke-opacity: .35; } }
.mcShortC { filter: drop-shadow(0 0 5px #ef4444); }
@media (max-width: 700px) { .mcPwr { font-size: 11.5px; padding: 5px 10px; bottom: 44px; } }

/* 26/11/2026: console senza schede; Aggiungi e scelta del chip con lo stesso stile (bordo grigio) */
.mcTabs { justify-content: flex-end; margin-bottom: 4px; }
.mcPane { margin-top: 0; border-radius: 10px; }
.mcClr { margin-left: 0; }
.mcu .mcAddBtn, .mcu .mcChipPick { position: absolute; top: 10px; box-sizing: border-box; height: 34px; display: flex; align-items: center; border-radius: 10px; border: 1px solid var(--mc-bd); background: var(--mc-pn); color: var(--mc-tx); font: inherit; font-size: 12.5px; font-weight: 700; box-shadow: none; }
.mcu .mcAddBtn { left: 10px; gap: 7px; padding: 0 12px 0 8px; cursor: pointer; }
.mcu .mcAddBtn:hover, .mcu .mcAddBtn:focus-visible { background: var(--mc-pn2); color: var(--mc-tx); border-color: var(--mc-mu); outline: none; }
.mcu .mcAddBtn:hover .mcAddP, .mcu .mcAddBtn:focus-visible .mcAddP { stroke: var(--mc-pn2); }
.mcu .mcChipPick { left: 146px; padding: 0 6px 0 10px; }
.mcu .mcChipPick select { font: inherit; font-size: 12.5px; font-weight: 700; color: var(--mc-tx); height: 30px; padding: 0 4px; }
/* elimina esempio (solo sviluppatori) */
.clMenuRow { display: flex; align-items: flex-start; gap: 2px; } .clMenuRow .clMenuI { flex: 1; min-width: 0; }
.clMenuDel { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 30px; min-width: 30px; margin-top: 6px; padding: 0 6px; border: 0; border-radius: 8px; background: transparent; color: var(--cl-mut, var(--mc-mu)); cursor: pointer; opacity: .55; justify-content: center; }
.clMenuDel svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.clMenuDel em { font-style: normal; font-size: .72rem; font-weight: 700; }
.clMenuRow:hover .clMenuDel, .clMenuDel:focus-visible { opacity: 1; }
.clMenuDel:hover { color: #ef4444; background: rgba(239,68,68,.12); }
.clMenuRow.armed .clMenuDel { opacity: 1; color: #fff; background: #dc2626; }
/* componenti realistici (26/11/2026) */
.ptOn { font-family: Arial, Helvetica, sans-serif; pointer-events: none; }
.ptJk { font: 800 6px Arial, Helvetica, sans-serif; pointer-events: none; }
.ptPrHit { cursor: pointer; }
.mcLocked .mcComp .ptPrHit { cursor: pointer; }
/* giunzioni tra fili, nome dei componenti */
.mcJn { fill: var(--mc-wire); stroke: var(--mc-card); stroke-width: 1; }
.mcComp:has(.mcJn) .mcHi { rx: 6; }
.mcJnHint { fill: #22c55e; stroke: #fff; stroke-width: 1.6; pointer-events: none; filter: drop-shadow(0 0 3px rgba(34,197,94,.9)); }
.mcCLn { font-weight: 800; }
.mcNameRow input { flex: 1 1 auto; min-width: 0; }
.mcT_jn .mcTerm { opacity: 0; } .mcT_jn .mcJn { r: 4.4; }
.mcT_jn:hover .mcJn, .mcT_jn .mcTermG:hover ~ .mcJn { fill: var(--mc-ac); }
/* circuito avviato: i componenti non si evidenziano ne' si selezionano; restano attivi solo i comandi */
.mcLocked .mcComp .mcHi { display: none; }
.mcLocked .mcComp { cursor: default; }
.mcLocked .mcComp .mcStb { display: block; }
.mcLocked .mcComp .ptPrHit, .mcLocked .mcComp .mcSl, .mcLocked .mcComp [data-ctl] { cursor: pointer; }
.mcLocked [data-ctl="joy"] { cursor: grab; } .mcLocked [data-ctl^="kn:"] { cursor: ns-resize; }   /* 27/11/2026: cursori dei comandi solo a programma avviato */

/* 27/11/2026: a programma fermo i comandi dei componenti non si azionano: il cursore resta quello dello spostamento */
.mcu:not(.mcLocked) .mcComp [data-ctl], .mcu:not(.mcLocked) .mcComp .mcSl, .mcu:not(.mcLocked) .mcComp .ptCap, .mcu:not(.mcLocked) .mcComp .ptLvHit, .mcu:not(.mcLocked) .mcComp .ptPrHit { cursor: pointer; }

/* 27/11/2026: pannello laterale a destra con i dettagli del componente o del filo (stesso aspetto di Meccatronica) */
.muDock { display: none; flex: 0 0 260px; width: 260px; min-width: 0; box-sizing: border-box; overflow: auto; padding: 12px; color: var(--mc-tx); font-size: .9rem; flex-direction: column; gap: 12px; }
.muMain.muDockOn > .muDock { display: flex; }
@media (max-width: 760px) { .muMain > .muDock { flex: none; width: auto; } }
.muPH { display: flex; align-items: center; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--mc-bd); }
.muPH > div { flex: 1 1 auto; min-width: 0; } .muPH b { display: block; line-height: 1.2; } .muPH small { display: block; color: var(--mc-mu); font-size: .78rem; margin-top: 2px; }
.muMini { width: 46px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--mc-pn2); border: 1px solid var(--mc-bd); }
.muMini svg { width: 44px; height: 30px; }
.muDockX { flex: none; width: 28px; height: 28px; border: 0; border-radius: 8px; background: none; color: var(--mc-mu); cursor: pointer; display: grid; place-items: center; padding: 0; }
.muDockX:hover { background: var(--mc-pn2); color: var(--mc-tx); } .muDockX svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.muDock .mcCm { min-width: 0; padding: 0; }
.muDock .mcRow2 { grid-template-columns: minmax(80px, 38%) 1fr; margin: 7px 0; font-size: .86rem; }
.muDock .mcNum .mcUn { flex: 0 0 64px; }
.muPBtns { display: flex; flex-wrap: wrap; gap: 6px; }
.muPBtns .clBtn2 { flex: 1 1 auto; justify-content: center; white-space: nowrap; font-size: .84rem; }
.muPBtns .clBtn2 svg { width: 16px; height: 16px; }
.muWI { display: flex; flex-direction: column; gap: 14px; }
.muWIic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--mc-pn2); color: var(--mc-ac); flex: none; }
.muWIic svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muWIr { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; }
.muWIp { min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 7px 10px; border: 1px solid var(--mc-bd); border-radius: 10px; background: var(--mc-pn2); }
.muWIp b { font-size: .84rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muWIp em { font-style: normal; font-size: .76rem; font-weight: 700; color: var(--mc-ac); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muWIa { color: var(--mc-mu); font-size: 1.1rem; }
.muWIs { display: flex; flex-direction: column; gap: 7px; }
.muWIl { font-size: .74rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--mc-mu); }
.muWIc { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.muWIo { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px 7px; border: 1px solid var(--mc-bd); border-radius: 11px; background: var(--mc-pn2); color: var(--mc-tx); font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; }
.muWIo:hover { border-color: var(--mc-ac); }
.muWIo.on { border-color: var(--mc-ac); box-shadow: 0 0 0 1px var(--mc-ac) inset; background: color-mix(in srgb, var(--mc-ac) 12%, var(--mc-pn2)); }
.muWIo svg { width: 100%; max-width: 120px; height: 46px; }
.muWIln { fill: none; stroke: var(--mc-mu); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; } .muWIo.on .muWIln { stroke: var(--mc-ac); }
.muWIpt { fill: var(--mc-pn); stroke: var(--mc-mu); stroke-width: 2; } .muWIo.on .muWIpt { stroke: var(--mc-ac); }
.muWIsw { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.muWIsw button { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--mc-bd); padding: 0; cursor: pointer; transition: transform .12s; }
.muWIsw button:hover { transform: scale(1.12); }
.muWIsw button.au { width: auto; height: 26px; border-radius: 13px; padding: 0 11px; background: var(--mc-pn2); color: var(--mc-tx); font: inherit; font-size: .8rem; font-weight: 600; }
.muWIsw button.on { outline: 2px solid var(--mc-ac); outline-offset: 2px; }
.muDockW .muPBtns .clBtn2:first-child { flex: 1 1 60%; }

/* 27/11/2026: filo selezionato evidenziato, pannello proprieta' vuoto, Magia piste da usare, pulsanti filo su due righe */
.mcWireG.sel .mcWire { stroke-width: 4.4; filter: drop-shadow(0 0 3px var(--mc-ac)) drop-shadow(0 0 7px var(--mc-ac)); }
.mcWireG.sel:hover .mcWire { stroke-width: 5; }
.muIdle { display: flex; flex-direction: column; gap: 14px; color: var(--mc-mu); line-height: 1.45; }
.muIdle p { margin: 0; }
.muIdleS { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.muIdleS span { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border: 1px solid var(--mc-bd); border-radius: 10px; background: var(--mc-pn2); font-size: .82rem; }
.muIdleS b { font-size: 1.35rem; color: var(--mc-tx); }
.muDockW .muPBtns { flex-direction: column; }
.muDockW .muPBtns .clBtn2, .muDockW .muPBtns .clBtn2:first-child { flex: 0 0 auto; width: 100%; }

/* 27/11/2026: cursori come negli editor (freccia sullo schema, dito su componenti e fili) e modalita' mano */
.mcu .mcSvg { cursor: default; }
.mcu.muHand .mcSvg, .mcu.muHand .mcSvg * { cursor: grab !important; }
.mcu.muHand.muPanning .mcSvg, .mcu.muHand.muPanning .mcSvg * { cursor: grabbing !important; }

/* 27/11/2026: spazio tra schema e pannello (come in Circuiti), microcontrollore selezionabile, selezione multipla */
.muMain > .muDock { margin-left: 10px; }
@media (max-width: 760px) { .muMain > .muDock { margin-left: 0; } }
.mcChipG { cursor: pointer; }
.mcChipG.sel .mcChip { stroke: var(--mc-ac); stroke-width: 3; filter: drop-shadow(0 0 6px var(--mc-ac)); }
.mcu.muHand .mcChipG { cursor: grab; }
.mcBand { fill: rgba(96, 165, 250, .12); stroke: #60a5fa; stroke-width: 1.2; stroke-dasharray: 5 3; pointer-events: none; vector-effect: non-scaling-stroke; }
.muGrpL { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow: auto; }
.muGrpL > span { display: flex; align-items: center; gap: 8px; font-size: .84rem; padding: 3px 6px; border-radius: 8px; background: var(--mc-pn2); }
.muGrpL .muMini { width: 34px; height: 24px; } .muGrpL .muMini svg { width: 32px; height: 22px; }
.muGrpH { margin: 8px 0 0; font-size: .8rem; line-height: 1.4; color: var(--mc-mu); }
.muChip { display: flex; flex-direction: column; gap: 6px; }
.muChR { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border: 1px solid var(--mc-bd); border-radius: 9px; background: var(--mc-pn2); font-size: .85rem; }
.muChR span { color: var(--mc-mu); } .muChR b { font-weight: 600; }
.muDockC .muPBtns .clBtn2, .muDockG .muPBtns .clBtn2 { width: 100%; }
.mcu .mcSvg:focus, .mcu .mcSvg:focus-visible { outline: none; }   /* niente riquadro blu attorno allo schema dopo un clic */

/* 27/11/2026: il Microcontrollore occupa l'altezza disponibile come gli altri simulatori (52 px = barra in alto) */
@media (min-width: 761px) { .cl.mcu:not(.xMob):not(.xFs) .muMain { height: calc(var(--simH, 692px) - 52px); } }
