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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    color: #ffffff;
    overflow-x: hidden;
}

.header {
    text-align: center;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: #64ffda;
    text-shadow: 0 0 20px rgba(100, 255, 218, 0.5);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.control-panel {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn:hover {
    background: rgba(100, 255, 218, 0.2);
    border-color: #64ffda;
    transform: translateY(-2px);
}

.btn.primary {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    border-color: #ff6b6b;
}

.btn.active {
    background: rgba(100, 255, 218, 0.3);
    border-color: #64ffda;
}

.btn.evolution-btn {
    background: linear-gradient(45deg, #9c88ff, #7c6ac7);
    border-color: #9c88ff;
}

.btn.evolution-btn.active {
    background: rgba(156, 136, 255, 0.4);
    border-color: #9c88ff;
}

.btn.activity-btn {
    background: linear-gradient(45deg, #00ff88, #00cc66);
    border-color: #00ff88;
}

.btn.activity-btn.active {
    background: rgba(0, 255, 136, 0.4);
    border-color: #00ff88;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
}

/* Evolution Panel Styles */
.evolution-panel {
    background: rgba(0, 0, 0, 0.4);
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.evolution-panel.hidden {
    display: none;
}

.evolution-panel h3 {
    color: #9c88ff;
    margin-bottom: 1rem;
    text-align: center;
}

.evolution-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.evolution-slider-container {
    text-align: center;
}

.evolution-slider-container label {
    display: block;
    color: #64ffda;
    margin-bottom: 0.5rem;
}

#evolution-slider {
    width: 300px;
    max-width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
}

.stage-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.stage-btn {
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
}

.evolution-annotations {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.annotation-item h4 {
    color: #ff9ff3;
    margin-bottom: 0.5rem;
}

.annotation-item p {
    font-size: 0.9rem;
    line-height: 1.5;
    opacity: 0.9;
}

#visualization-container {
    display: flex;
    height: 600px;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.model-container {
    flex: 1;
    position: relative;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.model-container:last-child {
    border-right: none;
}

.model-container.hidden {
    display: none;
}

.model-container.full-width {
    flex: 2;
}

#brain-canvas, #cosmic-canvas {
    width: 100%;
    height: 100%;
}

.model-label {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: bold;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.info-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.panel h3 {
    color: #64ffda;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

/* Interactive Statistics Styles */
.interactive-stat {
    transition: all 0.3s ease;
    cursor: pointer;
    border-radius: 10px;
    padding: 1rem;
    margin: 0.5rem 0;
    position: relative;
    overflow: hidden;
}

.interactive-stat:hover {
    transform: scale(1.05);
    background: rgba(100, 255, 218, 0.1) !important;
    box-shadow: 0 0 20px rgba(100, 255, 218, 0.3) !important;
}

.animated-counter {
    font-weight: bold;
    color: #64ffda;
    display: inline-block;
    min-width: 2em;
    text-align: right;
    transition: all 0.3s ease;
}

.animated-counter:hover {
    text-shadow: 0 0 10px rgba(100, 255, 218, 0.8);
}

.stats-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.stat-particle {
    position: absolute;
    background: #64ffda;
    border-radius: 50%;
    opacity: 0.8;
    transition: all 2s ease-out;
}

.stat-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(100, 255, 218, 0.3);
    transform: scale(0);
    pointer-events: none;
    transition: transform 0.6s ease-out, opacity 0.6s ease-out;
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.stat-item h4 {
    color: #ff9ff3;
    margin-bottom: 0.5rem;
}

.stat-item p {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.note {
    font-style: italic;
    opacity: 0.8;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(100, 255, 218, 0.1);
    border-radius: 8px;
}

.comparison-image {
    width: 100%;
    max-width: 300px;
    height: auto;
    border-radius: 10px;
    margin: 1rem 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.comparison-image:hover {
    transform: scale(1.02);
    box-shadow: 0 0 15px rgba(100, 255, 218, 0.3);
}

.comparison-image.large {
    max-width: 500px;
}

caption {
    font-size: 0.85rem;
    opacity: 0.8;
    font-style: italic;
    display: block;
    margin-top: 0.5rem;
}

.scale-statement {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255, 107, 107, 0.1);
    border-radius: 10px;
    border-left: 4px solid #ff6b6b;
}

.scale-slider {
    margin: 1rem 0;
}

.scale-slider label {
    display: block;
    margin-bottom: 0.5rem;
    color: #64ffda;
}

#scale-range {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    margin-bottom: 0.5rem;
}

.scale-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    opacity: 0.7;
}

.slice-info {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.slice-info p {
    margin-bottom: 0.5rem;
}

#morphology-panel ul {
    list-style: none;
    padding-left: 0;
}

#morphology-panel li {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid #64ffda;
}

.scale-panel {
    position: relative;
}

.scale-visualization {
    width: 100%;
    height: 300px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    margin: 1rem 0;
    background: rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.scale-info-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 0.5rem;
    border-radius: 5px;
    font-size: 0.9rem;
    color: #64ffda;
    pointer-events: none;
    z-index: 10;
}

.scale-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.scale-particle {
    position: absolute;
    border-radius: 50%;
    transition: all 0.5s ease;
}

.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.popup.hidden {
    opacity: 0;
    pointer-events: none;
}

.popup-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    padding: 2rem;
    border-radius: 15px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #ff6b6b;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: #ff9ff3;
}

#popup-title {
    color: #64ffda;
    margin-bottom: 1rem;
}

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a0a, #1a1a2e);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.5s ease;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(100, 255, 218, 0.3);
    border-top: 3px solid #64ffda;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .control-panel {
        flex-wrap: wrap;
    }
    
    #visualization-container {
        flex-direction: column;
        height: 800px;
    }
    
    .info-panels {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
    
    .stat-grid {
        grid-template-columns: 1fr;
    }
    
    .evolution-annotations {
        grid-template-columns: 1fr;
    }
    
    .stage-buttons {
        flex-direction: column;
        align-items: center;
    }
}

.advanced-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 2rem;
    padding: 2rem;
    margin-top: 2rem;
    background: linear-gradient(135deg, rgba(10, 10, 26, 0.8), rgba(22, 33, 62, 0.6));
    border-top: 2px solid rgba(100, 255, 218, 0.3);
}

.advanced-panel {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(100, 255, 218, 0.2);
    min-height: 400px;
}

.advanced-panel h3 {
    color: #9c88ff;
    border-bottom: 1px solid rgba(156, 136, 255, 0.3);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.analysis-controls {
    margin-bottom: 1.5rem;
}

.analysis-slider-group {
    margin-bottom: 1rem;
}

.analysis-slider-group label {
    display: block;
    color: #64ffda;
    margin-bottom: 0.5rem;
}

.morphology-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.analysis-btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    background: linear-gradient(45deg, #64ffda, #4ecdc4);
    border-color: #64ffda;
}

.analysis-btn:hover {
    background: linear-gradient(45deg, #4ecdc4, #45b7aa);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(100, 255, 218, 0.3);
}

.morphology-visualization {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.morphology-metric {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 8px;
    border-left: 3px solid #64ffda;
}

.morphology-metric h4 {
    color: #ff9ff3;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.metric-bar-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.metric-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.metric-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #64ffda, #9c88ff);
    border-radius: 4px;
    transition: width 0.5s ease;
}

#connectivity-bar::after { width: 85%; }
#clustering-bar::after { width: 72%; }
#hierarchy-bar::after { width: 91%; }

.metric-value {
    font-weight: bold;
    color: #64ffda;
    min-width: 3em;
    text-align: right;
}

.information-controls {
    margin-bottom: 1.5rem;
}

.info-type-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.info-btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 159, 243, 0.2);
    border-color: #ff9ff3;
}

.info-btn.active {
    background: rgba(255, 159, 243, 0.4);
    box-shadow: 0 0 10px rgba(255, 159, 243, 0.3);
}

.information-slider label {
    display: block;
    color: #ff9ff3;
    margin-bottom: 0.5rem;
}

.information-visualization {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#information-canvas {
    width: 100%;
    height: 200px;
    border: 1px solid rgba(255, 159, 243, 0.3);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.5);
}

.information-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.info-stat {
    text-align: center;
    padding: 0.5rem;
    background: rgba(255, 159, 243, 0.1);
    border-radius: 6px;
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: #ff9ff3;
    margin-bottom: 0.25rem;
}

.stat-value {
    display: block;
    font-weight: bold;
    color: #ffffff;
    font-size: 1.1rem;
}

.topology-controls {
    margin-bottom: 1.5rem;
}

.topology-metrics {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.topology-btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    border-color: #ff6b6b;
}

.topology-btn:hover {
    background: linear-gradient(45deg, #ee5a24, #d63031);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.topology-filter label {
    display: block;
    color: #ff6b6b;
    margin-bottom: 0.5rem;
}

.topology-results {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 1rem;
}

#topology-graph {
    height: 200px;
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.5);
    position: relative;
}

.topology-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.topo-stat {
    background: rgba(255, 107, 107, 0.1);
    padding: 0.75rem;
    border-radius: 6px;
    text-align: center;
}

.topo-stat h4 {
    color: #ff6b6b;
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.topo-stat span {
    font-weight: bold;
    color: #ffffff;
}

.emergence-controls {
    margin-bottom: 1.5rem;
}

.emergence-scenario {
    margin-bottom: 1rem;
}

.emergence-scenario label {
    display: block;
    color: #00ff88;
    margin-bottom: 0.5rem;
}

.emergence-scenario select {
    width: 100%;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 4px;
    color: #ffffff;
}

.emergence-parameters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.param-control label {
    display: block;
    color: #00ff88;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.emergence-btn {
    background: linear-gradient(45deg, #00ff88, #00cc66);
    border-color: #00ff88;
    padding: 0.75rem 1.5rem;
    font-weight: bold;
}

.emergence-btn:hover {
    background: linear-gradient(45deg, #00cc66, #00aa55);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.4);
}

#emergence-canvas {
    width: 100%;
    height: 300px;
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.5);
    margin-bottom: 1rem;
}

.emergence-metrics {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

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

.emergence-metric span {
    color: #00ff88;
    min-width: 120px;
    font-size: 0.9rem;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff88, #64ffda);
    border-radius: 3px;
    transition: width 0.5s ease;
}

#order-progress { width: 73%; }
#coherence-progress { width: 85%; }

.correlation-controls {
    margin-bottom: 1.5rem;
}

.scale-mapping {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.scale-pair {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.scale-pair label {
    color: #ffa500;
    font-size: 0.9rem;
}

.scale-pair input {
    width: 100%;
}

.scale-pair span {
    color: #ffffff;
    font-weight: bold;
    text-align: center;
}

.correlation-arrow {
    font-size: 1.5rem;
    color: #ffa500;
    text-align: center;
}

.correlation-strength label {
    display: block;
    color: #ffa500;
    margin-bottom: 0.5rem;
}

.correlation-bar {
    width: 100%;
    height: 12px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.correlation-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #ffa500, #64ffda);
    border-radius: 6px;
    width: 89%;
    transition: width 0.5s ease;
}

.correlation-explanation {
    background: rgba(255, 165, 0, 0.1);
    padding: 1rem;
    border-radius: 8px;
    border-left: 3px solid #ffa500;
}

.correlation-explanation p {
    margin: 0;
    line-height: 1.5;
    color: #ffffff;
}