* {
    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, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

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

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 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;
    }
}

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

#forceCanvas {
    width: 100%;
    height: auto;
    background: linear-gradient(to bottom, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 8px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    cursor: crosshair;
}

.canvas-info {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.info-item {
    background: white;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    font-size: 0.9rem;
}

.info-item span:first-child {
    font-weight: 600;
    color: #475569;
}

.info-item span:last-child {
    color: #27ae60;
    font-weight: 700;
}

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

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

.formula-section h3,
.method-section h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 15px;
}

.formula-display {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.formula-main {
    font-size: 1.3rem;
    font-weight: 700;
    color: #27ae60;
    text-align: center;
    margin-bottom: 10px;
}

.formula-sub {
    font-size: 1.1rem;
    color: #64748b;
    text-align: center;
    margin-bottom: 10px;
    font-weight: 600;
}

.formula-detail {
    font-size: 1rem;
    color: #475569;
    text-align: center;
    margin: 5px 0;
    font-family: 'Courier New', monospace;
}

.method-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.method-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s ease;
}

.method-btn:hover {
    border-color: #27ae60;
    color: #27ae60;
}

.method-btn.active {
    background: #27ae60;
    color: white;
    border-color: #27ae60;
}

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

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

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

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

.control-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 10px;
}

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

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

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

.toggle-container {
    display: flex;
    align-items: center;
    margin-top: 10px;
}

.toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e2e8f0;
    transition: 0.3s;
    border-radius: 26px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #27ae60;
}

input:checked + .slider:before {
    transform: translateX(24px);
}

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

.control-button {
    flex: 1;
    min-width: 150px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.control-button.reset:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

.control-button.preset {
    background: #27ae60;
    color: white;
}

.control-button.preset:hover {
    background: #219a52;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(39, 174, 96, 0.3);
}

.calculations-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

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

.calc-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.calc-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8fafc;
    border-radius: 6px;
    border-left: 4px solid #27ae60;
}

.calc-item.highlight {
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.1) 0%, rgba(39, 174, 96, 0.05) 100%);
    border-left: 4px solid #27ae60;
    font-weight: 600;
}

.calc-label {
    font-weight: 600;
    color: #475569;
    font-family: 'Courier New', monospace;
}

.calc-value {
    font-weight: 700;
    color: #27ae60;
    font-size: 1.1rem;
}

.explanation {
    background: #f8fafc;
    border-radius: 12px;
    padding: 30px;
    margin-top: 30px;
}

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

.explanation h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #334155;
    margin-top: 25px;
    margin-bottom: 10px;
}

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

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

.application-item {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-left: 4px solid #27ae60;
}

.application-item:nth-child(2) {
    border-left-color: #3498db;
}

.application-item:nth-child(3) {
    border-left-color: #9b59b6;
}

.application-item h4 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 10px;
}

.application-item p {
    color: #64748b;
    line-height: 1.6;
    font-size: 0.95rem;
}

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

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

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

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

    .control-button {
        width: 100%;
    }

    .method-buttons {
        flex-direction: column;
    }

    .method-btn {
        width: 100%;
    }
}
