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

body {
    background: #000000;
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    height: 100vh;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #1a1a1a, #0d0d0d);
    border-bottom: 1px solid #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
    position: relative;
    z-index: 100;
}

.title h1 {
    font-family: 'Orbitron', monospace;
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(45deg, #00ffff, #ff0080);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
}

.subtitle {
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.2rem;
}

.nav-tabs {
    display: flex;
    gap: 1rem;
}

.nav-tab {
    background: transparent;
    border: 1px solid #333;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.nav-tab:hover {
    border-color: #00ffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.nav-tab.active {
    background: rgba(0, 255, 255, 0.1);
    border-color: #00ffff;
    color: #00ffff;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
}

.status-bar {
    display: flex;
    gap: 1rem;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.8rem;
    color: #aaa;
}

.equation-display {
    color: #00ffff;
}

/* Main Layout */
.main-layout {
    display: flex;
    height: calc(100vh - 80px);
    position: relative;
}

.left-panel, .right-panel {
    width: 300px;
    background: rgba(26, 26, 26, 0.95);
    border: 1px solid rgba(0, 255, 255, 0.3);
    padding: 1rem;
    overflow-y: auto;
    backdrop-filter: blur(10px);
    z-index: 50;
}

.right-panel {
    border-left: none;
}

.canvas-container {
    flex: 1;
    position: relative;
    background: #000;
    overflow: hidden;
}

#scene-container {
    width: 100%;
    height: 100%;
}

.canvas-overlay {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
}

.overlay-button {
    background: rgba(26, 26, 26, 0.8);
    border: 1px solid #333;
    color: #fff;
    padding: 0.5rem;
    border-radius: 0.3rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.overlay-button:hover,
.overlay-button.active {
    border-color: #00ffff;
    color: #00ffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

/* Panel Sections */
.panel-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #333;
}

.panel-section:last-child {
    border-bottom: none;
}

.panel-section h3 {
    color: #00ffff;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Coordinate Selector */
.coordinate-selector {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.coordinate-selector label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.coordinate-selector input[type="radio"] {
    accent-color: #00ffff;
}

/* Equation Input */
.equation-input {
    margin-bottom: 1rem;
}

#equation-editor {
    width: 100%;
    height: 100px;
    background: #0d0d0d;
    border: 1px solid #333;
    border-radius: 0.5rem;
    color: #fff;
    padding: 0.75rem;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.9rem;
    resize: vertical;
    transition: border-color 0.3s ease;
}

#equation-editor:focus {
    outline: none;
    border-color: #00ffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

.validation-status {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    padding: 0.3rem;
    border-radius: 0.3rem;
}

.validation-status.valid {
    color: #00ff00;
    background: rgba(0, 255, 0, 0.1);
}

.validation-status.warning {
    color: #ffaa00;
    background: rgba(255, 170, 0, 0.1);
}

.validation-status.error {
    color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
}

/* Parameter Controls */
.parameter {
    margin-bottom: 1rem;
}

.parameter label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #ccc;
}

.parameter input[type="range"] {
    width: 100%;
    height: 6px;
    background: #333;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.parameter input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #00ffff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
    transition: all 0.3s ease;
}

.parameter input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.7);
}

.parameter input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #00ffff;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

/* Animation Controls */
.animation-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.control-button {
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid #00ffff;
    color: #00ffff;
    padding: 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    margin-right: 0.5rem;
    min-width: 50px;
}

.control-button:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
}

/* Render Modes */
.render-modes {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.mode-tab {
    flex: 1;
    background: transparent;
    border: 1px solid #333;
    color: #fff;
    padding: 0.5rem;
    border-radius: 0.3rem;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.mode-tab:hover {
    border-color: #00ffff;
}

.mode-tab.active {
    background: rgba(0, 255, 255, 0.1);
    border-color: #00ffff;
    color: #00ffff;
}

/* Color Schemes */
.color-schemes {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.color-preset {
    width: 100%;
    height: 40px;
    border-radius: 0.3rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.color-preset:hover,
.color-preset.active {
    border-color: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Quality Indicator */
.quality-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.indicator-bar {
    flex: 1;
    height: 6px;
    background: #333;
    border-radius: 3px;
    overflow: hidden;
}

.indicator-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff4444, #ffaa00, #00ff00);
    transition: width 0.3s ease;
}

/* Preset Gallery */
.preset-gallery {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.preset-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #333;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preset-card:hover,
.preset-card.active {
    border-color: #00ffff;
    background: rgba(0, 255, 255, 0.05);
    transform: translateX(5px);
}

.preset-thumbnail {
    width: 40px;
    height: 30px;
    background: linear-gradient(45deg, #333, #555);
    border-radius: 0.3rem;
    position: relative;
    overflow: hidden;
}

.preset-thumbnail::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #00ffff;
    transform: translateY(-50%) scaleY(3);
    border-radius: 1px;
}

.preset-card span {
    font-size: 0.9rem;
    color: #ccc;
}

.preset-card.active span {
    color: #00ffff;
}

/* Export Buttons */
.export-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.export-button {
    background: rgba(255, 0, 128, 0.1);
    border: 1px solid #ff0080;
    color: #ff0080;
    padding: 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.export-button:hover {
    background: rgba(255, 0, 128, 0.2);
    box-shadow: 0 0 15px rgba(255, 0, 128, 0.3);
    transform: translateY(-2px);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Loading State */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: #000;
    color: #00ffff;
    font-family: 'Orbitron', monospace;
}

/* Error State */
.error-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid #ff4444;
    color: #ff4444;
    padding: 2rem;
    border-radius: 0.5rem;
    text-align: center;
    z-index: 1000;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .left-panel, .right-panel {
        width: 250px;
    }
    
    .title h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
    }
    
    .left-panel, .right-panel {
        width: 100%;
        height: 200px;
        position: absolute;
        bottom: -200px;
        transition: bottom 0.3s ease;
        z-index: 20;
        border-radius: 1rem 1rem 0 0;
    }
    
    .left-panel.open, .right-panel.open {
        bottom: 0;
    }
    
    .header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .nav-tabs {
        order: -1;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav-tab {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .status-bar {
        font-size: 0.7rem;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }
    
    .canvas-container {
        height: 100%;
    }
    
    .canvas-overlay {
        top: 0.5rem;
        right: 0.5rem;
    }
    
    .overlay-button {
        padding: 0.4rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0.5rem;
    }
    
    .title h1 {
        font-size: 1.2rem;
    }
    
    .subtitle {
        font-size: 0.7rem;
    }
    
    .nav-tab {
        padding: 0.3rem 0.6rem;
        font-size: 0.7rem;
    }
    
    .panel-section {
        padding: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .parameter {
        margin-bottom: 0.75rem;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .nav-tab, .mode-tab, .overlay-button, .export-button, .control-button {
        border-width: 2px;
    }
    
    .preset-card.active, .color-preset.active {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    }
}

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