/* Multi-link Pendulum Simulation */
#pendulumContainer {
    max-width: 800px;
    margin: 0 auto;
    padding: 12px;
    background: #1a1a1e;
    border: 1px solid #333;
    border-radius: 8px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#pendulumContainer .pendulum-lab {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

#pendulumContainer .pendulum-canvas-wrap {
    position: relative;
    flex: 1;
    min-width: 300px;
}

#pendulumContainer #pendulumCanvas {
    display: block;
    width: 100%;
    max-width: 600px;
    min-height: 200px;
    background: #0d0d10;
    border-radius: 6px;
    cursor: crosshair;
}

#pendulumContainer .pendulum-time-wrap {
    width: 100%;
    flex-basis: 100%;
    margin-top: 4px;
}

#pendulumContainer #pendulumTimeCanvas {
    display: block;
    background: #0d0d10;
    border-radius: 6px;
}

#pendulumContainer .pendulum-state-plots {
    width: 100%;
    flex-basis: 100%;
    display: flex;
    flex-direction: row;
    gap: 8px;
    margin-top: 4px;
}

#pendulumContainer .pendulum-state-left,
#pendulumContainer .pendulum-state-right {
    flex: 1;
    min-width: 0;
}

#pendulumContainer #pendulumStateLeft,
#pendulumContainer #pendulumStateRight {
    display: block;
    background: #0d0d10;
    border-radius: 6px;
}

#pendulumContainer .pendulum-controls {
    width: 220px;
    min-width: 220px;
    padding: 12px;
    background: rgba(30, 30, 35, 0.95);
    border: 1px solid #444;
    border-radius: 6px;
    color: #ddd;
}

#pendulumContainer .pendulum-controls h3 {
    font-size: 12px;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: #7bed9f;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#pendulumContainer .pendulum-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

#pendulumContainer .pendulum-row label {
    min-width: 90px;
    font-size: 11px;
    color: #aaa;
}

#pendulumContainer .pendulum-row-inline label {
    min-width: 0;
    margin-right: 12px;
}

#pendulumContainer .pendulum-row input[type="range"] {
    flex: 1;
    min-width: 60px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #333;
    border-radius: 3px;
    outline: none;
}

#pendulumContainer .pendulum-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #7bed9f;
    cursor: pointer;
}

#pendulumContainer .pendulum-row .pendulum-val {
    min-width: 36px;
    font-size: 11px;
    color: #7bed9f;
}

#pendulumContainer .pendulum-row input[type="checkbox"] {
    cursor: pointer;
}

#pendulumContainer button.pendulum-btn {
    width: 100%;
    padding: 8px 12px;
    margin-top: 8px;
    background: #2f3542;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
}

#pendulumContainer button.pendulum-btn:hover {
    background: #57606f;
}

#pendulumContainer .pendulum-step-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

#pendulumContainer .pendulum-step-row .pendulum-btn-step,
#pendulumContainer .pendulum-step-row .pendulum-btn-run {
    flex: 1;
    padding: 6px 8px;
    font-size: 11px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: #2f3542;
    color: #fff;
}

#pendulumContainer .pendulum-step-row .pendulum-btn-step:hover,
#pendulumContainer .pendulum-step-row .pendulum-btn-run:hover {
    background: #57606f;
}

#pendulumContainer .pendulum-step-row .pendulum-btn-run {
    flex: 1.2;
    font-weight: bold;
}

#pendulumContainer .pendulum-legend {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #333;
    font-size: 11px;
    color: #aaa;
}

#pendulumContainer .pendulum-legend label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    color: #888;
}

#pendulumContainer .pendulum-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

#pendulumContainer .pendulum-legend-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid #444;
    flex-shrink: 0;
}

#pendulumContainer .pendulum-legend-label {
    color: #ccc;
}

#pendulumContainer .pendulum-stats {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #333;
    font-size: 11px;
    color: #888;
}

#pendulumContainer .meter-bg {
    width: 100%;
    height: 8px;
    background: #222;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 4px;
}

#pendulumContainer #divergence-bar {
    width: 0%;
    height: 100%;
    background: #ff6b81;
    border-radius: 4px;
    transition: width 0.1s;
}
