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

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

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 8px;
    font-size: 2rem;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.tab {
    padding: 12px 24px;
    border: none;
    background: #f5f5f5;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    transition: all 0.2s;
}

.tab:hover {
    background: #e0e0e0;
}

.tab.active {
    background: #667eea;
    color: white;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.method-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #667eea;
}

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

.input-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.input-group label {
    width: 180px;
    font-weight: 500;
    color: #444;
}

.input-group input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
}

.calc-btn {
    padding: 14px 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 10px;
}

.calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.error {
    background: #fee2e2;
    color: #dc2626;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    border-left: 4px solid #dc2626;
}

.hidden {
    display: none !important;
}

.results {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #eee;
}

.results h2 {
    color: #333;
    margin-bottom: 20px;
}

.solution {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
}

.solution h3 {
    color: #667eea;
    margin-bottom: 20px;
}

.result-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 30px;
    margin-bottom: 25px;
}

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

.result-section h4 {
    color: #444;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.label-toggles {
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 8px;
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.label-toggles .toggle-label {
    font-weight: 600;
    color: #444;
    margin-right: 5px;
}

.label-toggles label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.label-toggles input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.values-table {
    width: 100%;
    border-collapse: collapse;
}

.values-table th {
    text-align: left;
    padding: 8px;
    color: #666;
    width: 80px;
}

.values-table td {
    padding: 8px;
    font-family: 'Courier New', monospace;
    color: #333;
}

canvas {
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
}

.latex-section {
    grid-column: 1 / -1;
}

.copy-btn {
    padding: 6px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.copy-btn:hover {
    background: #5a6fd6;
}

.code-block {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

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

    .input-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .input-group label {
        width: auto;
    }

    .input-group input {
        width: 100%;
    }
}
