/* ==========================================================================
   Interactive Circuit Simulator & SPICE CAD Suite Stylesheet
   Python4Physics Engineering EDA & Virtual Instrumentation Suite
   ========================================================================== */

:root {
    --ms-bg-workspace: #0f172a;
    --ms-grid-dot: rgba(148, 163, 184, 0.22);
    --ms-grid-line: rgba(51, 65, 85, 0.35);
    --ms-ribbon-bg: #1e293b;
    --ms-ribbon-border: #334155;
    --ms-panel-bg: #111827;
    --ms-panel-border: #1f2937;
    --ms-wire-color: #38bdf8;
    --ms-wire-active: #22c55e;
    --ms-wire-selected: #f59e0b;
    --ms-comp-stroke: #e2e8f0;
    --ms-comp-fill: #1e293b;
    --ms-pin-color: #ef4444;
    --ms-pin-hover: #10b981;
    --ms-cro-screen: #021a12;
    --ms-cro-grid: rgba(34, 197, 94, 0.22);
    --ms-cro-trace-a: #fbbf24;
    --ms-cro-trace-b: #38bdf8;
    --ms-dmm-lcd-bg: #032b1a;
    --ms-dmm-digits: #4ade80;
    --ms-accent: #0284c7;
    --ms-accent-glow: rgba(2, 132, 199, 0.4);
    --ms-danger: #ef4444;
    --ms-success: #22c55e;

    /* High-Contrast Curriculum Cards & Guidance (Dark Default) */
    --ms-card-bg: #111827;
    --ms-card-border: rgba(148, 163, 184, 0.16);
    --ms-card-hover-border: rgba(56, 189, 248, 0.55);
    --ms-card-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
    --ms-card-hover-shadow: 0 14px 34px -4px rgba(0, 0, 0, 0.65), 0 0 18px rgba(56, 189, 248, 0.18);
    --ms-card-title: #f8fafc;
    --ms-card-desc: #cbd5e1;
    --ms-formula-bg: rgba(15, 23, 42, 0.72);
    --ms-formula-border: rgba(255, 255, 255, 0.09);
    --ms-formula-text: #f8fafc;
    --ms-btn-secondary-bg: #1e293b;
    --ms-btn-secondary-text: #f1f5f9;
    --ms-btn-secondary-border: rgba(255, 255, 255, 0.14);
    --ms-btn-secondary-hover: #334155;
    --ms-guide-bg: rgba(15, 23, 42, 0.94);
    --ms-guide-text: #f8fafc;
    --ms-guide-border: rgba(56, 189, 248, 0.35);
}

[data-theme="light"] {
    --ms-bg-workspace: #f8fafc;
    --ms-grid-dot: rgba(100, 116, 139, 0.28);
    --ms-grid-line: rgba(203, 213, 225, 0.55);
    --ms-ribbon-bg: #ffffff;
    --ms-ribbon-border: #cbd5e1;
    --ms-panel-bg: #f1f5f9;
    --ms-panel-border: #cbd5e1;
    --ms-wire-color: #0284c7;
    --ms-comp-stroke: #0f172a;
    --ms-comp-fill: #ffffff;

    /* High-Contrast Curriculum Cards & Guidance (Light Theme) */
    --ms-card-bg: #ffffff;
    --ms-card-border: #e2e8f0;
    --ms-card-hover-border: #0284c7;
    --ms-card-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.07), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
    --ms-card-hover-shadow: 0 14px 30px -4px rgba(2, 132, 199, 0.16), 0 4px 12px -2px rgba(15, 23, 42, 0.06);
    --ms-card-title: #0f172a;
    --ms-card-desc: #334155;
    --ms-formula-bg: #f8fafc;
    --ms-formula-border: #e2e8f0;
    --ms-formula-text: #0f172a;
    --ms-btn-secondary-bg: #f1f5f9;
    --ms-btn-secondary-text: #0f172a;
    --ms-btn-secondary-border: #cbd5e1;
    --ms-btn-secondary-hover: #e2e8f0;
    --ms-guide-bg: #ffffff;
    --ms-guide-text: #0f172a;
    --ms-guide-border: #cbd5e1;
}

/* Base Workbench Container */
.ms-workbench-wrapper {
    position: relative;
    width: 100%;
    height: 860px;
    min-height: 680px;
    background: var(--ms-bg-workspace);
    border: 1px solid var(--ms-ribbon-border);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    user-select: none;
    font-family: 'Inter', -apple-system, sans-serif;
    transition: height 0.2s ease;
}

/* Fullscreen Mode */
.ms-workbench-wrapper.ms-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

/* Title Bar & Ribbon */
.ms-menu-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #090d16;
    border-bottom: 1px solid #1e293b;
    padding: 4px 12px;
    font-size: 0.8rem;
    color: #cbd5e1;
}

.ms-menu-left {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ms-logo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 800;
    color: #38bdf8;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    padding-right: 12px;
    border-right: 1px solid #334155;
    margin-right: 6px;
}

.ms-logo i {
    color: #f59e0b;
    font-size: 1rem;
}

.ms-menu-item {
    position: relative;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
    font-weight: 500;
}

.ms-menu-item:hover, .ms-menu-item.active {
    background: #1e293b;
    color: #f8fafc;
}

.ms-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    min-width: 200px;
    padding: 4px 0;
    z-index: 1000;
    display: none;
}

.ms-menu-item:hover .ms-dropdown-menu,
.ms-menu-item.active .ms-dropdown-menu {
    display: block;
}

.ms-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    font-size: 0.78rem;
    color: #cbd5e1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.ms-dropdown-item:hover {
    background: #0284c7;
    color: #ffffff;
}

.ms-dropdown-item kbd {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #64748b;
    background: rgba(0,0,0,0.3);
    padding: 2px 5px;
    border-radius: 3px;
}

.ms-dropdown-divider {
    height: 1px;
    background: #334155;
    margin: 4px 0;
}

/* Standard & Simulation Toolbars */
.ms-ribbon-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--ms-ribbon-bg);
    border-bottom: 1px solid var(--ms-ribbon-border);
    padding: 6px 12px;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.ms-toolbar-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ms-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 30px;
    padding: 0 8px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 5px;
    color: #e2e8f0;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.ms-tool-btn:hover {
    background: #1e293b;
    border-color: #0284c7;
    color: #38bdf8;
}

.ms-tool-btn.active {
    background: #0284c7;
    border-color: #38bdf8;
    color: #ffffff;
    box-shadow: 0 0 10px var(--ms-accent-glow);
}

.ms-tool-btn i {
    font-size: 0.82rem;
}

.ms-tool-divider {
    width: 1px;
    height: 22px;
    background: #334155;
    margin: 0 4px;
}

/* Simulation Controls (Play / Stop / Pause) */
.ms-sim-btn {
    height: 32px;
    padding: 0 14px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.ms-sim-btn.run {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.ms-sim-btn.run:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 0 18px rgba(16, 185, 129, 0.6);
}

.ms-sim-btn.stop {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
}

.ms-sim-btn.stop:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.ms-sim-clock {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #030712;
    border: 1px solid #1f2937;
    border-radius: 6px;
    padding: 4px 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: #4ade80;
}

.ms-clock-led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #475569;
}

.ms-clock-led.running {
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
    animation: msPulse 1s infinite alternate;
}

@keyframes msPulse {
    from { opacity: 0.6; }
    to { opacity: 1; }
}

/* Main Body Layout (Left Palette, Center Canvas, Right Instruments) */
.ms-body-layout {
    display: flex;
    flex: 1;
    position: relative;
    overflow: hidden;
    height: calc(100% - 76px);
}

/* Left Component Palette */
.ms-component-drawer {
    width: 250px;
    background: var(--ms-panel-bg);
    border-right: 1px solid var(--ms-panel-border);
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: transform 0.25s ease, width 0.25s ease;
}

.ms-drawer-header {
    padding: 10px 12px;
    background: #090d16;
    border-bottom: 1px solid #1f2937;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ms-drawer-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ms-search-input {
    width: calc(100% - 24px);
    margin: 8px 12px;
    background: #030712;
    border: 1px solid #334155;
    border-radius: 5px;
    color: #f8fafc;
    padding: 5px 8px;
    font-size: 0.76rem;
    outline: none;
}

.ms-search-input:focus {
    border-color: #0284c7;
    box-shadow: 0 0 6px var(--ms-accent-glow);
}

.ms-palette-categories {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px;
}

.ms-category-group {
    margin-bottom: 8px;
    border: 1px solid rgba(51, 65, 85, 0.4);
    border-radius: 6px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.6);
}

.ms-category-header {
    padding: 7px 10px;
    background: rgba(30, 41, 59, 0.6);
    font-size: 0.76rem;
    font-weight: 700;
    color: #38bdf8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ms-category-header:hover {
    background: rgba(30, 41, 59, 0.9);
}

.ms-category-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    padding: 8px;
}

.ms-comp-card {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 6px 4px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 58px;
}

.ms-comp-card:hover {
    border-color: #38bdf8;
    background: #1e293b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.ms-comp-icon-preview {
    width: 38px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 3px;
}

.ms-comp-icon-preview svg {
    max-width: 100%;
    max-height: 100%;
    stroke: #38bdf8;
    stroke-width: 2;
    fill: none;
}

.ms-comp-name {
    font-size: 0.68rem;
    color: #cbd5e1;
    font-weight: 600;
    line-height: 1.1;
}

/* Center Schematic Canvas */
.ms-canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background-color: var(--ms-bg-workspace);
    background-image: 
        radial-gradient(var(--ms-grid-dot) 1.2px, transparent 1.2px),
        linear-gradient(to right, var(--ms-grid-line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--ms-grid-line) 1px, transparent 1px);
    background-size: 20px 20px, 100px 100px, 100px 100px;
    cursor: crosshair;
}

.ms-schematic-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: all;
}

/* Schematic Elements (Wires, Components, Junctions) */
.ms-wire {
    stroke: var(--ms-wire-color);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    cursor: pointer;
    transition: stroke 0.15s, stroke-width 0.15s;
}

.ms-wire:hover {
    stroke: #38bdf8;
    stroke-width: 3.5;
}

.ms-wire.selected {
    stroke: var(--ms-wire-selected);
    stroke-width: 3;
}

.ms-wire-drawing {
    stroke: #f59e0b;
    stroke-width: 2;
    stroke-dasharray: 4, 4;
}

.ms-junction {
    fill: #e2e8f0;
    r: 3.5;
    cursor: pointer;
}

.ms-terminal-pin {
    fill: #ef4444;
    stroke: #090d16;
    stroke-width: 1.5;
    r: 4;
    cursor: pointer;
    transition: transform 0.15s, fill 0.15s;
}

.ms-terminal-pin:hover {
    fill: #10b981;
    transform: scale(1.4);
}

.ms-comp-group {
    cursor: grab;
    transition: filter 0.15s;
}

.ms-comp-group:active {
    cursor: grabbing;
}

.ms-comp-group.selected {
    filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.8));
}

.ms-comp-body {
    stroke: var(--ms-comp-stroke);
    stroke-width: 2;
    fill: var(--ms-comp-fill);
}

.ms-comp-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    fill: #94a3b8;
    user-select: none;
}

.ms-comp-text.val {
    fill: #38bdf8;
    font-weight: 600;
}

/* Right Instruments Toolbar (Vertical Bar) */
.ms-instruments-bar {
    width: 52px;
    background: #090d16;
    border-left: 1px solid #1e293b;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 4px;
    gap: 10px;
    z-index: 10;
}

.ms-inst-btn {
    width: 40px;
    height: 40px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.85rem;
    position: relative;
}

.ms-inst-btn:hover {
    background: #0284c7;
    border-color: #38bdf8;
    color: #ffffff;
    transform: scale(1.05);
}

.ms-inst-btn.active {
    background: #0284c7;
    color: #ffffff;
    box-shadow: 0 0 12px var(--ms-accent-glow);
}

.ms-inst-label {
    font-size: 0.55rem;
    font-weight: 700;
    margin-top: 2px;
    text-transform: uppercase;
}

/* Floating Instruments Windows (Oscilloscope, Multimeter, Function Generator) */
.ms-floating-window {
    position: absolute;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    z-index: 100;
    overflow: hidden;
    display: none;
    flex-direction: column;
    animation: msWindowPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes msWindowPop {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.ms-floating-window.active {
    display: flex;
}

.ms-window-header {
    background: #1e293b;
    border-bottom: 1px solid #334155;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: move;
}

.ms-window-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ms-window-close-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}

.ms-window-close-btn:hover {
    background: #ef4444;
    color: #ffffff;
}

/* Dual-Channel Cathode Ray Oscilloscope (CRO) */
.ms-cro-window {
    width: 680px;
    top: 30px;
    right: 60px;
}

.ms-cro-body {
    display: flex;
    padding: 12px;
    gap: 12px;
    background: #090d16;
}

.ms-cro-screen-container {
    position: relative;
    width: 380px;
    height: 300px;
    background: var(--ms-cro-screen);
    border: 3px solid #1e293b;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: inset 0 0 25px rgba(0,0,0,0.8);
}

.ms-cro-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.ms-cro-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ms-cro-section {
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 6px;
    padding: 8px;
}

.ms-cro-sec-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ms-cro-knob-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 6px;
}

.ms-cro-label {
    font-size: 0.72rem;
    color: #cbd5e1;
}

.ms-cro-select {
    background: #030712;
    border: 1px solid #334155;
    color: #38bdf8;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.74rem;
    padding: 3px 6px;
    border-radius: 4px;
    outline: none;
}

.ms-cro-autoset-btn {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px solid #38bdf8;
    color: #38bdf8;
    font-weight: 700;
    font-size: 0.72rem;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-bottom: 6px;
    transition: all 0.2s ease;
}
.ms-cro-autoset-btn:hover {
    background: #0284c7;
    color: #fff;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.ms-cro-pos-stepper {
    display: flex;
    align-items: center;
    gap: 4px;
}
.ms-cro-pos-btn {
    background: #0f172a;
    border: 1px solid #334155;
    color: #cbd5e1;
    font-size: 0.75rem;
    font-weight: bold;
    width: 22px;
    height: 22px;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}
.ms-cro-pos-btn:hover {
    background: #1e293b;
    border-color: #38bdf8;
    color: #38bdf8;
}
.ms-cro-pos-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #cbd5e1;
    min-width: 50px;
    text-align: center;
}

.ms-cro-telemetry {
    background: #030712;
    border: 1px solid #1f2937;
    border-radius: 4px;
    padding: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    color: #4ade80;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

/* Digital Multimeter (DMM - Agilent Style) */
.ms-dmm-window {
    width: 440px;
    top: 50px;
    left: 280px;
}

.ms-dmm-body {
    padding: 12px;
    background: #090d16;
}

.ms-dmm-display {
    background: var(--ms-dmm-lcd-bg);
    border: 2px solid #1e293b;
    border-radius: 6px;
    padding: 12px 16px;
    text-align: right;
    margin-bottom: 12px;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.9);
}

.ms-dmm-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--ms-dmm-digits);
    letter-spacing: 0.05em;
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.6);
}

.ms-dmm-unit {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    color: #38bdf8;
    margin-left: 6px;
}

.ms-dmm-modes {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}

.ms-dmm-mode-btn {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 5px;
    color: #cbd5e1;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 6px 0;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
}

.ms-dmm-mode-btn:hover {
    background: #0284c7;
    color: #ffffff;
}

.ms-dmm-mode-btn.active {
    background: #0284c7;
    border-color: #38bdf8;
    color: #ffffff;
    box-shadow: 0 0 10px var(--ms-accent-glow);
}

/* Function Generator (XFG) */
.ms-xfg-window {
    width: 420px;
    top: 80px;
    left: 320px;
}

.ms-xfg-body {
    padding: 12px;
    background: #090d16;
}

.ms-xfg-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 8px;
}

.ms-xfg-slider {
    flex: 1;
    accent-color: #0284c7;
}

/* Syllabus Modules Drawer / Bar */
.ms-modules-bar {
    background: #090d16;
    border-top: 1px solid #1e293b;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.78rem;
    color: #94a3b8;
}

.ms-module-select {
    background: #1e293b;
    border: 1px solid #334155;
    color: #f8fafc;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.78rem;
    outline: none;
    cursor: pointer;
    max-width: 420px;
}

.ms-module-select option {
    background: #0f172a;
    color: #f8fafc;
}

/* ==========================================================================
   Engineering Component Properties Inspector & Value Editor
   ========================================================================== */
.ms-inspector-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.96);
    width: 460px;
    max-width: 95vw;
    max-height: 88vh;
    background: #0f172a;
    border: 1px solid #38bdf8;
    border-radius: 12px;
    box-shadow: 0 25px 70px rgba(0,0,0,0.85), 0 0 25px rgba(56, 189, 248, 0.2);
    z-index: 500;
    display: none;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
    opacity: 0;
}

.ms-inspector-modal.active {
    display: flex;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.ms-inspector-body {
    padding: 16px 18px;
    overflow-y: auto;
    max-height: calc(88vh - 120px);
}

.ms-inspector-body::-webkit-scrollbar {
    width: 6px;
}
.ms-inspector-body::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}
.ms-inspector-body::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Header Component Tag */
.ms-insp-header-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.6);
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #1e293b;
    margin-bottom: 14px;
}
.ms-insp-header-tag .badge {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* Inspector Form Groups */
.ms-insp-group {
    margin-bottom: 14px;
}
.ms-insp-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.74rem;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ms-insp-label span.note {
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 400;
    text-transform: none;
}

/* Unit-Integrated Input Row */
.ms-insp-unit-group {
    display: flex;
    align-items: stretch;
    background: #030712;
    border: 1px solid #334155;
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ms-insp-unit-group:focus-within {
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}
.ms-insp-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 8px 12px;
    color: #f8fafc;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    font-weight: 600;
    outline: none;
    min-width: 0;
}
.ms-insp-unit-select {
    background: #1e293b;
    border: none;
    border-left: 1px solid #334155;
    color: #38bdf8;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0 10px;
    cursor: pointer;
    outline: none;
}
.ms-insp-unit-select option {
    background: #0f172a;
    color: #f8fafc;
}

/* Standard Preset Value Pills */
.ms-insp-preset-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 7px;
}
.ms-insp-pill {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid #334155;
    color: #cbd5e1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.ms-insp-pill:hover {
    background: #334155;
    color: #38bdf8;
    border-color: #38bdf8;
    transform: translateY(-1px);
}
.ms-insp-pill.active {
    background: rgba(56, 189, 248, 0.2);
    border-color: #38bdf8;
    color: #38bdf8;
    font-weight: 700;
}

/* Interactive Slider Row */
.ms-insp-slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}
.ms-insp-range {
    flex: 1;
    accent-color: #38bdf8;
    height: 6px;
    cursor: pointer;
}
.ms-insp-badge {
    background: #030712;
    border: 1px solid #334155;
    border-radius: 4px;
    padding: 3px 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    color: #4ade80;
    min-width: 55px;
    text-align: center;
}

/* Segmented Buttons (e.g. Waveforms, Switch States) */
.ms-insp-seg-group {
    display: flex;
    background: #030712;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 3px;
    gap: 4px;
}
.ms-insp-seg-btn {
    flex: 1;
    background: transparent;
    border: none;
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.ms-insp-seg-btn:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.05);
}
.ms-insp-seg-btn.active {
    background: #0284c7;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}
.ms-insp-seg-btn.active.green {
    background: #16a34a;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.4);
}
.ms-insp-seg-btn.active.amber {
    background: #d97706;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.4);
}

/* LED Color Buttons */
.ms-insp-color-group {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}
.ms-insp-color-btn {
    flex: 1;
    height: 32px;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    transition: all 0.15s ease;
}
.ms-insp-color-btn:hover {
    transform: scale(1.05);
}
.ms-insp-color-btn.active {
    border-color: #ffffff;
    box-shadow: 0 0 12px currentColor;
}

/* Helper note */
.ms-insp-help {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 4px;
    line-height: 1.4;
}

/* Inspector Footer */
.ms-inspector-footer {
    padding: 12px 18px;
    background: #090d16;
    border-top: 1px solid #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   On-Canvas Floating Quick Action Bar (For Selected Component)
   ========================================================================== */
.ms-comp-quick-actions {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(10px);
    border: 1px solid #38bdf8;
    border-radius: 8px;
    padding: 4px 6px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.75), 0 0 14px rgba(56, 189, 248, 0.35);
    z-index: 150;
    transform: translate(-50%, -100%);
    pointer-events: all;
    animation: msFadeSlideUp 0.15s ease-out;
}

@keyframes msFadeSlideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -90%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -100%);
    }
}

.ms-quick-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border: 1px solid transparent;
    border-radius: 5px;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    background: #1e293b;
    color: #e2e8f0;
}
.ms-quick-btn:hover {
    background: #334155;
    color: #ffffff;
}
.ms-quick-btn.edit {
    background: rgba(2, 132, 199, 0.25);
    border-color: #0284c7;
    color: #38bdf8;
}
.ms-quick-btn.edit:hover {
    background: #0284c7;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}
.ms-quick-btn.rotate:hover {
    color: #fbbf24;
    border-color: #fbbf24;
}
.ms-quick-btn.delete {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}
.ms-quick-btn.delete:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

/* ==========================================================================
   Wire Selection & Professional Tweak Handles
   ========================================================================== */
.ms-wire.selected {
    stroke: #f59e0b !important;
    stroke-width: 3.5px !important;
    filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.7));
}

.ms-wire-handle {
    fill: #38bdf8;
    stroke: #ffffff;
    stroke-width: 2.2px;
    cursor: grab;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.65));
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), fill 0.15s ease;
}

.ms-wire-handle:hover {
    transform: scale(1.45);
    fill: #f59e0b;
    stroke: #ffffff;
    cursor: grabbing;
}

.ms-wire-handle.trunk {
    fill: #0284c7;
}

.ms-wire-handle.waypoint {
    fill: #10b981;
}

.ms-wire-handle.corner {
    fill: #a855f7;
}

.ms-wire-handle.active {
    fill: #22c55e;
    transform: scale(1.5);
    cursor: grabbing;
}

/* On-Canvas Floating Quick Action Bar for Wires */
.ms-wire-quick-actions {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(10px);
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 4px 6px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.75), 0 0 14px rgba(245, 158, 11, 0.35);
    z-index: 150;
    transform: translate(-50%, -100%);
    pointer-events: all;
    animation: msFadeSlideUp 0.15s ease-out;
}

/* ==========================================================================
   AI Circuit Diagram Recognition & Auto-Simulator Modal
   ========================================================================== */
.ms-diagram-modal {
    width: 780px !important;
    max-width: 95vw !important;
}

.ms-diagram-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 768px) {
    .ms-diagram-grid {
        grid-template-columns: 1fr;
    }
}

.ms-diagram-dropzone {
    border: 2px dashed #38bdf8;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 10px;
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    position: relative;
}

.ms-diagram-dropzone:hover, .ms-diagram-dropzone.dragover {
    background: rgba(2, 132, 199, 0.15);
    border-color: #7dd3fc;
    transform: scale(1.01);
}

.ms-diagram-preview-box {
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
    max-height: 180px;
    background: #030712;
    border: 1px solid #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.ms-diagram-preview-box img {
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
    border-radius: 6px;
}

.ms-diagram-samples-title {
    font-size: 0.76rem;
    font-weight: 700;
    color: #94a3b8;
    margin: 12px 0 6px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ms-diagram-samples-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ms-sample-chip {
    background: #1e293b;
    border: 1px solid #334155;
    color: #e2e8f0;
    padding: 4px 9px;
    border-radius: 6px;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.ms-sample-chip:hover {
    background: #0284c7;
    border-color: #38bdf8;
    color: #ffffff;
    transform: translateY(-1px);
}

.ms-diagram-status-box {
    background: #090d16;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 12px;
    min-height: 180px;
    display: flex;
    flex-direction: column;
}

.ms-diagram-summary-card {
    background: rgba(2, 132, 199, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
}

.ms-detected-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.ms-detected-pill {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: #38bdf8;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    padding: 2px 7px;
    border-radius: 4px;
}

/* ==========================================================================
   On-Canvas Toast Notification
   ========================================================================== */
.ms-canvas-toast {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid #0284c7;
    border-radius: 8px;
    padding: 8px 16px;
    color: #f8fafc;
    font-size: 0.78rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 12px rgba(2, 132, 199, 0.4);
    z-index: 500;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: msToastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes msToastIn {
    from {
        opacity: 0;
        transform: translate(-50%, -10px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Bottom Syllabus Curriculum Cards & Formula Containers */
.ms-curriculum-container {
    margin-top: 2.5rem;
    margin-bottom: 2.5rem;
}

.ms-curriculum-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1.5rem;
    margin-top: 1.25rem;
}

.ms-module-card {
    background: var(--ms-card-bg);
    border: 1px solid var(--ms-card-border);
    border-radius: 12px;
    padding: 1.4rem 1.45rem;
    box-shadow: var(--ms-card-shadow);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
                border-color 0.25s ease;
}

.ms-module-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    transition: background 0.25s ease;
}

.ms-module-card:hover {
    transform: translateY(-4px);
    border-color: var(--ms-card-hover-border);
    box-shadow: var(--ms-card-hover-shadow);
}

.ms-module-card:hover::before {
    background: linear-gradient(90deg, #0284c7, #38bdf8);
}

.ms-module-card h3 {
    color: var(--ms-card-title) !important;
    font-size: 1.2rem !important;
    font-weight: 700 !important;
    margin: 0.6rem 0 0.4rem 0 !important;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.ms-module-card p {
    color: var(--ms-card-desc) !important;
    font-size: 0.86rem !important;
    line-height: 1.55 !important;
    margin-bottom: 0.85rem !important;
    flex-grow: 1;
}

/* Mathematical Equation Box with High Contrast & Subtle Scrollbar */
.ms-formula-box {
    background: var(--ms-formula-bg);
    border: 1px solid var(--ms-formula-border);
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
    margin: 0.4rem 0 1rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ms-formula-box::-webkit-scrollbar {
    height: 5px;
}

.ms-formula-box::-webkit-scrollbar-track {
    background: transparent;
}

.ms-formula-box::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 4px;
}

.ms-formula-box::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.6);
}

.ms-module-card .katex,
.ms-formula-box .katex,
.ms-formula-box .katex-display .katex {
    color: var(--ms-formula-text) !important;
    font-size: 0.92rem;
}

.ms-formula-box .katex-display {
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
    text-align: center;
}

/* Adaptive Module Badges */
.ms-module-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    width: fit-content;
    border: 1px solid transparent;
}

.ms-module-badge.badge-mod1 { background: rgba(2, 132, 199, 0.12); color: #0284c7; border-color: rgba(2, 132, 199, 0.28); }
.ms-module-badge.badge-mod2 { background: rgba(16, 185, 129, 0.12); color: #059669; border-color: rgba(16, 185, 129, 0.28); }
.ms-module-badge.badge-mod3 { background: rgba(217, 119, 6, 0.12); color: #d97706; border-color: rgba(217, 119, 6, 0.28); }
.ms-module-badge.badge-mod4 { background: rgba(147, 51, 234, 0.12); color: #9333ea; border-color: rgba(147, 51, 234, 0.28); }
.ms-module-badge.badge-mod5 { background: rgba(225, 29, 72, 0.12); color: #e11d48; border-color: rgba(225, 29, 72, 0.28); }
.ms-module-badge.badge-mod6 { background: rgba(14, 165, 233, 0.12); color: #0284c7; border-color: rgba(14, 165, 233, 0.28); }
.ms-module-badge.badge-mod7 { background: rgba(13, 148, 136, 0.12); color: #0d9488; border-color: rgba(13, 148, 136, 0.28); }

:root:not([data-theme="light"]) .ms-module-badge.badge-mod1 { background: rgba(56, 189, 248, 0.16); color: #38bdf8; border-color: rgba(56, 189, 248, 0.3); }
:root:not([data-theme="light"]) .ms-module-badge.badge-mod2 { background: rgba(34, 197, 94, 0.16); color: #4ade80; border-color: rgba(34, 197, 94, 0.3); }
:root:not([data-theme="light"]) .ms-module-badge.badge-mod3 { background: rgba(245, 158, 11, 0.16); color: #fbbf24; border-color: rgba(245, 158, 11, 0.3); }
:root:not([data-theme="light"]) .ms-module-badge.badge-mod4 { background: rgba(168, 85, 247, 0.16); color: #c084fc; border-color: rgba(168, 85, 247, 0.3); }
:root:not([data-theme="light"]) .ms-module-badge.badge-mod5 { background: rgba(244, 63, 94, 0.16); color: #fb7185; border-color: rgba(244, 63, 94, 0.3); }
:root:not([data-theme="light"]) .ms-module-badge.badge-mod6 { background: rgba(56, 189, 248, 0.16); color: #38bdf8; border-color: rgba(56, 189, 248, 0.3); }
:root:not([data-theme="light"]) .ms-module-badge.badge-mod7 { background: rgba(45, 212, 191, 0.16); color: #2dd4bf; border-color: rgba(45, 212, 191, 0.3); }

/* Launch Actions / Buttons */
.ms-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 0.5rem;
}

.ms-module-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 6px;
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: #ffffff !important;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
    transition: all 0.15s ease;
}

.ms-module-btn:hover {
    background: linear-gradient(135deg, #0369a1, #075985);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.38);
    color: #ffffff !important;
}

.ms-module-btn.btn-secondary {
    background: var(--ms-btn-secondary-bg);
    color: var(--ms-btn-secondary-text) !important;
    border: 1px solid var(--ms-btn-secondary-border);
    box-shadow: none;
}

.ms-module-btn.btn-secondary:hover {
    background: var(--ms-btn-secondary-hover);
    border-color: #0284c7;
    color: var(--ms-btn-secondary-text) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* Floating On-Canvas Guidance Bar */
.ms-canvas-guidance {
    position: absolute;
    bottom: 12px;
    left: 16px;
    background: var(--ms-guide-bg);
    border: 1px solid var(--ms-guide-border);
    color: var(--ms-guide-text);
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 0.76rem;
    line-height: 1.4;
    z-index: 5;
    pointer-events: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100% - 32px);
    flex-wrap: wrap;
}

.ms-canvas-guidance strong {
    color: var(--ms-guide-text);
    font-weight: 700;
}

.ms-canvas-guidance kbd {
    background: rgba(148, 163, 184, 0.22);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.72rem;
    font-family: monospace;
    color: inherit;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Mobile Compatibility */
@media (max-width: 992px) {
    .ms-workbench-wrapper {
        height: 720px;
    }
    .ms-component-drawer {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        transform: translateX(-100%);
        box-shadow: 5px 0 25px rgba(0,0,0,0.5);
    }
    .ms-component-drawer.open {
        transform: translateX(0);
    }
    .ms-cro-window {
        width: 95vw;
        left: 2.5vw;
        right: auto;
    }
    .ms-cro-body {
        flex-direction: column;
    }
    .ms-cro-screen-container {
        width: 100%;
        height: 220px;
    }
    .ms-dmm-window, .ms-xfg-window {
        width: 92vw;
        left: 4vw;
    }
}

@media (max-width: 640px) {
    .ms-workbench-wrapper {
        height: 640px;
        border-radius: 6px;
    }
    .ms-menu-bar {
        overflow-x: auto;
    }
    .ms-ribbon-toolbar {
        gap: 4px;
    }
    .ms-tool-btn span {
        display: none;
    }
    .ms-instruments-bar {
        width: 44px;
    }
    .ms-inst-btn {
        width: 36px;
        height: 36px;
    }
    .ms-modules-bar {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ==========================================================================
   Advanced Real-Time Probe HUD & Virtual Instruments Enhancements
   ========================================================================== */
.ms-pin-hitbox {
    fill: transparent;
    stroke: transparent;
    cursor: crosshair;
    pointer-events: all;
}

.ms-pin-hitbox:hover + .ms-terminal-pin,
.ms-terminal-pin:hover {
    fill: #10b981 !important;
    stroke: #ffffff !important;
    transform: scale(1.5);
}

/* Interactive Live Node Probe Tooltip */
.ms-probe-tooltip {
    position: absolute;
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid #0284c7;
    border-radius: 6px;
    padding: 6px 10px;
    color: #f8fafc;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    pointer-events: none;
    z-index: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 10px rgba(2, 132, 199, 0.3);
    display: none;
    white-space: nowrap;
}

.ms-probe-tooltip .ms-probe-header {
    font-size: 0.65rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    margin-bottom: 2px;
}

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

.ms-probe-tooltip .ms-probe-val {
    color: #4ade80;
    font-weight: 700;
}

/* Floating Window Draggable Cursor */
.ms-floating-window {
    cursor: default;
}

.ms-floating-window.dragging {
    opacity: 0.95;
    user-select: none;
    box-shadow: 0 25px 60px rgba(0,0,0,0.85);
}

/* Glowing LED Dynamic Style */
.ms-led-lit {
    filter: drop-shadow(0 0 8px currentColor);
    animation: msLedFlicker 0.1s infinite alternate;
}

@keyframes msLedFlicker {
    from { opacity: 0.9; }
    to { opacity: 1; }
}

/* Switch Interactive Hover */
.ms-switch-interactive {
    cursor: pointer;
}

.ms-switch-interactive:hover line {
    stroke: #22c55e !important;
}
