/* ═══════════════════════════════════════════════════════════════════════════
 * sim-pages.css - the rules the simulator pages share (class="pg-sim" on
 * <body>): the wiring simulator, AC math, DC math, troubleshooting, the lab
 * and the assignment builders.
 *
 * Split out of app.css (card ckbma) so the other pages do not download them.
 * Link it after /app.css and before the page's own <style>:
 *     <link rel="stylesheet" href="/sim-pages.css?v=N">
 * Every selector starts with :where(body.pg-sim), which adds nothing to its
 * specificity, so the page's own <style> still wins a tie, exactly as when
 * these rules were in the page. The palette they use (--pbg, --txt, the
 * --ip-* instrument tokens) stays in app.css.
 * ═══════════════════════════════════════════════════════════════════════════ */

/* ── class="pg-sim": the simulator pages (wiring simulator, AC math, DC math, troubleshooting, lab, assignment builders). */
:where(body.pg-sim), :where(body.pg-sim) *{box-sizing:border-box;margin:0;padding:0;}
body:where(.pg-sim){font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',system-ui,Roboto,Arial,sans-serif;background:var(--pbg,#0d1117);color:var(--txt,#c9d1d9);height:100vh;overflow:hidden;display:flex;flex-direction:column;user-select:none;}
:where(body.pg-sim) #header{background:var(--panel,#161b22);border-bottom:2px solid var(--ip-raised,#21262d);padding:7px 14px;display:flex;align-items:center;gap:8px;flex-shrink:0;flex-wrap:wrap;}
:where(body.pg-sim) #header h1{font-size:14px;color:var(--ip-accent,#58a6ff);white-space:nowrap;}
:where(body.pg-sim) .hbtn{padding:4px 10px;border:1px solid var(--ip-border,#30363d);border-radius:4px;background:var(--ip-raised,#21262d);color:var(--ip-text,#c9d1d9);cursor:pointer;font-size:12px;font-family:inherit;}
:where(body.pg-sim) .hbtn:hover{border-color:var(--ip-accent,#58a6ff);background:var(--ip-raised2,#1c2733);}
:where(body.pg-sim) .hbtn.active{background:#1f6feb33;border-color:var(--ip-accent,#58a6ff);color:#79c0ff;}
:where(body.pg-sim) .hbtn.danger{border-color:#f85149;color:#f85149;}
:where(body.pg-sim) .sep{width:1px;height:20px;background:var(--ip-border,#30363d);margin:0 2px;}
:where(body.pg-sim) .badge{font-size:11px;padding:2px 8px;border-radius:10px;background:var(--ip-raised,#21262d);border:1px solid var(--ip-border,#30363d);}
:where(body.pg-sim) .badge.ok{border-color:#22c55e;color:#22c55e;}
:where(body.pg-sim) .badge.warn{border-color:#f59e0b;color:#f59e0b;}
:where(body.pg-sim) #main{display:flex;flex:1;overflow:hidden;}
:where(body.pg-sim) .cat-hdr{padding:5px 8px 3px;font-size:10px;text-transform:uppercase;letter-spacing:1px;color:var(--ip-text-mid,#8b949e);background:var(--ip-bg,#0d1117);border-top:1px solid var(--ip-raised,#21262d);cursor:pointer;display:flex;justify-content:space-between;}
:where(body.pg-sim) .cat-hdr:hover{color:var(--ip-text,#c9d1d9);}
:where(body.pg-sim) .cat-body{display:flex;flex-wrap:wrap;gap:4px;padding:5px 6px;}
:where(body.pg-sim) .cat-body.collapsed{display:none;}
:where(body.pg-sim) .pitem{width:88px;border:1px solid var(--ip-raised,#21262d);border-radius:4px;background:var(--ip-bg,#0d1117);cursor:grab;padding:3px 3px 2px;text-align:center;display:flex;flex-direction:column;align-items:center;gap:2px;position:relative;}
:where(body.pg-sim) .pitem.locked{opacity:.45;cursor:not-allowed;}
:where(body.pg-sim) .pitem.locked:hover{opacity:.65;}
:where(body.pg-sim) .pitem .pitem-lock{position:absolute;top:1px;right:1px;font-size:9px;color:#a855f7;background:rgba(168,85,247,0.15);border:1px solid rgba(168,85,247,0.4);border-radius:3px;padding:0 3px;line-height:11px;font-weight:700;letter-spacing:.4px;}
:where(body.pg-sim) .pitem .pitem-lock.basic{color:#3b82f6;background:rgba(59,130,246,0.15);border-color:rgba(59,130,246,0.4);}
:where(body.pg-sim) #tier-toast{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);background:var(--ip-panel,#161b22);border:1px solid #a855f7;border-radius:8px;padding:10px 16px;font-size:13px;color:#fafafa;z-index:1000;box-shadow:0 4px 24px rgba(0,0,0,0.5);display:none;max-width:420px;}
:where(body.pg-sim) #tier-toast a{color:#a855f7;text-decoration:underline;margin-left:8px;}
:where(body.pg-sim) .pitem:hover{border-color:var(--ip-accent,#58a6ff);background:var(--ip-raised2,#1c2733);}
:where(body.pg-sim) .pitem.active{border-color:#22c55e;background:#22c55e12;}
:where(body.pg-sim) .pitem-name{font-size:9px;color:var(--ip-text-mid,#8b949e);line-height:1.2;}
:where(body.pg-sim) .pitem:hover .pitem-name{color:var(--ip-text,#c9d1d9);}
:where(body.pg-sim) #canvas-wrap{flex:1;overflow:hidden;position:relative;background:var(--cbg,#080c11);}
:where(body.pg-sim) #props-bar{position:absolute;top:6px;left:50%;transform:translateX(-50%);background:#161b22ee;border:1px solid var(--ip-border,#30363d);border-radius:6px;padding:4px 10px;font-size:11px;display:none;gap:8px;align-items:center;z-index:50;}
:where(body.pg-sim) #props-bar b{color:var(--ip-text,#c9d1d9);}
:where(body.pg-sim) #props-bar span{color:var(--ip-text-mid,#8b949e);}
:where(body.pg-sim) .pbtn{background:none;border:1px solid var(--ip-border,#30363d);border-radius:3px;font-size:11px;padding:1px 7px;cursor:pointer;}
:where(body.pg-sim) .pbtn.blue{color:var(--ip-accent,#58a6ff);border-color:var(--ip-accent,#58a6ff);}
:where(body.pg-sim) .pbtn.blue:hover{background:var(--ip-raised2,#1c2733);}
:where(body.pg-sim) .pbtn.red{color:#f85149;border-color:#f85149;}
:where(body.pg-sim) .pbtn.red:hover{background:#f8514920;}
:where(body.pg-sim) #label-wrap{position:absolute;display:none;z-index:100;}
:where(body.pg-sim) #label-inp{background:var(--ip-raised2,#1c2733);border:1px solid var(--ip-accent,#58a6ff);border-radius:3px;color:var(--ip-text-hi,#e6edf3);font-size:12px;font-weight:bold;padding:2px 6px;width:80px;outline:none;}
:where(body.pg-sim) #statusbar{background:var(--panel,#161b22);border-top:1px solid var(--ip-raised,#21262d);padding:3px 12px;font-size:10px;color:var(--ip-text-mid,#8b949e);display:flex;gap:14px;flex-shrink:0;}
:where(body.pg-sim) #st-mode{color:var(--ip-accent,#58a6ff);}
:where(body.pg-sim) #ctx-menu{display:none;position:fixed;z-index:300;background:var(--ip-panel,#161b22);border:1px solid var(--ip-border,#30363d);border-radius:6px;padding:4px 0;min-width:160px;box-shadow:0 4px 16px #00000088;}
:where(body.pg-sim) .cm-title{padding:4px 14px 3px;font-size:10px;color:var(--ip-text-mid,#8b949e);border-bottom:1px solid var(--ip-raised,#21262d);margin-bottom:3px;font-weight:bold;}
:where(body.pg-sim) .cm-item{padding:5px 14px;cursor:pointer;font-size:12px;color:var(--ip-text,#c9d1d9);}
:where(body.pg-sim) .cm-item:hover{background:var(--ip-raised2,#1c2733);color:var(--ip-text-hi,#e6edf3);}
:where(body.pg-sim) .cm-item.danger{color:#f85149;}
:where(body.pg-sim) .cm-item.danger:hover{background:#f8514920;}
:where(body.pg-sim) .cm-sep{height:1px;background:var(--ip-raised,#21262d);margin:3px 0;}
body.light:where(.pg-sim) #canvas-wrap{background:var(--cbg)!important;}
body.light:where(.pg-sim) #header,body.light:where(.pg-sim) #statusbar{background:var(--panel);border-color:var(--bdr);}
body.light:where(.pg-sim) #palette{background:var(--panel);border-color:var(--bdr);}
body.light:where(.pg-sim) .hbtn:hover{border-color:#3b82f6;background:#dbeafe;}
body.light:where(.pg-sim) .cat-hdr{background:var(--pbg);color:var(--txt2);border-color:var(--bdr);}
body.light:where(.pg-sim) .cat-body{background:var(--panel);}
body.light:where(.pg-sim) .pitem{background:var(--hov);border-color:var(--bdr);}
body.light:where(.pg-sim) .pitem:hover{border-color:#3b82f6;background:#dbeafe;}
body.light:where(.pg-sim) .pitem.active{border-color:var(--ip-btn-hi,#2563eb);background:#dbeafe;}
body.light:where(.pg-sim) .pitem-name{color:var(--txt2);}
body.light:where(.pg-sim) #props-bar{background:#ffffffee;border-color:var(--bdr);}
body.light:where(.pg-sim) .pbtn{border-color:var(--bdr);color:var(--txt);}
body.light:where(.pg-sim) #label-inp{background:#fff;border-color:#3b82f6;color:#1f2937;}
body.light:where(.pg-sim) #statusbar #st-mode{color:var(--ip-btn-hi,#2563eb);}
body.light:where(.pg-sim) #ctx-menu{background:var(--panel);border-color:var(--bdr);}
body.light:where(.pg-sim) .cm-item{color:var(--txt);}
body.light:where(.pg-sim) .cm-sep{background:var(--bdr);}
body.light:where(.pg-sim) .badge{background:var(--hov);border-color:var(--bdr);}
:where(body.pg-sim) #plc-prof-overlay{position:fixed;inset:0;z-index:1000;background:#00000099;display:none;align-items:center;justify-content:center;}
:where(body.pg-sim) #plc-prof-overlay.vis{display:flex;}
:where(body.pg-sim) #plc-prof-box{background:var(--ip-panel,#161b22);border:1px solid var(--ip-border,#30363d);border-radius:8px;min-width:440px;max-width:560px;max-height:70vh;display:flex;flex-direction:column;box-shadow:0 12px 40px #000d;}
:where(body.pg-sim) #plc-prof-box h3{margin:0;padding:12px 16px;font-size:13px;color:var(--ip-text-hi,#e6edf3);border-bottom:1px solid var(--ip-raised,#21262d);background:#1c2128;border-radius:8px 8px 0 0;display:flex;align-items:center;justify-content:space-between;}
:where(body.pg-sim) #plc-prof-box h3 span{color:var(--ip-text-mid,#8b949e);font-size:11px;font-weight:normal;}
:where(body.pg-sim) #plc-prof-scroll{flex:1;overflow-y:auto;padding:8px;}
:where(body.pg-sim) .spl-item{display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:5px;cursor:pointer;border:1px solid transparent;transition:border-color .1s;}
:where(body.pg-sim) .spl-item:hover{background:var(--ip-raised2,#1c2733);border-color:var(--ip-border,#30363d);}
:where(body.pg-sim) .spl-icon{font-size:18px;flex-shrink:0;}
:where(body.pg-sim) .spl-name{flex:1;font-size:13px;color:var(--ip-text-hi,#e6edf3);font-weight:500;}
:where(body.pg-sim) .spl-meta{font-size:11px;color:var(--ip-text-mid,#8b949e);white-space:nowrap;}
:where(body.pg-sim) .spl-del{background:none;border:none;color:#484f58;cursor:pointer;font-size:16px;padding:0 3px;line-height:1;flex-shrink:0;}
:where(body.pg-sim) .spl-del:hover{color:#f85149;}
:where(body.pg-sim) #plc-prof-empty{padding:32px;text-align:center;color:#484f58;font-size:12px;}
:where(body.pg-sim) #plc-prof-foot{padding:10px 16px;border-top:1px solid var(--ip-raised,#21262d);display:flex;gap:8px;justify-content:flex-end;background:#1c2128;border-radius:0 0 8px 8px;}
:where(body.pg-sim) .spl-btn{padding:5px 14px;border-radius:4px;border:1px solid var(--ip-border,#30363d);background:var(--ip-raised,#21262d);color:var(--ip-text,#c9d1d9);cursor:pointer;font-size:12px;font-family:inherit;}
:where(body.pg-sim) .spl-btn:hover{border-color:var(--ip-accent,#58a6ff);color:#79c0ff;}
body.embed-mode:where(.pg-sim) #header{display:none!important;}
body.embed-mode:where(.pg-sim) #palette-container{display:none!important;}
body.embed-mode:where(.pg-sim) #statusbar{display:none!important;}
body.embed-mode:where(.pg-sim) #login-overlay{display:none!important;}
body.embed-mode:where(.pg-sim) #main{height:100vh;}
body.embed-mode:where(.pg-sim) #canvas-wrap{height:100vh;}
:where(body.pg-sim) #login-overlay{position:fixed;inset:0;z-index:2000;background:#080c12;display:flex;align-items:center;justify-content:center;}
:where(body.pg-sim) .login-box{background:var(--ip-panel,#161b22);border:1px solid var(--ip-border,#30363d);border-radius:12px;padding:32px;width:360px;max-width:calc(100vw - 32px);box-shadow:0 16px 48px #000c;}
:where(body.pg-sim) .login-box h2{font-size:20px;color:var(--ip-accent,#58a6ff);margin-bottom:4px;}
:where(body.pg-sim) .login-box p{font-size:12px;color:var(--ip-text-mid,#8b949e);margin-bottom:20px;}
:where(body.pg-sim) .login-tab{display:flex;margin-bottom:20px;border:1px solid var(--ip-border,#30363d);border-radius:6px;overflow:hidden;}
:where(body.pg-sim) .login-tab button{flex:1;padding:8px;background:none;border:none;color:var(--ip-text-mid,#8b949e);cursor:pointer;font-size:13px;transition:all .15s;font-family:inherit;}
:where(body.pg-sim) .login-tab button.active{background:#1f6feb33;color:var(--ip-accent,#58a6ff);}
:where(body.pg-sim) .login-field{margin-bottom:14px;}
:where(body.pg-sim) .login-field label{display:block;font-size:11px;color:var(--ip-text-mid,#8b949e);margin-bottom:5px;text-transform:uppercase;letter-spacing:.5px;}
:where(body.pg-sim) .login-field input{width:100%;padding:9px 12px;background:var(--ip-bg,#0d1117);border:1px solid var(--ip-border,#30363d);border-radius:6px;color:var(--ip-text-hi,#e6edf3);font-size:14px;outline:none;font-family:inherit;box-sizing:border-box;}
:where(body.pg-sim) .login-field input:focus{border-color:var(--ip-accent,#58a6ff);}
:where(body.pg-sim) .login-btn{width:100%;padding:10px;background:var(--ip-btn,#1d4ed8);border:1px solid #3b82f6;border-radius:6px;color:#fff;font-size:14px;font-weight:700;cursor:pointer;margin-top:4px;font-family:inherit;transition:background .15s;}
:where(body.pg-sim) .login-btn:hover{background:var(--ip-btn-hi,#2563eb);}
:where(body.pg-sim) .login-err{color:#f85149;font-size:12px;margin-top:8px;min-height:16px;}
:where(body.pg-sim) .login-skip{width:100%;padding:8px;background:none;border:1px solid var(--ip-border,#30363d);border-radius:6px;color:var(--ip-text-mid,#8b949e);font-size:12px;cursor:pointer;margin-top:8px;font-family:inherit;transition:all .15s;}
:where(body.pg-sim) .login-skip:hover{border-color:var(--ip-text-mid,#8b949e);color:var(--ip-text,#c9d1d9);}
:where(body.pg-sim) #palette-container{display:flex;flex-direction:column;width:200px;min-width:0;flex-shrink:0;background:var(--panel,#161b22);border-right:1px solid var(--ip-raised,#21262d);transition:width .15s ease;overflow:hidden;}
:where(body.pg-sim) #palette-container.collapsed{width:28px;}
:where(body.pg-sim) #palette-container.collapsed #palette{display:none;}
:where(body.pg-sim) #palette-container.collapsed .pal-hdr-txt{display:none;}
:where(body.pg-sim) #pal-hdr{display:flex;align-items:center;justify-content:space-between;padding:5px 8px 5px 10px;border-bottom:1px solid var(--ip-raised,#21262d);flex-shrink:0;background:var(--ip-bg,#0d1117);}
:where(body.pg-sim) #pal-toggle-btn{background:none;border:none;color:var(--ip-text-mid,#8b949e);cursor:pointer;font-size:12px;padding:2px 4px;line-height:1;transition:transform .15s;}
:where(body.pg-sim) #pal-toggle-btn:hover{color:var(--ip-text,#c9d1d9);}
:where(body.pg-sim) #palette-container.collapsed #pal-toggle-btn{transform:rotate(180deg);}
:where(body.pg-sim) #tc-panel{position:absolute;right:0;top:0;bottom:0;width:300px;background:#0f1419;border-left:1px solid var(--ip-raised,#21262d);display:none;flex-direction:column;z-index:60;box-shadow:-4px 0 16px #0008;}
:where(body.pg-sim) #tc-panel.open{display:flex;}
:where(body.pg-sim) #tc-hdr{display:flex;align-items:center;justify-content:space-between;padding:8px 10px;border-bottom:1px solid var(--ip-raised,#21262d);background:var(--ip-bg,#0d1117);flex-shrink:0;}
:where(body.pg-sim) #tc-hdr h3{margin:0;font-size:12px;text-transform:uppercase;letter-spacing:1px;color:var(--ip-text,#c9d1d9);font-weight:600;}
:where(body.pg-sim) #tc-close{background:none;border:none;color:var(--ip-text-mid,#8b949e);cursor:pointer;font-size:16px;padding:2px 6px;line-height:1;}
:where(body.pg-sim) #tc-close:hover{color:var(--ip-text,#c9d1d9);}
:where(body.pg-sim) #tc-toolbar{display:flex;gap:6px;padding:8px 10px;border-bottom:1px solid var(--ip-raised,#21262d);flex-shrink:0;}
:where(body.pg-sim) #tc-toolbar button{flex:1;padding:6px 8px;font-size:11px;background:var(--ip-raised2,#1c2733);color:var(--ip-text,#c9d1d9);border:1px solid var(--ip-border,#30363d);border-radius:4px;cursor:pointer;font-weight:500;}
:where(body.pg-sim) #tc-toolbar button:hover{background:#26303c;border-color:#484f58;}
:where(body.pg-sim) #tc-toolbar button.primary{background:var(--ip-accent2,#1f6feb);border-color:var(--ip-accent2,#1f6feb);color:#fff;}
:where(body.pg-sim) #tc-toolbar button.primary:hover{background:#388bfd;}
:where(body.pg-sim) #tc-list{flex:1;overflow-y:auto;padding:6px;}
:where(body.pg-sim) #tc-list:empty::before{content:'No test cases yet. Click ● Record New Case to author one against the current circuit.';display:block;padding:18px 14px;color:var(--ip-text-dim,#6e7681);font-size:11px;line-height:1.5;text-align:center;}
:where(body.pg-sim) .tc-case{background:var(--ip-panel,#161b22);border:1px solid var(--ip-raised,#21262d);border-radius:6px;margin-bottom:6px;overflow:hidden;}
:where(body.pg-sim) .tc-case-hdr{display:flex;align-items:center;gap:6px;padding:6px 8px;cursor:pointer;}
:where(body.pg-sim) .tc-case-hdr:hover{background:var(--ip-raised2,#1c2733);}
:where(body.pg-sim) .tc-case-icon{font-size:11px;width:14px;text-align:center;}
:where(body.pg-sim) .tc-case-icon.pass{color:#3fb950;}
:where(body.pg-sim) .tc-case-icon.fail{color:#f85149;}
:where(body.pg-sim) .tc-case-icon.pending{color:var(--ip-text-mid,#8b949e);}
:where(body.pg-sim) .tc-case-name{flex:1;font-size:12px;color:var(--ip-text,#c9d1d9);font-weight:500;}
:where(body.pg-sim) .tc-case-actions{display:flex;gap:2px;}
:where(body.pg-sim) .tc-case-actions button{background:none;border:none;color:var(--ip-text-mid,#8b949e);cursor:pointer;font-size:11px;padding:2px 4px;border-radius:3px;}
:where(body.pg-sim) .tc-case-actions button:hover{background:#26303c;color:var(--ip-text,#c9d1d9);}
:where(body.pg-sim) .tc-case-actions button.danger:hover{color:#f85149;}
:where(body.pg-sim) .tc-steps{border-top:1px solid var(--ip-raised,#21262d);background:var(--ip-bg,#0d1117);display:none;padding:4px 0;}
:where(body.pg-sim) .tc-case.open .tc-steps{display:block;}
:where(body.pg-sim) .tc-step{display:flex;align-items:center;gap:6px;padding:3px 10px;font-size:11px;color:var(--ip-text-mid,#8b949e);font-family:'Consolas','Courier New',monospace;}
:where(body.pg-sim) .tc-step:hover{background:var(--ip-panel,#161b22);}
:where(body.pg-sim) .tc-step-num{color:#484f58;width:18px;text-align:right;}
:where(body.pg-sim) .tc-step-txt{flex:1;}
:where(body.pg-sim) .tc-step-x{background:none;border:none;color:#484f58;cursor:pointer;font-size:11px;padding:0 4px;}
:where(body.pg-sim) .tc-step-x:hover{color:#f85149;}
:where(body.pg-sim) .tc-case-reason{padding:6px 10px;font-size:11px;color:#f85149;background:#22171a;border-top:1px solid var(--ip-raised,#21262d);display:none;}
:where(body.pg-sim) .tc-case.failed .tc-case-reason{display:block;}
:where(body.pg-sim) #tc-rec-banner{position:absolute;top:6px;left:8px;right:316px;background:#5a1d1d;border:1px solid #f85149;border-radius:6px;padding:6px 10px;display:none;align-items:center;gap:10px;z-index:55;font-size:12px;color:#fff;box-shadow:0 2px 12px #0008;}
:where(body.pg-sim) #tc-rec-banner.recording{display:flex;}
:where(body.pg-sim) #tc-rec-dot{width:10px;height:10px;border-radius:50%;background:#f85149;animation:tc-pulse 1.2s ease-in-out infinite;flex-shrink:0;}
:where(body.pg-sim) #tc-rec-banner b{color:#fff;font-weight:600;}
:where(body.pg-sim) #tc-rec-banner .tc-rec-count{color:#ffd6a5;font-size:11px;margin-left:auto;}
:where(body.pg-sim) #tc-rec-banner button{padding:4px 10px;font-size:11px;background:var(--ip-raised,#21262d);color:#fff;border:1px solid var(--ip-border,#30363d);border-radius:4px;cursor:pointer;}
:where(body.pg-sim) #tc-rec-banner button.snapshot{background:var(--ip-accent2,#1f6feb);border-color:var(--ip-accent2,#1f6feb);}
:where(body.pg-sim) #tc-rec-banner button.stop{background:#3fb950;border-color:#3fb950;}
:where(body.pg-sim) #tc-rec-banner button.cancel{background:var(--ip-raised,#21262d);}
:where(body.pg-sim) #tc-rec-banner button:hover{filter:brightness(1.15);}
body.tc-recording:where(.pg-sim) #canvas-wrap{outline:2px solid #f85149;outline-offset:-2px;}
:where(body.pg-sim) #tc-snap-overlay{position:fixed;inset:0;background:#000a;display:none;align-items:center;justify-content:center;z-index:1000;}
:where(body.pg-sim) #tc-snap-overlay.open{display:flex;}
:where(body.pg-sim) #tc-snap-box{background:var(--ip-panel,#161b22);border:1px solid var(--ip-border,#30363d);border-radius:8px;padding:0;width:420px;max-height:80vh;display:flex;flex-direction:column;}
:where(body.pg-sim) #tc-snap-box h3{margin:0;padding:12px 16px;border-bottom:1px solid var(--ip-raised,#21262d);font-size:13px;color:var(--ip-text,#c9d1d9);}
:where(body.pg-sim) #tc-snap-list{flex:1;overflow-y:auto;padding:8px 16px;}
:where(body.pg-sim) .tc-snap-row{display:flex;align-items:center;gap:8px;padding:5px 0;font-size:12px;color:var(--ip-text,#c9d1d9);}
:where(body.pg-sim) .tc-snap-row input{cursor:pointer;}
:where(body.pg-sim) .tc-snap-row .tc-snap-changed{margin-left:auto;font-size:10px;color:#fbbf24;}
:where(body.pg-sim) #tc-snap-foot{padding:10px 16px;border-top:1px solid var(--ip-raised,#21262d);display:flex;justify-content:flex-end;gap:8px;}
:where(body.pg-sim) #tc-snap-foot button{padding:6px 14px;font-size:12px;border-radius:4px;cursor:pointer;border:1px solid var(--ip-border,#30363d);background:var(--ip-raised,#21262d);color:var(--ip-text,#c9d1d9);}
:where(body.pg-sim) #tc-snap-foot button.primary{background:var(--ip-accent2,#1f6feb);border-color:var(--ip-accent2,#1f6feb);color:#fff;}
:where(body.pg-sim) #tut-veil{position:fixed;inset:0;z-index:900;pointer-events:none;background:transparent;display:none;}
:where(body.pg-sim) #tut-veil.show{display:block;}
:where(body.pg-sim) #tut-spot{position:fixed;border-radius:8px;box-shadow:0 0 0 4px var(--ip-accent2,#1f6feb), 0 0 22px 6px rgba(31,111,235,0.6);z-index:901;pointer-events:none;transition:all .25s ease;display:none;}
:where(body.pg-sim) #tut-card{position:fixed;z-index:902;background:var(--ip-panel,#161b22);border:1px solid var(--ip-accent2,#1f6feb);border-radius:10px;padding:18px 20px;max-width:380px;min-width:300px;box-shadow:0 10px 40px #000c;color:var(--ip-text,#c9d1d9);font-size:13px;line-height:1.55;display:none;}
:where(body.pg-sim) #tut-card.show{display:block;}
:where(body.pg-sim) #tut-card .tut-icon{font-size:22px;}
:where(body.pg-sim) #tut-card .tut-step{font-size:10px;text-transform:uppercase;letter-spacing:1px;color:var(--ip-text-dim,#6e7681);}
:where(body.pg-sim) #tut-card h4{margin:6px 0 6px;color:var(--ip-text-hi,#e6edf3);font-size:15px;font-weight:600;}
:where(body.pg-sim) #tut-card .tut-body{color:var(--ip-text,#c9d1d9);margin-bottom:14px;}
:where(body.pg-sim) #tut-card .tut-body b{color:#79c0ff;}
:where(body.pg-sim) #tut-card .tut-row{display:flex;align-items:center;justify-content:space-between;gap:8px;}
:where(body.pg-sim) #tut-card .tut-dots{display:flex;gap:3px;}
:where(body.pg-sim) #tut-card .tut-dot{width:6px;height:6px;border-radius:3px;background:var(--ip-border,#30363d);}
:where(body.pg-sim) #tut-card .tut-dot.done{background:#3fb950;}
:where(body.pg-sim) #tut-card .tut-dot.cur{background:var(--ip-accent2,#1f6feb);width:18px;}
:where(body.pg-sim) #tut-card button{padding:6px 14px;font-size:12px;border-radius:5px;cursor:pointer;border:1px solid var(--ip-border,#30363d);background:var(--ip-raised,#21262d);color:var(--ip-text,#c9d1d9);}
:where(body.pg-sim) #tut-card button.primary{background:var(--ip-accent2,#1f6feb);border-color:var(--ip-accent2,#1f6feb);color:#fff;font-weight:600;}
:where(body.pg-sim) #tut-card button.ghost{background:transparent;color:var(--ip-text-mid,#8b949e);}
:where(body.pg-sim) #settings-wrap{position:relative;}
:where(body.pg-sim) #settings-dropdown{position:absolute;top:calc(100% + 4px);right:0;z-index:500;background:var(--ip-panel,#161b22);border:1px solid var(--ip-border,#30363d);border-radius:6px;padding:4px 0;min-width:195px;box-shadow:0 4px 20px #000a;display:none;}
:where(body.pg-sim) #settings-dropdown.open{display:block;}
:where(body.pg-sim) .sd-item{padding:6px 14px;cursor:pointer;font-size:12px;color:var(--ip-text,#c9d1d9);display:flex;align-items:center;gap:8px;}
:where(body.pg-sim) .sd-item:hover{background:var(--ip-raised2,#1c2733);}
:where(body.pg-sim) .sd-item.danger{color:#f85149;}
:where(body.pg-sim) .sd-item.danger:hover{background:#f8514920;}
:where(body.pg-sim) .sd-sep{height:1px;background:var(--ip-raised,#21262d);margin:3px 0;}
:where(body.pg-sim) .sd-lbl{padding:4px 14px 2px;font-size:10px;color:var(--ip-text-dim,#6e7681);text-transform:uppercase;letter-spacing:.5px;}
:where(body.pg-sim) .mobile-hint{display:none;}
:where(body.pg-sim) .desktop-hint{display:inline;}
@media(pointer:coarse){
  :where(body.pg-sim) .mobile-hint{display:inline;}
  :where(body.pg-sim) .desktop-hint{display:none;}
}
body.light:where(.pg-sim) #pal-hdr{background:var(--pbg);border-color:var(--bdr);}
body.light:where(.pg-sim) .login-box{background:var(--panel);border-color:var(--bdr);}
body.light:where(.pg-sim) .login-tab button{color:var(--txt2);}
body.light:where(.pg-sim) .login-tab button.active{background:#dbeafe;color:var(--ip-btn-hi,#2563eb);}
body.light:where(.pg-sim) #settings-dropdown{background:var(--panel);border-color:var(--bdr);}
body.light:where(.pg-sim) .sd-item{color:var(--txt);}
body.light:where(.pg-sim) .sd-item:hover{background:var(--hov);}
body.light:where(.pg-sim) #header h1{color:var(--ip-btn,#1d4ed8);}
body.light:where(.pg-sim) #header a{color:var(--ip-btn,#1d4ed8) !important;}
body.light:where(.pg-sim) .cat-hdr:hover{color:var(--txt);}
body.light:where(.pg-sim) .pitem:hover .pitem-name{color:var(--txt);}
body.light:where(.pg-sim) #props-bar b{color:var(--txt);}
body.light:where(.pg-sim) #props-bar span{color:var(--txt2);}
body.light:where(.pg-sim) .pbtn.blue{color:var(--ip-btn,#1d4ed8);border-color:var(--ip-btn,#1d4ed8);}
body.light:where(.pg-sim) .pbtn.blue:hover{background:#dbeafe;}
body.light:where(.pg-sim) #statusbar{color:var(--txt2);}
body.light:where(.pg-sim) #pal-toggle-btn{color:var(--txt2);}
body.light:where(.pg-sim) #pal-toggle-btn:hover{color:var(--txt);}
body.light:where(.pg-sim) #tc-hdr h3,body.light:where(.pg-sim) #tc-close:hover,body.light:where(.pg-sim) .tc-name,body.light:where(.pg-sim) .tc-stat{color:var(--txt);}
body.light:where(.pg-sim) #tc-close,body.light:where(.pg-sim) .tc-meta,body.light:where(.pg-sim) .tc-empty{color:var(--txt2);}
body.light:where(.pg-sim) #tc-toolbar button{background:var(--hov);color:var(--txt);border-color:var(--bdr);}
body.light:where(.pg-sim) #tc-toolbar button:hover{background:#e0e7ff;border-color:#3b82f6;}
body.light:where(.pg-sim) #tier-toast{background:#fff;color:var(--txt);box-shadow:0 4px 24px rgba(15,23,42,0.12);}
body.light:where(.pg-sim) .login-box h2{color:var(--ip-btn,#1d4ed8);}
body.light:where(.pg-sim) .login-box p{color:var(--txt2);}
body.light:where(.pg-sim) .login-field label{color:var(--txt2);}
body.light:where(.pg-sim) .login-skip{color:var(--txt2);border-color:var(--bdr);}
body.light:where(.pg-sim) .login-skip:hover{color:var(--txt);border-color:var(--txt2);}
body.light:where(.pg-sim) #plc-prof-box{background:var(--panel);border-color:var(--bdr);}
body.light:where(.pg-sim) #plc-prof-box h3{color:var(--txt);background:var(--hov);border-color:var(--bdr);}
body.light:where(.pg-sim) #plc-prof-box h3 span{color:var(--txt2);}
body.light:where(.pg-sim) .spl-item{background:var(--hov);border-color:var(--bdr);}
body.light:where(.pg-sim) .spl-item:hover{background:#e0e7ff;}
body.light:where(.pg-sim) .spl-name{color:var(--txt);}
body.light:where(.pg-sim) .spl-meta{color:var(--txt2);}
body.light:where(.pg-sim) .spl-btn{background:var(--hov);color:var(--txt);border-color:var(--bdr);}
body.light:where(.pg-sim) .spl-btn:hover{background:#dbeafe;color:var(--ip-btn,#1d4ed8);}
body.light:where(.pg-sim) #profile-overlay{background:rgba(255,255,255,0.85);}
body.light:where(.pg-sim) #profile-panel{background:var(--panel);border-color:var(--bdr);}
body.light:where(.pg-sim) #profile-hdr{background:var(--hov);border-color:var(--bdr);}
body.light:where(.pg-sim) #profile-hdr h3{color:var(--txt);}
body.light:where(.pg-sim) #profile-close{color:var(--txt2);}
body.light:where(.pg-sim) #profile-close:hover{color:var(--txt);}
body.light:where(.pg-sim) .profile-item{border-color:var(--bdr);}
body.light:where(.pg-sim) .pi-name{color:var(--txt);}
body.light:where(.pg-sim) .pi-date{color:var(--txt2);}
body.light:where(.pg-sim) #profile-empty{color:var(--txt2);}
body.light:where(.pg-sim) #profile-name-inp{background:#fff;border-color:var(--bdr);color:var(--txt);}
body.light:where(.pg-sim) #profile-save-form{border-color:var(--bdr);}
:where(body.pg-sim) #profile-overlay{position:fixed;inset:0;z-index:1600;background:rgba(8,12,18,0.92);display:none;align-items:center;justify-content:center;padding:20px;}
:where(body.pg-sim) #profile-overlay.open{display:flex;}
:where(body.pg-sim) #profile-panel{width:100%;max-width:480px;background:var(--ip-panel,#161b22);border:1px solid var(--ip-border,#30363d);border-radius:12px;overflow:hidden;}
:where(body.pg-sim) #profile-hdr{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;background:var(--ip-bg,#0d1117);border-bottom:1px solid var(--ip-raised,#21262d);}
:where(body.pg-sim) #profile-hdr h3{font-size:15px;color:var(--ip-text-hi,#e6edf3);margin:0;}
:where(body.pg-sim) #profile-close{background:none;border:none;color:var(--ip-text-mid,#8b949e);font-size:18px;cursor:pointer;padding:2px 8px;line-height:1;}
:where(body.pg-sim) #profile-close:hover{color:var(--ip-text-hi,#e6edf3);}
:where(body.pg-sim) #profile-list{list-style:none;max-height:340px;overflow-y:auto;}
:where(body.pg-sim) .profile-item{display:flex;align-items:center;justify-content:space-between;padding:12px 20px;border-bottom:1px solid var(--ip-raised,#21262d);gap:12px;}
:where(body.pg-sim) .profile-item:last-child{border-bottom:none;}
:where(body.pg-sim) .pi-name{font-size:13px;font-weight:600;color:var(--ip-text-hi,#e6edf3);}
:where(body.pg-sim) .pi-date{font-size:10px;color:var(--ip-text-dim,#6e7681);}
:where(body.pg-sim) .pi-btns{display:flex;gap:6px;flex-shrink:0;}
:where(body.pg-sim) .pi-btn{font-size:11px;padding:4px 10px;border-radius:4px;cursor:pointer;font-family:inherit;font-weight:600;border:1px solid;}
:where(body.pg-sim) .pi-btn.open{color:var(--ip-accent,#58a6ff);border-color:rgba(88,166,255,.35);background:rgba(88,166,255,.08);}
:where(body.pg-sim) .pi-btn.open:hover{background:rgba(88,166,255,.18);}
:where(body.pg-sim) .pi-btn.del{color:#f85149;border-color:rgba(248,81,73,.3);background:rgba(248,81,73,.06);}
:where(body.pg-sim) .pi-btn.del:hover{background:rgba(248,81,73,.14);}
:where(body.pg-sim) #profile-empty{padding:28px 20px;text-align:center;color:var(--ip-text-dim,#6e7681);font-size:13px;}
:where(body.pg-sim) #profile-save-form{padding:14px 20px;border-top:1px solid var(--ip-raised,#21262d);display:flex;gap:8px;}
:where(body.pg-sim) #profile-name-inp{flex:1;padding:8px 12px;background:var(--ip-bg,#0d1117);border:1px solid var(--ip-border,#30363d);border-radius:6px;color:var(--ip-text-hi,#e6edf3);font-size:13px;outline:none;font-family:inherit;}
:where(body.pg-sim) #profile-name-inp:focus{border-color:var(--ip-accent,#58a6ff);}
:where(body.pg-sim) #profile-save-btn{padding:8px 14px;background:var(--ip-btn,#1d4ed8);border:1px solid #3b82f6;border-radius:6px;color:#fff;font-size:13px;font-weight:700;cursor:pointer;font-family:inherit;white-space:nowrap;}
:where(body.pg-sim) #profile-save-btn:hover{background:var(--ip-btn-hi,#2563eb);}
:where(body.pg-sim) #profile-msg{padding:6px 20px 10px;font-size:12px;color:#22c55e;min-height:20px;}
