
        :root {
            --primary: #2e7d32;
            --primary-dark: #1b5e20;
            --secondary: #4caf50;
            --accent: #ff9800;
            --bg: #f0f2f5;
            --card-bg: #ffffff;
            --text: #37474f;
            --border: #cfd8dc;
            --error: #d32f2f;
            --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
            --radius: 12px;
            --font-fa: 'Vazirmatn', sans-serif;
            --font-en: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        
        * { 
            box-sizing: border-box; 
            font-family: var(--font-fa); 
            margin: 0; 
            padding: 0; 
        }
        
        html[dir="ltr"] * {
            font-family: var(--font-en);
        }
        
        body {
            background-color: var(--bg);
            color: var(--text);
            display: flex;
            flex-direction: column;
            min-height: 100vh;
            line-height: 1.6;
            transition: all 0.3s ease;
        }
        /* Header */
        header {
            background: linear-gradient(135deg, var(--primary-dark), var(--primary));
            color: white;
            padding: 2rem 1rem;
            text-align: center;
            box-shadow: var(--shadow);
            position: relative;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }
        .lang-btn-header {
            position: absolute;
            top: 1rem;
            right: 1rem;
            background: rgba(255,255,255,0.2);
            border: 1px solid rgba(255,255,255,0.4);
            color: white;
            padding: 5px 15px;
            border-radius: 20px;
            cursor: pointer;
            font-size: 0.9rem;
            transition: background 0.3s;
            z-index: 10;
        }
        html[dir="ltr"] .lang-btn-header {
            right: auto;
            left: 1rem;
        }
        .lang-btn-header:hover {
            background: rgba(255,255,255,0.3);
        }
        header h1 { font-size: 1.8rem; margin-bottom: 0.5rem; font-weight: 700; }
        header p { font-size: 1rem; opacity: 0.9; max-width: 600px; margin: 0 auto; }
        /* Navigation Tabs */
        .tabs {
            display: flex;
            justify-content: center;
            background: var(--card-bg);
            padding: 0.5rem;
            box-shadow: 0 1px 3px rgba(0,0,0,0.05);
            position: sticky;
            top: 0;
            z-index: 100;
            flex-wrap: nowrap;
            overflow-x: auto;
            gap: 5px;
        }
        .tab-btn {
            background: transparent;
            border: none;
            padding: 12px 24px;
            cursor: pointer;
            font-size: 1rem;
            color: #607d8b;
            border-bottom: 3px solid transparent;
            transition: all 0.3s ease;
            font-weight: 500;
            border-radius: 4px 4px 0 0;
            white-space: nowrap;
        }
        .tab-btn:hover { color: var(--primary); background-color: #f1f8e9; }
        .tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); background-color: #e8f5e9; }
        /* Main Content */
        main {
            flex: 1;
            padding: 2rem 1rem;
            max-width: 1200px;
            margin: 0 auto;
            width: 100%;
        }
        .converter-section {
            display: none;
            animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        }
        .converter-section.active { display: block; }
        @keyframes slideUp { 
            from { opacity: 0; transform: translateY(20px); } 
            to { opacity: 1; transform: translateY(0); } 
        }
        /* Grid Layout */
        .grid-container {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 1.5rem;
            margin-bottom: 2rem;
        }
        .card {
            background: var(--card-bg);
            padding: 1.5rem;
            border-radius: var(--radius);
            box-shadow: var(--shadow);
            border: 1px solid var(--border);
            transition: transform 0.2s;
        }
        .card:hover { transform: translateY(-2px); }
        
        .card h3 { 
            margin-bottom: 1.2rem; 
            color: var(--primary-dark); 
            border-bottom: 2px solid #e0e0e0; 
            padding-bottom: 0.5rem; 
            font-size: 1.2rem; 
            display: flex; 
            align-items: center; 
            justify-content: space-between; 
        }
        
        .reset-btn {
            background: none; border: none; color: var(--accent); cursor: pointer; font-size: 0.85rem;
        }
        .reset-btn:hover { text-decoration: underline; }
        /* Form Elements */
        .input-group { margin-bottom: 1.2rem; position: relative; }
        
        .input-group label { 
            display: block; 
            margin-bottom: 0.4rem; 
            font-size: 0.95rem; 
            color: #546e7a; 
            font-weight: 500; 
        }
        .input-group input {
            width: 100%;
            padding: 12px;
            border: 2px solid var(--border);
            border-radius: 8px;
            font-size: 1rem;
            transition: all 0.3s;
            background: #fafafa;
            font-family: inherit;
        }
        .input-group input:focus { 
            border-color: var(--secondary); 
            outline: none; 
            background: #fff; 
            box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1); 
        }
        .input-group input.readonly { 
            background-color: #eceff1; 
            color: #455a64; 
            font-weight: bold; 
            border-color: transparent; 
            cursor: not-allowed; 
        }
        
        .unit { 
            font-size: 0.8rem; 
            color: #78909c; 
            position: absolute; 
            inset-inline-end: 12px; /* Logical property for RTL/LTR */
            top: 42px; 
            background: #fff; 
            padding: 0 4px; 
            border-radius: 4px; 
            border: 1px solid #eee; 
            pointer-events: none;
        }
        /* Visual Phase Diagram */
        .phase-diagram {
            background: var(--card-bg);
            padding: 1.5rem;
            border-radius: var(--radius);
            box-shadow: var(--shadow);
            margin-top: 1rem;
            text-align: center;
        }
        .bars { 
            display: flex; 
            height: 50px; 
            border-radius: 8px; 
            overflow: hidden; 
            margin-top: 1rem; 
            border: 1px solid #ddd; 
            direction: ltr; /* Keep bars LTR for logical flow */
        }
        .bar-solid { 
            background-color: #795548; 
            transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); 
            display: flex; 
            align-items: center; 
            justify-content: center; 
            color: white; 
            font-size: 0.9rem; 
            font-weight: bold; 
            text-shadow: 0 1px 2px rgba(0,0,0,0.3); 
        }
        .bar-water { 
            background-color: #2196f3; 
            transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); 
            display: flex; 
            align-items: center; 
            justify-content: center; 
            color: white; 
            font-size: 0.9rem; 
            font-weight: bold; 
            text-shadow: 0 1px 2px rgba(0,0,0,0.3); 
        }
        .bar-air { 
            background-color: #cfd8dc; 
            transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); 
            display: flex; 
            align-items: center; 
            justify-content: center; 
            color: #455a64; 
            font-size: 0.9rem; 
            font-weight: bold; 
        }
        
        .legend { 
            display: flex; 
            justify-content: center; 
            gap: 20px; 
            margin-top: 1rem; 
            font-size: 0.9rem; 
            color: #555; 
            flex-wrap: wrap;
        }
        .legend-item { display: flex; align-items: center; gap: 8px; }
        .dot { width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
        /* Error Box */
        .error-box {
            background-color: #ffebee;
            color: var(--error);
            padding: 1rem;
            border-radius: 8px;
            margin-bottom: 1.5rem;
            display: none;
            font-size: 0.95rem;
            border-inline-start: 4px solid var(--error); /* Logical property */
            align-items: center;
            gap: 10px;
        }
        /* Responsive */
        @media (max-width: 768px) {
            .tabs { 
                justify-content: flex-start; 
                padding-inline-start: 1rem; /* Logical property */
            }
            header h1 { font-size: 1.4rem; }
        }
    
