/**
 * Python4Physics - Tinkercad Circuits Pro: Photorealistic Circuit Simulator
 * =========================================================================
 * Realistic solderless breadboard with 3D embossed holes, metal contacts,
 * ABS plastic texture, power rail color stripes, column numbering.
 * Professional orthogonal wiring with drop shadows.
 * Drag-and-drop component placement with ghost preview.
 * Full Tinkercad-faithful UI chrome.
 */

/* ========================================
   CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ======================================== */
:root {
    --tc-bg-canvas: #e8ecf1;
    --tc-grid-color: rgba(100, 116, 139, 0.15);
    --tc-toolbar-bg: #ffffff;
    --tc-toolbar-border: #e2e8f0;
    --tc-panel-bg: #ffffff;
    --tc-panel-border: #e2e8f0;
    --tc-text-main: #1e293b;
    --tc-text-muted: #64748b;
    --tc-accent-green: #10b981;
    --tc-accent-blue: #0284c7;
    --tc-accent-red: #ef4444;
    --tc-accent-amber: #f59e0b;

    /* Breadboard Tokens */
    --bb-board-bg: #f5f0e8;
    --bb-board-border: #c8bfaf;
    --bb-hole-bg: #1a1a1a;
    --bb-hole-ring: #8a8a8a;
    --bb-hole-inner: #2a2a2a;
    --bb-trough-bg: #d6cfc2;
    --bb-rail-red: #dc2626;
    --bb-rail-blue: #2563eb;
    --bb-rail-stripe-alpha: 0.25;
    --bb-label-color: #7c7365;
    --bb-hole-size: 6px;
    --bb-hole-gap: 0px;
}

/* Dark mode compatibility */
[data-theme="dark"] .tinkercad-studio {
    --tc-bg-canvas: #0c1222;
    --tc-grid-color: rgba(255, 255, 255, 0.04);
    --tc-toolbar-bg: #151e30;
    --tc-toolbar-border: rgba(255, 255, 255, 0.08);
    --tc-panel-bg: #151e30;
    --tc-panel-border: rgba(255, 255, 255, 0.08);
    --tc-text-main: #f1f5f9;
    --tc-text-muted: #94a3b8;
}

/* ========================================
   STUDIO CONTAINER
   ======================================== */
.tinkercad-studio {
    background: var(--tc-panel-bg);
    border: 1px solid var(--tc-toolbar-border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.18),
        0 0 0 1px rgba(2, 132, 199, 0.06);
    margin-bottom: 3.5rem;
    position: relative;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    user-select: none;
}

/* ========================================
   TOP APP NAVBAR
   ======================================== */
.tc-top-navbar {
    background: var(--tc-toolbar-bg);
    border-bottom: 1px solid var(--tc-toolbar-border);
    padding: 0.55rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.tc-project-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tc-logo-badge {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #fff;
    font-weight: 800;
    font-size: 0.78rem;
    padding: 4px 10px;
    border-radius: 6px;
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.tc-title-input {
    background: transparent;
    border: 1px solid transparent;
    font-size: 1rem;
    font-weight: 700;
    color: var(--tc-text-main);
    padding: 3px 8px;
    border-radius: 4px;
    outline: none;
    transition: all 0.2s;
    min-width: 200px;
}

.tc-title-input:hover,
.tc-title-input:focus {
    background: rgba(0, 0, 0, 0.04);
    border-color: var(--tc-toolbar-border);
}

/* View Mode Switcher */
.tc-view-modes {
    display: flex;
    background: rgba(0, 0, 0, 0.04);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--tc-toolbar-border);
}

.tc-view-tab {
    padding: 4px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--tc-text-muted);
    border-radius: 6px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s;
    white-space: nowrap;
}

.tc-view-tab:hover {
    color: var(--tc-text-main);
    background: rgba(0, 0, 0, 0.03);
}

.tc-view-tab.active {
    background: #0284c7;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}

/* ========================================
   ACTION TOOLS BAR
   ======================================== */
.tc-tools-bar {
    background: var(--tc-toolbar-bg);
    border-bottom: 1px solid var(--tc-toolbar-border);
    padding: 0.4rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.tc-tools-left,
.tc-tools-right {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.tc-tool-btn {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    border: 1px solid var(--tc-toolbar-border);
    background: transparent;
    color: var(--tc-text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.15s;
}

.tc-tool-btn:hover:not(:disabled) {
    background: rgba(2, 132, 199, 0.08);
    color: #0284c7;
    border-color: #93c5fd;
}

.tc-tool-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.tc-tool-btn.active {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}

/* Wire Color Button & Palette */
.tc-wire-color-dropdown {
    position: relative;
}

.tc-wire-color-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    height: 34px;
    border-radius: 6px;
    border: 1px solid var(--tc-toolbar-border);
    background: transparent;
    cursor: pointer;
    color: var(--tc-text-main);
    font-size: 0.82rem;
    font-weight: 600;
    transition: border-color 0.15s;
}

.tc-wire-color-btn:hover {
    border-color: #93c5fd;
}

.tc-wire-color-btn .swatch-preview {
    width: 22px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.18);
}

.tc-color-palette-popover {
    position: absolute;
    top: 42px;
    left: 0;
    z-index: 100;
    background: var(--tc-panel-bg);
    border: 1px solid var(--tc-toolbar-border);
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    width: 170px;
}

.tc-color-option {
    width: 32px;
    height: 24px;
    border-radius: 5px;
    border: 2.5px solid transparent;
    cursor: pointer;
    transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}

.tc-color-option:hover {
    transform: scale(1.18);
    border-color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

.tc-color-option.selected {
    border-color: #0284c7;
    box-shadow: 0 0 0 2px #38bdf8;
}

/* Wire Type Button */
.tc-wire-type-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    height: 34px;
    border-radius: 6px;
    border: 1px solid var(--tc-toolbar-border);
    background: transparent;
    cursor: pointer;
    color: var(--tc-text-main);
    font-size: 0.8rem;
    font-weight: 600;
}

.tc-divider-v {
    width: 1px;
    height: 24px;
    background: var(--tc-toolbar-border);
    margin: 0 3px;
}

/* Simulation Buttons */
.btn-tc-sim {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    white-space: nowrap;
}

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

.btn-tc-sim.start:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 5px 18px rgba(16, 185, 129, 0.5);
    transform: translateY(-1px);
}

.btn-tc-sim.stop {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
    box-shadow: 0 3px 12px rgba(239, 68, 68, 0.4);
    animation: tcPulse 2s infinite;
}

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

.btn-tc-code-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    background: transparent;
    color: var(--tc-text-main);
    border: 1px solid var(--tc-toolbar-border);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-tc-code-toggle:hover,
.btn-tc-code-toggle.active {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}

.tc-sim-time-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    background: #0f172a;
    color: #38bdf8;
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    border: 1px solid rgba(56, 189, 248, 0.2);
    min-width: 88px;
    text-align: center;
    letter-spacing: 0.02em;
}

/* ========================================
   MAIN STUDIO LAYOUT
   ======================================== */
.tc-workbench-body {
    display: flex;
    height: 680px;
    position: relative;
    overflow: hidden;
    background: var(--tc-bg-canvas);
}

/* Canvas Area */
.tc-canvas-container {
    flex: 1;
    height: 100%;
    position: relative;
    overflow: hidden;
    background-color: var(--tc-bg-canvas);
    background-image:
        radial-gradient(circle, var(--tc-grid-color) 1px, transparent 1px);
    background-size: 16px 16px;
    cursor: default;
}

/* Wiring mode cursor */
.tc-canvas-container.wiring-mode {
    cursor: crosshair;
}

.tc-canvas-stage {
    position: absolute;
    top: 0;
    left: 0;
    width: 2400px;
    height: 2000px;
    transform-origin: 0 0;
    transition: transform 0.06s ease-out;
}

/* Canvas Zoom Controls */
.tc-canvas-nav {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    background: var(--tc-panel-bg);
    border: 1px solid var(--tc-toolbar-border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.tc-nav-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: var(--tc-text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.12s;
    border-bottom: 1px solid var(--tc-toolbar-border);
}

.tc-nav-btn:last-child {
    border-bottom: none;
}

.tc-nav-btn:hover {
    background: rgba(2, 132, 199, 0.08);
    color: #0284c7;
}

/* ========================================
   SVG WIRES LAYER
   ======================================== */
.tc-wires-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 24;
    pointer-events: none;
}

.tc-wire-svg-path {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    cursor: pointer;
    pointer-events: stroke;
    filter: drop-shadow(0 1.5px 2px rgba(0, 0, 0, 0.35));
    transition: stroke-width 0.12s;
}

.tc-wire-svg-path:hover {
    stroke-width: 5.5px !important;
    filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.7));
}

.tc-wire-svg-path.selected {
    stroke-width: 6px !important;
    filter: drop-shadow(0 0 10px #38bdf8) drop-shadow(0 0 4px #ffffff) !important;
}

/* Rubberband live drawing wire */
.tc-rubberband-wire {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 8, 5;
    animation: tcDashAnim 0.8s linear infinite;
    pointer-events: none;
    opacity: 0.85;
}

@keyframes tcDashAnim {
    from { stroke-dashoffset: 26; }
    to { stroke-dashoffset: 0; }
}

/* Wire Waypoint Handle */
.tc-wire-waypoint {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #0284c7;
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 12;
    cursor: grab;
    pointer-events: all;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s;
}

.tc-wire-waypoint:hover {
    transform: translate(-50%, -50%) scale(1.3);
}

.tc-wire-waypoint:active {
    cursor: grabbing;
    background: #38bdf8;
}

/* ========================================
   TERMINAL PIN SNAPPING POINTS & OVERLAY
   ======================================== */
#tcTerminalsContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: auto;
}

#tcComponentsContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 40;
}

.tc-terminal,
.tc-terminal-pin {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid transparent;
    cursor: crosshair;
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 15;
    pointer-events: auto;
    transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

/* Touch & mouse hit target - generous 22px radius for effortless wire starting and landing */
.tc-terminal::after,
.tc-terminal-pin::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: transparent;
    cursor: crosshair;
    pointer-events: auto;
}

.tc-terminal-pin.tc-bb-pin {
    z-index: 15;
}
.tc-terminal-pin.tc-ard-pin {
    z-index: 35;
}
/* Photorealistic metallic solder terminal contacts for placed components */
.tc-terminal-pin.tc-comp-pin {
    z-index: 48;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #f1f5f9 15%, #94a3b8 55%, #475569 85%, #1e293b 100%);
    border: 1.5px solid #cbd5e1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tc-terminal-pin.tc-comp-pin::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.4);
    pointer-events: none;
}

/* Component hovered or selected: pins illuminate with cyan high-visibility halos */
.tc-terminal-pin.tc-comp-pin.selected-parent,
.tc-terminal-pin.tc-comp-pin.hovered-parent {
    border-color: #38bdf8 !important;
    background: radial-gradient(circle at 35% 35%, #7dd3fc 20%, #0284c7 65%, #0369a1 100%) !important;
    box-shadow: 0 0 10px #38bdf8, 0 0 18px rgba(56, 189, 248, 0.65) !important;
    transform: translate(-50%, -50%) scale(1.3) !important;
    z-index: 68 !important;
}

/* Active wiring mode: all component pins and connection points illuminate like target docking rings */
.tc-wiring-mode .tc-terminal-pin.tc-comp-pin {
    border-color: #38bdf8;
    background: radial-gradient(circle at 35% 35%, #bae6fd 15%, #0284c7 65%, #0369a1 100%);
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.85), 0 0 16px rgba(56, 189, 248, 0.45);
    animation: tcPinTargetPulse 1.4s infinite ease-in-out;
    z-index: 55;
}

.tc-wiring-mode .tc-terminal-pin.tc-ard-pin {
    background: rgba(56, 189, 248, 0.35);
    border-color: #38bdf8;
    box-shadow: 0 0 6px rgba(56, 189, 248, 0.6);
}

@keyframes tcPinTargetPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1.1);
        box-shadow: 0 0 8px rgba(56, 189, 248, 0.8), 0 0 14px rgba(56, 189, 248, 0.4);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.4);
        box-shadow: 0 0 14px rgba(56, 189, 248, 0.95), 0 0 24px rgba(56, 189, 248, 0.7);
    }
}

/* Mini pin identification badge */
.tc-comp-pin-tag {
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(56, 189, 248, 0.5);
    color: #e2e8f0;
    font-size: 0.62rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    padding: 1px 4px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.tc-comp-pin:hover .tc-comp-pin-tag,
.tc-comp-pin.selected-parent .tc-comp-pin-tag,
.tc-comp-pin.hovered-parent .tc-comp-pin-tag,
.tc-wiring-mode .tc-comp-pin-tag {
    opacity: 1;
    visibility: visible;
    border-color: #38bdf8;
    color: #38bdf8;
    transform: translateX(-50%) translateY(1px);
    font-weight: 800;
}

.tc-terminal:hover,
.tc-terminal.active,
.tc-terminal-pin:hover,
.tc-terminal-pin.active {
    background: rgba(16, 185, 129, 0.8) !important;
    border-color: #10b981 !important;
    box-shadow: 0 0 12px #10b981, 0 0 24px rgba(16, 185, 129, 0.65) !important;
    transform: translate(-50%, -50%) scale(1.5) !important;
    z-index: 100 !important;
}

.tc-terminal.snap-candidate,
.tc-terminal-pin.snap-candidate {
    border-color: #38bdf8 !important;
    background: rgba(56, 189, 248, 0.85) !important;
    box-shadow: 0 0 16px rgba(56, 189, 248, 1), 0 0 28px rgba(56, 189, 248, 0.7) !important;
    transform: translate(-50%, -50%) scale(1.6) !important;
    z-index: 100 !important;
    cursor: crosshair !important;
}

@keyframes tcTerminalPulse {
    0% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.8); }
    50% { transform: translate(-50%, -50%) scale(2.4); box-shadow: 0 0 14px 6px rgba(16, 185, 129, 0.9); }
    100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.tc-pulse-snap {
    animation: tcTerminalPulse 0.4s ease-out !important;
}

/* Floating Wire Selection Chip with Delete Option */
.tc-wire-floating-action {
    position: absolute;
    transform: translate(-50%, -100%);
    margin-top: -12px;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 20px;
    padding: 3px 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
    z-index: 60;
    font-size: 0.72rem;
    font-weight: 700;
    color: #f8fafc;
    pointer-events: all;
    animation: tcPopupFadeIn 0.15s ease-out;
}

.tc-wire-floating-action button {
    background: #ef4444;
    border: none;
    color: #ffffff;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
}

.tc-wire-floating-action button:hover {
    background: #dc2626;
    transform: scale(1.05);
}

/* Pin Tooltip */
.tc-pin-tooltip {
    position: absolute;
    bottom: calc(100% + 7px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(56, 189, 248, 0.6);
    color: #f8fafc;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 5px;
    white-space: nowrap;
    pointer-events: none !important;
    user-select: none;
    z-index: 120 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 8px rgba(56, 189, 248, 0.35);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease, transform 0.12s ease;
    letter-spacing: 0.01em;
}

.tc-terminal:hover .tc-pin-tooltip,
.tc-terminal-pin:hover .tc-pin-tooltip,
.tc-terminal.snap-candidate .tc-pin-tooltip,
.tc-terminal-pin.snap-candidate .tc-pin-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-2px);
}

/* ========================================
   PHOTOREALISTIC ARDUINO UNO R3
   ======================================== */
.tc-arduino-uno {
    position: absolute;
    width: 360px;
    height: 250px;
    cursor: grab;
    z-index: 5;
    filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.22));
    transition: filter 0.2s;
}

.tc-arduino-uno:hover {
    filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.28));
}

.tc-arduino-uno:active {
    cursor: grabbing;
}

/* ========================================
   PHOTOREALISTIC SOLDERLESS BREADBOARD
   ======================================== */
.tc-breadboard {
    position: absolute;
    width: 600px;
    height: 330px;
    cursor: grab;
    z-index: 5;
    user-select: none;
    filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.16));
    transition: filter 0.2s;
}

.tc-breadboard:hover {
    filter: drop-shadow(0 16px 32px rgba(0, 0, 0, 0.22));
}

.tc-breadboard:active {
    cursor: grabbing;
}

#tcBreadboardSvg {
    display: block;
    width: 600px;
    height: 330px;
    pointer-events: all;
}

.tc-bb-bus-rect {
    fill: rgba(56, 189, 248, 0.32);
    stroke: #0284c7;
    stroke-width: 1.5;
    rx: 4px;
    filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.5));
}

/* Power Rail Containers */
.tc-bb-power-rail {
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
}

/* Color stripe behind the power rail holes */
.tc-bb-rail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    padding: 1px 0;
}

/* Red line for positive rail */
.tc-bb-rail-row:first-child {
    border-top: 2.5px solid var(--bb-rail-red);
}

/* Blue line for negative rail */
.tc-bb-rail-row:last-child {
    border-bottom: 2.5px solid var(--bb-rail-blue);
}

.tc-bb-sign-plus {
    color: var(--bb-rail-red);
    font-weight: 900;
    font-size: 0.75rem;
    width: 12px;
    text-align: center;
    line-height: 1;
}

.tc-bb-sign-minus {
    color: var(--bb-rail-blue);
    font-weight: 900;
    font-size: 0.85rem;
    width: 12px;
    text-align: center;
    line-height: 1;
}

/* Hole Group Container */
.tc-bb-holes-group {
    display: flex;
    gap: 0px;
    flex: 1;
    margin: 0 6px;
    justify-content: space-between;
}

/* ========================================
   BREADBOARD HOLE - PHOTOREALISTIC 3D
   ======================================== */
.tc-bb-hole {
    width: var(--bb-hole-size);
    height: var(--bb-hole-size);
    background: var(--bb-hole-bg);
    border-radius: 1.5px;
    position: relative;
    cursor: crosshair;
    /* 3D embossed effect */
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.7),
        inset 0 -0.5px 0.5px rgba(255, 255, 255, 0.15),
        0 0.5px 0 rgba(255, 255, 255, 0.3);
    border: 0.5px solid rgba(0, 0, 0, 0.25);
    transition: all 0.08s ease;
}

.tc-bb-hole:hover {
    background: var(--tc-accent-green);
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.3),
        0 0 6px var(--tc-accent-green),
        0 0 12px rgba(16, 185, 129, 0.3);
    border-color: #059669;
    transform: scale(1.2);
}

/* Occupied hole - component lead inserted */
.tc-bb-hole.occupied {
    background: #059669;
    box-shadow:
        inset 0 1px 1px rgba(0, 0, 0, 0.4),
        0 0 4px rgba(5, 150, 105, 0.4);
}

/* Connected group highlight */
.tc-bb-hole.group-highlight {
    background: rgba(56, 189, 248, 0.5);
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.3),
        0 0 5px rgba(56, 189, 248, 0.4);
}

/* ========================================
   CENTER TERMINAL GRID
   ======================================== */
.tc-bb-center-grid {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 5px 0;
}

/* Row container */
.tc-bb-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Row labels (a, b, c, ... j) */
.tc-bb-row-label {
    font-size: 0.6rem;
    color: var(--bb-label-color);
    font-weight: 700;
    width: 11px;
    text-align: center;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    user-select: none;
}

/* IC Isolation Trough */
.tc-bb-trough {
    height: 12px;
    background: linear-gradient(
        180deg,
        var(--bb-trough-bg) 0%,
        #e0d9cc 40%,
        #c4bbaa 50%,
        #e0d9cc 60%,
        var(--bb-trough-bg) 100%
    );
    border-top: 1px solid rgba(0, 0, 0, 0.12);
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    margin: 3px 0;
    border-radius: 1px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
}

/* Column numbers along top/bottom */
.tc-bb-col-numbers {
    display: flex;
    justify-content: space-between;
    margin: 0 17px;
    padding: 0 0 2px 0;
}

.tc-bb-col-num {
    font-size: 0.5rem;
    color: var(--bb-label-color);
    font-weight: 700;
    width: var(--bb-hole-size);
    text-align: center;
    user-select: none;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

/* ========================================
   PLACED CIRCUIT COMPONENTS
   ======================================== */
.tc-placed-component {
    position: absolute;
    cursor: pointer;
    z-index: 40;
    user-select: none;
    transition: filter 0.12s ease, outline 0.12s ease;
    touch-action: none;
    pointer-events: auto;
}

.tc-placed-component:hover {
    filter: drop-shadow(0 0 7px rgba(56, 189, 248, 0.7));
    outline: 1.5px solid rgba(56, 189, 248, 0.45);
    outline-offset: 3px;
    border-radius: 4px;
    z-index: 44;
}

.tc-placed-component:active,
.tc-placed-component.dragging {
    cursor: grabbing !important;
    z-index: 70 !important;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 10px rgba(56, 189, 248, 0.8)) !important;
}

.tc-placed-component.selected {
    z-index: 60 !important;
    filter: drop-shadow(0 0 10px rgba(2, 132, 199, 0.95)) drop-shadow(0 0 4px #38bdf8) !important;
    outline: none;
}

/* Selection indicator overlay */
.tc-placed-component.selected::after {
    content: '';
    position: absolute;
    inset: -6px;
    border: 2px dashed #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    border-radius: 6px;
    pointer-events: none;
    animation: tcSelectionPulse 1.5s ease-in-out infinite;
    z-index: 61;
}

@keyframes tcSelectionPulse {
    0%, 100% { border-color: #0284c7; box-shadow: 0 0 8px rgba(2, 132, 199, 0.4); }
    50% { border-color: #38bdf8; box-shadow: 0 0 16px rgba(56, 189, 248, 0.8); }
}

/* Floating Quick-Action Bar for Selected Component */
.tc-comp-floating-bar {
    position: absolute;
    z-index: 75;
    display: flex;
    align-items: center;
    gap: 4px;
    background: #090d16;
    border: 1px solid #0284c7;
    border-radius: 8px;
    padding: 3px 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7), 0 0 12px rgba(2, 132, 199, 0.4);
    transform: translateY(-5px);
    animation: tcFloatBarIn 0.15s ease-out;
    user-select: none;
    white-space: nowrap;
}

@keyframes tcFloatBarIn {
    from { opacity: 0; transform: translateY(0); }
    to { opacity: 1; transform: translateY(-5px); }
}

.tc-float-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #38bdf8;
    padding: 2px 6px;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    gap: 4px;
}

.tc-float-btn {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #f1f5f9;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 7px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.12s;
}

.tc-float-btn:hover {
    background: #334155;
    color: #ffffff;
}

.tc-float-btn.tc-float-edit:hover {
    background: #0284c7;
    border-color: #38bdf8;
    color: #ffffff;
}

.tc-float-btn.tc-float-rotate:hover {
    background: #059669;
    border-color: #10b981;
    color: #ffffff;
}

.tc-float-btn.tc-float-delete {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.35);
}

.tc-float-btn.tc-float-delete:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #f87171;
}

.tc-float-btn.tc-float-close {
    padding: 3px 5px;
    color: var(--tc-text-muted);
}
.tc-float-btn.tc-float-close:hover {
    color: #ffffff;
    background: #334155;
}

/* Drag ghost preview (semi-transparent copy following cursor) */
.tc-drag-ghost {
    position: absolute;
    opacity: 0.5;
    pointer-events: none;
    z-index: 100;
    filter: drop-shadow(0 4px 12px rgba(2, 132, 199, 0.4));
    transition: none;
}

/* Component entrance animation */
.tc-placed-component.entering {
    animation: tcComponentDrop 0.3s ease-out;
}

@keyframes tcComponentDrop {
    from {
        opacity: 0;
        transform: scale(0.6) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ========================================
   COMPONENT INSPECTOR POPOVER
   ======================================== */
.tc-component-inspector {
    position: absolute;
    z-index: 95;
    background: var(--tc-panel-bg);
    border: 1px solid var(--tc-toolbar-border);
    border-radius: 10px;
    padding: 12px 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45), 0 0 16px rgba(56, 189, 248, 0.25);
    font-size: 0.84rem;
    color: var(--tc-text-main);
    min-width: 210px;
    max-width: 280px;
    backdrop-filter: blur(8px);
}

.tc-inspector-title {
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--tc-toolbar-border);
    padding-bottom: 6px;
    font-size: 0.88rem;
    cursor: grab;
    user-select: none;
}
.tc-inspector-title:active {
    cursor: grabbing;
}

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

.tc-inspector-row span:first-child {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--tc-text-muted);
}

.tc-inspector-input {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid var(--tc-toolbar-border);
    border-radius: 5px;
    padding: 4px 8px;
    font-size: 0.82rem;
    color: var(--tc-text-main);
    width: 85px;
    outline: none;
    transition: border-color 0.15s;
}

.tc-inspector-input:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

/* ========================================
   RIGHT-HAND DRAWER
   ======================================== */
.tc-right-drawer {
    width: 310px;
    min-width: 310px;
    height: 100%;
    background: var(--tc-panel-bg);
    border-left: 1px solid var(--tc-toolbar-border);
    display: flex;
    flex-direction: column;
    z-index: 30;
    transition: width 0.25s ease;
}

.tc-right-drawer.collapsed {
    width: 0;
    min-width: 0;
    display: none;
}

.tc-drawer-header {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--tc-toolbar-border);
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.tc-comp-category-select {
    width: 100%;
    padding: 0.4rem 0.7rem;
    border-radius: 6px;
    border: 1px solid var(--tc-toolbar-border);
    background: var(--tc-toolbar-bg);
    color: var(--tc-text-main);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    outline: none;
}

.tc-search-box {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--tc-toolbar-border);
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    gap: 6px;
}

.tc-search-input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.82rem;
    color: var(--tc-text-main);
    width: 100%;
}

/* Component Cards Grid */
.tc-components-grid {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    align-content: start;
}

.tc-components-grid::-webkit-scrollbar {
    width: 5px;
}

.tc-components-grid::-webkit-scrollbar-track {
    background: transparent;
}

.tc-components-grid::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 3px;
}

.tc-component-card {
    background: var(--tc-panel-bg);
    border: 1.5px solid var(--tc-toolbar-border);
    border-radius: 8px;
    padding: 8px 5px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: grab;
    transition: all 0.12s ease;
    user-select: none;
}

.tc-component-card:hover {
    border-color: #0284c7;
    background: rgba(2, 132, 199, 0.04);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.tc-component-card:active {
    cursor: grabbing;
    transform: translateY(0) scale(0.96);
}

.tc-component-card.dragging {
    opacity: 0.35;
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.08);
}

.tc-drag-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 99999;
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.94);
    border: 1.5px solid #38bdf8;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(56, 189, 248, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transform: translate(-50%, -50%);
    cursor: grabbing;
    backdrop-filter: blur(8px);
}
.tc-drag-ghost svg {
    max-width: 52px;
    max-height: 42px;
}
.tc-drag-ghost span {
    font-size: 0.72rem;
    font-weight: 700;
    color: #38bdf8;
    white-space: nowrap;
}
.tc-drag-prompt {
    animation: tcPulsePrompt 0.4s ease-in-out;
}
@keyframes tcPulsePrompt {
    0% { transform: scale(1); }
    50% { transform: scale(1.06); border-color: #38bdf8; box-shadow: 0 0 10px rgba(56, 189, 248, 0.5); }
    100% { transform: scale(1); }
}

.tc-component-card-icon {
    width: 52px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.tc-component-card-name {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--tc-text-main);
    line-height: 1.15;
}

/* ========================================
   CODE EDITOR PANE
   ======================================== */
.tc-code-pane {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #0b0f19;
}

.tc-code-header {
    background: #0f172a;
    padding: 0.45rem 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #f8fafc;
    font-size: 0.82rem;
    font-weight: 600;
}

.tc-code-header span {
    color: #f8fafc;
}

.tc-code-header .btn-tc-code-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.08) !important;
    color: #f1f5f9 !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    border-radius: 6px;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.16s ease;
    white-space: nowrap;
}

.tc-code-header .btn-tc-code-toggle span {
    color: #f1f5f9 !important;
}

.tc-code-header .btn-tc-code-toggle:hover {
    background: #0284c7 !important;
    color: #ffffff !important;
    border-color: #38bdf8 !important;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.45);
    transform: translateY(-1px);
}

.tc-code-header .btn-tc-code-toggle:hover span {
    color: #ffffff !important;
}

.tc-code-header #tcCloseCodeBtn {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #cbd5e1 !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

.tc-code-header #tcCloseCodeBtn:hover {
    background: #dc2626 !important;
    color: #ffffff !important;
    border-color: #ef4444 !important;
}

.tc-codemirror-holder {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.tc-codemirror-holder .CodeMirror {
    height: 100%;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    background: #0b0f19;
}

/* ========================================
   BOTTOM SERIAL MONITOR / PLOTTER
   ======================================== */
.tc-bottom-serial-drawer {
    border-top: 1px solid var(--tc-toolbar-border);
    background: #090d16;
    height: 155px;
    display: flex;
    flex-direction: column;
}

.tc-serial-head {
    background: #0f172a;
    padding: 0.35rem 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #cbd5e1;
    font-size: 0.78rem;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tc-serial-head .tc-view-tab {
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.tc-serial-head .tc-view-tab:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
}

.tc-serial-head .tc-view-tab.active {
    background: #0284c7;
    color: #ffffff;
    border-color: #38bdf8;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}

.tc-serial-head #tcBaudSelect {
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 0.72rem;
    padding: 2px 6px;
    outline: none;
}

.tc-serial-head #tcClearSerialBtn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: #cbd5e1;
    font-size: 0.72rem;
    padding: 2px 8px;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tc-serial-head #tcClearSerialBtn:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
}

.tc-serial-stream {
    flex: 1;
    overflow-y: auto;
    padding: 0.4rem 0.7rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.76rem;
    color: #38bdf8;
    line-height: 1.35;
    white-space: pre-wrap;
    background: #020617;
}

.tc-serial-stream::-webkit-scrollbar {
    width: 5px;
}

.tc-serial-stream::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.2);
    border-radius: 3px;
}

/* ========================================
   LED GLOW EFFECT
   ======================================== */
.tc-led-lit {
    filter: drop-shadow(0 0 10px currentColor) drop-shadow(0 0 20px currentColor) !important;
}

/* ========================================
   STATUS BAR (BOTTOM OF CANVAS)
   ======================================== */
.tc-status-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 24px;
    background: var(--tc-toolbar-bg);
    border-top: 1px solid var(--tc-toolbar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    font-size: 0.68rem;
    color: var(--tc-text-muted);
    font-weight: 600;
    z-index: 20;
    gap: 12px;
}

.tc-status-bar .tc-status-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ========================================
   CIRCUIT ERROR / WARNING OVERLAY
   ======================================== */
.tc-circuit-warning {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 25;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #ef4444;
    border-radius: 20px;
    padding: 5px 16px;
    font-size: 0.78rem;
    font-weight: 700;
    display: none;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    white-space: nowrap;
}

[data-theme="dark"] .tc-circuit-warning {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.2);
}

.tc-circuit-warning.ok {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.35);
    color: #059669;
}

[data-theme="dark"] .tc-circuit-warning.ok {
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.2);
}

.tc-circuit-warning.visible {
    display: inline-flex;
}

/* ========================================
   VOLTAGE PROBE TOOLTIP
   ======================================== */
.tc-voltage-probe {
    position: absolute;
    z-index: 35;
    background: #0f172a;
    border: 1px solid #38bdf8;
    border-radius: 6px;
    padding: 4px 10px;
    color: #38bdf8;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    pointer-events: none;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
}

.tc-voltage-probe.visible {
    display: block;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
    .tc-workbench-body {
        flex-direction: column;
        height: auto;
    }

    .tc-canvas-container {
        height: 520px;
    }

    .tc-right-drawer {
        width: 100% !important;
        min-width: 100% !important;
        height: 320px;
        border-left: none;
        border-top: 1px solid var(--tc-toolbar-border);
    }

    .tc-status-bar {
        right: 0;
    }

    .tc-code-pane {
        width: 100% !important;
        max-width: 100% !important;
        height: 420px;
    }

    .tc-split-resizer {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .tc-top-navbar {
        padding: 0.5rem 0.6rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .tc-project-info {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    .tc-title-input {
        font-size: 0.85rem;
        min-width: 140px;
        flex: 1;
        max-width: 220px;
    }

    .tc-view-modes {
        display: flex !important;
        width: 100%;
        justify-content: stretch;
        background: rgba(0, 0, 0, 0.05);
        border-radius: 8px;
        padding: 3px;
        box-sizing: border-box;
    }

    .tc-view-modes .tc-view-tab {
        flex: 1;
        justify-content: center;
        padding: 6px 4px;
        font-size: 0.74rem;
    }

    #tcPresetSelector {
        width: 100%;
        max-width: 100%;
        font-size: 0.78rem;
    }

    .tc-tools-bar {
        padding: 0.4rem 0.5rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0.4rem;
    }

    .tc-tools-left,
    .tc-tools-right {
        width: 100%;
        display: flex;
        justify-content: flex-start;
        align-items: center;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 0.35rem;
        padding-bottom: 3px;
        flex-wrap: nowrap;
    }

    .tc-tools-left::-webkit-scrollbar,
    .tc-tools-right::-webkit-scrollbar {
        height: 3px;
    }

    .tc-canvas-container {
        height: 52vh;
        min-height: 340px;
        max-height: 500px;
        touch-action: none;
    }

    .tc-code-pane {
        width: 100% !important;
        max-width: 100% !important;
        height: 360px;
        box-shadow: none;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .tc-code-header {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }

    .tc-code-header .btn-tc-code-toggle {
        padding: 2px 6px;
        font-size: 0.7rem;
    }

    .tc-split-resizer {
        display: none !important;
    }

    .tc-right-drawer {
        width: 100% !important;
        min-width: 100% !important;
        height: 280px;
    }

    .tc-components-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
        padding: 8px;
    }

    .tc-component-card {
        padding: 8px 4px;
    }

    .tc-component-card .card-thumb-svg {
        width: 44px;
        height: 44px;
    }

    .tc-status-bar {
        font-size: 0.62rem;
        padding: 0 8px;
        gap: 8px;
        overflow-x: auto;
        white-space: nowrap;
    }

    .tc-sim-time-badge {
        min-width: 72px;
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    .btn-tc-sim {
        padding: 0.35rem 0.75rem;
        font-size: 0.78rem;
    }
}

/* ========================================
   LIVE WIRE CURRENT GLOW ANIMATION
   ======================================== */
.tc-wire-svg-path.active-current {
    filter: drop-shadow(0 0 5px currentColor);
    stroke-dasharray: 6 3;
    animation: tcWireCurrentFlow 0.8s linear infinite;
}

@keyframes tcWireCurrentFlow {
    from { stroke-dashoffset: 18; }
    to { stroke-dashoffset: 0; }
}

/* Overcurrent flashing alert on wire/component */
.tc-overcurrent-blink {
    animation: tcOvercurrentPulse 0.4s ease-in-out infinite alternate !important;
}

@keyframes tcOvercurrentPulse {
    from { filter: drop-shadow(0 0 4px #ef4444); }
    to { filter: drop-shadow(0 0 16px #ef4444) brightness(1.4); }
}

/* ========================================
   INTERACTIVE COMPONENT OVERLAYS (Sliders / Dials)
   ======================================== */
.tc-comp-ctrl-badge {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #38bdf8;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 25;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    font-family: 'JetBrains Mono', monospace;
}

.tc-comp-overlay-slider {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: 14px;
    padding: 3px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 30;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    color: #e2e8f0;
    font-size: 0.7rem;
    font-weight: 600;
}

.tc-comp-overlay-slider input[type="range"] {
    width: 75px;
    accent-color: #0284c7;
    height: 4px;
    cursor: pointer;
}

/* Pushbutton styling & 3D tactile press */
.tc-pushbutton-housing {
    position: relative;
    user-select: none;
    transition: box-shadow 0.15s ease;
}

.tc-pushbutton-cap {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #475569 15%, #1e293b 70%, #0f172a 100%);
    border: 1.5px solid #64748b;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: transform 0.08s ease, background 0.12s ease, box-shadow 0.12s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tc-pushbutton-cap:hover {
    border-color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.6), 0 3px 6px rgba(0, 0, 0, 0.45);
}

.tc-pushbutton-cap.tc-btn-active-cap {
    transform: scale(0.88) !important;
    background: radial-gradient(circle at 35% 35%, #22c55e 20%, #15803d 70%, #064e3b 100%) !important;
    border-color: #4ade80 !important;
    box-shadow: 0 0 12px #22c55e, inset 0 2px 4px rgba(0, 0, 0, 0.7) !important;
}

.tc-pushbutton-cap.tc-btn-active-cap .tc-btn-center-led {
    background: #86efac !important;
    box-shadow: 0 0 8px #4ade80 !important;
}

/* Floating bar toggle button */
.tc-float-btn.tc-float-toggle-btn {
    border-radius: 6px;
    padding: 3px 9px;
    font-size: 0.72rem;
    font-weight: 700;
    transition: all 0.15s ease;
}
.tc-float-btn.tc-float-toggle-btn.btn-active {
    background: #10b981 !important;
    color: #ffffff !important;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

/* Piezo Buzzer Sound Rings */
.tc-buzzer-wave {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid #38bdf8;
    opacity: 0;
    pointer-events: none;
    animation: tcBuzzerRings 0.6s ease-out infinite;
}

@keyframes tcBuzzerRings {
    0% { width: 34px; height: 34px; opacity: 0.9; }
    100% { width: 70px; height: 70px; opacity: 0; }
}

/* ========================================
   SCHEMATIC & BOM VIEWS
   ======================================== */
.tc-schematic-svg {
    max-width: 100%;
    height: auto;
    font-family: 'JetBrains Mono', monospace;
}

#tcBomTable tbody tr {
    border-bottom: 1px solid var(--tc-toolbar-border);
    transition: background 0.15s;
}

#tcBomTable tbody tr:hover {
    background: rgba(2, 132, 199, 0.04);
}

/* ========================================
   BREADBOARD SNAPPING CANDIDATE HALO
   ======================================== */
.tc-snap-hole-halo {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #10b981;
    background: rgba(16, 185, 129, 0.45);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.7);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 22;
    animation: tcSnapPulse 0.8s ease-in-out infinite alternate;
}

@keyframes tcSnapPulse {
    from { transform: translate(-50%, -50%) scale(1.0); opacity: 0.8; }
    to { transform: translate(-50%, -50%) scale(1.35); opacity: 1; }
}

/* ========================================
   MICRO SERVO MOTOR (SG90)
   ======================================== */
.tc-servo-motor {
    position: relative;
    user-select: none;
}

.tc-servo-horn {
    transition: transform 0.15s cubic-bezier(0.2, 0.9, 0.3, 1);
    transform-origin: 22px 22px;
}

.tc-servo-angle-badge {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 7px;
    white-space: nowrap;
    pointer-events: none;
    font-family: 'JetBrains Mono', monospace;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* ========================================
   DC MOTOR & ROTATING PROPELLER
   ======================================== */
.tc-propeller {
    transform-origin: 24px 24px;
}

.tc-propeller.spinning {
    animation: tcMotorSpin 0.25s linear infinite;
}

@keyframes tcMotorSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========================================
   PIR MOTION SENSOR
   ======================================== */
.tc-pir-trigger-btn {
    position: absolute;
    bottom: -26px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 8px;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
    transition: transform 0.1s, background 0.15s;
    z-index: 26;
}

.tc-pir-trigger-btn:hover {
    background: linear-gradient(135deg, #38bdf8, #0284c7);
    transform: translateX(-50%) scale(1.05);
}

.tc-pir-trigger-btn:active {
    transform: translateX(-50%) scale(0.95);
}

.tc-pir-motion-wave {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #ef4444;
    opacity: 0;
    pointer-events: none;
    animation: tcPirMotion 1s ease-out infinite;
}

@keyframes tcPirMotion {
    0% { width: 36px; height: 36px; opacity: 0.9; }
    100% { width: 90px; height: 90px; opacity: 0; }
}

/* ========================================
   TEMPERATURE SENSOR (TMP36)
   ======================================== */
.tc-tmp36-temp-badge {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 7px;
    white-space: nowrap;
    pointer-events: none;
    font-family: 'JetBrains Mono', monospace;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* ========================================
   SLIDE SWITCH (SPDT)
   ======================================== */
.tc-switch-lever {
    cursor: pointer;
    transition: transform 0.12s ease;
}

/* ========================================
   RGB LED GLOW
   ======================================== */
.tc-rgb-lit {
    filter: drop-shadow(0 0 12px var(--rgb-glow, #38bdf8)) drop-shadow(0 0 24px var(--rgb-glow, #38bdf8)) !important;
}

/* ========================================
   ULTRASONIC CONE ANIMATION
   ======================================== */
.tc-us-beam {
    position: absolute;
    left: 45px;
    top: -35px;
    width: 60px;
    height: 30px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.tc-us-beam.active {
    opacity: 0.7;
    animation: tcSonicRings 0.7s ease-out infinite;
}

@keyframes tcSonicRings {
    0% { transform: scale(0.6) translateY(0); opacity: 0.8; }
    100% { transform: scale(1.4) translateY(-15px); opacity: 0; }
}

/* ========================================
   STARTER PROJECT CARDS (RIGHT DRAWER)
   ======================================== */
.tc-starter-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95)) !important;
    border: 1px solid rgba(56, 189, 248, 0.25) !important;
    border-radius: 8px !important;
    padding: 0.6rem !important;
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    position: relative !important;
    overflow: hidden !important;
}

.tc-starter-card:hover {
    transform: translateY(-3px) scale(1.02) !important;
    border-color: #38bdf8 !important;
    box-shadow: 0 8px 20px rgba(56, 189, 248, 0.25) !important;
    background: linear-gradient(135deg, rgba(30, 58, 95, 0.95), rgba(15, 23, 42, 0.98)) !important;
}

.tc-starter-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tc-starter-card-desc {
    font-size: 0.68rem;
    color: var(--tc-text-muted);
    text-align: center;
    margin-top: 2px;
    line-height: 1.2;
}

/* ========================================
   CANVAS TOAST NOTIFICATION
   ======================================== */
.tc-toast-banner {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(15, 23, 42, 0.92);
    color: #f8fafc;
    border: 1px solid rgba(56, 189, 248, 0.4);
    padding: 0.5rem 1.2rem;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(56, 189, 248, 0.3);
    backdrop-filter: blur(8px);
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tc-toast-banner.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ========================================
   CURRICULUM LAUNCH BUTTONS
   ======================================== */
.tc-launch-project-btn {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: 700;
    transition: all 0.2s ease;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.tc-launch-project-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.5);
    background: linear-gradient(135deg, #0369a1, #0284c7);
}

/* ========================================
   CIRCUIT / CODE SPLIT RESIZER
   ======================================== */
.tc-split-resizer {
    width: 8px;
    height: 100%;
    background: #1e293b;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    cursor: col-resize;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 35;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.tc-split-resizer:hover,
.tc-split-resizer.dragging {
    background: #0284c7;
    box-shadow: 0 0 10px rgba(2, 132, 199, 0.5);
}

.tc-resizer-handle {
    width: 2px;
    height: 32px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 2px;
    pointer-events: none;
}

.tc-split-resizer:hover .tc-resizer-handle,
.tc-split-resizer.dragging .tc-resizer-handle {
    background: #ffffff;
}

.tc-code-pane {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #0b0f19;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 30;
    flex-shrink: 0;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.25);
    position: relative;
}

.tc-code-pane .CodeMirror {
    height: 100% !important;
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 0.84rem;
    line-height: 1.55;
    background: #0b0f19;
}

/* ========================================
   EXPORT DROPDOWN MENU
   ======================================== */
.tc-export-dropdown {
    position: relative;
    display: inline-block;
}

.tc-export-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.65);
    padding: 6px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 3px;
    animation: tcPopupFadeIn 0.15s ease-out;
}

.tc-export-header {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    padding: 6px 10px 3px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tc-export-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 4px 0;
}

.tc-export-item {
    background: transparent;
    border: none;
    color: #cbd5e1;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 7px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
    transition: all 0.15s;
    width: 100%;
}

.tc-export-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

/* ========================================================
   PHYSICS LAB REALISTIC INTERACTIVE WIDGETS (OBSTACLES & TARGETS)
   ======================================================== */

/* 1. Ultrasonic HC-SR04 Interactive Obstacle */
.tc-ultrasonic-obstacle-container {
    position: absolute;
    z-index: 45;
    user-select: none;
    cursor: grab;
    touch-action: none;
    transition: filter 0.15s ease;
}
.tc-ultrasonic-obstacle-container:active {
    cursor: grabbing;
}
.tc-ultrasonic-obstacle-block {
    width: 28px;
    height: 90px;
    background: linear-gradient(135deg, #475569 0%, #334155 50%, #1e293b 100%);
    border: 2px solid #38bdf8;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 16px rgba(56, 189, 248, 0.35);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.tc-obstacle-stripes {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background: repeating-linear-gradient(45deg, rgba(234, 179, 8, 0.25), rgba(234, 179, 8, 0.25) 6px, transparent 6px, transparent 12px);
    border-radius: 4px;
    pointer-events: none;
}
.tc-obstacle-badge {
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    border: 1px solid #38bdf8;
    color: #38bdf8;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 5px;
}
.tc-obstacle-drag-handle {
    position: absolute;
    top: -26px;
    left: 50%;
    transform: translateX(-50%);
    background: #0284c7;
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 8px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* Ultrasonic Sonar Wave Arcs */
.tc-sonar-waves-svg {
    position: absolute;
    pointer-events: none;
    z-index: 15;
    overflow: visible;
}
.tc-sonar-arc-ping {
    fill: none;
    stroke: #38bdf8;
    stroke-width: 2.2;
    opacity: 0.8;
    stroke-dasharray: 4 2;
    animation: tcSonarPing 1.2s infinite ease-out;
}
.tc-sonar-arc-echo {
    fill: none;
    stroke: #10b981;
    stroke-width: 1.8;
    opacity: 0.6;
    animation: tcSonarEcho 1.2s infinite ease-in;
}
@keyframes tcSonarPing {
    0% { opacity: 0; stroke-width: 1; }
    30% { opacity: 0.9; stroke-width: 2.5; }
    100% { opacity: 0; stroke-width: 3.5; }
}
@keyframes tcSonarEcho {
    0% { opacity: 0; }
    50% { opacity: 0.8; }
    100% { opacity: 0; }
}

/* 2. PIR Motion Interactive Human Avatar */
.tc-pir-subject-container {
    position: absolute;
    z-index: 45;
    user-select: none;
    cursor: grab;
    touch-action: none;
}
.tc-pir-subject-container:active {
    cursor: grabbing;
}
.tc-pir-human-avatar {
    width: 48px;
    height: 72px;
    background: #0f172a;
    border: 2px solid #ec4899;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(236, 72, 153, 0.35);
    position: relative;
    transition: all 0.2s;
}
.tc-pir-human-avatar.moving {
    border-color: #ef4444;
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.7);
    animation: tcHumanStep 0.4s infinite alternate ease-in-out;
}
@keyframes tcHumanStep {
    0% { transform: translateY(0); }
    100% { transform: translateY(-4px); }
}
.tc-pir-subject-badge {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    border: 1px solid #ec4899;
    color: #f472b6;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}
.tc-pir-field-cone {
    position: absolute;
    pointer-events: none;
    z-index: 12;
    transition: fill 0.3s, opacity 0.3s;
}

/* 3. LDR Interactive Flashlight */
.tc-ldr-flashlight-container {
    position: absolute;
    z-index: 45;
    cursor: grab;
    user-select: none;
    touch-action: none;
}
.tc-ldr-flashlight-container:active {
    cursor: grabbing;
}
.tc-ldr-flashlight-body {
    width: 64px;
    height: 38px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: 2px solid #fef08a;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 0.72rem;
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.45);
    position: relative;
}
.tc-ldr-light-beam {
    position: absolute;
    pointer-events: none;
    z-index: 14;
}

/* 4. Interactive TSOP1838 TV Remote Control */
.tc-ir-remote-modal {
    position: absolute;
    top: 55px;
    left: 20px;
    width: 145px;
    background: #0f172a;
    border: 2px solid #334155;
    border-radius: 16px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.75);
    padding: 10px 8px;
    z-index: 80;
    user-select: none;
    touch-action: none;
}
.tc-ir-remote-header {
    text-align: center;
    font-size: 0.68rem;
    font-weight: 800;
    color: #94a3b8;
    letter-spacing: 1px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
}
.tc-ir-led-emitter {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #334155;
    border: 1px solid #64748b;
    margin: 0 auto 6px auto;
    transition: all 0.08s;
}
.tc-ir-led-emitter.flash {
    background: #38bdf8;
    box-shadow: 0 0 14px 4px #38bdf8;
}
.tc-remote-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}
.tc-remote-btn {
    background: #1e293b;
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 6px 0;
    cursor: pointer;
    text-align: center;
    transition: all 0.1s;
}
.tc-remote-btn:active {
    background: #0284c7;
    transform: scale(0.92);
}
.tc-remote-btn.pwr {
    background: #dc2626;
    color: #fff;
    grid-column: span 3;
}

/* 5. Interactive Simple Pendulum Widget */
.tc-pendulum-assembly {
    position: absolute;
    pointer-events: all;
    z-index: 35;
}
.tc-pendulum-bob {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #e2e8f0, #475569);
    border: 2px solid #0f172a;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    cursor: grab;
    position: absolute;
    transform: translate(-50%, -50%);
}
.tc-pendulum-bob:active {
    cursor: grabbing;
}

/* 6. Seven Segment Display & Matrix Elements */
.tc-seven-segment-display {
    width: 85px;
    height: 85px;
    background: #090d16;
    border: 2px solid #1e293b;
    border-radius: 6px;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
.tc-seg {
    position: absolute;
    background: #1e293b;
    border-radius: 2px;
    transition: background 0.06s, box-shadow 0.06s;
}
.tc-seg.lit {
    background: #ef4444;
    box-shadow: 0 0 10px 2px rgba(239, 68, 68, 0.85);
}

/* 7. Enhanced Mobile Touch Inspector & Responsive Controls */
@media (max-width: 768px) {
    .tc-component-inspector {
        position: fixed !important;
        bottom: 0 !important;
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 16px 16px 0 0 !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6) !important;
        z-index: 1500 !important;
        max-height: 75vh;
        overflow-y: auto;
    }
    .tc-inspector-title {
        font-size: 1rem !important;
        padding-bottom: 8px;
    }
    .tc-inspector-input,
    .tc-inspector-row select,
    .tc-inspector-row input[type="range"] {
        min-height: 40px;
    }
    .tc-tools-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .tc-top-navbar {
        gap: 0.5rem;
    }
}

/* Preset quick-select chips in component inspector */
.tc-preset-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}
.tc-preset-chip {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--tc-text-main);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.1s;
}
.tc-preset-chip:hover,
.tc-preset-chip.active {
    background: #0284c7;
    color: #ffffff;
    border-color: #38bdf8;
}

/* Stepper buttons in inspector */
.tc-stepper-row {
    display: flex;
    align-items: center;
    gap: 4px;
}
.tc-inspector-stepper-btn {
    width: 26px;
    height: 26px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: #1e293b;
    color: #e2e8f0;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.tc-inspector-stepper-btn:hover {
    background: #334155;
    color: #38bdf8;
}

/* Color swatches in inspector */
.tc-swatch-group {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 4px;
}
.tc-color-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.15s, border-color 0.15s;
}
.tc-color-swatch:hover,
.tc-color-swatch.active {
    transform: scale(1.18);
    border-color: #ffffff;
    box-shadow: 0 0 8px currentColor;
}

/* Sound Sensor Clap Floating Widget */
.tc-sound-clap-widget {
    position: absolute;
    z-index: 40;
    padding: 6px 12px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid #38bdf8;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #f1f5f9;
}
.tc-sound-clap-btn {
    background: #0284c7;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    font-weight: 800;
    font-size: 0.75rem;
    transition: transform 0.1s, background 0.1s;
}
.tc-sound-clap-btn:active {
    transform: scale(0.92);
    background: #0369a1;
}

/* Bluetooth Smartphone Controller Modal */
.tc-bt-phone-modal {
    position: absolute;
    top: 50px;
    right: 25px;
    width: 200px;
    background: #090d16;
    border: 3px solid #334155;
    border-radius: 20px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
    z-index: 45;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    user-select: none;
}
.tc-bt-phone-header {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 800;
    color: #38bdf8;
    letter-spacing: 0.5px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.tc-bt-phone-screen {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 0.68rem;
    color: #a5f3fc;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.tc-bt-btn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.tc-bt-app-btn {
    background: #1e293b;
    border: 1px solid #334155;
    color: #e2e8f0;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 6px 4px;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    transition: background 0.12s;
}
.tc-bt-app-btn:hover {
    background: #0284c7;
    border-color: #38bdf8;
    color: #fff;
}
.tc-bt-app-btn:active {
    transform: scale(0.95);
}
.tc-bt-input-row {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}
.tc-bt-input {
    flex: 1;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 4px;
    color: #f8fafc;
    font-size: 0.72rem;
    padding: 3px 6px;
    outline: none;
}
.tc-bt-send-btn {
    background: #10b981;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 0.7rem;
    font-weight: 800;
    cursor: pointer;
}

/* Photogate Pendulum Widget */
.tc-photogate-widget {
    position: absolute;
    z-index: 40;
    padding: 6px 12px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid #10b981;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #f1f5f9;
}
.tc-photogate-btn {
    background: #059669;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    font-weight: 800;
    font-size: 0.75rem;
    transition: transform 0.1s, background 0.1s;
}
.tc-photogate-btn:hover {
    background: #10b981;
}
.tc-photogate-btn:active {
    transform: scale(0.92);
}

/* ========================================================
   1.8" ST7735 SPI Color TFT Display & Inspector Modal
   ======================================================== */
.tc-tft-module-pcb {
    background: #991b1b;
    border: 2px solid #7f1d1d;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    user-select: none;
    box-sizing: border-box;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tc-tft-module-pcb:hover {
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.35);
}
.tc-tft-mounting-hole {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #450a0a;
    border: 1px solid #f87171;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6);
}
.tc-tft-mounting-hole.top-left { top: 4px; left: 4px; }
.tc-tft-mounting-hole.top-right { top: 4px; right: 4px; }
.tc-tft-mounting-hole.bot-left { bottom: 16px; left: 4px; }
.tc-tft-mounting-hole.bot-right { bottom: 16px; right: 4px; }

.tc-tft-bezel {
    position: absolute;
    top: 7px;
    left: 10px;
    width: 104px;
    height: 66px;
    background: #0f172a;
    border: 1.5px solid #475569;
    border-radius: 4px;
    box-sizing: border-box;
    padding: 3px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.7);
}
.tc-tft-canvas-layer {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border-radius: 2px;
    display: none;
    background: #000;
}
.tc-tft-screen-canvas {
    width: 100%;
    height: 220px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background: #000000;
    border-radius: 4px;
    display: block;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.9), 0 0 12px rgba(56, 189, 248, 0.15);
}
.tc-tft-screen-surface {
    width: 100%;
    height: 100%;
    background: #020617;
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3px 4px;
    box-sizing: border-box;
    font-family: 'JetBrains Mono', monospace;
    transition: all 0.25s ease;
}
.tc-tft-screen-surface.tc-tft-screen-on {
    background: #041026;
    box-shadow: inset 0 0 12px rgba(56, 189, 248, 0.35);
}
.tc-tft-screen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.44rem;
    color: #64748b;
    font-weight: 700;
}
.tc-tft-screen-on .tc-tft-screen-header {
    color: #38bdf8;
}
.tc-tft-dot-offline {
    color: #64748b;
    font-size: 0.55rem;
}
.tc-tft-dot-online {
    color: #22c55e;
    font-size: 0.55rem;
    text-shadow: 0 0 6px #22c55e;
}
.tc-tft-screen-value {
    font-size: 0.72rem;
    font-weight: 900;
    color: #475569;
    text-align: center;
    line-height: 1.1;
    letter-spacing: 0.5px;
}
.tc-tft-screen-on .tc-tft-screen-value {
    color: #22c55e;
    text-shadow: 0 0 6px rgba(34, 197, 94, 0.7);
}
.tc-tft-bar-track {
    width: 100%;
    height: 5px;
    background: #1e293b;
    border-radius: 2px;
    overflow: hidden;
}
.tc-tft-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #10b981, #eab308, #ef4444);
    transition: width 0.1s ease;
}
.tc-tft-screen-footer {
    font-size: 0.4rem;
    color: #475569;
    text-align: center;
}
.tc-tft-screen-on .tc-tft-screen-footer {
    color: #94a3b8;
}

.tc-tft-pin-labels {
    position: absolute;
    bottom: 1px;
    left: 0;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(7, 17px);
    justify-content: center;
    font-size: 0.38rem;
    font-weight: 800;
    color: #e2e8f0;
    text-align: center;
}

/* ========================================================
   FLOATING INSTRUMENT WINDOWS (TFT Replica, Serial Monitor, Serial Plotter)
   ======================================================== */
.tc-floating-window {
    position: absolute;
    background: rgba(9, 14, 26, 0.96);
    border: 1px solid #334155;
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 1px rgba(255, 255, 255, 0.15);
    z-index: 100;
    display: flex;
    flex-direction: column;
    user-select: none;
    overflow: hidden;
    backdrop-filter: blur(16px);
    transition: box-shadow 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: calc(100% - 20px);
    max-height: calc(100% - 20px);
}
.tc-floating-window.tc-highlight-pulse {
    box-shadow: 0 0 32px rgba(56, 189, 248, 0.9), 0 20px 50px rgba(0, 0, 0, 0.85);
}
.tc-floating-window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 12px;
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
    cursor: move;
    color: #f8fafc;
    font-size: 0.76rem;
    font-weight: 700;
}
.tc-window-ctrl-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #cbd5e1;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.68rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.4;
}
.tc-window-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}
.tc-window-btn-close {
    font-size: 0.95rem;
    padding: 0 6px;
    line-height: 1.2;
}
.tc-window-btn-close:hover {
    background: #e11d48;
    color: #ffffff;
    border-color: #f43f5e;
}
.tc-modal-status-led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
    display: inline-block;
}
.tc-modal-status-led.standby {
    background: #eab308;
    box-shadow: 0 0 6px #eab308;
}
.tc-modal-status-led.offline {
    background: #ef4444;
    box-shadow: none;
}

/* ========================================================
   1.8" Color TFT Display Replica Modal
   ======================================================== */
.tc-tft-inspector-modal {
    width: 320px;
    border: 2px solid #334155;
    border-radius: 12px;
}
.tc-tft-modal-body {
    padding: 10px;
    background: #090e1a;
}
.tc-tft-replica-pcb {
    background: linear-gradient(145deg, #7f1d1d 0%, #991b1b 50%, #7f1d1d 100%);
    border: 2px solid #b91c1c;
    border-radius: 8px;
    padding: 12px 14px;
    position: relative;
    box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.45);
}
.tc-tft-hole-corner {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #0f172a;
    border: 1.8px solid #d97706;
    position: absolute;
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.8);
}
.tc-tft-hole-corner.top-left { top: 6px; left: 6px; }
.tc-tft-hole-corner.top-right { top: 6px; right: 6px; }
.tc-tft-hole-corner.bot-left { bottom: 6px; left: 6px; }
.tc-tft-hole-corner.bot-right { bottom: 6px; right: 6px; }

.tc-tft-pcb-label {
    font-size: 0.58rem;
    color: #fef08a;
    text-align: center;
    font-weight: 800;
    letter-spacing: 0.7px;
    margin-bottom: 7px;
    font-family: 'JetBrains Mono', monospace;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}
.tc-tft-screen-bezel {
    background: #0b1120;
    border: 2px solid #334155;
    border-radius: 6px;
    padding: 4px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8), 0 4px 10px rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
}
.tc-tft-screen {
    background: #000000;
    border-radius: 2px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 240px;
}
.tc-tft-screen-canvas {
    width: 256px;
    height: 320px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    display: block;
    background: #000000;
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.95);
    transition: width 0.2s, height 0.2s;
}
.tc-tft-screen-canvas.scale-1x {
    width: 128px;
    height: 160px;
}
.tc-tft-screen-canvas.scale-2x {
    width: 256px;
    height: 320px;
}
.tc-tft-screen-canvas.scale-large {
    width: 288px;
    height: 360px;
}
.tc-tft-pin-header-bar {
    display: flex;
    justify-content: space-between;
    font-size: 0.52rem;
    color: #fde047;
    font-weight: 800;
    margin-top: 8px;
    padding: 2px 4px;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.3px;
}

/* Breadboard TFT Module PCB Cursor & Hover */
.tc-tft-module-pcb {
    cursor: pointer;
    transition: filter 0.2s ease, transform 0.15s ease;
}
.tc-tft-module-pcb:hover {
    filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.85));
}

/* Telemetry Screen View inside TFT */
.tc-tft-view-pane {
    width: 256px;
    padding: 6px;
    font-family: 'JetBrains Mono', monospace;
    box-sizing: border-box;
}
.tc-tft-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1e3a8a;
    color: #fbbf24;
    font-size: 0.62rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 3px;
    margin-bottom: 3px;
    letter-spacing: 0.5px;
}
.tc-tft-sub-bar {
    font-size: 0.52rem;
    color: #94a3b8;
    text-align: center;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}
.tc-tft-value-box {
    background: #030d22;
    border: 1px solid #1e293b;
    border-radius: 6px;
    padding: 6px;
    text-align: center;
    margin-bottom: 6px;
}
.tc-tft-lbl {
    font-size: 0.54rem;
    color: #38bdf8;
    font-weight: 700;
    margin-bottom: 2px;
}
.tc-tft-big-readout {
    font-size: 1.45rem;
    font-weight: 900;
    color: #22c55e;
    text-shadow: 0 0 10px rgba(34, 197, 94, 0.65);
    line-height: 1.1;
}
.tc-tft-adc-line {
    font-size: 0.56rem;
    color: #cbd5e1;
    margin-top: 2px;
}
.tc-tft-meter-box {
    margin-bottom: 6px;
}
.tc-tft-meter-track {
    position: relative;
    width: 100%;
    height: 10px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 3px;
    overflow: hidden;
}
.tc-tft-meter-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #eab308 60%, #ef4444 100%);
    transition: width 0.1s ease;
}
.tc-tft-meter-pointer {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: #ffffff;
    box-shadow: 0 0 4px #ffffff;
    transition: left 0.1s ease;
}
.tc-tft-meter-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.46rem;
    color: #64748b;
    margin-top: 2px;
    padding: 0 2px;
}
.tc-tft-chart-container {
    background: #030712;
    border: 1px solid #1e293b;
    border-radius: 4px;
    padding: 4px;
    margin-bottom: 6px;
}
.tc-tft-chart-title {
    font-size: 0.48rem;
    font-weight: 800;
    color: #38bdf8;
    margin-bottom: 3px;
    text-align: center;
    letter-spacing: 0.5px;
}
.tc-tft-wave-canvas {
    width: 100%;
    height: 42px;
    display: block;
    border-radius: 2px;
}
.tc-tft-footer-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.48rem;
    color: #64748b;
    border-top: 1px solid #1e293b;
    padding-top: 4px;
}

/* Demo Palette */
.tc-tft-color-bars {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    height: 55px;
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
    border: 1px solid #334155;
}
.tc-tft-color-bars div {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    font-size: 0.44rem;
    font-weight: 800;
    padding-bottom: 2px;
    color: #fff;
}
.tc-tft-shapes-demo {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 45px;
    background: #030712;
    border: 1px solid #1e293b;
    border-radius: 4px;
    margin-bottom: 6px;
}
.tc-tft-shape-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #ef4444;
    background: #22c55e;
}
.tc-tft-shape-rect {
    width: 26px;
    height: 20px;
    background: #3b82f6;
    border: 2px solid #eab308;
    border-radius: 2px;
}
.tc-tft-shape-line {
    width: 32px;
    height: 2px;
    background: #06b6d4;
    transform: rotate(30deg);
}

/* Potentiometer Quick Dial */
.tc-tft-quick-control {
    background: #030816;
    border: 1px solid #1e293b;
    border-radius: 6px;
    padding: 6px 8px;
    margin: 8px 0;
}
.tc-tft-slider {
    width: 100%;
    accent-color: #38bdf8;
    height: 5px;
    cursor: pointer;
    margin: 4px 0 6px 0;
}
.tc-tft-preset-buttons {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}
.tc-tft-chip {
    background: #1e293b;
    border: 1px solid #334155;
    color: #cbd5e1;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 3px 0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}
.tc-tft-chip:hover {
    background: #0284c7;
    color: #fff;
    border-color: #38bdf8;
}

/* Diagnostics */
.tc-tft-diag-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    background: #020617;
    border: 1px solid #1e293b;
    border-radius: 6px;
    padding: 5px 6px;
}
.tc-tft-diag-item {
    font-size: 0.55rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}
.tc-tft-diag-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ef4444;
}
.tc-tft-diag-dot.online,
.tc-tft-diag-dot.active {
    background: #22c55e;
    box-shadow: 0 0 5px #22c55e;
}

/* ========================================================
   Interactive Serial Monitor Modal
   ======================================================== */
.tc-serial-monitor-modal {
    width: 530px;
    height: 380px;
    min-width: 380px;
    min-height: 260px;
    resize: both;
    overflow: hidden;
}
.tc-serial-tx-bar {
    display: flex;
    gap: 6px;
    padding: 7px 10px;
    background: #0b0f19;
    border-bottom: 1px solid #1e293b;
    align-items: center;
}
.tc-serial-input-wrapper {
    flex: 1;
    position: relative;
}
#tcSerialModalInput {
    width: 100%;
    background: #020617;
    border: 1px solid #334155;
    border-radius: 4px;
    color: #f8fafc;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    padding: 5px 8px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}
#tcSerialModalInput:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.35);
}
#tcSerialLineEnding {
    background: #0f172a;
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    font-size: 0.72rem;
    padding: 4px 6px;
}
.btn-tc-send {
    background: #0284c7;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.btn-tc-send:hover {
    background: #0369a1;
}
.tc-serial-modal-body {
    flex: 1;
    padding: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #020617;
    position: relative;
}
.tc-serial-stream-content {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.76rem;
    line-height: 1.45;
    color: #38bdf8;
    white-space: pre-wrap;
    word-break: break-all;
    padding: 4px;
}
.tc-serial-bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: #0f172a;
    border-top: 1px solid #1e293b;
}
#tcSerialModalBaud {
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    font-size: 0.72rem;
    padding: 3px 6px;
}
.tc-comm-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    background: #334155;
    transition: background 0.1s;
    vertical-align: middle;
}
.tc-comm-dot.rx.blink {
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
}
.tc-comm-dot.tx.blink {
    background: #f59e0b;
    box-shadow: 0 0 8px #f59e0b;
}

/* ========================================================
   Oscilloscope Serial Plotter Modal
   ======================================================== */
.tc-serial-plotter-modal {
    width: 600px;
    height: 350px;
    min-width: 420px;
    min-height: 260px;
    resize: both;
    overflow: hidden;
}
.tc-plotter-modal-body {
    flex: 1;
    padding: 8px;
    background: #020617;
    position: relative;
    overflow: hidden;
}
.tc-oscilloscope-screen {
    width: 100%;
    height: 100%;
    background: #010409;
    border: 1px solid #1e293b;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    display: flex;
}
#tcSerialPlotterModalCanvas {
    width: 100%;
    height: 100%;
    display: block;
}
.tc-scope-grid-overlay {
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
    padding: 8px 0;
}
.tc-scope-tick {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem;
    color: rgba(148, 163, 184, 0.75);
    text-shadow: 0 1px 2px #000;
}
.tc-scope-hud-panel {
    position: absolute;
    top: 8px;
    right: 12px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 4px;
    padding: 3px 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: #94a3b8;
    pointer-events: none;
    line-height: 1.35;
}
.tc-plotter-hud-tag {
    font-size: 0.72rem;
    font-family: 'JetBrains Mono', monospace;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 4px;
    padding: 1px 6px;
    color: #cbd5e1;
}
.tc-plotter-bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: #0f172a;
    border-top: 1px solid #1e293b;
}
