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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    line-height: 1.6;
    min-height: 100vh;
}

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

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

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #fff 0%, #f0f0f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1em;
}

.visualization-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.system-panel,
.analysis-panel {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.scenario-selector {
    margin-bottom: 20px;
}

.scenario-selector h3 {
    margin-bottom: 10px;
    color: #fff;
}

.scenario-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 15px;
    margin: 5px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.scenario-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.scenario-btn.active {
    background: rgba(255, 255, 255, 0.4);
    border-color: white;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

.system-display,
.trajectory-display,
.momentum-display,
.position-display,
.force-display {
    margin-bottom: 20px;
}

.system-display h3,
.trajectory-display h3,
.momentum-display h3,
.position-display h3,
.force-display h3 {
    margin-bottom: 10px;
    color: #fff;
    font-size: 1.1em;
}

canvas {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 100%;
    height: 300px;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85em;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-cross {
    font-size: 16px;
    font-weight: bold;
}

.momentum-values,
.force-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 10px;
}

.momentum-item,
.force-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.momentum-label,
.force-label {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.8);
}

.momentum-value,
.force-value {
    font-weight: bold;
    color: #10b981;
    font-size: 1.1em;
}

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

.controls-panel h3 {
    margin-bottom: 20px;
    color: #fff;
}

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

.control-group {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 8px;
}

.control-group h4 {
    margin-bottom: 15px;
    color: #fff;
    font-size: 1em;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9em;
}

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

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: none;
}

.checkbox-input {
    margin-right: 8px;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.control-button {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

.control-button.start {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.control-button.start:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.4);
}

.control-button.pause {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.control-button.pause:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(245, 158, 11, 0.4);
}

.control-button.reset {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.control-button.reset:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(239, 68, 68, 0.4);
}

.control-button.explode {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.control-button.explode:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(139, 92, 246, 0.4);
}

.preset-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 12px;
    margin: 3px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85em;
    width: calc(50% - 6px);
}

.preset-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.formulas-section {
    margin-top: 20px;
}

.formulas-section h3 {
    margin-bottom: 15px;
    color: #fff;
}

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

.formula-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.formula-label {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.7);
}

.formula {
    font-family: 'Courier New', monospace;
    color: #10b981;
    font-size: 0.95em;
}

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

.explanation h2 {
    margin-bottom: 20px;
    color: #fff;
    font-size: 2em;
}

.explanation h3 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: #fff;
    font-size: 1.5em;
}

.explanation p {
    margin-bottom: 15px;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.9);
}

.explanation strong {
    color: #fbbf24;
}

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

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

    header h1 {
        font-size: 1.8em;
    }

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

    .control-button {
        width: 100%;
    }
}
