* {
    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;
}

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

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

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

header .subtitle {
    font-size: 1.1em;
    opacity: 0.9;
    max-width: 800px;
    margin: 0 auto;
}

main {
    padding: 30px;
}

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

.simulation-panel {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#capacitorCanvas {
    width: 100%;
    height: 400px;
    border-radius: 10px;
    background: linear-gradient(180deg, #e8f4f8 0%, #d4e9f2 100%);
    display: block;
}

.simulation-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 20px;
}

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

.info-item span:first-child {
    font-weight: 600;
    color: #2c3e50;
    display: block;
    margin-bottom: 5px;
    font-size: 0.85em;
}

.info-item span:last-child {
    font-size: 1.1em;
    font-weight: 700;
    color: #3498db;
}

.info-panel {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.formula-section {
    margin-bottom: 25px;
}

.formula-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.3em;
}

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

.formula-main {
    font-size: 1.5em;
    font-weight: 600;
    color: #e74c3c;
    text-align: center;
    margin-bottom: 10px;
}

.formula-sub {
    font-size: 1em;
    color: #34495e;
    text-align: center;
    margin-bottom: 5px;
}

.graph-section {
    margin-top: 25px;
}

.graph-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2em;
}

#qvCanvas,
#chargingCanvas {
    width: 100%;
    height: 200px;
    border-radius: 10px;
    background: white;
    display: block;
}

.controls-panel {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.controls-panel h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.3em;
}

.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: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.control-group label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
}

.control-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

.control-group select:focus {
    outline: none;
    border-color: #3498db;
}

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

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

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

.control-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

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

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

.control-button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    min-width: 120px;
}

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

.control-button.charge:hover {
    background: #229954;
    transform: translateY(-2px);
}

.control-button.discharge {
    background: #e67e22;
    color: white;
}

.control-button.discharge:hover {
    background: #d35400;
    transform: translateY(-2px);
}

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

.control-button.reset:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.applications-section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.applications-section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.applications-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.application-item {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.application-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.application-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.application-item h4 {
    color: #3498db;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.application-item p {
    color: #555;
    line-height: 1.6;
    margin: 0;
}

.explanation {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.explanation h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.explanation h3 {
    color: #34495e;
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 1.4em;
}

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

.points-list li {
    padding: 12px 15px;
    margin-bottom: 10px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    color: #555;
}

.comparison-table {
    overflow-x: auto;
}

.comparison-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
}

.comparison-table th,
.comparison-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

.comparison-table th {
    background: #3498db;
    color: white;
    font-weight: 600;
}

.comparison-table tr:last-child td {
    border-bottom: none;
}

.comparison-table tr:hover {
    background: #f8f9fa;
}

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

    .simulation-info {
        grid-template-columns: repeat(2, 1fr);
    }

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

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

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

    main {
        padding: 15px;
    }

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

    .simulation-info {
        grid-template-columns: 1fr;
    }

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

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