:root {
    /* AI-Mechanical Color Palette */
    --primary-neon: #00ffff;
    --secondary-neon: #ff6b35;
    --accent-neon: #39ff14;
    --warning-neon: #ffaa00;
    --error-neon: #ff073a;
    
    --bg-primary: #0a0a0f;
    --bg-secondary: #1a1a2e;
    --bg-surface: #16213e;
    --bg-elevated: #0f3460;
    
    --text-primary: #ffffff;
    --text-secondary: #b8c5d6;
    --text-muted: #6b7794;
    --text-accent: var(--primary-neon);
    
    --border-primary: #2a3f5f;
    --border-active: var(--primary-neon);
    --border-glow: rgba(0, 255, 255, 0.3);
    
    --shadow-deep: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(0, 255, 255, 0.2);
    --shadow-intense: 0 0 30px rgba(0, 255, 255, 0.4);
}

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

body {
    font-family: 'Rajdhani', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Neural Grid Background */
.neural-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -2;
    animation: gridPulse 4s ease-in-out infinite;
}

@keyframes gridPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

.circuit-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(0, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(255, 107, 53, 0.1) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
}

/* Neural Header */
.neural-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-elevated) 100%);
    border-radius: 20px;
    border: 2px solid var(--border-primary);
    box-shadow: var(--shadow-deep), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.neural-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-neon), transparent);
    animation: scanLine 3s linear infinite;
}

@keyframes scanLine {
    0% { left: -100%; }
    100% { left: 100%; }
}

.ai-badge {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 2rem;
}

.pulse-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px solid var(--primary-neon);
    border-radius: 50%;
    animation: pulseRing 2s ease-out infinite;
}

@keyframes pulseRing {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

.ai-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, var(--primary-neon), var(--secondary-neon));
    border-radius: 50%;
    box-shadow: 0 0 30px var(--primary-neon);
    animation: coreGlow 1.5s ease-in-out infinite alternate;
}

@keyframes coreGlow {
    0% { box-shadow: 0 0 30px var(--primary-neon); }
    100% { box-shadow: 0 0 50px var(--primary-neon); }
}

.neural-title {
    font-family: 'Orbitron', monospace;
    margin-bottom: 1rem;
}

.title-main {
    display: block;
    font-size: 3.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary-neon), var(--secondary-neon));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
}

.title-sub {
    display: block;
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 0.3em;
    margin-top: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.2rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    margin-bottom: 2rem;
}

.system-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: 'Orbitron', monospace;
    font-size: 0.9rem;
    font-weight: 700;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--error-neon);
}

.status-indicator.active {
    background: var(--accent-neon);
    box-shadow: 0 0 15px var(--accent-neon);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.status-text {
    color: var(--accent-neon);
    text-shadow: 0 0 10px var(--accent-neon);
}

/* Main Content */
.neural-main {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Module Styling */
.input-module,
.conversion-module,
.resolution-module {
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: var(--shadow-deep);
    position: relative;
    overflow: hidden;
}

.input-module::before,
.conversion-module::before,
.resolution-module::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-neon), var(--secondary-neon), var(--primary-neon));
    opacity: 0.7;
}

.module-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-primary);
}

.module-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-neon), var(--secondary-neon));
    border-radius: 8px;
    color: var(--bg-primary);
}

.module-header h3 {
    font-family: 'Orbitron', monospace;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-accent);
    letter-spacing: 0.1em;
}

/* Input Styling */
.input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.neural-input {
    flex: 1;
    padding: 1.2rem 1.5rem;
    background: var(--bg-primary);
    border: 2px solid var(--border-primary);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: 'Orbitron', monospace;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.neural-input:focus {
    outline: none;
    border-color: var(--border-active);
    box-shadow: 0 0 20px var(--border-glow), inset 0 2px 8px rgba(0, 0, 0, 0.3);
    color: var(--text-accent);
}

.neural-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

/* Button Styling */
.btn {
    position: relative;
    padding: 1.2rem 2rem;
    border: none;
    border-radius: 10px;
    font-family: 'Orbitron', monospace;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    text-transform: uppercase;
}

.btn-text {
    position: relative;
    z-index: 2;
}

.btn-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover .btn-glow {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-neon), var(--secondary-neon));
    color: var(--bg-primary);
    box-shadow: 0 4px 15px rgba(0, 255, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 255, 255, 0.5);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-neon), var(--warning-neon));
    color: var(--bg-primary);
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 107, 53, 0.5);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent-neon), var(--primary-neon));
    color: var(--bg-primary);
    box-shadow: 0 4px 15px rgba(57, 255, 20, 0.3);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(57, 255, 20, 0.5);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--border-primary);
}

.btn-outline:hover {
    background: var(--bg-elevated);
    border-color: var(--border-active);
    color: var(--text-primary);
    box-shadow: 0 0 15px var(--border-glow);
}

/* Error Messages */
.error-message {
    color: var(--error-neon);
    font-family: 'Orbitron', monospace;
    font-weight: 600;
    min-height: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-shadow: 0 0 10px var(--error-neon);
}

/* Expression Display */
.expression-display {
    margin-bottom: 2rem;
}

.expression-row {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.data-label {
    position: relative;
    min-width: 100px;
}

.label-text {
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    color: var(--text-accent);
    font-size: 0.9rem;
    letter-spacing: 0.1em;
}

.label-circuit {
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-neon), transparent);
}

.expression-container {
    flex: 1;
    background: var(--bg-primary);
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.expression {
    font-family: 'Orbitron', monospace;
    font-size: 1.3rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* Processor Grid */
.processor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.stack-unit,
.expression-unit {
    background: var(--bg-primary);
    border: 2px solid var(--border-primary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.unit-header {
    background: var(--bg-elevated);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.unit-title {
    font-family: 'Orbitron', monospace;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-accent);
    letter-spacing: 0.1em;
}

.unit-indicators {
    display: flex;
    gap: 0.5rem;
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.indicator.active {
    background: var(--accent-neon);
    box-shadow: 0 0 8px var(--accent-neon);
}

.stack-chamber,
.expression-chamber {
    padding: 1.5rem;
    min-height: 120px;
}

.stack {
    display: flex;
    flex-direction: column-reverse;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
    min-height: 100px;
}

.stack-item {
    background: linear-gradient(135deg, var(--primary-neon), var(--secondary-neon));
    color: var(--bg-primary);
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(0, 255, 255, 0.3);
    animation: stackPush 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes stackPush {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.current-expression {
    font-family: 'Orbitron', monospace;
    font-size: 1.4rem;
    color: var(--text-primary);
    text-align: center;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.expression-token {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin: 0.2rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 600;
    border: 1px solid transparent;
}

.token-number {
    background: rgba(57, 255, 20, 0.2);
    color: var(--accent-neon);
    border-color: rgba(57, 255, 20, 0.3);
}

.token-operator {
    background: rgba(255, 7, 58, 0.2);
    color: var(--error-neon);
    border-color: rgba(255, 7, 58, 0.3);
}

.token-current {
    background: rgba(0, 255, 255, 0.3) !important;
    color: var(--primary-neon) !important;
    border: 2px solid var(--primary-neon) !important;
    transform: scale(1.1);
    box-shadow: 0 0 20px var(--border-glow);
}

/* Neural Log */
.neural-log {
    background: var(--bg-primary);
    border: 2px solid var(--border-primary);
    border-radius: 10px;
    margin-bottom: 2rem;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.log-header {
    background: var(--bg-elevated);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Orbitron', monospace;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-accent);
    letter-spacing: 0.1em;
}

.log-pulse {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-neon);
    animation: logPulse 1.5s ease-in-out infinite;
}

@keyframes logPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

.step-description {
    padding: 1.5rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.6;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 400;
}

/* Control Panel */
.control-panel {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

/* Result Chamber */
.result-chamber {
    background: linear-gradient(135deg, var(--bg-elevated), var(--bg-surface));
    border: 2px solid var(--accent-neon);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(57, 255, 20, 0.2);
    animation: resultReveal 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes resultReveal {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.result-chamber::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(57, 255, 20, 0.1), transparent);
    animation: resultScan 2s ease-in-out infinite;
}

@keyframes resultScan {
    0% { left: -100%; }
    100% { left: 100%; }
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.result-label {
    font-family: 'Orbitron', monospace;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-neon);
    letter-spacing: 0.1em;
    text-shadow: 0 0 15px var(--accent-neon);
}

.success-pulse {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-neon);
    box-shadow: 0 0 20px var(--accent-neon);
    animation: successPulse 1s ease-in-out infinite;
}

@keyframes successPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.3); }
}

.result-display {
    position: relative;
    z-index: 2;
}

.result-value {
    font-family: 'Orbitron', monospace;
    font-size: 4rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent-neon), var(--primary-neon));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(57, 255, 20, 0.5);
    display: block;
}

/* Neural Footer */
.neural-footer {
    margin-top: 4rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-primary);
    border-radius: 15px;
    padding: 3rem 2rem 2rem;
    box-shadow: var(--shadow-deep);
    position: relative;
    overflow: hidden;
}

.neural-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-neon), var(--primary-neon), var(--secondary-neon));
    opacity: 0.7;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    font-family: 'Orbitron', monospace;
    color: var(--text-accent);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

.doc-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.doc-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.doc-icon {
    color: var(--primary-neon);
    font-weight: bold;
    font-family: 'Orbitron', monospace;
    min-width: 20px;
    text-shadow: 0 0 10px var(--primary-neon);
}

.doc-item strong {
    color: var(--text-primary);
    font-weight: 600;
}

.resource-links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.resource-link {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem 1.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.resource-link:hover {
    border-color: var(--border-active);
    color: var(--text-accent);
    box-shadow: 0 0 15px var(--border-glow);
    transform: translateX(5px);
}

.resource-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.resource-link:hover::before {
    left: 100%;
}

.link-icon {
    font-size: 1.2rem;
    color: var(--secondary-neon);
    text-shadow: 0 0 10px var(--secondary-neon);
}

.patronage-note {
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 1.5rem;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.6;
}

.patronage-note p {
    margin-bottom: 0.5rem;
}

.patronage-note p:last-child {
    margin-bottom: 0;
    font-weight: 600;
    color: var(--text-secondary);
}

.footer-bottom {
    border-top: 1px solid var(--border-primary);
    padding-top: 2rem;
    text-align: center;
}

.system-info {
    font-family: 'Orbitron', monospace;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.separator {
    margin: 0 1rem;
    color: var(--border-primary);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .processor-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .title-main {
        font-size: 2.5rem;
    }
    
    .title-sub {
        font-size: 1.2rem;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .control-panel {
        flex-direction: column;
    }
    
    .result-value {
        font-size: 2.5rem;
    }
    
    .expression-row {
        flex-direction: column;
        gap: 1rem;
        text-align: left;
    }
    
    .data-label {
        min-width: auto;
    }
    
    .footer-grid {
        gap: 1.5rem;
    }
    
    .resource-links {
        gap: 0.8rem;
    }
}

@media (max-width: 480px) {
    .neural-header {
        padding: 2rem 1rem;
    }
    
    .title-main {
        font-size: 2rem;
    }
    
    .result-value {
        font-size: 2rem;
    }
    
    .current-expression {
        font-size: 1.1rem;
    }
    
    .btn {
        padding: 1rem 1.5rem;
        font-size: 0.8rem;
    }
}

/* Accessibility enhancements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for accessibility */
button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary-neon);
    outline-offset: 2px;
}
    