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

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

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

header {
    text-align: center;
    padding: 30px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #8B5CF6, #6366F1, #3B82F6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.1rem;
    color: #9ca3af;
}

.visualization-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.panel h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #8B5CF6;
}

.panel canvas {
    width: 100%;
    height: 300px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    margin-bottom: 15px;
}

.panel-info {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.info-item {
    font-size: 0.9rem;
    color: #9ca3af;
}

.info-item span:last-child {
    color: #3B82F6;
    font-weight: bold;
}

.legend-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
}

.stage-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.stage-label {
    font-size: 0.8rem;
    color: #9ca3af;
    text-align: center;
}

.fate-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.fate-btn {
    flex: 1;
    padding: 10px;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.5);
    border-radius: 8px;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.fate-btn:hover {
    background: rgba(139, 92, 246, 0.4);
    transform: translateY(-2px);
}

.fate-btn.active {
    background: rgba(139, 92, 246, 0.5);
    border-color: #8B5CF6;
}

.controls-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
}

.controls-section h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #8B5CF6;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.control-group h4 {
    font-size: 1.1rem;
    color: #6366F1;
    margin-bottom: 10px;
}

.control-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #d1d5db;
}

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

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #8B5CF6;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #6366F1;
    transform: scale(1.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #8B5CF6;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-group input[type="range"]::-moz-range-thumb:hover {
    background: #6366F1;
    transform: scale(1.2);
}

.checkbox-input {
    width: auto !important;
    margin-left: 10px;
}

.preset-btn {
    padding: 12px;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.5);
    border-radius: 8px;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.preset-btn:hover {
    background: rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

.button-group {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.control-button {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-button.play {
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
}

.control-button.pause {
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: white;
}

.control-button.reset {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: white;
}

.control-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.formulas-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 20px;
    margin-top: 25px;
}

.formulas-section h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: #6366F1;
}

.formula-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.formula-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.formula-label {
    font-size: 0.85rem;
    color: #9ca3af;
}

.formula {
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    color: #3B82F6;
    background: rgba(59, 130, 246, 0.1);
    padding: 8px;
    border-radius: 5px;
}

.explanation {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 30px;
    backdrop-filter: blur(10px);
}

.explanation h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #8B5CF6;
}

.explanation h3 {
    font-size: 1.5rem;
    margin-top: 30px;
    margin-bottom: 15px;
    color: #6366F1;
}

.explanation p {
    font-size: 1rem;
    line-height: 1.8;
    color: #d1d5db;
    margin-bottom: 15px;
}

.explanation strong {
    color: #3B82F6;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    .visualization-grid {
        grid-template-columns: 1fr;
    }

    .controls-grid {
        grid-template-columns: 1fr;
    }

    .button-group {
        flex-direction: column;
    }

    .formula-list {
        grid-template-columns: 1fr;
    }
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}
