* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: white;
    user-select: none;
    overflow-x: hidden;
    height: 100vh; /* Full viewport height */
    overflow-y: hidden; /* Prevent vertical scroll on desktop */
}

.game-header {
    text-align: center;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.game-title {
    font-size: 1.8rem;
    background: linear-gradient(45deg, #ffd700, #ffeb3b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
    line-height: 1.1;
}

.game-subtitle {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 8px;
}

.instructions {
    font-size: 0.85rem;
    line-height: 1.4;
    color: #ecf0f1;
    opacity: 0.9;
}

.instructions strong {
    color: #f39c12;
}

.game-container {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    max-width: 1600px;
    margin: 10px auto;
    padding: 0 20px;
    height: calc(100vh - 140px); /* Reduced height calculation due to smaller header */
    max-height: calc(100vh - 140px); /* Prevent overflow */
}

.info-panel.left-panel {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Circuit Section - Contains console + circuit area */
.circuit-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 600px;
    gap: 10px;
}

/* Feedback Container - Console above circuit area only */
.feedback-container {
    width: 100%;
    display: flex;
    justify-content: stretch; /* Changed from center to stretch */
    z-index: 200;
}

.feedback-box {
    background: rgba(52, 152, 219, 0.95);
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 0.8rem;
    line-height: 1.2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-align: center;
    width: 100%; /* Changed from max-width to full width */
    height: 100px; /* Increased height to fit more content */
    min-height: 100px; /* Ensure minimum height */
    max-height: 100px; /* Prevent expansion */
    overflow-y: auto; /* Allow scrolling if content is too long */
    transition: all 0.3s ease;
    opacity: 1;
    /* Console-like appearance */
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    border-left: 4px solid rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Feedback box states - console-like with left border indicators */
.feedback-box.success {
    background: rgba(46, 204, 113, 0.95);
    border-left-color: #2ecc71;
}

.feedback-box.warning {
    background: rgba(230, 126, 34, 0.95);
    border-left-color: #f39c12;
}

.feedback-box.error {
    background: rgba(231, 76, 60, 0.95);
    border-left-color: #e74c3c;
}

.feedback-box.info {
    background: rgba(52, 152, 219, 0.95);
    border-left-color: #3498db;
}

/* Circuit area - Workspace below console */
.circuit-area {
    flex: 1;
    background: #2c3e50;
    border-radius: 15px;
    border: 3px solid #34495e;
    position: relative;
    height: calc(100% - 110px); /* Subtract feedback box height + gap */
    min-height: 400px; /* Minimum usable height */
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.info-panel {
    width: 350px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.panel {
    width: 100%; /* Ensure full width */
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.panel h3 {
    color: #ffd700;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.status-item {
    display: flex;
    align-items: center;
    margin: 8px 0;
    font-size: 0.9rem;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 10px;
    background: #e74c3c;
    transition: all 0.3s ease;
}

.status-dot.active {
    background: #2ecc71;
    box-shadow: 0 0 12px rgba(46, 204, 113, 0.6);
}

.component {
    position: absolute;
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
}

.component:hover {
    transform: scale(1.05);
}

.component.dragging {
    cursor: grabbing;
    z-index: 1000;
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

/* Battery - Realistic D-Cell Design */
.battery {
    width: 60px;
    height: 120px;
    background: linear-gradient(
        to bottom,
        red 50%,
        black 50%
    );
    border: 2px solid #2c1810;
    border-radius: 6px;
    top: 100px;
    left: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    position: relative;
    box-shadow: 
        inset 3px 0 6px rgba(255,255,255,0.15),
        inset -3px 0 6px rgba(0,0,0,0.5),
        inset 0 3px 6px rgba(255,255,255,0.1),
        inset 0 -3px 6px rgba(0,0,0,0.4),
        0 3px 8px rgba(0,0,0,0.4),
        0 1px 0 rgba(255,255,255,0.1);
    overflow: visible; /* Changed from hidden to show the raised terminal */
    transition: all 0.3s ease;
}

/* Short Circuit Shake Animation */
@keyframes shortCircuitShake {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-5px) rotate(-1deg); }
    20% { transform: translateX(5px) rotate(1deg); }
    30% { transform: translateX(-4px) rotate(-1deg); }
    40% { transform: translateX(4px) rotate(1deg); }
    50% { transform: translateX(-3px) rotate(-0.5deg); }
    60% { transform: translateX(3px) rotate(0.5deg); }
    70% { transform: translateX(-2px) rotate(-0.5deg); }
    80% { transform: translateX(2px) rotate(0.5deg); }
    90% { transform: translateX(-1px); }
}

.battery.short-circuit-shake {
    animation: shortCircuitShake 0.6s ease-in-out infinite;
}

.battery.short-circuit-danger {
    border-color: #ff0000 !important;
    box-shadow: 
        inset 3px 0 6px rgba(255,255,255,0.15),
        inset -3px 0 6px rgba(0,0,0,0.5),
        inset 0 3px 6px rgba(255,255,255,0.1),
        inset 0 -3px 6px rgba(0,0,0,0.4),
        0 0 20px rgba(255, 0, 0, 0.8),
        0 0 40px rgba(255, 0, 0, 0.4),
        0 3px 8px rgba(0,0,0,0.4),
        0 1px 0 rgba(255,255,255,0.1) !important;
}

/* Battery positive terminal (top) - raised like a small stick */
.battery::before {
    content: '';
    position: absolute;
    top: -10px; /* Raised higher above the battery */
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 10px; /* Taller to look like a small stick */
    background: linear-gradient(to bottom, #f8f9fa, #e9ecef, #dee2e6, #adb5bd);
    border: 1px solid yellow;
    border-radius: 6px 6px 2px 2px;
    box-shadow: 
        0 3px 6px rgba(0,0,0,0.5),
        inset 0 2px 3px rgba(255,255,255,0.4),
        inset 0 -2px 3px rgba(0,0,0,0.4),
        inset 2px 0 3px rgba(255,255,255,0.2),
        inset -2px 0 3px rgba(0,0,0,0.3);
}

/* Realistic D-cell battery label */
.battery-label {
    color: #ffffff;
    font-weight: 900;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%) rotate(180deg);
    text-shadow: 
        0 1px 2px rgba(0,0,0,0.8),
        0 0 4px rgba(255,255,255,0.3);
    z-index: 10;
    letter-spacing: 1px;
}

/* Knife Switch - Realistic Design */
.switch {
    width: 80px;
    height: 40px;
    background: linear-gradient(
        to bottom,
        #2c2c2c 0%,
        #1a1a1a 25%,
        #0d0d0d 50%,
        #000000 75%,
        #1a1a1a 100%
    );
    border: 2px solid #333333;
    border-radius: 4px;
    top: 100px;
    left: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    box-shadow: 
        inset 2px 0 4px rgba(255,255,255,0.1),
        inset -2px 0 4px rgba(0,0,0,0.8),
        inset 0 2px 4px rgba(255,255,255,0.05),
        inset 0 -2px 4px rgba(0,0,0,0.6),
        0 2px 8px rgba(0,0,0,0.4);
}

/* Switch copper contact points - side view (elevated) */
.switch::before {
    content: '';
    position: absolute;
    left: 15px;
    top: -8px; /* Elevated above the switch body */
    width: 10px;
    height: 12px; /* Taller for side view */
    background: linear-gradient(to bottom, #cd7f32, #b8860b, #daa520);
    border: 1px solid #8b4513;
    border-radius: 2px 2px 0 0;
    box-shadow: 
        inset 1px 1px 2px rgba(255,215,0,0.4),
        inset -1px -1px 2px rgba(139,69,19,0.6),
        0 2px 4px rgba(0,0,0,0.4);
}

.switch::after {
    content: '';
    position: absolute;
    right: 15px;
    top: -8px; /* Elevated above the switch body */
    width: 10px;
    height: 12px; /* Taller for side view */
    background: linear-gradient(to bottom, #cd7f32, #b8860b, #daa520);
    border: 1px solid #8b4513;
    border-radius: 2px 2px 0 0;
    box-shadow: 
        inset 1px 1px 2px rgba(255,215,0,0.4),
        inset -1px -1px 2px rgba(139,69,19,0.6),
        0 2px 4px rgba(0,0,0,0.4);
}

/* Knife switch lever - side view (protruding from switch) */
.switch-lever {
    width: 45px; /* Longer for side view effect */
    height: 4px;
    background: linear-gradient(
        to right,
        #cd7f32 0%,
        #daa520 20%,
        #ffd700 40%,
        #daa520 60%,
        #b8860b 80%,
        #8b4513 100%
    );
    border: 1px solid #8b4513;
    border-radius: 1px;
    transition: all 0.3s ease;
    transform-origin: 8px center; /* Pivot point closer to switch body */
    transform: rotate(-35deg); /* Steeper angle for side view */
    position: absolute;
    left: 16px; /* Positioned to start from switch body */
    top: -10px; /* Slightly elevated above switch center */
    box-shadow: 
        inset 0 1px 2px rgba(255,215,0,0.6),
        inset 0 -1px 2px rgba(139,69,19,0.8),
        0 2px 4px rgba(0,0,0,0.4);
}

/* Knife switch lever handle - side view */
.switch-lever::before {
    content: '';
    position: absolute;
    right: -8px; /* Positioned at the end of the lever */
    top: 0%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    background: linear-gradient(
        135deg,
        #2c2c2c,
        #1a1a1a,
        #000000,
        #1a1a1a
    );
    border: 1px solid #444444;
    border-radius: 50%;
    box-shadow: 
        inset 1px 1px 2px rgba(255,255,255,0.1),
        inset -1px -1px 2px rgba(0,0,0,0.8),
        0 2px 4px rgba(0,0,0,0.5);
}

/* Closed switch state - side view */
.switch.closed .switch-lever {
    transform: rotate(-5deg); /* Nearly horizontal but slight angle for side view */
    background: linear-gradient(
        to right,
        #daa520 0%,
        #ffd700 25%,
        #ffff99 50%,
        #ffd700 75%,
        #daa520 100%
    );
    box-shadow: 
        inset 0 1px 2px rgba(255,255,0,0.8),
        inset 0 -1px 2px rgba(139,69,19,0.6),
        0 0 8px rgba(255,215,0,0.4),
        0 2px 4px rgba(0,0,0,0.4);
}

/* Switch label */
.switch-label {
    position: absolute;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1rem;
    color: #bdc3c7;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* Lamp with Bulb - Combined Component (Horizontal) */
/* Realistic Lamp Holder - Side View */
.lamp-with-bulb {
    border-radius: 30px;
    width: 70px;
    height: 70px;
    top: 220px;
    left: 400px;
    position: relative;
    cursor: grab;
    transition: all 0.2s ease;
}

.lamp-holder-base {
    border-radius: 30px;
    width: 70px;
    height: 70px;
    background: linear-gradient(
        135deg,
        #2c2c2c 0%,
        #1a1a1a 25%,
        #0d0d0d 50%,
        #000000 75%,
        #1a1a1a 100%
    );
    border: 2px solid #333333;
    position: absolute;
    bottom: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        inset 2px 2px 6px rgba(255,255,255,0.1),
        inset -2px -2px 6px rgba(0,0,0,0.8),
        0 3px 8px rgba(0,0,0,0.4);
}

/* Add threaded socket inside */
.lamp-holder-base::before {
    content: '';
    position: absolute;
    width: 15px;
    height: 30px;
    background: linear-gradient(to bottom, #404040, #202020, #404040);
    border-radius: 10%;
    box-shadow: 
        inset 0 1px 2px rgba(255,255,255,0.2),
        inset 0 -1px 2px rgba(0,0,0,0.6);
}

.lamp-with-bulb.has-power .lamp-holder-base {
    border-color: #ffd700;
    box-shadow: 
        inset 2px 2px 6px rgba(255,255,255,0.1),
        inset -2px -2px 6px rgba(0,0,0,0.8),
        0 0 15px rgba(255, 215, 0, 0.3),
        0 3px 8px rgba(0,0,0,0.4);
}

.lamp-label {
    position: absolute;
    bottom: 20%;
    left: 160%;
    font-size: 0.7rem;
    color: #bdc3c7;
    white-space: nowrap;
}

/* Simple Realistic Light Bulb */
.bulb-in-holder {
    width: 60px;
    height: 45px;
    background: radial-gradient(ellipse at 30% 30%, rgba(255,255,255,0.9), rgba(220,220,220,0.7), rgba(180,180,180,0.8));
    border: 2px solid #95a5a6;
    border-radius: 50% 50% 50% 50% / 60% 60% 60% 60%;
    position: absolute;
    top: 12px;
    left: 50px;
    transition: all 0.3s ease;
    transform: rotate(180deg);
    box-shadow: inset -2px -2px 6px rgba(0,0,0,0.2), inset 2px 2px 6px rgba(255,255,255,0.4);
}

/* Metal screw base */
.bulb-in-holder::before {
    content: '';
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 25px;
    background: linear-gradient(to bottom, #c0c0c0, #909090, #c0c0c0);
    border-radius: 0 4px 4px 0;
    border: 1px solid #707070;
}

/* Simple filament */
.bulb-in-holder::after {
    content: '';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: rgba(139, 69, 19, 0.3);
    border-radius: 50%;
    border: 1px solid rgba(139, 69, 19, 0.6);
}

/* Glowing state */
.bulb-in-holder.glowing {
    background: radial-gradient(ellipse at 30% 30%, rgba(255,255,255,1), rgba(255,235,59,0.9), rgba(255,193,7,0.8));
    border-color: #ffd700;
    box-shadow: 0 0 25px rgba(255, 235, 59, 0.8), inset -2px -2px 6px rgba(255,140,0,0.3);
}

.bulb-in-holder.glowing::after {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 8px rgba(255, 235, 59, 0.8);
}

/* Realistic Wires */
.wire {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 15px; /* Round wire shape */
    box-shadow: 
        inset 0 3px 6px rgba(255,255,255,0.3),
        inset 0 -3px 6px rgba(0,0,0,0.4),
        0 2px 4px rgba(0,0,0,0.2);
}

/* Red Wire - Realistic insulation */
.wire-red {
    width: 200px;
    height: 20px;
    background: linear-gradient(
        to bottom,
        #ff6b6b 0%,
        #e74c3c 50%,
        #c0392b 100%
    );
    border: 2px solid #a93226;
    border-radius: 5px;
    top: 400px;
    left: 50px;
    box-shadow: 
        inset 0 3px 6px rgba(255,255,255,0.4),
        inset 0 -3px 6px rgba(0,0,0,0.5),
        0 2px 6px rgba(0,0,0,0.3);
}

/* White Wire - Realistic insulation */
.wire-white {
    width: 200px;
    height: 20px;
    background: linear-gradient(
        to bottom,
        #ffffff 0%,
        #ecf0f1 50%,
        #d5d8dc 100%
    );
    border: 2px solid #bdc3c7;
    border-radius: 5px;
    top: 420px;
    left: 50px;
    box-shadow: 
        inset 0 3px 6px rgba(255,255,255,0.6),
        inset 0 -3px 6px rgba(0,0,0,0.3),
        0 2px 6px rgba(0,0,0,0.2);
}

/* Black Wire - Realistic insulation */
.wire-black {
    width: 200px;
    height: 20px;
    background: linear-gradient(
        to bottom,
        #34495e 0%,
        #2c3e50 50%,
        #1b2631 100%
    );
    border: 2px solid #17202a;
    border-radius: 5px;
    top: 440px;
    left: 50px;
    box-shadow: 
        inset 0 3px 6px rgba(255,255,255,0.2),
        inset 0 -3px 6px rgba(0,0,0,0.7),
        0 2px 6px rgba(0,0,0,0.4);
}

/* Wire selection effect */
.wire.selected {
    box-shadow: 
        inset 0 3px 6px rgba(255,255,255,0.4),
        inset 0 -3px 6px rgba(0,0,0,0.5),
        0 0 15px rgba(255, 255, 255, 0.8),
        0 0 25px rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

/* Connection Points */
/* Wire stripping animation */
.wire.wire-stripping {
    animation: wireStripping 0.8s ease-in-out;
}

@keyframes wireStripping {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.05) rotate(1deg); }
    50% { transform: scale(1.1) rotate(-1deg); }
    75% { transform: scale(1.05) rotate(1deg); }
}

/* Stripped wire with longer copper ends - ALL WIRES GET COPPER ENDS */
.wire.wire-stripped::before,
.wire.wire-stripped::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 80%;
    background: linear-gradient(
        to bottom,
        #cd7f32 0%,
        #daa520 30%,
        #ffd700 50%,
        #daa520 70%,
        #b8860b 100%
    );
    border: 2px solid #8b4513;
    border-radius: 8px;
    top: 0;
    box-shadow: 
        inset 1px 1px 3px rgba(255, 215, 0, 0.6),
        inset -1px -1px 3px rgba(139, 69, 19, 0.8),
        0 0 8px rgba(255, 215, 0, 0.4);
}

.wire.wire-stripped::before {
    left: -10px;
}

.wire.wire-stripped::after {
    right: -10px;
}

/* Make copper ends consistent for all wire colors */
.wire-red.wire-stripped::before,
.wire-red.wire-stripped::after,
.wire-white.wire-stripped::before,
.wire-white.wire-stripped::after,
.wire-black.wire-stripped::before,
.wire-black.wire-stripped::after {
    width: 10px;
    background: linear-gradient(
        to bottom,
        #cd7f32 0%,
        #daa520 25%,
        #ffd700 50%,
        #daa520 75%,
        #b8860b 100%
    );
    border: 2px solid #8b4513;
    box-shadow: 
        inset 1px 1px 3px rgba(255, 215, 0, 0.6),
        inset -1px -1px 3px rgba(139, 69, 19, 0.8),
        0 0 8px rgba(255, 215, 0, 0.4);
}

.connection-point.ready-for-connection {
    animation: readyPulse 1s ease-in-out 2;
    transform: scale(1.2);
}

@keyframes readyPulse {
    0%, 100% { 
        box-shadow: 
            inset -2px -2px 4px rgba(0, 0, 0, 0.4),
            inset 2px 2px 4px rgba(88, 214, 141, 0.6),
            0 0 15px rgba(46, 204, 113, 0.9),
            0 2px 6px rgba(0, 0, 0, 0.3);
    }
    50% { 
        box-shadow: 
            inset -2px -2px 4px rgba(0, 0, 0, 0.4),
            inset 2px 2px 4px rgba(88, 214, 141, 0.6),
            0 0 25px rgba(46, 204, 113, 1),
            0 2px 6px rgba(0, 0, 0, 0.3);
    }
}
.connection-point {
    position: absolute;
    width: 20px;
    height: 20px;
    background: radial-gradient(
        circle at 25% 25%, 
        #ffd700 0%,
        #daa520 30%,
        #b8860b 60%,
        #8b6914 100%
    );
    border: 2px solid #8b4513;
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    transition: all 0.2s ease;
    color: #2c1810;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 0.7rem;
    box-shadow:
        inset -2px -2px 4px rgba(0, 0, 0, 0.4),
        inset 2px 2px 4px rgba(255, 215, 0, 0.6),
        0 2px 6px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(139, 69, 19, 0.3);
}

.connection-point:hover {
    transform: scale(1.15);
    background: radial-gradient(
        circle at 25% 25%, 
        #ffff99 0%,
        #ffd700 30%,
        #daa520 60%,
        #b8860b 100%
    );
    box-shadow:
        inset -2px -2px 4px rgba(0, 0, 0, 0.3),
        inset 2px 2px 4px rgba(255, 255, 0, 0.8),
        0 0 8px rgba(255, 215, 0, 0.4),
        0 2px 6px rgba(0, 0, 0, 0.3);
}

.connection-point.connected {
    background: radial-gradient(
        circle at 25% 25%, 
        #58d68d 0%,
        #2ecc71 40%,
        #27ae60 80%,
        #1e8449 100%
    );
    border-color: #1e8449;
    box-shadow: 
        inset -2px -2px 4px rgba(0, 0, 0, 0.4),
        inset 2px 2px 4px rgba(88, 214, 141, 0.6),
        0 0 12px rgba(46, 204, 113, 0.7),
        0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Realistic Circuit Wires - Color-coded with Stripped Ends */
.circuit-wire {
    position: absolute;
    height: 8px; /* Slightly thicker for better visibility */
    z-index: 10;
    border-radius: 4px;
    transition: all 0.3s ease;
    overflow: visible;
}

/* Red Circuit Wire */
.circuit-wire.red-circuit {
    background: linear-gradient(
        to bottom,
        #ff6b6b 0%,
        #e74c3c 50%,
        #c0392b 100%
    );
    border: 1px solid #a93226;
    box-shadow: 
        inset 0 1px 2px rgba(255,255,255,0.4),
        inset 0 -1px 2px rgba(169,50,38,0.6),
        0 1px 4px rgba(0, 0, 0, 0.3);
}

/* White Circuit Wire */
.circuit-wire.white-circuit {
    background: linear-gradient(
        to bottom,
        #ffffff 0%,
        #ecf0f1 50%,
        #d5d8dc 100%
    );
    border: 1px solid #bdc3c7;
    box-shadow: 
        inset 0 1px 2px rgba(255,255,255,0.6),
        inset 0 -1px 2px rgba(189,195,199,0.4),
        0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Black Circuit Wire */
.circuit-wire.black-circuit {
    background: linear-gradient(
        to bottom,
        #34495e 0%,
        #2c3e50 50%,
        #1b2631 100%
    );
    border: 1px solid #17202a;
    box-shadow: 
        inset 0 1px 2px rgba(255,255,255,0.2),
        inset 0 -1px 2px rgba(23,32,42,0.7),
        0 1px 4px rgba(0, 0, 0, 0.4);
}

/* Default Copper Wire (fallback) */
.circuit-wire:not(.red-circuit):not(.white-circuit):not(.black-circuit) {
    background: linear-gradient(
        to bottom,
        #cd7f32 0%,
        #daa520 50%,
        #b8860b 100%
    );
    border: 1px solid #8b4513;
    box-shadow: 
        inset 0 1px 2px rgba(255, 215, 0, 0.4),
        inset 0 -1px 2px rgba(139, 69, 19, 0.6),
        0 1px 4px rgba(0, 0, 0, 0.3);
}

/* ALL CIRCUIT WIRES GET STANDARD COPPER ENDS */
.circuit-wire::before,
.circuit-wire::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: linear-gradient(
        45deg,
        #cd7f32 0%,
        #ffd700 50%,
        #b8860b 100%
    );
    border: 1px solid #8b4513;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    box-shadow: 
        inset 1px 1px 2px rgba(255, 215, 0, 0.8),
        inset -1px -1px 2px rgba(139, 69, 19, 0.6),
        0 0 6px rgba(255, 215, 0, 0.4);
}

.circuit-wire::before {
    left: -8px;
}

.circuit-wire::after {
    right: -8px;
}

/* Active wire state */
.circuit-wire.active {
    filter: brightness(1.2);
    box-shadow: 
        0 0 12px rgba(46, 204, 113, 0.8),
        0 0 6px rgba(46, 204, 113, 0.4);
}

.circuit-wire.active.red-circuit {
    box-shadow: 
        inset 0 1px 2px rgba(255,255,255,0.4),
        inset 0 -1px 2px rgba(169,50,38,0.6),
        0 0 12px rgba(46, 204, 113, 0.8),
        0 1px 4px rgba(0, 0, 0, 0.3);
}

.circuit-wire.active.white-circuit {
    box-shadow: 
        inset 0 1px 2px rgba(255,255,255,0.6),
        inset 0 -1px 2px rgba(189,195,199,0.4),
        0 0 12px rgba(46, 204, 113, 0.8),
        0 1px 4px rgba(0, 0, 0, 0.2);
}

.circuit-wire.active.black-circuit {
    box-shadow: 
        inset 0 1px 2px rgba(255,255,255,0.2),
        inset 0 -1px 2px rgba(23,32,42,0.7),
        0 0 12px rgba(46, 204, 113, 0.8),
        0 1px 4px rgba(0, 0, 0, 0.4);
}

/* Enhanced Realistic Electron Animation - Following Wires with Spiral Motion */
.electron {
    position: absolute;
    width: 6px;
    height: 6px;
    background: radial-gradient(
        circle,
        #ffffff 0%,
        #ffff00 40%,
        #ffd700 100%
    );
    border: 1px solid #ffff00;
    border-radius: 50%;
    z-index: 15;
    box-shadow: 
        0 0 8px rgba(255, 255, 0, 0.9),
        0 0 16px rgba(255, 215, 0, 0.6),
        inset 0 0 4px rgba(255, 255, 255, 0.8);
    transition: transform 0.1s ease-out;
}

/* New class for wire-following electrons */
.electron.wire-following {
    width: 5px;
    height: 5px;
    background: radial-gradient(
        circle,
        #ffffff 0%,
        #00ffff 40%,
        #0099ff 100%
    );
    border: 1px solid #00ccff;
    box-shadow: 
        0 0 6px rgba(0, 255, 255, 0.9),
        0 0 12px rgba(0, 153, 255, 0.6),
        inset 0 0 3px rgba(255, 255, 255, 0.9);
    animation: electronGlow 1s ease-in-out infinite alternate;
}

@keyframes electronGlow {
    0% { 
        opacity: 0.8;
        box-shadow: 
            0 0 4px rgba(0, 255, 255, 0.7),
            0 0 8px rgba(0, 153, 255, 0.4),
            inset 0 0 2px rgba(255, 255, 255, 0.8);
    }
    100% { 
        opacity: 1;
        box-shadow: 
            0 0 8px rgba(0, 255, 255, 1),
            0 0 16px rgba(0, 153, 255, 0.8),
            inset 0 0 4px rgba(255, 255, 255, 1);
    }
}

/* Legacy electron animation for backward compatibility */
@keyframes electronFlow {
    0% { 
        transform: translateX(0) translateY(0);
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
    100% { 
        transform: translateX(var(--flow-x)) translateY(var(--flow-y));
        opacity: 0.6;
    }
}

.electron.flowing {
    animation: electronFlow 2s linear infinite;
}

/* Educational Info */
.concept-explanation {
    font-size: 0.85rem;
    line-height: 1.4;
    color: #ecf0f1;
}

.concept-explanation strong {
    color: #f39c12;
}

.reset-button {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 8px 16px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    z-index: 50;
    transition: background 0.3s ease;
}

.reset-button:hover {
    background: #c0392b;
}

/* Desktop specific styles to prevent layout shifts */
@media (min-width: 1201px) {
    body {
        overflow-y: hidden; /* No vertical scroll on desktop */
    }
    
    .game-container {
        height: calc(100vh - 140px); /* Fixed container height - reduced due to smaller header */
        max-height: calc(100vh - 140px);
    }
    
    .feedback-box {
        height: 100px; /* Increased feedback box height */
        min-height: 100px;
        max-height: 100px;
        overflow-y: auto;
        padding: 8px 15px;
        font-size: 0.8rem;
        line-height: 1.2;
    }
    
    .circuit-area {
        height: calc(100% - 110px); /* Responsive to container minus feedback */
        min-height: 400px;
    }
}

/* Mobile responsive feedback */
@media (max-width: 1200px) {
    body {
        overflow-y: auto; /* Restore scroll on mobile */
        height: auto; /* Auto height on mobile */
    }
    
    .game-container {
        flex-direction: column;
        height: auto; /* Auto height on mobile */
        max-height: none; /* Remove height restrictions on mobile */
    }
    
    .circuit-section {
        min-width: 400px;
        gap: 5px;
    }
    
    .info-panel {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
    }
    
    .info-panel.left-panel {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
    }
    
    .panel {
        min-width: 300px;
    }
    
    .feedback-container {
        padding: 0 10px;
    }
    
    .feedback-box {
        font-size: 0.8rem;
        padding: 8px 15px;
        max-width: 100%;
        height: auto; /* Auto height on mobile */
        min-height: 20px; /* Restore original min-height */
        max-height: none; /* Remove height restriction on mobile */
    }
    
    .circuit-area {
        height: 450px; /* Fixed height on mobile */
        min-width: 400px;
        width: 100%;
        min-height: 400px;
        overflow-y: auto;
        padding: 20px;
    }

    /* Mobile Realistic Styles - Adapted to match desktop components */

    /* Battery - Mobile with realistic D-cell styling */
    .battery {
        position: absolute;
        width: 45px;
        height: 90px;
        top: 150px;
        left: 50px;
        background: linear-gradient(
            to bottom,
            red 50%,
            black 50%
        );
        border: 2px solid #2c1810;
        border-radius: 6px;
        box-shadow: 
            inset 3px 0 6px rgba(255,255,255,0.15),
            inset -3px 0 6px rgba(0,0,0,0.5),
            inset 0 3px 6px rgba(255,255,255,0.1),
            inset 0 -3px 6px rgba(0,0,0,0.4),
            0 3px 8px rgba(0,0,0,0.4),
            0 1px 0 rgba(255,255,255,0.1);
        overflow: visible;
    }

    .battery::before {
        top: -8px;
        left: 50%;
        transform: translateX(-50%);
        width: 14px;
        height: 8px;
        background: linear-gradient(to bottom, #f8f9fa, #e9ecef, #dee2e6, #adb5bd);
        border: 1px solid yellow;
        border-radius: 6px 6px 2px 2px;
        box-shadow: 
            0 3px 6px rgba(0,0,0,0.5),
            inset 0 2px 3px rgba(255,255,255,0.4),
            inset 0 -2px 3px rgba(0,0,0,0.4),
            inset 2px 0 3px rgba(255,255,255,0.2),
            inset -2px 0 3px rgba(0,0,0,0.3);
    }

    .battery-label {
        position: absolute;
        bottom: 15px;
        left: 50%;
        transform: translateX(-50%);
        writing-mode: horizontal-tb;
        text-orientation: mixed;
        font-size: 0.6rem;
        color: #ffffff;
        white-space: nowrap;
        font-weight: 900;
        text-shadow: 
            0 1px 2px rgba(0,0,0,0.8),
            0 0 4px rgba(255,255,255,0.3);
        letter-spacing: 1px;
    }

    /* Switch - Mobile with realistic knife switch styling */
    .switch {
        position: absolute;
        width: 70px;
        height: 35px;
        top: 50px;
        left: 150px;
        background: linear-gradient(
            to bottom,
            #2c2c2c 0%,
            #1a1a1a 25%,
            #0d0d0d 50%,
            #000000 75%,
            #1a1a1a 100%
        );
        border: 2px solid #333333;
        border-radius: 4px;
        box-shadow: 
            inset 2px 0 4px rgba(255,255,255,0.1),
            inset -2px 0 4px rgba(0,0,0,0.8),
            inset 0 2px 4px rgba(255,255,255,0.05),
            inset 0 -2px 4px rgba(0,0,0,0.6),
            0 2px 8px rgba(0,0,0,0.4);
    }

    .switch::before {
        top: -7px;
        left: 12px;
        width: 8px;
        height: 10px;
        background: linear-gradient(to bottom, #cd7f32, #b8860b, #daa520);
        border: 1px solid #8b4513;
        border-radius: 2px 2px 0 0;
        box-shadow: 
            inset 1px 1px 2px rgba(255,215,0,0.4),
            inset -1px -1px 2px rgba(139,69,19,0.6),
            0 2px 4px rgba(0,0,0,0.4);
    }

    .switch::after {
        top: -7px;
        right: 12px;
        width: 8px;
        height: 10px;
        background: linear-gradient(to bottom, #cd7f32, #b8860b, #daa520);
        border: 1px solid #8b4513;
        border-radius: 2px 2px 0 0;
        box-shadow: 
            inset 1px 1px 2px rgba(255,215,0,0.4),
            inset -1px -1px 2px rgba(139,69,19,0.6),
            0 2px 4px rgba(0,0,0,0.4);
    }

    .switch-lever {
        width: 35px;
        height: 3px;
        left: 12px;
        top: -8px;
        transform-origin: 6px center;
        transform: rotate(-35deg);
        background: linear-gradient(
            to right,
            #cd7f32 0%,
            #daa520 20%,
            #ffd700 40%,
            #daa520 60%,
            #b8860b 80%,
            #8b4513 100%
        );
        border: 1px solid #8b4513;
        border-radius: 1px;
        box-shadow: 
            inset 0 1px 2px rgba(255,215,0,0.6),
            inset 0 -1px 2px rgba(139,69,19,0.8),
            0 2px 4px rgba(0,0,0,0.4);
    }

    .switch-lever::before {
        right: -6px;
        top: 0%;
        transform: translateY(-50%);
        width: 12px;
        height: 12px;
        background: linear-gradient(135deg, #2c2c2c, #1a1a1a, #000000, #1a1a1a);
        border: 1px solid #444444;
        border-radius: 50%;
        box-shadow: 
            inset 1px 1px 2px rgba(255,255,255,0.1),
            inset -1px -1px 2px rgba(0,0,0,0.8),
            0 2px 4px rgba(0,0,0,0.5);
    }

    .switch.closed .switch-lever {
        transform: rotate(-5deg);
        background: linear-gradient(
            to right,
            #daa520 0%,
            #ffd700 25%,
            #ffff99 50%,
            #ffd700 75%,
            #daa520 100%
        );
        box-shadow: 
            inset 0 1px 2px rgba(255,255,0,0.8),
            inset 0 -1px 2px rgba(139,69,19,0.6),
            0 0 8px rgba(255,215,0,0.4),
            0 2px 4px rgba(0,0,0,0.4);
    }

    .switch-label {
        position: absolute;
        bottom: -20px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 0.8rem;
        color: #bdc3c7;
        font-weight: bold;
        text-shadow: 0 1px 2px rgba(0,0,0,0.8);
        white-space: nowrap;
    }

    /* Lamp with Bulb - Mobile with realistic styling */
    .lamp-with-bulb {
        position: absolute;
        width: 60px;
        height: 60px;
        top: 200px;
        left: 250px;
        border-radius: 30px;
    }

    .lamp-holder-base {
        width: 60px;
        height: 60px;
        position: relative;
        border-radius: 30px;
        background: linear-gradient(
            135deg,
            #2c2c2c 0%,
            #1a1a1a 25%,
            #0d0d0d 50%,
            #000000 75%,
            #1a1a1a 100%
        );
        border: 2px solid #333333;
        box-shadow: 
            inset 2px 2px 6px rgba(255,255,255,0.1),
            inset -2px -2px 6px rgba(0,0,0,0.8),
            0 3px 8px rgba(0,0,0,0.4);
    }

    .lamp-holder-base::before {
        width: 12px;
        height: 24px;
        background: linear-gradient(to bottom, #404040, #202020, #404040);
        border-radius: 10%;
        box-shadow: 
            inset 0 1px 2px rgba(255,255,255,0.2),
            inset 0 -1px 2px rgba(0,0,0,0.6);
    }

    .bulb-in-holder {
        position: absolute;
        top: 8px;
        left: 30px;
        width: 44px;
        height: 35px;
        transform: rotate(-180deg);
        background: radial-gradient(ellipse at 30% 30%, rgba(255,255,255,0.9), rgba(220,220,220,0.7), rgba(180,180,180,0.8));
        border: 2px solid #95a5a6;
        border-radius: 50% 50% 50% 50% / 60% 60% 60% 60%;
        box-shadow: inset -2px -2px 6px rgba(0,0,0,0.2), inset 2px 2px 6px rgba(255,255,255,0.4);
    }

    .bulb-in-holder::before {
        right: -8px;
        width: 10px;
        height: 20px;
        border-radius: 0 3px 3px 0;
        background: linear-gradient(to bottom, #c0c0c0, #909090, #c0c0c0);
        border: 1px solid #707070;
    }

    .bulb-in-holder::after {
        left: 12px;
        width: 16px;
        height: 16px;
        background: rgba(139, 69, 19, 0.3);
        border-radius: 50%;
        border: 1px solid rgba(139, 69, 19, 0.6);
    }

    .bulb-in-holder.glowing {
        background: radial-gradient(ellipse at 30% 30%, rgba(255,255,255,1), rgba(255,235,59,0.9), rgba(255,193,7,0.8));
        border-color: #ffd700;
        box-shadow: 0 0 25px rgba(255, 235, 59, 0.8), inset -2px -2px 6px rgba(255,140,0,0.3);
    }

    .bulb-in-holder.glowing::after {
        background: rgba(255, 255, 255, 0.9);
        border-color: rgba(255, 255, 255, 0.8);
        box-shadow: 0 0 8px rgba(255, 235, 59, 0.8);
    }

    .lamp-label {
        position: absolute;
        bottom: -35px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 0.7rem;
        color: #bdc3c7;
        white-space: nowrap;
    }

    /* Wires - Mobile with realistic styling */
    .wire-red {
        position: absolute;
        width: 120px;
        height: 30px;
        top: 300px;
        left: 50px;
        background: linear-gradient(to bottom, #ff6b6b 0%, #e74c3c 50%, #c0392b 100%);
        border: 2px solid #a93226;
        border-radius: 15px;
        box-shadow: 
            inset 0 3px 6px rgba(255,255,255,0.4),
            inset 0 -3px 6px rgba(0,0,0,0.5),
            0 2px 6px rgba(0,0,0,0.3);
    }

    .wire-white {
        position: absolute;
        width: 120px;
        height: 30px;
        top: 330px;
        left: 50px;
        background: linear-gradient(to bottom, #ffffff 0%, #ecf0f1 50%, #d5d8dc 100%);
        border: 2px solid #bdc3c7;
        border-radius: 15px;
        box-shadow: 
            inset 0 3px 6px rgba(255,255,255,0.6),
            inset 0 -3px 6px rgba(0,0,0,0.3),
            0 2px 6px rgba(0,0,0,0.2);
    }

    .wire-black {
        position: absolute;
        width: 120px;
        height: 30px;
        top: 360px;
        left: 50px;
        background: linear-gradient(to bottom, #34495e 0%, #2c3e50 50%, #1b2631 100%);
        border: 2px solid #17202a;
        border-radius: 15px;
        box-shadow: 
            inset 0 3px 6px rgba(255,255,255,0.2),
            inset 0 -3px 6px rgba(0,0,0,0.7),
            0 2px 6px rgba(0,0,0,0.4);
    }

    /* Connection points - Mobile with realistic brass styling (bigger for touch) */
    .connection-point {
        width: 20px;
        height: 20px;
        border-width: 2px;
        font-size: 0.8rem;
        background: radial-gradient(
            circle at 25% 25%, 
            #ffd700 0%,
            #daa520 30%,
            #b8860b 60%,
            #8b6914 100%
        );
        border: 2px solid #8b4513;
        box-shadow:
            inset -2px -2px 4px rgba(0, 0, 0, 0.4),
            inset 2px 2px 4px rgba(255, 215, 0, 0.6),
            0 2px 6px rgba(0, 0, 0, 0.3),
            0 0 0 1px rgba(139, 69, 19, 0.3);
    }

    /* Reset button */
    .reset-button {
        top: 10px;
        right: 10px;
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}