:root {
    --primary: #2563eb;
    --secondary: #3b82f6;
    --background: #ffffff;
    --text: #1f2937;
    --accent: #dbeafe;
    --overlay-bg: rgba(37, 99, 235, 0.9);
}

[data-theme="dark"] {
    --primary: #3b82f6;
    --secondary: #60a5fa;
    --background: #111827;
    --text: #f3f4f6;
    --accent: #1e3a8a;
    --overlay-bg: rgba(37, 99, 235, 0.95);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--background);
    color: var(--text);
    transition: all 0.3s ease;
    line-height: 1.6;
}

.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 24px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1000;
}

.hamburger span {
    width: 100%;
    height: 3px;
    background: var(--primary);
    transition: all 0.3s ease;
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.menu-overlay.active {
    display: flex;
    opacity: 1;
}

.menu-content {
    text-align: center;
    max-width: 80%;
    position: relative;
}

.menu-content h2 {
    color: white;
    margin-bottom: 1rem;
    font-size: 2rem;
}

.menu-content ul {
    list-style: none;
    padding: 0;
}

.era-menu-item {
    color: white;
    font-size: 1.5rem;
    margin: 1rem 0;
    cursor: pointer;
    transition: transform 0.3s ease;
    background: rgba(255,255,255,0.1);
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.era-menu-item:hover {
    transform: scale(1.1);
    background: rgba(255,255,255,0.2);
}

.close-menu {
    position: absolute;
    top: -2rem;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
}

nav {
    padding: 1rem;
    background: var(--accent);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo img {
    width: 40px;
    height: 40px;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.quick-controls button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

#content-area {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    overflow-x: hidden;
}

.content-section {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.content-section.active {
    opacity: 1;
    transform: translateY(0);
}

.era-description {
    background: var(--accent);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.visual-explanation, .language-timeline, .visual-programming-tools, .ai-tools-showcase {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 1rem 0;
}

.code-snippets, .tool-showcase, .ai-tools-showcase {
    display: flex;
    gap: 1rem;
}

.code-snippet, .tool-item, .ai-tool {
    background: var(--background);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 1rem;
    flex: 1;
    text-align: center;
}

.key-takeaways {
    background: var(--primary);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.key-takeaways p {
    margin: 0.5rem 0;
}

.timeline {
    display: flex;
    justify-content: space-between;
    padding: 2rem;
    position: relative;
    margin: 2rem 0;
}

.timeline-track {
    position: absolute;
    height: 4px;
    background: var(--primary);
    width: 100%;
    top: 50%;
    transform: translateY(-50%);
    z-index: -1;
}

.era {
    background: var(--accent);
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.era.active {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

.bit-box {
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0.5rem;
    border-radius: 8px;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--secondary);
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.binary-converter {
    background: var(--accent);
    padding: 1.5rem;
    border-radius: 12px;
    margin: 1rem 0;
}

.converter-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

#binary-input {
    flex-grow: 1;
    padding: 0.5rem;
    border: 1px solid var(--primary);
    border-radius: 8px;
}

#convert-binary-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
}

#convert-binary-btn:hover {
    background: var(--secondary);
}

.binary-output {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    background: var(--background);
    padding: 1rem;
    border-radius: 8px;
}

.binary-illustration {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 1rem 0;
}

.binary-state {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.binary-light {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.binary-light.off {
    background: #e0e0e0;
    border: 3px solid #888;
}

.binary-light.on {
    background: #4caf50;
    border: 3px solid #2e7d32;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.7);
}

.era-illustration {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 1rem;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.era-header p {
    font-size: 1.2rem;
    font-style: italic;
    color: var(--secondary);
    margin-bottom: 1rem;
}

.binary-conversion-result {
    background: var(--accent);
    padding: 1rem;
    border-radius: 8px;
}

.binary-chars-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.binary-char {
    background: var(--background);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 0.5rem;
    text-align: center;
    min-width: 100px;
}

.binary-char .char {
    font-weight: bold;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.binary-char .binary-code {
    font-family: monospace;
    color: var(--primary);
    word-break: break-all;
}

@media (max-width: 768px) {
    .logo h1 {
        font-size: 1.2rem;
    }

    .era-description {
        padding: 1rem;
    }

    .code-snippets, 
    .visual-explanation, 
    .language-timeline, 
    .visual-programming-tools, 
    .ai-tools-showcase {
        flex-direction: column;
    }

    .code-snippet, 
    .tool-item, 
    .ai-tool,
    .language-item {
        margin-bottom: 1rem;
    }

    .process-steps {
        flex-direction: column;
    }

    .step {
        margin-bottom: 1rem;
    }
    
    .timeline {
        flex-direction: column;
        gap: 1rem;
    }
    
    .timeline-track {
        width: 4px;
        height: 100%;
        left: 2rem;
    }
    
    .era {
        margin-left: 4rem;
    }

    .binary-illustration {
        flex-direction: column;
        align-items: center;
    }

    .binary-light {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 480px) {
    .logo img {
        width: 30px;
        height: 30px;
    }

    .menu-content h2 {
        font-size: 1.5rem;
    }

    .era-menu-item {
        font-size: 1.2rem;
    }
}