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

:root {
    --primary-color: #2196F3;
    --secondary-color: #FFC107;
    --success-color: #4CAF50;
    --danger-color: #F44336;
    --info-color: #00BCD4;
    --dark-bg: #1a1a2e;
    --light-bg: #f5f5f5;
    --text-primary: #333;
    --text-secondary: #666;
    --border-color: #ddd;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-primary);
    padding: 20px;
    min-height: 100vh;
}

.work-energy-container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px 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.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

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

main {
    padding: 30px;
}

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

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

.animation-panel {
    background: var(--light-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
}

#mainCanvas {
    width: 100%;
    height: 400px;
    background: white;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.scene-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: center;
}

.scene-btn {
    padding: 10px 20px;
    border: 2px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.scene-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.scene-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

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

.energy-bars {
    background: var(--light-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.energy-bars h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.energy-bar-container {
    margin-bottom: 15px;
}

.energy-bar-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.9rem;
    font-weight: 600;
}

.energy-bar {
    width: 100%;
    height: 30px;
    background: white;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
}

.energy-fill {
    height: 100%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
}

.energy-fill.initial {
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
}

.energy-fill.work {
    background: linear-gradient(90deg, #2196F3, #03A9F4);
}

.energy-fill.final {
    background: linear-gradient(90deg, #FF9800, #FFC107);
}

.energy-change {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid var(--border-color);
}

.formula-display {
    background: white;
    padding: 12px;
    border-radius: 6px;
    text-align: center;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.velocity-display {
    background: var(--light-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-around;
}

.velocity-item {
    text-align: center;
    flex: 1;
}

.velocity-item span:first-child {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.velocity-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
}

.velocity-arrow {
    font-size: 2rem;
    color: var(--info-color);
    font-weight: 700;
}

.current-state {
    background: var(--light-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.current-state h4 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.state-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.state-item {
    background: white;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
}

.state-item span:first-child {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.state-item span:last-child {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.controls-panel {
    background: var(--light-bg);
    border-radius: 8px;
    padding: 25px;
    box-shadow: var(--shadow);
}

.controls-panel h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.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: 6px;
}

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

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

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 6px rgba(33, 150, 243, 0.4);
}

.force-hint {
    margin-top: 5px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
}

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

.control-button {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.control-button.start {
    background: var(--success-color);
    color: white;
}

.control-button.start:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.control-button.pause {
    background: var(--secondary-color);
    color: var(--text-primary);
}

.control-button.pause:hover {
    background: #FFB300;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.control-button.reset {
    background: var(--danger-color);
    color: white;
}

.control-button.reset:hover {
    background: #da190b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

.formulas-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.formulas-section h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

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

.formula-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: var(--light-bg);
    border-radius: 6px;
    border-left: 4px solid var(--primary-color);
}

.formula-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.formula {
    font-family: 'Times New Roman', serif;
    font-size: 1.2rem;
    font-style: italic;
    color: var(--primary-color);
}

.explanation {
    background: var(--light-bg);
    border-radius: 8px;
    padding: 30px;
    margin-top: 30px;
}

.explanation h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.explanation h3 {
    color: var(--primary-color);
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.explanation p {
    line-height: 1.8;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.concept-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 5px solid var(--primary-color);
    box-shadow: var(--shadow);
}

.concept-card h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.applications-list {
    list-style: none;
    padding: 0;
}

.applications-list li {
    background: white;
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 6px;
    border-left: 4px solid var(--success-color);
}

.scenario-explanation {
    background: white;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    border-left: 4px solid var(--info-color);
}

.scenario-explanation h4 {
    color: var(--info-color);
    margin-bottom: 8px;
}

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

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

    #mainCanvas {
        height: 300px;
    }

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

    .velocity-display {
        flex-direction: column;
        gap: 15px;
    }

    .velocity-arrow {
        transform: rotate(90deg);
    }

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

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

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