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

.charge-interaction-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, #f97316 0%, #ea580c 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;
}

.canvas-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

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

.canvas-section canvas {
    width: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: crosshair;
    touch-action: none;
}

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

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #475569;
}

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

.controls-panel {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.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(280px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

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

.control-group h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f97316;
}

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

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

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

.checkbox-input {
    width: auto !important;
    margin-right: 8px;
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    cursor: pointer;
}

.scene-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.scene-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 8px;
    min-height: 80px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #475569;
    text-align: center;
}

.scene-btn:hover {
    border-color: #f97316;
    background: #fff7ed;
}

.scene-btn.active {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    border-color: #f97316;
    color: white;
}

.scene-btn .charge-icons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.charge-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.charge-icon.positive {
    background: #ef4444;
    color: white;
}

.charge-icon.negative {
    background: #3b82f6;
    color: white;
}

.scene-label {
    font-size: 0.8rem;
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.scene-label span {
    display: block;
}

@media (max-width: 768px) {
    .scene-buttons {
        grid-template-columns: 1fr;
    }

    .scene-btn {
        min-height: 70px;
    }

    .scene-label {
        font-size: 0.75rem;
    }
}

.reset-button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(249, 115, 22, 0.3);
}

.reset-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(249, 115, 22, 0.4);
}

.reset-button:active {
    transform: translateY(0);
}

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

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

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

.formula-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: #f8fafc;
    border-radius: 6px;
    border-left: 3px solid #f97316;
}

.formula-label {
    font-size: 0.9rem;
    color: #475569;
    font-weight: 500;
    min-width: 180px;
}

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

.instructions {
    background: #fef3c7;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #f59e0b;
}

.instructions h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 12px;
}

.instructions ul {
    list-style: none;
    padding-left: 0;
}

.instructions li {
    position: relative;
    padding-left: 25px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #78350f;
    line-height: 1.5;
}

.instructions li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: #f59e0b;
    font-weight: bold;
}

.explanation {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.explanation h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 3px solid #f97316;
}

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

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

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

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

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

    .scene-buttons {
        grid-template-columns: 1fr;
    }

    .canvas-info {
        flex-direction: column;
        gap: 10px;
    }

    .formula-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .formula-label {
        min-width: auto;
    }
}
