* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    padding: 20px;
    color: #e0e0e0;
    font-size: 16px;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding: 20px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

.author {
    font-size: 1em;
    opacity: 0.85;
    margin-top: 10px;
    font-style: italic;
}

footer {
    text-align: center;
    color: #a0a0a0;
    padding: 20px;
    margin-top: 40px;
    font-size: 0.9em;
}

footer p {
    margin: 0;
}

.calculator {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 30px;
    background: #1e1e2e;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    margin-bottom: 30px;
    border: 1px solid #333;
}

.input-section,
.output-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: #2a2a3e;
    border-radius: 15px;
    min-width: 250px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid #3a3a4e;
}

.output-section {
    background: #1e3a2e;
    border: 2px solid #4a9d6e;
}

h2 {
    margin-bottom: 20px;
    color: #e0e0e0;
    font-size: 1.5em;
}

.led-group {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #2c3e50;
    border-radius: 10px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.led {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.led:hover {
    transform: scale(1.1);
}

.led-bulb {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #1a1a1a;
    border: 3px solid #333;
    box-shadow: 
        inset 0 2px 5px rgba(0, 0, 0, 0.8),
        0 0 10px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    position: relative;
}

.led-bulb::before {
    content: '';
    position: absolute;
    top: 20%;
    left: 20%;
    width: 30%;
    height: 30%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.led.on .led-bulb {
    background: #ff4444;
    border-color: #ff6666;
    box-shadow: 
        inset 0 2px 5px rgba(255, 68, 68, 0.8),
        0 0 20px rgba(255, 68, 68, 0.8),
        0 0 30px rgba(255, 68, 68, 0.6),
        0 0 40px rgba(255, 68, 68, 0.4);
    animation: pulse 2s ease-in-out infinite;
}

.led.on .led-bulb::before {
    opacity: 1;
}

.overflow-led.on .led-bulb {
    background: #ffaa00;
    border-color: #ffcc66;
    box-shadow: 
        inset 0 2px 5px rgba(255, 170, 0, 0.8),
        0 0 25px rgba(255, 170, 0, 0.9),
        0 0 35px rgba(255, 170, 0, 0.7),
        0 0 45px rgba(255, 170, 0, 0.5);
    animation: pulse-overflow 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 
            inset 0 2px 5px rgba(255, 68, 68, 0.8),
            0 0 20px rgba(255, 68, 68, 0.8),
            0 0 30px rgba(255, 68, 68, 0.6),
            0 0 40px rgba(255, 68, 68, 0.4);
    }
    50% {
        box-shadow: 
            inset 0 2px 5px rgba(255, 68, 68, 0.8),
            0 0 25px rgba(255, 68, 68, 1),
            0 0 35px rgba(255, 68, 68, 0.8),
            0 0 45px rgba(255, 68, 68, 0.6);
    }
}

@keyframes pulse-overflow {
    0%, 100% {
        box-shadow: 
            inset 0 2px 5px rgba(255, 170, 0, 0.8),
            0 0 25px rgba(255, 170, 0, 0.9),
            0 0 35px rgba(255, 170, 0, 0.7),
            0 0 45px rgba(255, 170, 0, 0.5);
    }
    50% {
        box-shadow: 
            inset 0 2px 5px rgba(255, 170, 0, 0.8),
            0 0 30px rgba(255, 170, 0, 1),
            0 0 40px rgba(255, 170, 0, 0.9),
            0 0 50px rgba(255, 170, 0, 0.7);
    }
}

.bit-label {
    font-size: 0.9em;
    color: #ecf0f1;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.value-display {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.1em;
}

.binary {
    font-family: 'Courier New', monospace;
    color: #a0a0d0;
    font-weight: bold;
}

.decimal {
    color: #4a9d6e;
    font-weight: bold;
    font-size: 1.2em;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    align-items: center;
}

.slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #3a3a4e;
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #7a7aa0;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #7a7aa0;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.number-input {
    width: 80px;
    padding: 8px;
    border: 2px solid #7a7aa0;
    border-radius: 5px;
    text-align: center;
    font-size: 1.1em;
    font-weight: bold;
    background: #1e1e2e;
    color: #e0e0e0;
}

.number-input:focus {
    outline: none;
    border-color: #9a9ac0;
    box-shadow: 0 0 5px rgba(122, 122, 160, 0.5);
}

.operator {
    font-size: 3em;
    font-weight: bold;
    color: #7a7aa0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.overflow-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 15px;
    background: #3a2e1e;
    border-radius: 10px;
    border: 2px solid #ffaa00;
}

.overflow-text {
    font-weight: bold;
    color: #ffcc66;
    font-size: 1.1em;
}

.overflow-led .bit-label {
    color: #ffcc66;
}

.info-section {
    background: #2a2a3e;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 1px solid #3a3a4e;
}

.info-section h3 {
    margin-bottom: 15px;
    color: #7a7aa0;
    font-size: 1.5em;
}

.info-section ul {
    list-style-position: inside;
    line-height: 1.8;
    color: #d0d0d0;
}

.info-section li {
    margin-bottom: 10px;
    padding-left: 10px;
}

/* Content Sections */
.content-section {
    background: #1e1e2e;
    border-radius: 15px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid #333;
}

.content-section h2 {
    color: #7a7aa0;
    font-size: 2em;
    margin-bottom: 20px;
    border-bottom: 3px solid #5a5a80;
    padding-bottom: 10px;
}

.content-section h3 {
    color: #9a9ac0;
    font-size: 1.4em;
    margin-top: 25px;
    margin-bottom: 15px;
}

.content-section h4 {
    color: #7a7aa0;
    font-size: 1.2em;
    margin-top: 20px;
    margin-bottom: 10px;
}

.content-section p {
    line-height: 1.8;
    color: #d0d0d0;
    margin-bottom: 15px;
    font-size: 1.05em;
}

.content-section ul {
    line-height: 1.8;
    color: #d0d0d0;
    margin-left: 20px;
    margin-bottom: 15px;
}

.content-section li {
    margin-bottom: 10px;
}

.content-section strong {
    color: #9a9ac0;
}

/* Project Image */
.project-image {
    margin: 30px 0;
    text-align: center;
}

.project-image img {
    max-width: 60%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    border: 3px solid #5a5a80;
}

.image-caption {
    margin-top: 15px;
    font-style: italic;
    color: #a0a0a0;
    font-size: 0.95em;
}

/* Half Adder Content */
.half-adder-content {
    margin-top: 20px;
}

.half-adder-text {
    max-width: 100%;
}

/* Truth Table */
.truth-table {
    margin: 25px 0;
    overflow-x: auto;
}

.truth-table table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.truth-table th {
    background: #5a5a80;
    color: #e0e0e0;
    padding: 12px;
    text-align: center;
    font-weight: bold;
}

.truth-table td {
    padding: 12px;
    text-align: center;
    border: 1px solid #3a3a4e;
    background: #2a2a3e;
    color: #e0e0e0;
}

.truth-table tr:nth-child(even) td {
    background: #252535;
}

.truth-table tr:hover td {
    background: #303045;
}

/* Wiring Content */
.wiring-content {
    margin-top: 20px;
}

/* Simulation Intro */
.simulation-intro {
    font-size: 1.1em;
    color: #b0b0b0;
    margin-bottom: 20px;
    text-align: center;
    font-style: italic;
}

@media (max-width: 1200px) {
    .calculator {
        flex-direction: column;
    }
    
    .operator {
        transform: rotate(90deg);
        margin: 10px 0;
    }
}

@media (max-width: 600px) {
    header h1 {
        font-size: 1.8em;
    }
    
    .led-group {
        gap: 10px;
    }
    
    .led-bulb {
        width: 40px;
        height: 40px;
    }
}

