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

:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #151b3d;
    --bg-tertiary: #1a2148;
    --text-primary: #e0e6ed;
    --text-secondary: #a0aec0;
    --accent-primary: #60a5fa;
    --accent-secondary: #a78bfa;
    --accent-success: #34d399;
    --accent-warning: #fbbf24;
    --accent-danger: #f87171;
    --border-color: #2d3748;
    --glow-primary: rgba(96, 165, 250, 0.5);
    --glow-secondary: rgba(167, 139, 250, 0.3);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

header h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    margin-bottom: 30px;
}

.canvas-container {
    position: relative;
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
}

#attractorCanvas {
    display: block;
    width: 100%;
    height: 700px;
    cursor: grab;
}

#attractorCanvas:active {
    cursor: grabbing;
}

.canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 15px;
    pointer-events: none;
    display: flex;
    justify-content: space-between;
}

.stats-panel {
    background: rgba(10, 14, 39, 0.85);
    backdrop-filter: blur(10px);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    pointer-events: auto;
}

.stat {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.stat:last-child {
    margin-bottom: 0;
}

.stat-label {
    color: var(--text-secondary);
    margin-right: 15px;
}

.stat-value {
    color: var(--accent-primary);
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.position-panel {
    background: rgba(10, 14, 39, 0.85);
    backdrop-filter: blur(10px);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    pointer-events: auto;
}

.coordinate {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.85rem;
}

.coordinate:last-child {
    margin-bottom: 0;
}

.coord-label {
    color: var(--text-secondary);
    margin-right: 15px;
    font-weight: 600;
}

.coord-value {
    color: var(--accent-secondary);
    font-family: 'Courier New', monospace;
}

.controls-panel {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    max-height: 700px;
    overflow-y: auto;
}

.controls-panel::-webkit-scrollbar {
    width: 8px;
}

.controls-panel::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.controls-panel::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 4px;
}

.control-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.control-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.control-section h3 {
    color: var(--accent-primary);
    font-size: 1.1rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.control-section h3::before {
    content: '▸';
    margin-right: 8px;
    color: var(--accent-secondary);
}

.control-group {
    margin-bottom: 15px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.control-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.control-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

select.control-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0aec0' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

input[type="range"].control-input {
    -webkit-appearance: none;
    height: 6px;
    padding: 0;
    background: var(--bg-tertiary);
    cursor: pointer;
}

input[type="range"].control-input::-webkit-slider-runnable-track {
    height: 6px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 3px;
}

input[type="range"].control-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--text-primary);
    border-radius: 50%;
    margin-top: -6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

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

input[type="range"].control-input::-moz-range-track {
    height: 6px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 3px;
}

input[type="range"].control-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--text-primary);
    border: none;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.checkbox-group {
    margin-top: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.parameter-control {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}

.parameter-control:last-child {
    margin-bottom: 0;
}

.parameter-label {
    flex: 0 0 50px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
}

.parameter-input {
    flex: 1;
    padding: 8px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
}

.parameter-slider {
    flex: 2;
    -webkit-appearance: none;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    cursor: pointer;
}

.parameter-slider::-webkit-slider-runnable-track {
    height: 4px;
    background: linear-gradient(90deg, var(--accent-secondary), var(--accent-success));
    border-radius: 2px;
}

.parameter-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--text-primary);
    border-radius: 50%;
    margin-top: -6px;
    cursor: pointer;
}

.actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: var(--bg-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(96, 165, 250, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--accent-secondary);
    color: var(--bg-primary);
    transform: translateY(-2px);
}

.info-panel {
    background: var(--bg-tertiary);
    padding: 15px;
    border-radius: 8px;
    border-left: 3px solid var(--accent-primary);
}

.info-panel p {
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.info-panel p:last-child {
    margin-bottom: 0;
}

.info-panel strong {
    color: var(--accent-primary);
}

.info-panel .equations {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .controls-panel {
        max-height: none;
    }
}

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

    .subtitle {
        font-size: 1rem;
    }

    #attractorCanvas {
        height: 500px;
    }

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