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

.capacitor-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, #7c3aed 0%, #a855f7 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: #faf5ff;
    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: 10px 16px;
    background: #f3e8ff;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #475569;
    border: 1px solid #d8b4fe;
}

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

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

.controls-panel {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 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: 700;
    color: #5b21b6;
    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: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.control-group h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #7c3aed;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #d8b4fe;
}

.control-group label {
    display: block;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
    margin-top: 12px;
    font-size: 0.85rem;
}

.control-group label span:last-child {
    color: #7c3aed;
    font-weight: 700;
}

.select-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    color: #374151;
    outline: none;
    transition: border-color 0.2s;
}

.select-input:focus {
    border-color: #7c3aed;
}

.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: #7c3aed;
    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: #7c3aed;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.checkbox-input {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: #7c3aed;
}

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

.control-btn {
    flex: 1;
    min-width: 100px;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.control-btn.charge {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.control-btn.charge:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

.control-btn.discharge {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.control-btn.discharge:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

.control-btn.reset {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}

.control-btn.reset:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

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

.formulas-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #5b21b6;
    margin-bottom: 15px;
}

.formula-list {
    display: grid;
    gap: 12px;
}

.formula-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #faf5ff;
    border-radius: 6px;
}

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

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

.parameter-display {
    padding-top: 15px;
    border-top: 2px solid #e2e8f0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #5b21b6;
}

.parameter-display span:last-child {
    color: #7c3aed;
    font-weight: 700;
}

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

.instructions h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #7c3aed;
    margin-bottom: 10px;
}

.instructions ul {
    list-style-position: inside;
    padding-left: 10px;
}

.instructions li {
    font-size: 0.9rem;
    color: #475569;
    line-height: 1.6;
    margin-bottom: 6px;
}

.explanation {
    padding: 30px;
    background: #fafafa;
    border-top: 1px solid #e5e7eb;
}

.explanation h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #5b21b6;
    margin-bottom: 15px;
}

.explanation h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #7c3aed;
    margin: 20px 0 10px;
}

.explanation p {
    line-height: 1.8;
    color: #374151;
    margin-bottom: 12px;
}

.explanation strong {
    color: #7c3aed;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.6rem;
    }

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

    main {
        padding: 15px;
    }

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

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

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

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

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

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