* {
    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%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.pendulum-container {
    max-width: 1600px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 600;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

main {
    padding: 30px;
}

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

.pendulum-panel {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.view-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: center;
}

.view-btn {
    padding: 8px 16px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.view-btn:hover {
    background: #667eea;
    color: white;
}

.view-btn.active {
    background: #667eea;
    color: white;
}

#pendulumCanvas {
    width: 100%;
    height: 400px;
    background: white;
    border-radius: 10px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pendulum-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.info-item {
    background: white;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-weight: 600;
    color: #667eea;
}

.charts-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chart-container {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.chart-container h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: 600;
}

.chart-container canvas {
    width: 100%;
    height: 150px;
    background: white;
    border-radius: 8px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
}

.force-legend,
.energy-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
    justify-content: space-around;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    font-weight: 600;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.legend-color.tension,
.legend-color.kinetic {
    background: #ef4444;
}

.legend-color.gravity,
.legend-color.potential {
    background: #3b82f6;
}

.legend-color.centripetal,
.legend-color.total {
    background: #10b981;
}

.controls-panel {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.controls-panel h3 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.3em;
    font-weight: 600;
}

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

.control-group {
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.control-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #667eea;
}

.control-group input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e0e7ff;
    outline: none;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    border: none;
}

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

.control-button {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.control-button.start {
    background: #10b981;
    color: white;
}

.control-button.start:hover {
    background: #059669;
    transform: translateY(-2px);
}

.control-button.pause {
    background: #f59e0b;
    color: white;
}

.control-button.pause:hover {
    background: #d97706;
    transform: translateY(-2px);
}

.control-button.reset {
    background: #ef4444;
    color: white;
}

.control-button.reset:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.formulas-section,
.comparison-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e0e7ff;
}

.formulas-section h3,
.comparison-section h3 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.3em;
    font-weight: 600;
}

.formula-list {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
}

.formula-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.formula-label {
    font-weight: 600;
    color: #667eea;
    min-width: 150px;
}

.formula {
    font-family: 'Courier New', monospace;
    background: #f0f9ff;
    padding: 8px 15px;
    border-radius: 6px;
    color: #0369a1;
    font-size: 0.95em;
}

.calculated-values {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-weight: 600;
    color: #667eea;
}

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

.comparison-item {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.comparison-item h4 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: 600;
}

.comparison-item ul {
    list-style: none;
}

.comparison-item li {
    padding: 8px 0;
    padding-left: 20px;
    position: relative;
    color: #555;
    line-height: 1.5;
}

.comparison-item li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

.explanation {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.explanation h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.8em;
    font-weight: 600;
}

.explanation h3 {
    color: #667eea;
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 1.3em;
    font-weight: 600;
}

.explanation p {
    line-height: 1.8;
    color: #555;
    margin-bottom: 15px;
}

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

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

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

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

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