/* Reset and Base Styles */
* {
    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%, #0a0a0a 100%);
    color: #e0e0e0;
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Background Animations */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

/* Stars */
.stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: twinkle infinite, drift infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

@keyframes drift {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-50px, -30px); }
}

/* Nebulas */
.nebulas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.nebula {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.3;
    animation: nebulaDrift infinite linear;
}

@keyframes nebulaDrift {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(50px, 30px) scale(1.1); }
    100% { transform: translate(0, 0) scale(1); }
}

/* Planets */
.planets {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.planet-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: 0 0;
    animation: planetOrbit infinite linear;
}

.planet {
    position: absolute;
    border-radius: 50%;
    box-shadow: 0 0 30px rgba(255,255,255,0.3), inset -10px -10px 30px rgba(0,0,0,0.6);
    animation: planetSpin infinite linear;
}

.planet-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transform: rotateX(70deg);
}

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

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

/* Shooting Stars */
.shooting-stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.shooting-star {
    position: absolute;
    width: 2px;
    height: 80px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.8), transparent);
    animation: shoot linear;
}

@keyframes shoot {
    0% {
        transform: translateX(0) translateY(0) rotate(-45deg);
        opacity: 1;
    }
    70% {
        opacity: 1;
    }
    100% {
        transform: translateX(500px) translateY(500px) rotate(-45deg);
        opacity: 0;
    }
}

/* Equations */
.equations {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.equation {
    position: absolute;
    color: rgba(0, 255, 0, 0.15);
    font-family: 'Times New Roman', serif;
    font-weight: bold;
    animation: floatEquation infinite linear;
    white-space: nowrap;
}

@keyframes floatEquation {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) rotate(5deg);
        opacity: 0;
    }
}

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

/* Header Section */
.header {
    text-align: center;
    padding: 40px 20px;
    border-bottom: 2px solid #333;
    margin-bottom: 30px;
    position: relative;
}

.header::before {
    content: '𝕌';
    position: absolute;
    top: 10px;
    left: 20px;
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.1);
    font-weight: bold;
}

.header h1 {
    font-size: 2.5rem;
    background: linear-gradient(90deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    color: #888;
    margin-bottom: 15px;
}

.universal-set-indicator {
    display: inline-block;
    padding: 8px 20px;
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid rgba(0, 255, 0, 0.3);
    border-radius: 20px;
    color: #00ff00;
    font-size: 0.9rem;
    font-weight: bold;
}

.universal-set-indicator::before {
    content: '𝕌 = ';
    margin-right: 5px;
}

/* Main Display Area - Canvas */
.main-display {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
    position: relative;
}

.main-display::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-bottom: 20px solid rgba(0, 255, 0, 0.2);
}

.canvas-container {
    background: #1a1a2e;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(0, 255, 0, 0.3);
    position: relative;
}

#mainCanvas {
    display: block;
    border-radius: 10px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.canvas-container::after {
    content: '∈ 𝕌';
    position: absolute;
    bottom: -25px;
    right: 10px;
    font-size: 0.9rem;
    color: rgba(0, 255, 0, 0.5);
    font-weight: bold;
}

/* Color classes for pixels */
.color-0 { background: linear-gradient(135deg, #ff0000, #cc0000); }
.color-1 { background: linear-gradient(135deg, #ff7f00, #cc6600); }
.color-2 { background: linear-gradient(135deg, #ffff00, #cccc00); }
.color-3 { background: linear-gradient(135deg, #00ff00, #00cc00); }
.color-4 { background: linear-gradient(135deg, #0000ff, #0000cc); }
.color-5 { background: linear-gradient(135deg, #4b0082, #3a0066); }
.color-6 { background: linear-gradient(135deg, #9400d3, #7500a6); }

/* Chronological Timeline Section */
.chronological-timeline {
    margin-bottom: 40px;
    background: #1a1a2e;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(0, 255, 0, 0.2);
    position: relative;
}

.chronological-timeline::before {
    content: '⊂ 𝕌';
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.2rem;
    color: rgba(0, 255, 0, 0.4);
    font-weight: bold;
}

.chronological-timeline h2 {
    margin-bottom: 20px;
    color: #fff;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chronological-timeline h2::before {
    content: '{';
    font-size: 2rem;
    color: rgba(0, 255, 0, 0.3);
}

.chronological-timeline h2::after {
    content: '}';
    font-size: 2rem;
    color: rgba(0, 255, 0, 0.3);
}

.timeline-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.timeline-section {
    background: #0f0f1a;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #333;
    position: relative;
}

.timeline-section::before {
    content: '⊂';
    position: absolute;
    top: -10px;
    left: 15px;
    font-size: 1rem;
    color: rgba(0, 255, 0, 0.3);
    background: #1a1a2e;
    padding: 0 5px;
}

.timeline-section h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: #aaa;
    display: flex;
    align-items: center;
    gap: 8px;
}

.timeline-section.past h3::before {
    content: 'P ⊂ 𝕌';
    font-size: 0.8rem;
    color: rgba(0, 255, 0, 0.5);
}

.timeline-section.present h3::before {
    content: 'x ∈ 𝕌';
    font-size: 0.8rem;
    color: rgba(0, 255, 0, 0.5);
}

.timeline-section.future h3::before {
    content: 'F ⊂ 𝕌';
    font-size: 0.8rem;
    color: rgba(0, 255, 0, 0.5);
}

.past-images {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 100px;
}

.past-thumbnail {
    padding: 5px;
    background: #1a1a2e;
    border-radius: 5px;
}

.past-thumbnail canvas {
    border-radius: 3px;
    width: 100%;
}

.timeline-placeholder {
    color: #555;
    text-align: center;
    padding: 20px;
    font-style: italic;
}

.present-indicator {
    text-align: center;
}

.present-label {
    margin-bottom: 10px;
    color: #00ff00;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.present-preview {
    display: block;
    margin: 0 auto;
    padding: 10px;
    background: #1a1a2e;
    border-radius: 8px;
    border: 2px solid #00ff00;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.future-preview {
    text-align: center;
}

.future-gradient {
    height: 60px;
    background: linear-gradient(90deg, 
        rgba(255, 0, 0, 0.3), 
        rgba(255, 127, 0, 0.3), 
        rgba(255, 255, 0, 0.3), 
        rgba(0, 255, 0, 0.3), 
        rgba(0, 0, 255, 0.3), 
        rgba(75, 0, 130, 0.3), 
        rgba(148, 0, 211, 0.3)
    );
    border-radius: 8px;
    margin-bottom: 10px;
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

.future-info {
    color: #666;
    font-size: 0.9rem;
}

/* Scrolling Timeline Section */
.scrolling-timeline {
    margin-bottom: 40px;
    background: #1a1a2e;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(0, 255, 0, 0.2);
    position: relative;
}

.scrolling-timeline::before {
    content: '← Past | Present | Future →';
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 0.9rem;
    color: rgba(0, 255, 0, 0.4);
    font-weight: bold;
}

.scrolling-timeline h2 {
    margin-bottom: 20px;
    color: #fff;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.scrolling-container {
    position: relative;
    width: 100%;
    height: 200px;
    background: #0f0f1a;
    border-radius: 10px;
    border: 2px solid #333;
    overflow: hidden;
}

.scrolling-track {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 50%;
    transition: transform 0.5s ease;
}

.scroll-image {
    flex-shrink: 0;
    margin: 0 10px;
    background: #1a1a2e;
    border-radius: 8px;
    border: 2px solid #444;
    padding: 5px;
    transition: all 0.3s ease;
}

.scroll-image.current {
    border: 3px solid #00ff00;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
    transform: scale(1.1);
}

.scroll-image canvas {
    border-radius: 3px;
}

.scroll-index {
    text-align: center;
    font-size: 0.7rem;
    color: #666;
    margin-top: 5px;
}

/* Color Legend Section */
.color-legend {
    margin-bottom: 40px;
    background: #1a1a2e;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(0, 255, 0, 0.2);
    position: relative;
}

.color-legend::before {
    content: 'C = {0,1,2,3,4,5,6}';
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 0.9rem;
    color: rgba(0, 255, 0, 0.4);
    font-weight: bold;
}

.color-legend h2 {
    margin-bottom: 20px;
    color: #fff;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.legend-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #0f0f1a;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #333;
    position: relative;
}

.legend-item::after {
    content: '∈ C';
    position: absolute;
    bottom: -8px;
    right: 5px;
    font-size: 0.7rem;
    color: rgba(0, 255, 0, 0.3);
}

.color-swatch {
    width: 30px;
    height: 30px;
    border-radius: 5px;
    border: 2px solid #444;
}

.color-value {
    font-weight: bold;
    color: #fff;
    min-width: 20px;
}

.color-name {
    color: #888;
}

/* Statistics Dashboard Section */
.statistics-dashboard {
    margin-bottom: 40px;
    background: #1a1a2e;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(0, 255, 0, 0.2);
    position: relative;
}

.statistics-dashboard::before {
    content: '|𝕌| = 7^10000';
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 0.9rem;
    color: rgba(0, 255, 0, 0.4);
    font-weight: bold;
}

.statistics-dashboard h2 {
    margin-bottom: 20px;
    color: #fff;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.stats-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.progress-section {
    margin-bottom: 20px;
}

.progress-bar-container {
    width: 100%;
    height: 30px;
    background: #0f0f1a;
    border-radius: 15px;
    overflow: hidden;
    border: 2px solid #333;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3);
    transition: width 0.5s ease;
    border-radius: 15px;
}

.progress-text {
    text-align: center;
    margin-top: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    color: #00ff00;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0f0f1a;
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid #333;
}

.stat-label {
    color: #888;
    font-size: 0.95rem;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: #fff;
}

.stat-total {
    color: #666;
    font-size: 0.9rem;
}

/* Technical Details Panel */
.technical-details {
    margin-bottom: 40px;
    background: #1a1a2e;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(0, 255, 0, 0.2);
    position: relative;
}

.technical-details::before {
    content: '∀x ∈ 𝕌';
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 0.9rem;
    color: rgba(0, 255, 0, 0.4);
    font-weight: bold;
}

.technical-details h2 {
    margin-bottom: 20px;
    color: #fff;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.tech-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.tech-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0f0f1a;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid #333;
}

.tech-label {
    color: #888;
    font-size: 0.9rem;
}

.tech-value {
    font-weight: bold;
    color: #00ff00;
}

/* Controls Section */
.controls {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
}

.button-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.start-button,
.pause-button,
.reset-button {
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: bold;
    color: #fff;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    min-width: 150px;
}

.start-button {
    background: linear-gradient(135deg, #00ff00, #00cc00);
    box-shadow: 0 5px 20px rgba(0, 255, 0, 0.3);
}

.start-button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 255, 0, 0.5);
    background: linear-gradient(135deg, #00cc00, #009900);
}

.pause-button {
    background: linear-gradient(135deg, #ff9900, #cc7700);
    box-shadow: 0 5px 20px rgba(255, 153, 0, 0.3);
}

.pause-button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(255, 153, 0, 0.5);
    background: linear-gradient(135deg, #cc7700, #995500);
}

.reset-button {
    background: linear-gradient(135deg, #ff4444, #cc3333);
    box-shadow: 0 5px 20px rgba(255, 68, 68, 0.3);
}

.reset-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(255, 68, 68, 0.5);
    background: linear-gradient(135deg, #cc3333, #992222);
}

.start-button:active,
.pause-button:active,
.reset-button:active {
    transform: translateY(0);
}

.start-button:disabled,
.pause-button:disabled {
    background: #333;
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.6;
}

/* Completion Message */
.completion-message {
    background: linear-gradient(135deg, #0f3d0f, #1a5a1a);
    padding: 30px;
    border-radius: 15px;
    border: 2px solid #00ff00;
    box-shadow: 0 10px 40px rgba(0, 255, 0, 0.3);
    text-align: center;
}

.completion-content h2 {
    color: #00ff00;
    margin-bottom: 15px;
    font-size: 2rem;
}

.completion-content p {
    color: #ccc;
    margin-bottom: 25px;
    font-size: 1.1rem;
}

.completion-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.completion-stat {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px 25px;
    border-radius: 10px;
    border: 1px solid #00ff00;
}

.completion-label {
    display: block;
    color: #888;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.completion-value {
    display: block;
    color: #00ff00;
    font-size: 1.5rem;
    font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .timeline-container {
        grid-template-columns: 1fr;
    }
    
    .legend-container {
        flex-direction: column;
        align-items: center;
    }
    
    .completion-stats {
        flex-direction: column;
        gap: 15px;
    }
}
