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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 50%, #3d7ab5 100%);
    min-height: 100vh;
    padding: 20px;
}

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

header {
    background: linear-gradient(135deg, #2d5a87 0%, #3d7ab5 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 10px;
}

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

main {
    padding: 30px;
}

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

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

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

.system-view,
.force-view,
.work-view,
.displacement-view {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.system-view h3,
.force-view h3,
.work-view h3,
.displacement-view h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 10px;
}

.system-view canvas,
.force-view canvas,
.work-view canvas,
.displacement-view canvas {
    width: 100%;
    height: auto;
    display: block;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stats-panel {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.stats-panel h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 15px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.stat-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.stat-item:hover {
    transform: translateY(-2px);
}

.stat-item span:first-child {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 8px;
    font-weight: 600;
}

.stat-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: #2d5a87;
}

.controls-panel {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.controls-panel h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2d5a87;
    margin-bottom: 20px;
}

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

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

.control-group h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}

.control-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: #475569;
    cursor: pointer;
}

.control-group input[type="range"] {
    width: 100%;
    margin-bottom: 12px;
    height: 6px;
    background: #cbd5e1;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

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

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #3d7ab5;
}

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

.control-group input[type="range"]::-moz-range-thumb:hover {
    background: #3d7ab5;
}

.select-input {
    width: 100%;
    padding: 10px;
    margin-bottom: 12px;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.select-input:hover {
    border-color: #2d5a87;
}

.select-input:focus {
    outline: none;
    border-color: #3d7ab5;
}

.checkbox-input {
    margin-right: 8px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: #2d5a87;
}

.control-btn {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    border: 2px solid #2d5a87;
    background: white;
    color: #2d5a87;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.control-btn:hover {
    background: #2d5a87;
    color: white;
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(45, 90, 135, 0.3);
}

.control-btn:active {
    transform: scale(0.98);
}

.formulas-section {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.formulas-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 15px;
}

.formula-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.formula-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.formula-label {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
}

.formula {
    font-size: 0.95rem;
    color: #1e40af;
    font-family: 'Times New Roman', serif;
    font-style: italic;
}

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

.efficiency-info {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.efficiency-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 15px;
}

.efficiency-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.efficiency-stat-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.efficiency-stat-item span:first-child {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 8px;
    font-weight: 600;
}

.efficiency-stat-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: #d97706;
}

.explanation {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.explanation h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 20px;
}

.explanation h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2d5a87;
    margin-top: 25px;
    margin-bottom: 12px;
}

.explanation p {
    font-size: 1rem;
    line-height: 1.7;
    color: #475569;
    margin-bottom: 15px;
}

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

    header .subtitle {
        font-size: 0.9rem;
    }

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

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

    .additional-visualizations {
        grid-template-columns: 1fr;
    }

    .explanation h2 {
        font-size: 1.3rem;
    }

    .explanation h3 {
        font-size: 1.1rem;
    }
}
