/* ========================================
   REAL CONSCIOUSNESS AUDIO ENGINE STYLES
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;900&family=JetBrains+Mono:wght@400;700&display=swap');

:root {
    --primary: #4facfe;
    --secondary: #00ff88;
    --gold: #ffd700;
    --dark: #0a0a0f;
    --darker: #050508;
    --light: #e8e8f0;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--darker);
    color: var(--light);
    line-height: 1.6;
    overflow-x: hidden;
}

code {
    font-family: 'JetBrains Mono', monospace;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.9em;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Hero Section */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
}

#consciousnessCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 900px;
}

.hero h1 {
    font-size: 4rem;
    font-weight: 900;
    margin-bottom: 20px;
    background: var(--gradient-3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.5rem;
    margin-bottom: 40px;
    opacity: 0.9;
}

.equation-display {
    background: rgba(255, 255, 255, 0.05);
    padding: 30px;
    border-radius: 15px;
    border: 2px solid rgba(79, 172, 254, 0.3);
    margin: 40px 0;
}

.equation-display code {
    font-size: 1.2rem;
    background: none;
    padding: 0;
    color: var(--secondary);
}

/* Engine Section */
.engine-section {
    background: var(--dark);
    padding: 100px 0;
}

.section-title {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 20px;
    text-align: center;
    background: var(--gradient-3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-intro {
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: 60px;
    opacity: 0.9;
}

/* Intent Input */
.intent-input,
.optimization-panel,
.evolution-panel,
.synthesis-panel,
.pipeline-panel,
.algorithm-panel {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 20px;
    padding: 40px;
    margin: 50px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.intent-input h3,
.optimization-panel h3,
.evolution-panel h3,
.synthesis-panel h3,
.pipeline-panel h3,
.algorithm-panel h3 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: var(--secondary);
}

.intent-input p,
.optimization-panel p,
.evolution-panel p,
.synthesis-panel p {
    margin-bottom: 20px;
    opacity: 0.8;
}

#intentPrompt {
    width: 100%;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: var(--light);
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    resize: vertical;
    margin-bottom: 20px;
}

#intentPrompt:focus {
    outline: none;
    border-color: var(--primary);
}

.encode-btn,
.synth-btn {
    background: var(--gradient-3);
    color: var(--light);
    padding: 15px 40px;
    border: none;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.encode-btn:hover,
.synth-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(79, 172, 254, 0.5);
}

.intent-output {
    margin-top: 30px;
    padding: 20px;
    background: rgba(0, 255, 136, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.intent-output h4 {
    margin-bottom: 15px;
    color: var(--secondary);
}

.vector-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    margin-bottom: 20px;
}

.goal-weights {
    margin-top: 20px;
}

.goal-weight {
    display: flex;
    align-items: center;
    margin: 10px 0;
    gap: 15px;
}

.goal-weight span:first-child {
    min-width: 120px;
    font-weight: 600;
}

.goal-weight span:last-child {
    min-width: 60px;
    text-align: right;
    color: var(--gold);
}

.weight-bar {
    height: 20px;
    background: var(--gradient-3);
    border-radius: 10px;
    transition: width 0.3s ease;
}

/* Energy Functions */
.energy-functions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.energy-card {
    background: rgba(255, 255, 255, 0.03);
    padding: 25px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.energy-card.highlight {
    border-color: var(--secondary);
    background: rgba(0, 255, 136, 0.05);
}

.energy-card h4 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--primary);
}

.energy-value {
    font-size: 2.5rem;
    font-weight: 900;
    font-family: 'JetBrains Mono', monospace;
    background: var(--gradient-3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-top: 15px;
}

/* Optimization Visualization */
.optimization-viz {
    margin: 30px 0;
}

.optimization-viz canvas {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
}

.viz-label {
    text-align: center;
    margin-top: 10px;
    opacity: 0.7;
    font-size: 0.9rem;
}

/* Equation Box */
.equation-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid var(--gold);
    margin: 20px 0;
    overflow-x: auto;
}

.equation-box code {
    font-size: 1.1rem;
    background: none;
    color: var(--secondary);
}

/* Evolution Controls */
.evolution-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin: 30px 0;
}

.param-control {
    background: rgba(255, 255, 255, 0.03);
    padding: 20px;
    border-radius: 10px;
}

.param-control label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--primary);
}

.param-control input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    -webkit-appearance: none;
}

.param-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--gradient-3);
    cursor: pointer;
}

.param-control input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--gradient-3);
    cursor: pointer;
    border: none;
}

.param-control span {
    display: inline-block;
    margin-left: 10px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--gold);
    font-weight: 700;
}

#evolutionCanvas,
#amplitudeCanvas {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    margin: 20px 0;
}

/* Evolution Metrics */
.evolution-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.metric {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metric span:first-child {
    opacity: 0.8;
}

.metric span:last-child {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--secondary);
    font-size: 1.2rem;
}

/* Synthesis Config */
.synthesis-config {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.modulation-display {
    margin: 30px 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.modulation-display h4 {
    margin-bottom: 15px;
    color: var(--gold);
}

/* Audio Output */
.audio-output {
    margin-top: 30px;
    padding: 30px;
    background: rgba(0, 255, 136, 0.05);
    border-radius: 15px;
    border: 2px solid rgba(0, 255, 136, 0.3);
}

#waveformCanvas {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    margin-bottom: 20px;
}

.audio-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
    flex-wrap: wrap;
}

.audio-controls button {
    padding: 15px 35px;
    background: var(--gradient-2);
    border: none;
    border-radius: 10px;
    color: var(--light);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.audio-controls button:hover {
    transform: scale(1.05);
}

/* Processing Chain */
.processing-chain {
    margin-top: 30px;
}

.processing-chain h4 {
    margin-bottom: 20px;
    color: var(--primary);
}

.chain-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.chain-steps .step {
    padding: 15px 25px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.chain-steps .step.active {
    background: rgba(0, 255, 136, 0.1);
    border-color: var(--secondary);
}

.chain-steps .arrow {
    font-size: 1.5rem;
    color: var(--gold);
}

/* Pipeline Panel */
.pipeline-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 40px 0;
    flex-wrap: wrap;
}

.pipeline-step {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.1);
    min-width: 150px;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gradient-3);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-weight: 900;
    font-size: 1.3rem;
}

.pipeline-step h4 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--primary);
}

.pipeline-step p {
    font-size: 0.9rem;
    opacity: 0.8;
}

.arrow-big {
    font-size: 2rem;
    color: var(--gold);
    font-weight: 900;
}

/* Algorithm Panel */
.algo-steps {
    margin-top: 30px;
}

.algo-step {
    background: rgba(255, 255, 255, 0.02);
    padding: 25px;
    border-radius: 10px;
    margin: 20px 0;
    border-left: 4px solid var(--secondary);
}

.algo-step h4 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: var(--primary);
}

.algo-step code {
    display: block;
    margin: 15px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    font-size: 1rem;
    overflow-x: auto;
}

.algo-step p {
    opacity: 0.85;
}

/* Info Section */
.info-section {
    background: var(--darker);
    padding: 100px 0;
    text-align: center;
}

.info-section h2 {
    font-size: 3rem;
    margin-bottom: 20px;
}

.info-section p {
    font-size: 1.3rem;
    margin-bottom: 20px;
    opacity: 0.9;
}

.links {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 40px;
    flex-wrap: wrap;
}

.link-btn {
    padding: 15px 40px;
    background: var(--gradient-3);
    color: var(--light);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.link-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(79, 172, 254, 0.5);
}

/* Glitch Effect */
.glitch {
    position: relative;
    animation: glitch 5s infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    left: 2px;
    text-shadow: -2px 0 #ff00c1;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -2px 0 #00fff9;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim2 5s infinite linear alternate-reverse;
}

@keyframes glitch {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

@keyframes glitch-anim {
    0% { clip: rect(10px, 9999px, 31px, 0); }
    25% { clip: rect(70px, 9999px, 71px, 0); }
    50% { clip: rect(50px, 9999px, 90px, 0); }
    75% { clip: rect(30px, 9999px, 60px, 0); }
    100% { clip: rect(85px, 9999px, 140px, 0); }
}

@keyframes glitch-anim2 {
    0% { clip: rect(65px, 9999px, 119px, 0); }
    25% { clip: rect(10px, 9999px, 105px, 0); }
    50% { clip: rect(120px, 9999px, 130px, 0); }
    75% { clip: rect(45px, 9999px, 60px, 0); }
    100% { clip: rect(25px, 9999px, 46px, 0); }
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .evolution-controls,
    .synthesis-config,
    .energy-functions {
        grid-template-columns: 1fr;
    }
    
    .pipeline-flow {
        flex-direction: column;
    }
    
    .arrow-big {
        transform: rotate(90deg);
    }
}