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

:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #1a1f3a;
    --bg-tertiary: #2a2f4a;
    --text-primary: #e0e6ed;
    --text-secondary: #a0a6b0;
    --accent-blue: #4a9eff;
    --accent-purple: #b794f6;
    --accent-green: #7ee787;
    --accent-red: #ff6b6b;
    --accent-orange: #ffa94d;
    --border-color: #3a3f5a;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

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

.container {
    display: grid;
    grid-template-columns: 320px 1fr 380px;
    grid-template-rows: 100vh;
    gap: 0;
    height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    background: var(--bg-secondary);
    padding: 20px;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
}

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

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

h2 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--accent-blue);
    font-weight: 600;
}

/* Control Styles */
.control-group {
    margin-bottom: 15px;
}

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

label span:first-child {
    display: inline-block;
    min-width: 120px;
}

input[type="range"] {
    width: calc(100% - 140px);
    margin: 0 10px;
    vertical-align: middle;
}

input[type="range"] + span {
    display: inline-block;
    min-width: 50px;
    text-align: right;
    color: var(--accent-blue);
    font-weight: 600;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 8px;
}

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

.checkbox-label span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Button Styles */
.btn {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

.btn-primary:hover {
    background: #3a8eef;
}

.btn-danger {
    background: var(--accent-red);
    border-color: var(--accent-red);
    color: white;
}

.btn-danger:hover {
    background: #ff5252;
}

.btn-icon {
    font-size: 1rem;
}

.control-group .btn {
    margin-right: 8px;
    margin-bottom: 8px;
}

/* Preset Buttons */
.preset-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-preset {
    width: 100%;
    text-align: left;
    justify-content: flex-start;
}

/* Statistics */
.stats {
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: 8px;
}

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

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

.stat-row span:first-child {
    color: var(--text-secondary);
}

.stat-row span:last-child {
    color: var(--accent-blue);
    font-weight: 600;
}

/* Instructions */
.instructions ul {
    list-style: none;
    padding: 0;
}

.instructions li {
    padding: 6px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.instructions li:last-child {
    border-bottom: none;
}

.instructions li::before {
    content: "→";
    color: var(--accent-blue);
    margin-right: 8px;
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    padding: 0;
    position: relative;
}

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

#gravityCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.energy-container {
    height: 150px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    position: relative;
}

#energyCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Content Panel */
.content-panel {
    background: var(--bg-secondary);
    padding: 20px;
    overflow-y: auto;
    border-left: 1px solid var(--border-color);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.theory-section h3 {
    font-size: 1rem;
    color: var(--accent-purple);
    margin: 15px 0 8px 0;
}

.theory-section p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.6;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 20px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--accent-blue);
}

.timeline-item {
    position: relative;
    padding-left: 20px;
    margin-bottom: 25px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-blue);
    border: 2px solid var(--bg-secondary);
}

.timeline-year {
    font-weight: 600;
    color: var(--accent-blue);
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.timeline-content {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Experiments */
.experiment {
    margin-bottom: 20px;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border-left: 3px solid var(--accent-green);
}

.experiment h3 {
    font-size: 1rem;
    color: var(--accent-green);
    margin-bottom: 10px;
}

.experiment p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Scrollbar Styles */
.sidebar::-webkit-scrollbar,
.content-panel::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track,
.content-panel::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.sidebar::-webkit-scrollbar-thumb,
.content-panel::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.content-panel::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

/* Responsive Design */
@media (max-width: 1400px) {
    .container {
        grid-template-columns: 280px 1fr 320px;
    }
}

@media (max-width: 1200px) {
    .container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        height: auto;
    }

    .sidebar {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 300px;
    }

    .content-panel {
        border-left: none;
        border-top: 1px solid var(--border-color);
    }

    .main-content {
        min-height: 500px;
    }
}

@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        max-height: none;
    }

    .control-group .btn {
        width: 100%;
        margin-right: 0;
    }
}

/* Canvas Overlay */
.canvas-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(26, 31, 58, 0.9);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    pointer-events: none;
}

/* Energy Legend */
.energy-legend {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(26, 31, 58, 0.9);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-color {
    width: 12px;
    height: 3px;
    margin-right: 8px;
    border-radius: 2px;
}

.legend-kinetic {
    background: var(--accent-orange);
}

.legend-potential {
    background: var(--accent-purple);
}

.legend-total {
    background: var(--accent-green);
}
