/* =========================================================
   مختبر سجاج | Sijjaj Lab - Cartoon & Playful Theme
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Changa:wght@500;700;800&display=swap');

:root {
    /* ألوان كارتونية مشرقة */
    --primary-blue: #3b82f6;
    --primary-blue-dark: #1d4ed8;
    --accent-yellow: #facc15;
    --accent-orange: #fb923c;
    --accent-green: #4ade80;
    --accent-pink: #f472b6;
    
    /* ألوان طاولة المختبر الكارتونية */
    --wood-surface: #f59e0b;
    --wood-surface-light: #fbbf24;
    --wood-edge: #d97706;
    --wood-body: #b45309;
    --wood-dark: #78350f;

    /* ألوان الحدود والظل الكارتوني */
    --cartoon-border: #1e293b;
    --cartoon-shadow: rgba(15, 23, 42, 0.25);
    
    --lab-wall-bg: #e0f2fe;
}

* {
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    font-family: 'Changa', 'Comic Sans MS', cursive, sans-serif;
    background-color: var(--lab-wall-bg);
    user-select: none;
}

/* ---------------------------------------------------------
   1. بيئة المختبر الكارتونية والجدار (Lab Bench Background)
   --------------------------------------------------------- */
#lab-bench {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
    /* خلفية الجدار بنمط مربعات كارتونية ناعمة */
    background-color: #e0f2fe;
    background-image: 
        radial-gradient(#bae6fd 20%, transparent 20%),
        radial-gradient(#bae6fd 20%, transparent 20%);
    background-size: 40px 40px;
    background-position: 0 0, 20px 20px;
    overflow: hidden;
}

/* شعار منصة سجاج كلوحة كارتونية معلقة على الجدار */
#lab-bench::before {
    content: '';
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 260px;
    height: 160px;
    background-image: url('../imgs/sijjaj-logo.PNG');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: #ffffff;
    border: 5px solid var(--cartoon-border);
    border-radius: 20px;
    box-shadow: 0 8px 0 var(--cartoon-border), 0 15px 20px var(--cartoon-shadow);
    opacity: 0.85;
    pointer-events: none;
    z-index: 2;
}

/* ---------------------------------------------------------
   2. طاولة العمل الخشبية الكارتونية (Cartoon Wood Lab Table)
   --------------------------------------------------------- */
#lab-bench::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 38%; /* ارتفاع الطاولة الكارتونية */
    /* تدرج خشبي كارتوني متعدد الطبقات */
    background: 
        /* ألواح خشبية طولية */
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 120px,
            rgba(120, 53, 15, 0.15) 120px,
            rgba(120, 53, 15, 0.15) 124px
        ),
        /* سطح الطاولة */
        linear-gradient(to bottom, var(--wood-surface-light) 0%, var(--wood-surface) 35%, var(--wood-edge) 35%, var(--wood-body) 100%);
    border-top: 8px solid var(--cartoon-border);
    box-shadow: inset 0 10px 0 rgba(255, 255, 255, 0.3);
    z-index: 3;
}

/* ---------------------------------------------------------
   3. الجرارات والواجهات الكارتونية (Drawers & Handles)
   --------------------------------------------------------- */
.drawer {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 98%; /* تم التوسيع لتشمل الشاشات الكبيرة */
    max-width: 1400px; /* زيادة الحد الأقصى */
    z-index: 100;
    background-color: #ffffff;
    border: 5px solid var(--cartoon-border);
    border-radius: 28px;
    box-shadow: 0 10px 0 var(--cartoon-border), 0 15px 25px var(--cartoon-shadow);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.drawer-content {
    padding: 20px;
    height: 280px;
    overflow-y: auto;
    overflow-x: auto; /* إضافة تمرير أفقي لحماية العناصر من القص في الشاشات الصغيرة */
    background: #f8fafc;
    border-radius: 20px;
}

/* مقابض الجرارات الكارتونية المنتفخة */
.drawer-handle {
    height: 52px;
    background-color: var(--accent-yellow);
    color: var(--cartoon-border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 800;
    font-size: 1.2rem;
    border: 4px solid var(--cartoon-border);
    box-shadow: 0 6px 0 var(--cartoon-border);
    transition: all 0.2s ease;
}

.drawer-handle:hover {
    background-color: #fde047;
    transform: translateY(-2px);
}

.drawer-handle:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 var(--cartoon-border);
}

/* الجرار العلوي (أدوات المختبر) */
.top-drawer {
    top: -280px;
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}
.top-drawer.open {
    transform: translate(-50%, 280px);
}
.top-drawer .drawer-handle {
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    margin-top: -4px;
}

/* الجرار السفلي (الجدول الدوري) */
.bottom-drawer {
    bottom: -280px;
    border-bottom: none;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
.bottom-drawer.open {
    transform: translate(-50%, -280px);
}
.bottom-drawer .drawer-handle {
    order: -1;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    margin-bottom: -4px;
}

/* ---------------------------------------------------------
   4. الجدول الدوري الكارتوني (Comic Periodic Table)
   --------------------------------------------------------- */
.periodic-table-grid {
    display: grid;
    grid-template-columns: repeat(18, 1fr);
    gap: 6px;
    direction: ltr;
    min-width: 1050px; /* إجبار الشبكة على أخذ مساحة كافية لمنع تداخل العناصر */
}

.periodic-element {
    background: #ffffff;
    color: var(--cartoon-border);
    border: 3px solid var(--cartoon-border);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 4px;
    height: 60px;
    box-shadow: 0 4px 0 var(--cartoon-border);
    transition: all 0.15s ease;
    font-weight: 700;
}

.periodic-element:hover {
    background: var(--accent-pink);
    color: #ffffff;
    transform: translateY(-4px) scale(1.1);
    box-shadow: 0 8px 0 var(--cartoon-border);
    z-index: 20;
}

.periodic-element:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 var(--cartoon-border);
}

.atomic-number {
    font-size: 10px;
    align-self: flex-start;
}

.element-symbol {
    font-size: 18px;
    font-weight: 800;
    text-align: center;
    margin-top: -4px;
}

.atomic-mass {
    font-size: 8px;
    align-self: flex-end;
}

/* ---------------------------------------------------------
   5. زجاجيات وأدوات المختبر على الطاولة (Bench Glassware)
   --------------------------------------------------------- */
.glass-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 95px;
    padding: 10px;
    margin: 8px;
    background: var(--primary-blue);
    border: 4px solid var(--cartoon-border);
    border-radius: 18px;
    cursor: pointer;
    box-shadow: 0 6px 0 var(--cartoon-border);
    transition: all 0.2s ease;
}

.glass-item:hover {
    transform: translateY(-4px) scale(1.08);
    background: var(--accent-green);
    box-shadow: 0 10px 0 var(--cartoon-border);
}

.glass-item:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--cartoon-border);
}

.bench-glassware {
    position: absolute;
    top: 0;
    left: 0;
    cursor: grab;
    user-select: none;
    touch-action: none;
    background: transparent;
    border: none;
    box-shadow: none;
    width: 90px;
    height: 130px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 10;
    filter: drop-shadow(0px 8px 0px rgba(30, 41, 59, 0.4)); /* ظل كارتوني سميك */
    transition: filter 0.2s;
}

.bench-glassware:active {
    cursor: grabbing;
    filter: drop-shadow(0px 4px 0px rgba(30, 41, 59, 0.6));
}

/* السوائل داخل SVG */
.bench-glassware svg .liquid-fill {
    transition: y 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), fill 0.4s ease;
}

/* ---------------------------------------------------------
   6. العينات الكيميائية والتفاعلات (Chemical Elements)
   --------------------------------------------------------- */
.bench-chemical {
    position: absolute;
    width: 52px;
    height: 52px;
    background: var(--accent-yellow);
    color: var(--cartoon-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    cursor: grab;
    border: 4px solid var(--cartoon-border);
    box-shadow: 0 6px 0 var(--cartoon-border);
    z-index: 110;
    touch-action: none;
    transition: transform 0.15s ease;
}

.bench-chemical:active {
    cursor: grabbing;
    transform: scale(1.15) rotate(5deg);
}

/* توهج كارتوني عند اقتراب عنصر من الزجاجية */
.bench-glassware.can-drop svg {
    filter: drop-shadow(0px 0px 18px var(--accent-yellow));
    transform: scale(1.1);
    transition: all 0.2s ease;
}

/* ---------------------------------------------------------
   7. النوافذ المنبثقة والنصوص العائمة (Popups & Floating Text)
   --------------------------------------------------------- */
.floating-amount {
    position: absolute;
    bottom: 60%;
    left: 50%;
    transform: translate(-50%, 0);
    color: var(--accent-yellow);
    -webkit-text-stroke: 2px var(--cartoon-border); /* تحديد كارتوني للخط */
    font-weight: 800;
    font-size: 22px;
    pointer-events: none;
    z-index: 200;
    animation: cartoonFloat 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes cartoonFloat {
    0% {
        opacity: 0;
        transform: translate(-50%, 20px) scale(0.5);
    }
    30% {
        opacity: 1;
        transform: translate(-50%, -20px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -70px) scale(1);
    }
}

/* نافذة إدخال الكميات المصممة كفقاعة كلام كارتونية */
.amount-popup {
    position: absolute;
    background: #ffffff;
    border: 4px solid var(--cartoon-border);
    border-radius: 20px;
    padding: 12px 16px;
    box-shadow: 0 8px 0 var(--cartoon-border);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 300;
    opacity: 0;
    transform: scale(0.7) translateY(10px);
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.amount-popup.show {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.amount-popup input {
    width: 70px;
    padding: 6px;
    border: 3px solid var(--cartoon-border);
    border-radius: 12px;
    text-align: center;
    font-weight: 800;
    font-size: 16px;
    font-family: inherit;
    outline: none;
    background: #f1f5f9;
}

.amount-popup span {
    font-weight: 800;
    color: var(--cartoon-border);
    font-size: 16px;
}

.amount-popup button {
    background: var(--accent-green);
    border: 3px solid var(--cartoon-border);
    padding: 6px 14px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    color: var(--cartoon-border);
    box-shadow: 0 4px 0 var(--cartoon-border);
    font-family: inherit;
    transition: all 0.15s ease;
}

.amount-popup button:hover {
    background: #22c55e;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--cartoon-border);
}

.amount-popup button:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 var(--cartoon-border);
}

/* تأثير انكسار الزجاج الكارتوني */
@keyframes shatter {
    0% { transform: scale(1) rotate(0deg); opacity: 1; }
    20% { transform: scale(1.2) rotate(-10deg); }
    100% { transform: scale(0) translateY(120px) rotate(45deg); opacity: 0; }
}

.shattered {
    animation: shatter 0.45s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
    pointer-events: none;
}

/* =========================================================
   مؤثرات وأنميشن التفاعلات الكيميائية الكارتونية
   ========================================================= */

/* 1. اهتزاز الزجاجية عند التفاعل القوي */
@keyframes glassShake {
    0%, 100% { transform: translate(var(--x, 0), var(--y, 0)) rotate(0deg); }
    20% { transform: translate(calc(var(--x, 0) - 8px), var(--y, 0)) rotate(-8deg) scale(1.1); }
    40% { transform: translate(calc(var(--x, 0) + 8px), var(--y, 0)) rotate(8deg) scale(1.1); }
    60% { transform: translate(calc(var(--x, 0) - 6px), var(--y, 0)) rotate(-5deg); }
    80% { transform: translate(calc(var(--x, 0) + 6px), var(--y, 0)) rotate(5deg); }
}

.reaction-shake {
    animation: glassShake 0.5s ease-in-out;
}

/* 2. أنميشن ومؤثر الانفجار (Explosion) */
.explosion-effect {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 140px;
    height: 140px;
    pointer-events: none;
    z-index: 500;
}

.explosion-flash {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #fde047 0%, #ef4444 60%, transparent 80%);
    border-radius: 50%;
    animation: explodeFlash 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes explodeFlash {
    0% { transform: scale(0); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.9; }
    100% { transform: scale(2); opacity: 0; }
}

/* 3. أنميشن تصاعد الفقاعات (Bubbles Effect) */
.bubble-particle {
    position: absolute;
    bottom: 20px;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid #38bdf8;
    border-radius: 50%;
    pointer-events: none;
    z-index: 20;
    animation: riseBubble 1.2s ease-in forwards;
}

@keyframes riseBubble {
    0% { transform: translateY(0) scale(0.3); opacity: 1; }
    50% { opacity: 0.8; }
    100% { transform: translateY(-70px) scale(1.2); opacity: 0; }
}

/* 4. أنميشن تصاعد الدخان والغاز (Smoke Effect) */
.smoke-particle {
    position: absolute;
    top: 0;
    left: 50%;
    width: 30px;
    height: 30px;
    background: rgba(203, 213, 225, 0.8);
    border-radius: 50%;
    pointer-events: none;
    z-index: 25;
    animation: riseSmoke 1.5s ease-out forwards;
}

@keyframes riseSmoke {
    0% { transform: translate(-50%, 0) scale(0.5); opacity: 0.9; }
    50% { transform: translate(calc(-50% + 15px), -40px) scale(1.5); opacity: 0.6; }
    100% { transform: translate(calc(-50% - 20px), -90px) scale(2.5); opacity: 0; }
}

/* 5. أنميشن التوهج والتغير اللوني (Glow / Neutralization Effect) */
@keyframes glassGlow {
    0% { filter: drop-shadow(0 0 0px transparent); }
    50% { filter: drop-shadow(0 0 25px var(--accent-yellow)) scale(1.1); }
    100% { filter: drop-shadow(0 0 0px transparent); }
}

.reaction-glow {
    animation: glassGlow 0.8s ease-in-out;
}

/* 6. أنميشن ظهور المعادلة الكيميائية (Equation Board) */
/* 6. أنميشن ظهور المعادلة الكيميائية (Equation Board) بتأثير التلاشي */
.equation-board {
    position: absolute;
    top: 45%;
    left: 25%; /* تم تحريك اللوحة لليسار */
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    border: 5px solid var(--accent-yellow);
    border-radius: 20px;
    padding: 15px 40px;
    font-size: 40px;
    font-weight: 900;
    color: var(--primary-blue-dark);
    /* box-shadow: 0 15px 25px rgba(0,0,0,0.3), 0 0 40px rgba(250, 204, 21, 0.6); */
    z-index: 1000;
    pointer-events: none;
    direction: ltr;
    opacity: 0; /* البداية بشفافية 0 */
    animation: fadeEquation 4.5s ease-in-out forwards;
}

@keyframes fadeEquation {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
    10% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    85% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
}

/* =========================================================
   تصميم شريط التمرير (Slider) الكارتوني التفاعلي
   ========================================================= */
.cartoon-slider {
    -webkit-appearance: none;
    width: 130px;
    height: 14px;
    background: #e2e8f0;
    border: 3px solid var(--cartoon-border);
    border-radius: 10px;
    outline: none;
    margin: 0 5px;
}

.cartoon-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-yellow);
    border: 3px solid var(--cartoon-border);
    cursor: pointer;
    box-shadow: 0 4px 0 var(--cartoon-border);
    transition: transform 0.1s, box-shadow 0.1s;
}

.cartoon-slider::-webkit-slider-thumb:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 var(--cartoon-border);
}

.cartoon-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-yellow);
    border: 3px solid var(--cartoon-border);
    cursor: pointer;
    box-shadow: 0 4px 0 var(--cartoon-border);
}

/* =========================================================
   تأثيرات موقد بنزن ونظام الحرارة الكارتوني
   ========================================================= */

/* 1. أنميشن النار (تتحرك وتتوهج) */
.flame-path {
    transform-origin: bottom center;
    animation: flickerFlame 0.15s infinite alternate;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.burner-active .flame-path {
    opacity: 1;
}

@keyframes flickerFlame {
    0% { transform: scaleX(0.9) scaleY(0.95) rotate(-2deg); filter: drop-shadow(0 0 10px #38bdf8); }
    100% { transform: scaleX(1.1) scaleY(1.05) rotate(2deg); filter: drop-shadow(0 0 20px #bae6fd); }
}

/* 2. نافذة الحرارة الكارتونية (Pop-up) التي تلتصق بالزجاجية */
.temp-popup {
    position: absolute;
    right: -60px; /* تظهر بجانب الزجاجية على اليمين */
    top: 20px;
    background: #ffffff;
    border: 3px solid var(--cartoon-border);
    border-radius: 12px;
    padding: 4px 8px;
    font-weight: 900;
    font-size: 16px;
    color: #3b82f6; /* لون أزرق للبرودة */
    box-shadow: 0 4px 0 var(--cartoon-border);
    pointer-events: none; /* لكي لا تعيق النقر والسحب */
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s, color 0.3s;
    z-index: 300;
    display: flex;
    align-items: center;
    gap: 4px;
}

.temp-popup.visible {
    opacity: 1;
    transform: translateY(0);
}

/* أيقونة نار صغيرة داخل نافذة الحرارة */
.temp-popup::before {
    content: '🔥';
    font-size: 14px;
}

.thermometer-icon {
    font-size: 14px;
    color: #ef4444; /* لون أحمر للحرارة */
}

/* =========================================================
   ديناميكية السوائل (Sloshing) والغليان (Boiling)
   ========================================================= */

/* جعل حركة السائل مرنة عند الميلان (Sloshing) */
.bench-glassware svg .liquid-fill {
    transition: y 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), fill 0.4s ease, transform 0.2s ease-out;
    transform-origin: 50% 50%;
}

/* أنميشن بخار الغليان (Steam) */
.steam-particle {
    position: absolute;
    top: 30px;
    left: 50%;
    width: 14px;
    height: 14px;
    background: rgba(255, 255, 255, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    pointer-events: none;
    z-index: 25;
    animation: riseSteam 1s ease-in forwards;
}

@keyframes riseSteam {
    0% { transform: translate(-50%, 0) scale(0.5); opacity: 0; }
    20% { opacity: 0.8; }
    100% { transform: translate(calc(-50% + (var(--dir) * 20px)), -60px) scale(1.5); opacity: 0; }
}

/* --- طور طحن الهاون والمدقة --- */
body.pestle-cursor-active, 
body.pestle-cursor-active * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="%231e293b" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="m15 11-8 8"/><path d="m19 7-3-3a2.12 2.12 0 0 0-3 0L3 14a2.12 2.12 0 0 0 0 3l4 4a2.12 2.12 0 0 0 3 0l10-10a2.12 2.12 0 0 0 0-3Z"/></svg>'), auto !important;
}

.bench-glassware[data-type="mortar-pestle"].grinding-active {
    filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.5));
}

.bench-glassware.grind-impact {
    transform: scale(0.95) !important;
    transition: transform 0.08s ease;
}

/* ذرات البودرة المتطايرة */
.powder-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    bottom: 30%;
    left: 50%;
    pointer-events: none;
    animation: powderScatter 0.6s forwards ease-out;
}

@keyframes powderScatter {
    0% { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.3); }
}

/* نافذة حالة الهاون العائمة */
.mortar-popup {
    position: absolute;
    bottom: -55px;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    border: 2px solid #1e3a8a;
    border-radius: 20px;
    padding: 5px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    white-space: nowrap;
    z-index: 100;
}

.mortar-popup .mortar-status {
    font-size: 11px;
    font-weight: 800;
    color: #1e3a8a;
}

.mortar-popup .stop-grind-btn {
    background: #ef4444;
    color: #fff;
    border: none;
    font-size: 10px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.1s;
}

.mortar-popup .stop-grind-btn:active {
    transform: scale(0.9);
}

/* --- قطرات السحاحة ومعايرة السوائل --- */
.falling-drip {
    position: absolute;
    width: 6px;
    height: 9px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    bottom: 0;
    left: 48%;
    pointer-events: none;
    animation: dripFall 0.5s forwards linear;
}

@keyframes dripFall {
    0% { transform: translateY(0) scale(0.8); opacity: 1; }
    100% { transform: translateY(70px) scale(1.1); opacity: 0.2; }
}

.buret-control-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #ffffff;
    border: 2px solid #3b82f6;
    border-radius: 12px;
    padding: 10px 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    z-index: 300;
}

/* نبضة وسحب القطارة */
.bench-glassware[data-type="dropper"] .dropper-bulb {
    transition: transform 0.15s ease;
    transform-origin: center top;
}

.dropper-pulse .dropper-bulb {
    transform: scale(0.85, 0.7);
}

/* قطرة السائل الدقيقة المتساقطة من القطارة */
.micro-drop-anim {
    position: absolute;
    width: 5px;
    height: 7px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    bottom: -5px;
    left: 48%;
    pointer-events: none;
    animation: microDropFall 0.45s forwards ease-in;
    z-index: 100;
}

@keyframes microDropFall {
    0% { transform: translateY(0) scale(0.7); opacity: 1; }
    100% { transform: translateY(45px) scale(1.1); opacity: 0.1; }
}

/* وميض وتأثير السحب العياري للماصة */
.pipet-draw {
    filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.6));
    transition: filter 0.3s ease;
}

/* --- الدرجان السفليان المزدوجان --- */
.elements-drawer-style {
    left: 74% !important;
    width: 48% !important;
    max-width: 700px !important;
}

.reagents-drawer-style {
    left: 26% !important;
    width: 48% !important;
    max-width: 700px !important;
}

.reagents-drawer-style .drawer-handle {
    background-color: #38bdf8 !important;
    color: #0f172a !important;
}

.reagents-drawer-style .drawer-handle:hover {
    background-color: #7dd3fc !important;
}

/* شبكة بطاقات الكواشف */
.reagents-grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    direction: rtl;
}

.reagent-card {
    background: #ffffff;
    border: 3px solid var(--cartoon-border);
    border-radius: 16px;
    padding: 10px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 0 var(--cartoon-border);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.reagent-card:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 8px 0 var(--cartoon-border);
    background: #f8fafc;
}

.reagent-card:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 var(--cartoon-border);
}

.reagent-icon-badge {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 2px solid var(--cartoon-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
}

.reagent-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.reagent-title {
    font-weight: 800;
    font-size: 13px;
    color: var(--cartoon-border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reagent-code {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    direction: ltr;
    text-align: right;
}

.reagent-type-tag {
    font-size: 10px;
    color: #0284c7;
    font-weight: 700;
}

.reagent-indicator-stripe {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
}

/* قنينة الكاشف على طاولة المختبر */
.bench-reagent-bottle {
    border-radius: 14px !important;
    width: 58px !important;
    height: 64px !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2px;
}

.reagent-bottle-label {
    font-size: 10px;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 1px 1px 0 #000;
    text-align: center;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reagent-mini-tag {
    font-size: 8px;
    background: rgba(0, 0, 0, 0.4);
    color: #facc15;
    padding: 1px 4px;
    border-radius: 6px;
    margin-top: 2px;
}

/* شريط المستخدم والباقة */
.user-lab-badge {
    position: absolute;
    top: 15px;
    right: 20px;
    z-index: 250;
    background: #ffffff;
    border: 3px solid var(--cartoon-border);
    border-radius: 20px;
    padding: 6px 14px;
    box-shadow: 0 4px 0 var(--cartoon-border);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 800;
}
.user-plan-tag {
    padding: 2px 8px;
    border-radius: 10px;
    border: 2px solid var(--cartoon-border);
    font-size: 11px;
    color: #fff;
}
.plan-free { background-color: #64748b; }
.plan-basic { background-color: var(--primary-blue); }
.plan-premium { background-color: #e11d48; }
.plan-business { background-color: #8b5cf6; }

/* تمييز الأدوات المقفلة */
.vip-locked {
    position: relative;
    opacity: 0.6;
    filter: grayscale(0.8);
}
.vip-locked::after {
    content: '🔒 VIP';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--accent-yellow);
    color: var(--cartoon-border);
    font-size: 10px;
    font-weight: 900;
    padding: 2px 6px;
    border: 2px solid var(--cartoon-border);
    border-radius: 8px;
    pointer-events: none;
}

/* شريط المستخدم والباقة */
.user-lab-badge {
    position: absolute;
    top: 15px;
    right: 20px;
    z-index: 250;
    background: #ffffff;
    border: 3px solid var(--cartoon-border);
    border-radius: 20px;
    padding: 6px 14px;
    box-shadow: 0 4px 0 var(--cartoon-border);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 800;
}
.user-plan-tag {
    padding: 2px 8px;
    border-radius: 10px;
    border: 2px solid var(--cartoon-border);
    font-size: 11px;
    color: #fff;
}
.plan-free { background-color: #64748b; }
.plan-basic { background-color: var(--primary-blue); }
.plan-premium { background-color: #e11d48; }
.plan-business { background-color: #8b5cf6; }

/* تمييز العناصر المقفلة (زجاجيات، جدول دوري، بطاقات كواشف) */
.glass-item.vip-locked,
.periodic-element.vip-locked,
.reagent-card.vip-locked {
    position: relative;
    opacity: 0.55;
    filter: grayscale(0.8);
    cursor: not-allowed;
}

.glass-item.vip-locked::after,
.periodic-element.vip-locked::after,
.reagent-card.vip-locked::after {
    content: '🔒 VIP';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--accent-yellow);
    color: var(--cartoon-border);
    font-size: 10px;
    font-weight: 900;
    padding: 2px 6px;
    border: 2px solid var(--cartoon-border);
    border-radius: 8px;
    pointer-events: none;
    z-index: 50;
    white-space: nowrap;
}
/* --- مؤثرات الحمام المائي وموقد بنزن --- */
.bench-glassware[data-type="water-bath"] {
    transition: filter 0.3s ease;
}

.bench-glassware[data-type="water-bath"].bath-active .bath-led {
    fill: #22c55e !important;
    filter: drop-shadow(0 0 6px #4ade80);
}

.bench-glassware[data-type="water-bath"].bath-active {
    filter: drop-shadow(0 0 15px rgba(56, 189, 248, 0.5));
}

.burner-valve-knob:hover {
    transform: scale(1.2);
    fill: #f59e0b;
}

/* --- مؤثرات السطح الثلجي --- */
.bench-glassware[data-type="ice-plate"] {
    filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.45));
}

/* --- تنسيق السهم الكيميائي والشروط المعلقة فوقه --- */
.equation-board {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.chem-arrow-box {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 10px;
    position: relative;
    vertical-align: middle;
}

.chem-arrow-box .arrow-condition {
    font-size: 16px;
    font-weight: 800;
    color: #b45309; /* لون مميز لشروط التفاعل */
    line-height: 1;
    margin-bottom: -4px;
    text-shadow: none;
    white-space: nowrap;
}

.chem-arrow-box .chem-arrow,
.equation-board .chem-arrow {
    font-size: 34px;
    font-weight: bold;
    color: var(--primary-blue-dark);
    line-height: 1;
}