/* =======================================================
   1. أنماط أساسية وموضوع التصميم الداكن
   ======================================================= */

/* منع قائمة المتصفح الافتراضية وتحديد النصوص */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    outline: none;
    box-sizing: border-box;
}

/* السماح لحقول الإدخال بتحديد النص */
input, textarea {
    -webkit-user-select: text;
    user-select: text;
}

/* منع قوائم السياق على الصور */
img {
    pointer-events: none;
}

:root {
    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --text-color-primary: #e0e0e0;
    --text-color-secondary: #a0a0a0;
    --accent-color: #e91e63; /* Pinkish-red accent */
    --accent-color-light: rgba(233, 30, 99, 0.2);
    --shadow-color: rgba(0, 0, 0, 0.5);
}

body {
    background: var(--bg-color);
    color: var(--text-color-primary);
    font-family: 'Tajawal', sans-serif;
    text-align: center;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    overscroll-behavior-y: contain;
}

#mainContent {
    flex-grow: 1;
    padding: 20px 15px; /* (تعديل: إزالة الهامش السفلي من هنا) */
    
    /* (إضافة) إضافة مساحات آمنة للأجهزة ذات النتوء (Notch) أو شريط سفلي */
    padding-top: max(20px, env(safe-area-inset-top));

    /* (*** تعديل ***) إضافة مساحة سفلية ضخمة لإفساح المجال للشريط الزجاجي */
    /* يتكيف تلقائياً: 190px على الشاشات الكبيرة، أقل على الشاشات الصغيرة */
    padding-bottom: calc(clamp(155px, 28vh, 190px) + env(safe-area-inset-bottom));
    
    z-index: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    transition: opacity 0.3s ease;
    
    /* (*** تحسين الأداء ***) */
    will-change: opacity;
}

#topSection {
    flex-shrink: 0;
    flex-grow: 1;           /* يملأ المساحة المتبقية فوق bottomSection */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* رفع المحتوى أعلى قليلاً من المنتصف */
    padding-bottom: clamp(20px, 6vh, 50px);
}

/* (*** تعديل ***) جعل الشريط السفلي شريطاً زجاجياً ثابتاً */
#bottomSection {
    flex-shrink: 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;

    /* (*** تحسين الأداء: إزالة التأثير الزجاجي واستبداله بخلفية ثابتة ***) */
    background: rgba(30, 30, 30, 0.95); /* زيادة العتامة لتعويض غياب الضبابية */
    /* (تم التعطيل) backdrop-filter: blur(15px); */
    /* (تم التعطيل) -webkit-backdrop-filter: blur(15px); */
    
    /* (إضافة) حواف علوية دائرية وحدود مضيئة */
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    
    /* (إضافة) هوامش داخلية تتكيف مع حجم الشاشة */
    padding: clamp(8px, 1.8vh, 15px) 15px max(clamp(8px, 1.8vh, 15px), env(safe-area-inset-bottom));
    box-sizing: border-box; 
    
    box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.3);

    /* (*** تحسين الأداء: استخدام تسريع العتاد (GPU) ***) */
    transform: translateZ(0);
}

/* ═══════════════════════════════════════════════
   طبقة سحب وإفلات الملفات (Drag & Drop Overlay)
   ═══════════════════════════════════════════════ */
.drag-overlay-hidden { display: none !important; }

#drag-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: dragOverlayIn 0.22s cubic-bezier(0.25, 0.8, 0.25, 1);
}
@keyframes dragOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.drag-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    animation: dragContentIn 0.28s cubic-bezier(0.25, 0.8, 0.25, 1);
}
@keyframes dragContentIn {
    from { transform: scale(0.82) translateY(20px); opacity: 0; }
    to   { transform: scale(1) translateY(0);       opacity: 1; }
}
.drag-icon-wrap {
    width: 110px;
    height: 110px;
    border: 2.5px dashed var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
    position: relative;
    z-index: 2;
    animation: dragIconBob 1.4s ease-in-out infinite;
}
@keyframes dragIconBob {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-8px); }
}
.drag-pulse-ring {
    position: absolute;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 2px solid var(--accent-color);
    opacity: 0;
    animation: dragPulse 1.8s ease-out infinite;
    pointer-events: none;
}
@keyframes dragPulse {
    0%   { transform: scale(0.75); opacity: 0.7; }
    100% { transform: scale(1.5);  opacity: 0; }
}
.drag-main-text {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}
.drag-types-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}
.drag-type-badge {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 30px;
    padding: 6px 14px;
    font-size: 13px;
    color: var(--text-color-secondary);
    white-space: nowrap;
}
/* تأثير انتقال سلس عند تغير لون الألبوم */
#bar, #playPauseBtn, .icon-btn, .secondary-btn, .main-ctrl-btn,
.highlighted-lyric, .playlist-item, .eq-slider::-webkit-slider-thumb, 
.volume-slider::-webkit-slider-thumb, #defaultIcon {
    transition: background-color 0.6s ease, color 0.6s ease, border-color 0.6s ease, box-shadow 0.6s ease, stroke 0.6s ease !important;
}

/* =======================================================
   2. تصميم حاوية الميديا (صورة الغلاف) - ✨ مُعدلة بالأبعاد الجديدة
   ======================================================= */
#mediaContainer {
    width: 100%;
    /* تكيف تلقائي: لا يتجاوز 500px ولا يأخذ أكثر من المساحة المتاحة فوق شريط التحكم */
    max-width: min(500px, calc(100svh - 310px));
    max-width: min(500px, calc(100vh - 310px));  /* fallback للمتصفحات القديمة */
    max-width: min(500px, calc(100svh - 310px)); /* svh يتجاهل شريط المتصفح */
    margin: clamp(6px, 1.5vh, 15px) auto;
    background: var(--surface-color);
    height: auto;
    aspect-ratio: 1 / 1;
    display: flex;
    justify-content: center;
    align-items: center;

    /* (*** تعديل ***) زيادة نعومة الحواف */
    border-radius: 25px;
    
    overflow: hidden;
    position: relative;
    
    /* (*** تعديل ***) تحسين الظل */
    box-shadow: 0 10px 25px var(--shadow-color);
    
    /* (*** تحسين الأداء: إزالة box-shadow و aspect-ratio من الانتقالات ***) */
    /* aspect-ratio يسبب reflow مكلف عند تغيير الغلاف */
    transition: max-width 0.3s ease, border-radius 0.3s ease;

    /* (*** تحسين الأداء: تسريع العتاد للحاوية — بدون will-change لأنه لا animation ***) */
    transform: translateZ(0);

    /*
     * touch-action: pan-y
     * يُخبر المتصفح أن الحركة الأفقية على هذا العنصر يعالجها JavaScript حصراً.
     * هذا يمنع المتصفح من "حجز" السحب الأفقي (خاصةً اليمين) كإيماء تمرير
     * أو إيماء الرجوع للخلف، مما يضمن وصول e.preventDefault() في جميع الأحوال.
     */
    touch-action: pan-y;
}

#mediaContainerIcons {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    display: flex;
    justify-content: space-between;
    z-index: 10;
    transition: opacity 0.3s ease;
    
    /* (*** تحسين الأداء ***) */
    will-change: opacity;
}

.icon-btn {
    background: rgba(30, 30, 30, 0.7);
    border: none;
    color: var(--text-color-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    /* إعادة ضبط تنسيق button الافتراضي */
    -webkit-appearance: none;
    appearance: none;
    padding: 0;
    outline: none;
    /* (*** تم الحذف لتحسين الأداء: إزالة التأثير الزجاجي من الأزرار ***) */
    /* backdrop-filter: blur(5px); */ 
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 10px var(--shadow-color);
    transition: background 0.2s, opacity 0.3s;
}
@media (hover: hover) { .icon-btn:hover { background: var(--surface-color); } }
.icon-btn.active { color: var(--accent-color); }


#audioCanvas, #coverArt, #defaultIcon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    border-radius: 0;
    /* انتقال الظهور/الاختفاء فقط — بدون transform أو filter */
    transition: opacity 0.3s ease;
    position: absolute;
    top: 0;
    left: 0;
    
    /* (*** تحسين الأداء: تسريع العتاد بدون will-change زائد ***) */
    transform: translateZ(0);
    image-rendering: optimizeSpeed;
    will-change: opacity;
}

/* الكانفاس يُمرِّر جميع اللمسات للحاوية تحته — السحب يعمل حتى مع المؤثرات */
#audioCanvas {
    pointer-events: none;
}

#defaultIcon {
    font-size: 100px;
    color: var(--accent-color);
    display: flex; 
    justify-content: center;
    align-items: center;
    
    /* (*** إضافة ***) تدرج خفيف في الخلفية لجعله أقل سطحية */
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, rgba(0,0,0,0.1) 70%);
}

#lyricsDisplay {
    position: absolute;
    
    /* (*** تعديل ***) جعلها لوحة عائمة داخل الحاوية */
    bottom: 10px; 
    left: 10px; 
    right: 10px;
    
    /* (*** تحسين الأداء: إزالة التأثير الزجاجي ***) */
    background: rgba(40, 40, 40, 0.9); /* خلفية صلبة بدلاً من الزجاج */
    /* (تم التعطيل) backdrop-filter: blur(10px); */
    /* (تم التعطيل) -webkit-backdrop-filter: blur(10px); */
    
    color: var(--text-color-primary); /* ضمان لون النص الأساسي */
    padding: 15px;
    font-size: 16px; 
    z-index: 5;
    
    /* (*** تحسين الأداء: إزالة ظل النص ***) */
    /* (تم التعطيل) text-shadow: 0 0 8px var(--accent-color); */

    /* === الحالة الافتراضية: مخفي بدون انيمشن === */
    display: block;
    opacity: 0;
    pointer-events: none;
    transform: translateY(14px) scale(0.97);
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, opacity;

    line-height: 1.8;
    max-height: 40%;
    overflow-y: auto;
    
    /* (*** تعديل ***) حواف دائرية بالكامل وحدود زجاجية */
    border-radius: 15px; 
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); /* ظل لتعزيز العمق */
}

/* === الحالة المرئية: ظهور ناعم بـ fade + slide === */
#lyricsDisplay.lyrics-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.highlighted-lyric { color: var(--accent-color); font-weight: bold; }

/* انيميشن ظهور سطر الكلمات الجديد */
@keyframes lyricLineFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

#lyricsDisplay span.highlighted-lyric {
    display: inline-block;
    animation: lyricLineFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}


/* =======================================================
   تنسيق شريط التقدم والوقت (من ملفك القديم)
   ======================================================= */

#progressContainer {
    width: 100%;
    max-width: 380px;
    margin: 15px auto;
    cursor: pointer;
    position: relative;
    padding: 10px 0;
}

#progress {
    width: 100%;
    height: 3px;
    background: rgba(255,255,255,0.12);
    border-radius: 3px;
    position: relative;
    overflow: hidden;
}

#bar {
    height: 100%;
    width: 100%;
    position: absolute;
    left: 0;
    top: 0;
    background: var(--accent-color);
    border-radius: 3px;
    transform: translateX(-100%);
    transform-origin: left;
    will-change: transform;
    transition: transform 0.25s linear;
}

#audioCanvas, #coverArt, #defaultIcon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    border-radius: 0;
    transition: opacity 0.3s ease;
    position: absolute;
    top: 0;
    left: 0;
    transform: translateZ(0);
    image-rendering: auto;
    will-change: opacity;
}
/* الكانفاس لا يحتاج لاستقبال أي لمسات — يمررها للحاوية دائماً */
#audioCanvas { pointer-events: none; }
#timeDisplay {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-color-secondary);
    margin-top: 6px;
    padding: 0 2px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.3px;
    opacity: 0.8;
}

#currentTime {
    color: var(--text-color-primary);
    font-weight: 600;
    opacity: 1;
}

/* =======================================================
   4. تصميم عناصر التحكم الجديدة
   ======================================================= */
#controls {
    background: transparent;
    
    /* (*** تعديل ***) إزالة الهامش، #bottomSection يعالجه الآن */
    padding: 0; 
    
    box-shadow: none;
    display: flex;
    flex-direction: column; 
    width: 100%; max-width: 100%;
    position: static;

    /* (*** تعديل ***) تقليل الفجوة قليلاً لتحسين الشكل */
    gap: 15px;
    
    transition: opacity 0.3s ease;
    
    /* (*** تحسين الأداء ***) */
    will-change: opacity;
}

#secondaryControls {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: min(420px, 100%);
    width: 100%;
    margin: 0 auto;
    /* عزل أحداث اللمس لمنع تسربها نحو progressContainer */
    isolation: isolate;
    position: relative;
    z-index: 2;
}

.secondary-btn {
    background: none; border: none;
    color: var(--text-color-secondary);
    font-size: clamp(19px, 5.5vw, 24px); cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
    position: relative;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    will-change: color, transform;
}
@media (hover: hover) { .secondary-btn:hover { color: var(--text-color-primary); } }
/* على الأجهزة اللمسية: لا نُظهر حالة hover لمنع بقاء التمييز بعد الضغط */

/* إخفاء تلميح لوحة المفاتيح على الأجهزة اللمسية (الهواتف والأجهزة اللوحية) */
@media (pointer: coarse) {
    #keyboardHintBox { display: none !important; }
}
.secondary-btn.active { 
    color: var(--accent-color);
    transform: scale(1.1);
    text-shadow: 0 0 8px var(--accent-color);
}
/* زر معطَّل: شفافية خافتة + لا تغيير عند hover */
.secondary-btn:disabled,
.secondary-btn[disabled] {
    opacity: 0.28;
    cursor: not-allowed;
    pointer-events: none;
    transform: none !important;
    color: var(--text-color-secondary) !important;
    text-shadow: none !important;
}

#randomBtn.active::after {
    content: '';
    position: absolute;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    background-color: var(--accent-color);
    border-radius: 50%;
    box-shadow: 0 0 5px var(--accent-color);
}

#mainControls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(14px, 5vw, 30px);
    margin: clamp(4px, 1vh, 10px) auto;
}

.main-ctrl-btn {
    background: none; border: none;
    color: var(--text-color-primary);
    font-size: clamp(24px, 7vw, 30px); cursor: pointer;
    transition: color 0.2s, transform 0.15s;
    padding: 10px;
    will-change: color, transform;
}
.main-ctrl-btn.pressing { transform: scale(0.88); }
@media (hover: hover) { .main-ctrl-btn:hover { color: var(--accent-color); transform: scale(1.1); } }

#playPauseBtn {
    background: var(--accent-color);
    color: #fff;
    width: clamp(56px, 15vw, 70px); height: clamp(56px, 15vw, 70px);
    border-radius: 50%;
    font-size: clamp(22px, 6.5vw, 28px);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 5px 20px rgba(233, 30, 99, 0.4);
    transition: background 0.3s, transform 0.15s, box-shadow 0.15s;
    will-change: background, transform;
    position: relative;
    overflow: hidden;
}

/* تأثير ripple عند الضغط */
#playPauseBtn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    opacity: 0;
    transform: scale(0);
    transition: transform 0.35s ease, opacity 0.35s ease;
    pointer-events: none;
}
#playPauseBtn.pressing::after {
    transform: scale(1);
    opacity: 1;
    transition: none;
}
#playPauseBtn.pressing { transform: scale(0.92); box-shadow: 0 2px 10px rgba(233, 30, 99, 0.3); }
@media (hover: hover) { #playPauseBtn:hover { transform: scale(1.05); } }


/* (تعديل) أنماط التحكم بالصوت - إزالة الاعتماد على hover */
/* =======================================================
   تصميم شريط الصوت (Custom Range Input)
   ======================================================= */
#volumeContainer {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0;
    gap: 10px;
}

.volume-slider {
    -webkit-appearance: none; /* إلغاء التصميم الافتراضي */
    appearance: none;
    width: 100px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1); /* لون الخلفية (الجزء غير الممتلئ) */
    border-radius: 10px;
    outline: none;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
    /* إجبار LTR لمنع عكس الاتجاه في واجهة RTL */
    direction: ltr;
}

/* تصميم المقبض (Thumb) لمتصفح Chrome/Safari/Edge */
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--accent-color); /* إطار بلون الثيم */
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    margin-top: 0px; /* ضبط المحاذاة */
    transition: transform 0.2s, box-shadow 0.2s;
}

/* تأثير عند التمرير على مقبض الصوت — للماوس فقط لا للمس */
@media (hover: hover) and (pointer: fine) {
    .volume-slider::-webkit-slider-thumb:hover {
        transform: scale(1.2);
        box-shadow: 0 0 15px var(--accent-color);
        background: var(--accent-color);
        border-color: #fff;
    }

    .volume-slider::-moz-range-thumb:hover {
        transform: scale(1.2);
        box-shadow: 0 0 15px var(--accent-color);
    }
}

/* تصميم المقبض لمتصفح Firefox */
.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #fff;
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    transition: transform 0.2s, box-shadow 0.2s;
}

/* تأثير الضغط للمس — يختفي فور رفع الإصبع */
.volume-slider:active::-webkit-slider-thumb {
    transform: scale(1.15);
    box-shadow: 0 0 12px var(--accent-color);
}
.volume-slider:active::-moz-range-thumb {
    transform: scale(1.15);
    box-shadow: 0 0 12px var(--accent-color);
}


/* =======================================================
   5. أنماط قائمة التشغيل وشاشة المعلومات (Overlay)
   ======================================================= */
.overlay {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%; 
    background: rgba(18, 18, 18, 0.98);
    z-index: 40; padding: 20px 14px 14px 14px; 
    box-sizing: border-box; display: none; flex-direction: column;
    color: var(--text-color-primary);

    /* أنيميشن دخول خفيف — مناسب لجميع الأجهزة */
    animation: overlaySlideIn 0.28s cubic-bezier(0.25, 0.8, 0.25, 1) both;
    will-change: transform, opacity;
}

/* أنيميشن الدخول */
@keyframes overlaySlideIn {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* أنيميشن الخروج */
@keyframes overlaySlideOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(14px); }
}

.overlay-closing {
    animation: overlaySlideOut 0.22s cubic-bezier(0.4, 0, 1, 1) both !important;
    pointer-events: none;
}

.overlay h2 { 
    color: var(--accent-color); margin-bottom: 10px; 
    border-bottom: 1px solid var(--surface-color); padding-bottom: 8px; 
    font-size: 22px;
}

#listMode { 
    display: flex; 
    flex-direction: column; 
    flex-grow: 1; 
    overflow: hidden;

    /* (*** إضافة ***) حركة للمحتوى الداخلي */
    animation: overlaySlideIn 0.28s cubic-bezier(0.25, 0.8, 0.25, 1) 0.05s both;
    animation-fill-mode: backwards;
    will-change: transform, opacity;
}

/* ══ مقبض سحب قائمة التشغيل — شريط عرض كامل ══ */
#playlist-drag-handle {
    width: 100%;
    height: 22px;
    flex-shrink: 0;
    cursor: grab;
    touch-action: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.04);
    border-radius: 16px 16px 0 0;
}
/* الشريط المرئي داخل المقبض */
#playlist-drag-handle::after {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.22);
    border-radius: 4px;
    transition: width 0.2s ease, background 0.2s ease;
}
#playlist-drag-handle:active {
    cursor: grabbing;
}
#playlist-drag-handle:active::after,
#playlist-drag-handle.dragging::after {
    width: 56px;
    background: rgba(255, 255, 255, 0.5);
}

#searchInput {
    width: 100%;
    padding: 9px 38px 9px 36px;
    border-radius: 12px;
    border: 1.5px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.06);
    color: var(--text-color-primary);
    font-size: 14px;
    font-family: 'Tajawal', sans-serif;
    font-weight: 600;
    transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
    box-sizing: border-box;
    letter-spacing: 0.2px;
}
#searchInput::placeholder {
    color: var(--accent-color);
    opacity: 0.75;
    font-weight: 700;
    font-size: 10px;
}
#searchInput:focus {
    border-color: rgba(233,30,99, 0.45);
    background: rgba(255,255,255,0.07);
    outline: none;
    box-shadow: 0 0 0 3px rgba(233,30,99, 0.08);
}
#searchInput:focus::placeholder {
    color: rgba(255,255,255,0.3);
    font-weight: 400;
    font-size: 14px;
}

/* ── playlist-search-row تم دمجها في playlist-header-unified ── */

/* غلاف حقل البحث بالنسبة لأيقونة البحث */
.search-input-wrapper {
    position: relative;
    flex: 1;
}
.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.35);
    pointer-events: none;
}

/* زر مسح البحث (X) */
.clear-search-btn {
    position: absolute;
    right: 9px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background 0.18s, color 0.18s, transform 0.15s, opacity 0.18s;
    flex-shrink: 0;
    opacity: 0;
    pointer-events: none;
}
.clear-search-btn.visible {
    opacity: 1;
    pointer-events: auto;
}
@media (hover: hover) { .clear-search-btn:hover {
    background: rgba(233,30,99,0.25);
    color: var(--accent-color);
    transform: translateY(-50%) scale(1.1);
} }
.clear-search-btn:active {
    transform: translateY(-50%) scale(0.88);
    background: rgba(233,30,99,0.4);
}

/* زر إغلاق في مجموعة الأزرار الموحدة */
.playlist-close-btn {
    background: rgba(233, 30, 99, 0.12) !important;
    color: var(--accent-color) !important;
    border-radius: 9px !important;
    width: 34px !important;
    height: 34px !important;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.15s !important;
    border: none !important;
}
@media (hover: hover) { .playlist-close-btn:hover {
    background: rgba(233, 30, 99, 0.25) !important;
    transform: scale(1.07) !important;
} }
.playlist-close-btn:active {
    transform: scale(0.92) !important;
}

/* sortControlsGroup removed */
/* ══════════════════════════════════════════
   قائمة الفرز المنسدلة — تصميم محسّن
   ══════════════════════════════════════════ */
#sortMenuWrapper { position: static; flex-shrink: 0; }
#sortMenuBtn { /* inherits header-icon-btn styles */ }

.sort-dropdown {
    position: fixed; top: 0; left: 0;
    background: #1a1a2e;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    overflow: hidden;
    z-index: 9999;
    min-width: 230px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3);
    display: flex; flex-direction: column;
    animation: dropdownIn 0.18s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0)   scale(1);    }
}
.sort-dropdown.hidden { display: none; }

/* رأس القائمة */
.sort-dropdown-header {
    padding: 10px 14px 8px;
    font-family: 'Tajawal', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    direction: rtl;
    text-align: right;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

/* كل صف فرز */
.sort-option {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Tajawal', sans-serif;
    font-size: 13.5px;
    text-align: right;
    direction: rtl;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    width: 100%;
    color: var(--text-color-secondary);
}
.sort-option:last-child { border-bottom: none; }
@media (hover: hover) {
    .sort-option:not(.active-sort):hover {
        background: rgba(255,255,255,0.06);
        color: var(--text-color-primary);
    }
}

/* أيقونة النوع */
.sort-icon {
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.15s;
}

/* اسم أسلوب الفرز */
.sort-label {
    flex: 1;
    white-space: nowrap;
}

/* الصف النشط */
.sort-option.active-sort {
    background: rgba(233, 30, 99, 0.12);
    color: var(--text-color-primary);
}
.sort-option.active-sort .sort-icon { opacity: 1; }

/* ── كبسولة الاتجاه (↑ تصاعدي / ↓ تنازلي) ── */
.sort-dir-pill {
    display: none;           /* مخفية دائماً على الصفوف غير النشطة */
    align-items: center;
    gap: 3px;
    margin-right: auto;      /* يدفعها لأقصى اليسار في RTL */
    flex-shrink: 0;
}
.sort-option.active-sort .sort-dir-pill {
    display: flex;           /* تظهر فقط عند التفعيل */
}

.dir-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 7px;
    border-radius: 6px;
    font-size: 12px;
    font-family: 'Tajawal', sans-serif;
    color: rgba(255,255,255,0.45);
    background: rgba(255,255,255,0.07);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
}
.dir-btn .dir-label {
    font-size: 11px;
    opacity: 0.85;
}
@media (hover: hover) {
    .dir-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }
}

/* الاتجاه النشط مُميَّز بلون accent */
.dir-btn.active-dir {
    background: var(--accent-color);
    color: #fff;
}

/* زر العشوائي — بدون كبسولة اتجاه */
.sort-option-shuffle.active-sort {
    background: rgba(233, 30, 99, 0.12);
}
/* ── شريط التحكم السفلي ── */
#playlist-mini-player {
    display: flex; flex-direction: column;
    flex-shrink: 0; width: 100%; max-width: 480px; align-self: center;
    padding: 8px 12px 10px;
    background: rgba(255,255,255,0.04);
    border-top: 1px solid rgba(255,255,255,0.08);
    border-radius: 0 0 16px 16px;
    gap: 6px;
}
/* ── شريط التقدم العلوي ── */
#playlist-mini-progress-wrap {
    display: flex; align-items: center; gap: 6px; width: 100%;
}
#playlist-mini-current, #playlist-mini-duration {
    font-size: 10px; color: var(--text-color-secondary); opacity: 0.7;
    flex-shrink: 0; min-width: 28px; font-variant-numeric: tabular-nums;
}
#playlist-mini-duration { text-align: right; }
#playlist-mini-progress-track {
    flex: 1; position: relative;
}
#playlist-mini-progress-bar {
    width: 100%; height: 3px; background: rgba(255,255,255,0.12);
    border-radius: 3px; overflow: hidden; position: relative; cursor: pointer;
}
#playlist-mini-bar {
    position: absolute; inset: 0;
    background: var(--accent-color);
    transform: translateX(-100%);
    transform-origin: left;
    border-radius: 3px;
    transition: transform 0.25s linear;
    will-change: transform;
}
/* ── الصف السفلي: معلومات + أزرار ── */
#playlist-mini-bottom {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; width: 100%;
}
#playlist-mini-info {
    display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; overflow: hidden;
}
#playlist-mini-cover {
    width: 40px; height: 40px; border-radius: 8px; overflow: hidden; flex-shrink: 0;
    background: rgba(255,255,255,0.08); display: flex; align-items: center; justify-content: center;
}
#playlist-mini-cover img { width: 100%; height: 100%; object-fit: cover; }
#playlist-mini-text {
    display: flex; flex-direction: column; min-width: 0; overflow: hidden; flex: 1; gap: 2px;
}
#playlist-mini-title {
    font-size: 12px; font-weight: 600; color: var(--text-color-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: block; width: 100%;
    text-align: start;
}
#playlist-mini-artist {
    font-size: 10px; color: var(--text-color-secondary); opacity: 0.75;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    letter-spacing: 0.2px;
    text-align: start;
}
#playlist-mini-controls {
    display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}
#playlist-mini-controls button {
    background: none; border: none; cursor: pointer; display: flex; align-items: center;
    justify-content: center; width: 36px; height: 36px; border-radius: 50%;
    color: var(--text-color-secondary);
    transition: background 0.15s, color 0.15s, transform 0.15s;
    will-change: color, transform;
}
/* ══════════════════════════════════════════════════════
   أزرار السابق/التالي — نسخة طبق الأصل من main-ctrl-btn
   بدون أي background أو border-radius أو transition للخلفية
   ══════════════════════════════════════════════════════ */
#playlist-prev-btn,
#playlist-next-btn {
    /* إلغاء كل خصائص الزر الدائري الموروثة */
    background: none !important;
    border-radius: 0 !important;
    color: var(--text-color-primary) !important;
    /* نفس transition المشغل الرئيسي — بدون background */
    transition: color 0.2s, transform 0.15s !important;
    will-change: color, transform;
    -webkit-tap-highlight-color: transparent !important;
    outline: none !important;
}
/* منع أي خلفية في أي حالة كانت */
#playlist-prev-btn:hover,
#playlist-prev-btn:focus,
#playlist-prev-btn:active,
#playlist-next-btn:hover,
#playlist-next-btn:focus,
#playlist-next-btn:active {
    background: none !important;
    outline: none !important;
    box-shadow: none !important;
}
/* أيقونات stroke مثل المشغل الرئيسي */
#playlist-prev-btn svg,
#playlist-next-btn svg {
    fill: none !important;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: filter 0.2s ease;
}
#playlist-prev-btn:active,
#playlist-next-btn:active { transform: scale(0.88) !important; }

#playlist-play-btn { background: var(--accent-color-light) !important; color: var(--accent-color) !important; transition: background 0.2s, transform 0.15s !important; will-change: transform; }
#playlist-play-btn:active { transform: scale(0.88) !important; }
@media (hover: hover) {
    /* زر التشغيل فقط له hover بخلفية */
    #playlist-mini-controls button:hover { background: rgba(255,255,255,0.1); color: var(--text-color-primary); }
    #playlist-play-btn:hover { background: var(--accent-color) !important; color: #fff !important; }
    /* السابق/التالي: نفس hover المشغل الرئيسي — لون + تكبير فقط */
    #playlist-prev-btn:hover,
    #playlist-next-btn:hover {
        background: none !important;
        color: var(--accent-color) !important;
        transform: scale(1.1) !important;
    }
    #playlist-prev-btn:hover svg,
    #playlist-next-btn:hover svg {
        filter: drop-shadow(0 0 3px var(--accent-color));
    }
}
#sortButton { display: none; }


#playlist {
    list-style: none; padding: 0; margin: 0; flex-grow: 1; overflow-y: auto; 
    font-size: 15px; padding-right: 5px;
    width: 100%;

    /* منع إيماء السحب الأفقي */
    touch-action: pan-y;

    /* عزل التمرير بدون تقييد الحجم */
    contain: content;
}

/* منع إيماء الإغلاق (السحب) على overlay القائمة */
#playlistOverlay {
    touch-action: pan-y;
    overscroll-behavior: contain;
    /* إخفاء فوري يمنع الومضة عند إعادة ضبط transform بعد الـ dismiss */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.playlist-item {
    padding: 10px 10px; margin-bottom: 8px; background: var(--surface-color); border-radius: 12px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    transition: background 0.2s, color 0.2s; border-left: 4px solid transparent; 
    display: flex; justify-content: space-between; align-items: center;
    gap: 6px;
}
/* اسم الملف — يأخذ كل المساحة المتاحة */
.playlist-item-text {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    font-weight: 500;
}
/* رقم الترتيب — أقصى اليمين */
.playlist-item-number {
    flex-shrink: 0;
    direction: ltr;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-color);
    opacity: 0.75;
    min-width: 18px;
    text-align: center;
    background: var(--accent-color-light);
    border-radius: 4px;
    padding: 1px 4px;
    line-height: 1.6;
}
/* زر الانتظار — مضغوط */
.queue-btn {
    background: #333; color: var(--text-color-secondary); border: none;
    padding: 3px 6px; border-radius: 6px;
    font-weight: bold; font-size: 10px; cursor: pointer;
    flex-shrink: 0;
    width: 58px;
    text-align: center;
    white-space: nowrap;
    transition: background 0.2s, transform 0.1s;
}
@media (hover: hover) { .queue-btn:hover { background: #444; } }
.queue-btn.queue-btn-disabled {
    background: rgba(233,30,99, 0.12);
    color: var(--accent-color);
    opacity: 0.85;
    cursor: default;
    font-size: 11px;
    border: 1px solid var(--accent-color-light);
    /* لا pointer-events:none — نريد النقر ليصل للـ JS ويُظهر الرسالة */
}
.playlist-item.active {
    background: var(--accent-color-light);
    color: var(--accent-color); font-weight: bold;
    border-left: 4px solid var(--accent-color);
}
.playlist-item.queued { background: rgba(255, 170, 0, 0.2); border-left: 4px solid #ffaa00; }
/* ── زر الإغلاق X ── */
.header-icon-btn.close-overlay-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: rgba(255, 255, 255, 0.55);
    width: 34px;
    height: 34px;
    border-radius: 10px;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}
.header-icon-btn.close-overlay-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2.8;
}
@media (hover: hover) { .header-icon-btn.close-overlay-btn:hover {
    background: rgba(233, 30, 99, 0.18);
    border-color: rgba(233, 30, 99, 0.40);
    color: var(--accent-color);
    transform: scale(1.08);
} }
.header-icon-btn.close-overlay-btn:active {
    transform: scale(0.93);
    background: rgba(233, 30, 99, 0.28);
}

/* ══════════════════════════════════════════════
   صفحة "حول المشغل" — التصميم الجديد
   ══════════════════════════════════════════════ */
/* حاوية التمرير لقائمة "حول المشغل" — تتمرر فقط عند تجاوز ارتفاع الشاشة */
#infoScrollArea {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    overscroll-behavior: contain;
    padding: 4px 0 10px;
    gap: 0;
}

#infoContent {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 2px 0 2px;
    animation: overlaySlideIn 0.28s cubic-bezier(0.25, 0.8, 0.25, 1) 0.05s both;
    animation-fill-mode: backwards;
    will-change: transform, opacity;
}

/* بطاقة الأيقونة والعنوان والإصدار */
.info-app-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.info-app-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(var(--accent-rgb, 99,102,241), 0.25), rgba(var(--accent-rgb, 99,102,241), 0.08));
    border: 1px solid rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
    margin-bottom: 4px;
}

.info-app-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--text-color-primary);
}

.info-music-note {
    color: var(--accent-color);
}

.info-app-version {
    font-size: 12px;
    padding: 3px 12px;
    border-radius: 20px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--text-color-secondary);
    letter-spacing: 1px;
}

/* بطاقة بيانات المطور */
.info-rows-card {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 16px;
    overflow: hidden;
}

.info-row-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 16px;
    gap: 10px;
}

.info-row-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--text-color-secondary);
    white-space: nowrap;
}

.info-row-label svg {
    opacity: 0.7;
    flex-shrink: 0;
}

.info-row-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-color-primary);
    text-align: left;
}

.info-row-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-color);
    text-decoration: none;
    text-align: left;
}

@media (hover: hover) { .info-row-link:hover {
    text-decoration: underline;
} }

.info-row-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 0 12px;
}

#infoContent p {
    font-size: 18px;
    line-height: 2.2;
    color: var(--text-color-primary);
    margin: 5px 0;
}
#infoContent p strong {
    color: var(--text-color-secondary);
    margin-left: 10px;
    min-width: 100px;
    display: inline-block;
    text-align: right;
}

/* ── تلميح اختصارات الكمبيوتر ── */
#keyboardHintBox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 9px 16px;
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    font-size: 0.88rem;
    color: rgba(255,255,255,0.55);
    font-family: 'Tajawal', sans-serif;
    direction: rtl;
}
#keyboardHintIcon { font-size: 1rem; }
#keyboardHintText { white-space: nowrap; }
#keyboardHintBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.22);
    box-shadow: 0 2px 0 rgba(0,0,0,0.35);
    color: var(--accent-color, #60a5fa);
    font-size: 0.95rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
}
@media (hover: hover) { #keyboardHintBtn:hover {
    background: rgba(255,255,255,0.18);
    transform: translateY(-1px);
} }
#keyboardHintBtn:active {
    transform: translateY(1px);
    box-shadow: none;
}

/* =======================================================
   تنسيق رأس القائمة المدمج (العنوان + الأزرار)
   ======================================================= */

/* ══ رأس القائمة الموحد ══ */
.playlist-header-unified {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    align-self: center;
    flex-shrink: 0;
    box-sizing: border-box;
    /* نفس تصميم المشغل المصغر */
    background: rgba(255,255,255,0.04);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    /* ✅ لا border-radius هنا — #playlist-drag-handle فوقه يتكفل بذلك */
    border-radius: 0;
    padding: 8px 10px;
    margin-bottom: 0;
}

/* مجموعة الأزرار — نفس شكل أزرار المشغل المصغر */
.playlist-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 14px;
    padding: 3px 4px;
}

/* فاصل بين أزرار التحرير وزر الإغلاق */
.playlist-header-actions .playlist-close-btn {
    margin-right: 2px;
    position: relative;
}
.playlist-header-actions .playlist-close-btn::before {
    content: '';
    position: absolute;
    right: -3px;
    top: 20%;
    height: 60%;
    width: 1px;
    background: rgba(255,255,255,0.12);
}

/* للتوافق مع الأماكن الأخرى */
.header-actions {
    display: flex;
    gap: 6px;
}

/* حاجة فارغة للتوافق */
.playlist-title-group { display: none; }
#listTitle { display: none; }

/* تنسيق الأزرار — مطابق لأزرار المشغل المصغر */
.header-icon-btn {
    background: none;
    border: none;
    color: var(--text-color-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.header-icon-btn svg {
    width: 19px;
    height: 19px;
    stroke: currentColor;
    transition: stroke 0.2s;
}

@media (hover: hover) {
.header-icon-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-color-primary);
}

.header-icon-btn.danger:hover {
    background: rgba(244,67,54,0.15);
    color: #ff5252;
}
}

/* حالة تحميل الملفات — تعطيل بصري مع أنيميشن */
.header-icon-btn.file-loading {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.header-icon-btn.file-loading svg {
    animation: btn-spin 1s linear infinite;
    transform-origin: center;
}

@keyframes btn-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}



/* تحسين الاستجابة على الشاشات الصغيرة */
@media (max-width: 380px) {
    #listTitle {
        font-size: 18px;
    }
    .header-icon-btn {
        width: 34px;
        height: 34px;
    }
}

/* =======================================================
   6. (إضافة جديدة) أنماط الإشعارات المخصصة (Toast) - ✨ مُعدلة للأعلى
   ======================================================= */
#notification-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    width: 90%;
    max-width: 500px;
    pointer-events: none;
}

.toast {
    background-color: var(--surface-color);
    color: var(--text-color-primary);
    padding: 12px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px var(--shadow-color);
    border-left: 5px solid var(--text-color-secondary);
    font-size: 15px;
    opacity: 0;
    transform: translateY(-150%);
    
    /* (*** تحسين الأداء: تجنب transition: all ***) */
    /* تحديد الخصائص التي ستتحرك فقط (transform و opacity) */
    transition: opacity 0.4s cubic-bezier(0.215, 0.610, 0.355, 1), 
                transform 0.4s cubic-bezier(0.215, 0.610, 0.355, 1);
    
    pointer-events: auto;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    
    /* (*** تحسين الأداء ***) */
    will-change: opacity, transform;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.info {
    border-left-color: #2196F3;
}
.toast.success {
    border-left-color: #4CAF50;
}
.toast.error {
    border-left-color: #f44336;
}

@media (max-width: 600px) {
    #notification-container {
        left: 10px;
        right: 10px;
        top: 10px;
        width: auto;
        transform: none;
        align-items: center;
    }
    .toast {
        width: 100%;
        text-align: center;
    }
}

/* =======================================================
   7A. قواعد الماركي العالمية — تعمل في كل الأوضاع والأحجام
   (يجب أن تكون خارج @media لتعمل في landscape حيث العرض > 600px)
   ======================================================= */

/* inline-block ضروري لقياس scrollWidth في handleSmoothMarquee */
#trackTitle, #trackArtist {
    display: inline-block;
    will-change: transform;
    white-space: nowrap;
}

/* #trackInfo يحتاج overflow:hidden لقطع النص الطويل */
#trackInfo {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 0;
}

/* الماركي الفعّال */
.marquee-active {
    animation: ping-pong var(--marquee-duration, 4s) ease-in-out infinite alternate !important;
    will-change: transform;
}

/* حركة الذهاب والإياب */
@keyframes ping-pong {
    0%, 10% {
        transform: translate3d(var(--start-x, 0px), 0, 0);
    }
    90%, 100% {
        transform: translate3d(var(--end-x, 0px), 0, 0);
    }
}

/* =======================================================
   7. أنماط الهواتف (Responsive)
   ======================================================= */
@media (max-width: 600px) {
    /* تصغير الهوامش الرئيسية لملء الشاشة */
    #mainContent {
        padding: 10px 15px; /* (*** تعديل ***) إزالة الهامش السفلي من هنا */
        
        /* إزالة المسافة الكبيرة بين الأقسام */
        justify-content: flex-start; 
        gap: 15px; 
        overflow-y: auto; /* السماح بالتمرير إذا ضاقت الشاشة جداً */
        
        /* (*** تحسين الأداء: عزل التمرير ***) */
        /* نفس مبدأ قائمة التشغيل، نحسن أداء التمرير للمحتوى الرئيسي */
        contain: paint;
        
        /* (تعديل) التأكد من تطبيق المساحات الآمنة هنا أيضاً */
        padding-top: max(10px, env(safe-area-inset-top));
        
        /* (*** تعديل ***) إضافة مساحة سفلية ضخمة لإفساح المجال للشريط الزجاجي */
        /* 160px (ارتفاع الشريط التقريبي على الهاتف) + 10px (هامش) */
        padding-bottom: calc(170px + env(safe-area-inset-bottom));
    }

    #mediaContainer {
        margin-top: 5px; /* تقليل الهامش العلوي */
        margin-bottom: 5px;
    }

   /* حاوية المعلومات الكلية */
   /* حاوية المعلومات الكلية */
#trackInfo {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center; /* تنظيم اسم الفنان تحت اسم الأغنية في المنتصف */
    justify-content: center;
    overflow: hidden;
    padding: 15px 0;
}

/* تنسيق الحاويات الفردية للنص */
.scroll-container {
    width: 90%; 
    overflow: hidden;
    position: relative;
    white-space: nowrap;
    text-align: center; /* (تعديل) إجبار النص على التوسيط */
    /* السر: تلاشي النص عند الأطراف يميناً ويساراً */
    mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
    margin-bottom: 8px;
}

#trackTitle, #trackArtist {
    display: inline-block;
    padding-left: 0; /* (تعديل) إزالة المسافة التي كانت تكسر التوسيط */
    will-change: transform;
}

#trackArtist {
    font-size: 15px; /* (تعديل) إعادة الحجم كما في الكود القديم */
    opacity: 0.8; 
    margin-top: 4px;
}

/* حركات الدوران */
@keyframes loop-ltr {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@keyframes loop-rtl {
    0% { transform: translateX(0); }
    100% { transform: translateX(50%); }
}

/* تنسيق الحركة الفعالة */
.marquee-active {
    /* ease-in-out يجعل الحركة تبطئ عند الأطراف لتعطي وقتاً للقراءة */
    animation: ping-pong var(--marquee-duration, 4s) ease-in-out infinite alternate !important;
    
    /* تفعيل تسريع كارت الشاشة (GPU) لمنع التقطيع */
    will-change: transform;
    transform: translateZ(0);
}

/* حركة الذهاب والعودة الموحدة (تدعم العربي والإنجليزي معاً بفضل الجافاسكريبت) */
@keyframes ping-pong {
    /* الانتظار قليلاً في البداية (من 0% إلى 10%) للسماح للمستخدم بقراءة بداية الكلمة */
    0%, 10% { 
        transform: translate3d(var(--start-x, 0px), 0, 0); 
    }
    /* الانتظار قليلاً في النهاية (من 90% إلى 100%) */
    90%, 100% { 
        transform: translate3d(var(--end-x, 0px), 0, 0); 
    }
}

    #progressContainer {
        margin: 5px auto;
    }

    /* إخفاء شريط الصوت على الهواتف (الاعتماد على أزرار الجهاز) */
    #volumeContainer {
        display: none;
    }
    
    /* جعل الأزرار تملأ المساحة المتاحة بشكل أفضل */
    #secondaryControls {
        max-width: 100%;
        justify-content: space-between; /* توزيع الأزرار على كامل العرض */
        padding: 0 10px; /* إضافة هوامش جانبية */
        box-sizing: border-box;
    }

    /* تكبير أهداف اللمس للأزرار */
    .secondary-btn {
        font-size: 26px; /* أكبر قليلاً */
    }

    #controls {
        gap: 15px; /* تقليل المسافة بين مجموعتي الأزرار */
        padding: 0;
    }
    
    #mainControls {
        gap: 25px; /* تقريب الأزرار الرئيسية */
    }
    
    .main-ctrl-btn {
        font-size: 36px; /* تكبير أزرار السابق/التالي */
    }
    
    #playPauseBtn {
        width: 70px; /* الحفاظ على الحجم الكبير */
        height: 70px;
    }
}

/* =======================================================
   8. (*** تعديل ***) أنماط المعادل الصوتي الاحترافي
   ======================================================= */
/* ══════════════════════════════════════════════════════
   EQ MODE — تصميم احترافي مُحسَّن
   ══════════════════════════════════════════════════════ */

/* ── الحاوية الرئيسية ─── */
#eqMode {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 14px 20px;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    gap: 14px;
    animation: overlaySlideIn 0.28s cubic-bezier(0.25, 0.8, 0.25, 1) 0.05s both;
    animation-fill-mode: backwards;
    will-change: transform, opacity;
}

/* ══ قسم الـ Presets ══ */
.custom-dropdown {
    position: relative;
    width: 100%;
    font-family: 'Tajawal', sans-serif;
    z-index: 100;
}

.dropdown-header {
    padding: 11px 16px;
    border-radius: 14px;
    border: 1.5px solid rgba(255,255,255,0.08);
    background: linear-gradient(135deg, #22223a 0%, #1a1a2e 100%);
    color: var(--text-color-primary);
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: border-color 0.22s, box-shadow 0.22s, background 0.22s;
    box-shadow: 0 2px 14px rgba(0,0,0,0.3);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.dropdown-header:active { transform: scale(0.985); }

.dropdown-header.active {
    border-color: var(--accent-color);
    background: linear-gradient(135deg, #2a1a2e 0%, #1e1228 100%);
    box-shadow: 0 0 20px rgba(233,30,99,0.2);
}

.dropdown-arrow {
    width: 18px; height: 18px;
    stroke: var(--text-color-secondary);
    stroke-width: 2.2;
    fill: none;
    transition: transform 0.28s cubic-bezier(0.25, 0.8, 0.25, 1), stroke 0.2s;
    flex-shrink: 0;
}

.dropdown-header.active .dropdown-arrow {
    transform: rotate(180deg);
    stroke: var(--accent-color);
}

.dropdown-list {
    position: absolute;
    top: calc(100% + 8px);
    left: 0; right: 0;
    background: #15152a;
    border-radius: 14px;
    border: 1.5px solid rgba(255,255,255,0.09);
    box-shadow: 0 20px 60px rgba(0,0,0,0.75), 0 4px 16px rgba(0,0,0,0.4);
    list-style: none;
    padding: 6px 0;
    margin: 0;
    max-height: 220px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scaleY(0.95);
    transform-origin: top center;
    transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.25,0.8,0.25,1), visibility 0.22s;
    will-change: opacity, transform;
}

.dropdown-list.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scaleY(1);
}

.dropdown-item {
    padding: 11px 18px;
    color: var(--text-color-primary);
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    border-right: 3px solid transparent;
}

.eq-item-icon {
    display: flex;
    align-items: center;
    opacity: 0.65;
    flex-shrink: 0;
}

@media (hover: hover) { .dropdown-item:hover { background: rgba(255,255,255,0.05); } }

.dropdown-item.selected {
    background: rgba(233,30,99,0.1);
    color: var(--accent-color);
    font-weight: 700;
    border-right: 3px solid var(--accent-color);
}
.dropdown-item.selected .eq-item-icon { opacity: 1; }

.dropdown-list::-webkit-scrollbar { width: 3px; }
.dropdown-list::-webkit-scrollbar-track { background: transparent; }
.dropdown-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 10px; }

/* ══ بطاقة المعادل الرئيسية ══ */
.eq-card {
    background: linear-gradient(180deg, #0c0c1e 0%, #111126 50%, #0a0a1a 100%);
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.07);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.04),
        inset 0 -1px 0 rgba(0,0,0,0.4),
        0 8px 32px rgba(0,0,0,0.5);
    overflow: visible;
    position: relative;
}

/* شبكة خلفية خفيفة لإعطاء عمق بصري */
.eq-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
    background-size: 100% 25%, 10% 100%;
    pointer-events: none;
    border-radius: 20px;
}

/* شريط عنوان البطاقة */
.eq-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.eq-card-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.3);
    font-family: 'Tajawal', sans-serif;
}

/* مؤشر الخط المرجعي 0dB */
.eq-ref-labels {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 200px;
    padding: 0;
    margin-left: 2px;
    align-items: flex-end;
    flex-shrink: 0;
}

.eq-ref-label {
    font-size: 8px;
    color: rgba(255,255,255,0.2);
    font-weight: 600;
    font-family: monospace;
    line-height: 1;
    width: 26px;
    text-align: right;
}

/* ── حاوية الشرائط ── */
#eqContainer {
    display: flex;
    align-items: stretch;
    gap: 2px;
    padding: 12px 10px 10px;
    height: 180px;
    min-height: 160px;
    overflow-x: auto;
    overflow-y: visible;
    position: relative;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
#eqContainer::-webkit-scrollbar { display: none; }

/* خط المرجعي 0 dB */
#eqContainer::after {
    content: '';
    position: absolute;
    left: 36px; right: 10px;
    top: 50%;
    height: 1px;
    background: rgba(255,255,255,0.06);
    pointer-events: none;
}

/* ── شريط تردد واحد ── */
.eq-band {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    min-height: 140px;
    justify-content: space-between;
    gap: 4px;
    flex: 1 1 0;
    min-width: 32px;
    max-width: 52px;
    position: relative;
    padding-bottom: 2px;
}

/* قيمة dB فوق الشريط */
.eq-band::before {
    content: attr(data-db);
    font-size: 8.5px;
    font-weight: 700;
    color: rgba(255,255,255,0.38);
    letter-spacing: 0.2px;
    line-height: 1;
    min-height: 12px;
    text-align: center;
    font-family: monospace;
    transition: color 0.2s;
}

/* لون الـ dB حسب الـ hue المضبوطة على البطاقة */
.eq-band:not([data-db="0 dB"])::before {
    color: rgba(255,255,255,0.65);
}

/* فاصل بصري للـ Preamp */
#preamp-band {
    border-right: 1px solid rgba(255,255,255,0.06);
    padding-right: 6px;
    margin-right: 2px;
    min-width: 38px;
}

.eq-band label {
    font-size: 9px;
    font-weight: 700;
    color: rgba(255,255,255,0.28);
    white-space: nowrap;
    letter-spacing: 0.3px;
    font-family: monospace;
    padding-bottom: 0;
    transition: color 0.2s;
}

/* إضاءة label عند الحركة */
.eq-band:focus-within label,
.eq-band:focus-within::before {
    color: rgba(255,255,255,0.75);
}

/* ── الشريط العمودي ── */
.eq-slider {
    appearance: none;
    writing-mode: vertical-lr;
    direction: rtl;
    outline: none;
    cursor: pointer;
    border-radius: 8px;
    width: 8px;
    min-height: 100px;
    flex: 1;
    background: linear-gradient(
        to top,
        var(--eq-fill, rgba(255,255,255,0.08)) var(--eq-pct, 50%),
        rgba(255,255,255,0.05) var(--eq-pct, 50%)
    );
    transition: background 0.08s, width 0.15s;
}

/* توسيع خفيف عند التفاعل */
.eq-slider:focus,
.eq-slider:active {
    width: 10px;
}

.eq-slider::-webkit-slider-runnable-track {
    width: 7px;
    border-radius: 8px;
    background: linear-gradient(
        to top,
        var(--eq-fill, rgba(255,255,255,0.08)) var(--eq-pct, 50%),
        rgba(255,255,255,0.05) var(--eq-pct, 50%)
    );
    transition: background 0.08s;
}

.eq-slider::-moz-range-track {
    width: 7px;
    border-radius: 8px;
    background: linear-gradient(
        to top,
        var(--eq-fill, rgba(255,255,255,0.08)) var(--eq-pct, 50%),
        rgba(255,255,255,0.05) var(--eq-pct, 50%)
    );
}

/* ── المقبض (Thumb) ── */
.eq-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 35%, rgba(255,255,255,0.3), transparent 65%),
                var(--eq-thumb, #9e9e9e);
    border: 2px solid rgba(0,0,0,0.5);
    box-shadow:
        0 0 0 1.5px rgba(255,255,255,0.08),
        0 0 10px var(--eq-glow, rgba(255,255,255,0.15)),
        0 3px 8px rgba(0,0,0,0.7);
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    margin-left: -6px;
    will-change: transform;
}

.eq-slider::-webkit-slider-thumb:active {
    transform: scale(1.25);
    box-shadow:
        0 0 0 2px rgba(255,255,255,0.12),
        0 0 18px var(--eq-glow, rgba(255,255,255,0.3)),
        0 4px 12px rgba(0,0,0,0.8);
}

.eq-slider::-moz-range-thumb {
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--eq-thumb, #9e9e9e);
    border: 2px solid rgba(0,0,0,0.5);
    box-shadow: 0 0 10px var(--eq-glow, rgba(255,255,255,0.15));
    cursor: pointer;
    transition: transform 0.1s;
}
.eq-slider::-moz-range-thumb:active { transform: scale(1.25); }

/* ── Preamp thumb — أزرق مميز ── */
#preampSlider {
    --eq-fill: rgba(33,150,243,0.6);
    --eq-thumb: #2196F3;
    --eq-glow: rgba(33,150,243,0.45);
}

/* ══ زر إعادة الضبط ══ */
/* =======================================================
   بطاقة مؤثر الصدى (Echo Effect Card)
   ======================================================= */
.echo-card {
    background: rgba(255,255,255,0.03);
    border: 1.5px solid rgba(255,255,255,0.09);
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 12px;
}

.echo-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.echo-card-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-color-primary);
}

.echo-badge {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--accent-color);
    background: rgba(233,30,99,0.12);
    border: 1px solid rgba(233,30,99,0.25);
    padding: 2px 6px;
    border-radius: 6px;
}

.echo-toggle-btn {
    width: 44px;
    height: 24px;
    border-radius: 12px;
    border: none;
    background: rgba(255,255,255,0.1);
    cursor: pointer;
    position: relative;
    transition: background 0.22s;
    display: flex;
    align-items: center;
    padding: 0 4px;
    flex-shrink: 0;
}

.echo-toggle-btn svg {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255,255,255,0.6);
    transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1);
    position: absolute;
    left: 4px;
}

.echo-toggle-btn.active {
    background: var(--accent-color);
}

.echo-toggle-btn.active svg {
    transform: translateX(20px);
    background: #fff;
}

.echo-sliders {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.echo-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.echo-lbl {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
    width: 34px;
    flex-shrink: 0;
    text-align: right;
}

.echo-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    outline: none;
    cursor: pointer;
}

.echo-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-color);
    box-shadow: 0 0 6px rgba(233,30,99,0.4);
    cursor: pointer;
    transition: transform 0.15s;
}

.echo-slider::-webkit-slider-thumb:active {
    transform: scale(1.25);
}

.echo-val {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-color);
    width: 38px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.echo-reset-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.4);
    padding: 5px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 11px;
    font-family: 'Tajawal', sans-serif;
    margin-top: 4px;
    transition: background 0.18s, color 0.18s;
    align-self: flex-end;
}
.echo-reset-btn:active { transform: scale(0.94); }
@media (hover: hover) { .echo-reset-btn:hover { background: rgba(255,255,255,0.06); color: #fff; } }

/* =======================================================
   نبرة الصوت — Pitch Card
   ======================================================= */
.eq-reset-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 0;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 14px;
    color: rgba(255,255,255,0.4);
    font-size: 13px;
    font-family: 'Tajawal', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.25s, color 0.25s, border-color 0.25s, transform 0.15s;
    -webkit-tap-highlight-color: transparent;
    letter-spacing: 0.3px;
}

.eq-reset-btn svg {
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0.6;
}

.eq-reset-btn:active { transform: scale(0.97); }
@media (hover: hover) {
    .eq-reset-btn:hover {
        background: rgba(255,82,82,0.08);
        border-color: rgba(255,82,82,0.3);
        color: #ff6b6b;
    }
    .eq-reset-btn:hover svg {
        opacity: 1;
        transform: rotate(-180deg);
    }
}

/* ── إخفاء شريط التمرير الافتراضي للمتصفح ── */
#playlist {
    scrollbar-width: none; /* Firefox */
}
#playlist::-webkit-scrollbar {
    display: none; /* Chrome / Safari / Edge */
}

/* ── حاوية المقبض المخصص ── */
#playlist-scroll-wrap {
    position: relative;
    flex-grow: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding-top: 8px;
}

#playlist-scrollbar {
    position: absolute;
    left: 3px;
    top: 6px;
    bottom: 6px;
    width: 4px;
    z-index: 20;
    pointer-events: none;
    border-radius: 4px;
}

#playlist-scroll-thumb {
    position: absolute;
    left: 0;
    width: 4px;
    min-height: 36px;
    background: var(--accent-color);
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.35s ease, width 0.2s ease, left 0.2s ease,
                box-shadow 0.2s ease;
    cursor: grab;
    pointer-events: auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    will-change: top, height, opacity;
}

#playlist-scroll-thumb.visible {
    opacity: 0.55;
}

#playlist-scroll-thumb.dragging {
    width: 6px;
    left: -1px;
    opacity: 1 !important;
    cursor: grabbing;
    box-shadow: 0 0 10px var(--accent-color), 0 0 4px rgba(0,0,0,0.5);
    transition: width 0.15s ease, left 0.15s ease, box-shadow 0.15s ease;
}


/* =======================================================
   ... (الأقسام 1 إلى 8 كما هي بدون تغيير) ...
   ======================================================= */

/* =======================================================
   9. (*** تعديل ***) وضع ملء الشاشة المحاكى (عبر :target)
   ======================================================= */

/* (*** إضافة ***) تنسيقات لمجموعات الأزرار الجديدة */
#mediaContainerIcons {
    align-items: center; /* لضمان محاذاة المجموعتين */
}
#mediaIconGroupLeft, #mediaIconGroupRight {
    display: flex;
    gap: 10px; /* مسافة بين الأزرار في كل مجموعة */
}

/* (*** إضافة ***) تنسيق أيقونات SVG الجديدة */
.icon-btn svg {
    stroke: var(--text-color-primary); /* اللون الافتراضي للأيقونة */
    transition: stroke 0.2s;
    vertical-align: middle; /* لمحاذاة الأيقونة وسط الزر */
}
@media (hover: hover) {
.icon-btn:hover svg {
    stroke: var(--accent-color);
}
}


/* =======================================================
   10. (*** إضافة جديدة ***) الوضع الأفقي للهواتف
   ======================================================= */
@media (orientation: landscape) and (max-height: 600px) {

    /* ── EQ overlay في landscape (500-600px height) ── */
    #eqOverlay { padding: 6px 10px; }

    #eqMode {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto 1fr auto;
        column-gap: 10px;
        row-gap: 6px;
        padding: 0;
        gap: 0;
        overflow: visible;
        flex-shrink: 0;
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    #eqMode > .audio-dropdowns-row { grid-column:1; grid-row:1; margin-bottom:0; }
    #eqMode > .echo-card            { grid-column:1; grid-row:2/4; margin-bottom:0; padding:9px 11px; align-self:start; }
    #eqMode > #eqPresetsDropdown    { grid-column:2; grid-row:1; }
    #eqMode > .eq-card              { grid-column:2; grid-row:2; }
    #eqMode > #resetEqBtn           { grid-column:2; grid-row:3; margin-top:0; padding:7px 0; font-size:12px; }

    #eqContainer    { height: 110px; min-height: 95px; }
    .eq-ref-labels  { height: 110px; }
    .eq-card-header { padding: 5px 12px 4px; }

    .audio-drop-btn   { padding: 8px 11px; font-size: 12px; }
    .dropdown-header  { padding: 8px 12px; font-size: 13px; }
    .echo-card-header { margin-bottom: 8px; }
    .echo-sliders     { gap: 8px; }
    .echo-reset-btn   { padding: 4px 10px; font-size: 10px; }

    #mainContent {
        flex-direction: row; 
        justify-content: center;
        align-items: center;
        gap: 16px;
        padding: 10px; 
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        padding-top: max(10px, env(safe-area-inset-top));
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        overflow-y: hidden; 
    }

    #topSection {
        flex-grow: 1; 
        flex-basis: 0; 
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        height: 100%; 
        min-width: 0; 
        overflow: hidden;
    }

    #mediaContainer {
        width: auto;
        height: calc(100vh - 100px); 
        max-height: 340px; 
        max-width: none;
        margin: 0;
    }
    
    #trackInfo {
        margin-top: 8px;
        margin-bottom: 0;
        width: 100%;
        max-width: 280px;
    }

    /* اسم المقطع والفنان أصغر في landscape */
    #trackInfo #trackTitle {
        font-size: 13px !important;
    }
    #trackInfo #artistName,
    #trackInfo #albumName {
        font-size: 11px !important;
    }

    #bottomSection {
        position: relative; 
        flex-grow: 1.3; 
        flex-basis: 0;
        height: auto; 
        bottom: auto;
        left: auto;
        right: auto;
        border-radius: 16px; 
        box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
        border-top: none;
        padding: 12px 16px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 10px;
        overflow: hidden;
    }

    #progressContainer {
        margin: 0 auto; 
        width: 95%;
    }

    #controls {
        gap: 10px; 
        padding: 0;
        width: 100%;
    }

    /* أزرار ثانوية أصغر */
    .secondary-btn svg {
        width: 18px !important;
        height: 18px !important;
    }

    #secondaryControls {
        max-width: 100%;
        padding: 0 4px;
    }

    /* أزرار رئيسية مضغوطة */
    #mainControls {
        gap: 16px;
        margin: 0 auto;
    }

    .main-ctrl-btn {
        padding: 6px;
    }

    .main-ctrl-btn svg {
        width: 24px !important;
        height: 24px !important;
    }

    /* زر التشغيل أصغر */
    #playPauseBtn {
        width: 52px !important;
        height: 52px !important;
    }

    #playPauseBtn svg {
        width: 26px !important;
        height: 26px !important;
    }

    /* شريط الصوت أقصر */
    .volume-slider {
        width: 70px !important;
    }
}
/* =======================================================
   تحديث: تنسيق أيقونات SVG
   ======================================================= */

/* إزالة الاعتماد على حجم الخط للأيقونات واستخدام الأبعاد */
.secondary-btn, .main-ctrl-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    line-height: 0; /* لمنع مسافات إضافية */
}

/* تنسيق عام لجميع أيقونات SVG داخل الأزرار */
.secondary-btn svg, 
.main-ctrl-btn svg,
#volumeContainer svg {
    width: 24px;
    height: 24px;
    stroke: currentColor; /* يرث لون النص المحدد في الزر */
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.3s ease, transform 0.2s ease;
}

/* تكبير أيقونات التحكم الرئيسية قليلاً */
.main-ctrl-btn svg {
    width: 32px;
    height: 32px;
}

/* تكبير أيقونة التشغيل تحديداً */
#playPauseBtn svg {
    width: 36px;
    height: 36px;
    fill: white; /* تعبئة أيقونة التشغيل باللون الأبيض */
    stroke: white;
}

/* تأثير عند التحويم — فقط على أجهزة الماوس */
@media (hover: hover) {
    .secondary-btn:hover svg,
    .main-ctrl-btn:hover svg {
        stroke: var(--accent-color);
    }
}

@media (hover: hover) { #playPauseBtn:hover svg { stroke: #eee; } }

/* إصلاح زر الصوت */
#volumeBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
}

/* =======================================================
   تحديث: تنسيق الكلمات غير المتزامنة (Static Lyrics)
   ======================================================= */

/* كلاس سيتم إضافته للجافاسكريبت عند اكتشاف كلمات بدون توقيت */
.static-lyrics-content {
    display: block;
    width: 100%;
    height: 100%;
    overflow-y: auto; /* السماح بالتمرير */
    text-align: center;
    padding: 10px;
    box-sizing: border-box;
    
    /* تحسين شكل شريط التمرير */
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) transparent;
}

.static-lyrics-content p {
    margin: 10px 0;
    font-size: 18px;
    color: var(--text-color-primary);
    opacity: 0.8;
    line-height: 1.8;
    transition: color 0.3s;
}

.static-lyrics-content p:hover {
    color: #fff;
    opacity: 1;
}

/* =======================================================
   11. قائمة السياق (Context Menu) عند الضغط المطول
   ======================================================= */

/* ── Backdrop لقائمة السياق ── */
.context-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 9998;
    pointer-events: none;
    transition: background 0.3s ease;
}
.context-backdrop.show {
    background: rgba(0, 0, 0, 0.55);
    pointer-events: all;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/* ── قائمة السياق كـ Bottom Sheet ── */
.context-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    background: linear-gradient(180deg, #1e1e2e 0%, #16161f 100%);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    overflow: hidden;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    transform: translateY(110%);
    transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
    will-change: transform;
    /* منطقة مقبض السحب في الأعلى */
    padding-top: 12px;
    touch-action: pan-y;
}

.context-menu::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    margin: 0 auto 10px;
    transition: width 0.2s ease, background 0.2s ease;
}

/* تضخيم مقبض السحب عند اللمس */
.context-menu:active::before {
    width: 56px;
    background: rgba(255, 255, 255, 0.5);
}

.context-menu.show {
    transform: translateY(0);
}

.context-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px 14px;
    background: rgba(233, 30, 99, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

#contextMenuTitle {
    font-weight: 700;
    color: var(--accent-color);
    font-size: 16px;
}

.context-close-btn {
    background: transparent;
    border: none;
    color: var(--text-color-secondary);
    font-size: 20px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

@media (hover: hover) { .context-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color-primary);
} }

.context-menu-list {
    list-style: none;
    margin: 0;
    padding: 8px 0 max(12px, env(safe-area-inset-bottom));
    max-height: 60vh;
    overflow-y: auto;
}

.context-item {
    display: flex;
    align-items: center;
    padding: 14px 22px;
    color: var(--text-color-primary);
    cursor: pointer;
    transition: background 0.15s ease;
    gap: 15px;
    border-left: 3px solid transparent;
    position: relative;
    z-index: 10;
    touch-action: manipulation; /* يُلغي تأخير 300ms على الموبايل بدون touchend */
    -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
.context-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid var(--accent-color);
}

.context-item:hover .context-icon {
    background: rgba(255,255,255,0.10);
}
}

.context-item:active {
    background: rgba(233, 30, 99, 0.1);
    transform: scale(0.98);
}

.context-icon {
    font-size: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    flex-shrink: 0;
    transition: background 0.15s;
}

.context-text {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
}

.context-item[data-action="delete"] .context-icon {
    color: #ff5252;
    background: rgba(255,82,82,0.12);
}

.context-item[data-action="play"] .context-icon {
    color: #4CAF50;
    background: rgba(76,175,80,0.12);
}

.context-item[data-action="addToQueueTop"] .context-icon {
    color: #2196F3;
    background: rgba(33,150,243,0.12);
}

.context-item[data-action="addToQueue"] .context-icon {
    color: #9C27B0;
    background: rgba(156,39,176,0.12);
}

.context-item[data-action="removeFromQueue"] .context-icon {
    color: #FF9800;
    background: rgba(255,152,0,0.12);
}

.context-item[data-action="info"] .context-icon {
    color: #00BCD4;
    background: rgba(0,188,212,0.12);
}

.context-item[data-action="playNext"] .context-icon {
    color: #2196F3;
    background: rgba(33,150,243,0.12);
}

/* تأثير عند الضغط المطول على عنصر في القائمة */
.playlist-item.long-press {
    animation: pulse 0.5s ease;
    background: var(--accent-color-light) !important;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(0.98); }
    100% { transform: scale(1); }
}

/* تحسينات للشاشات الصغيرة */
@media (max-width: 600px) {
    .context-menu {
        border-radius: 20px 20px 0 0;
    }
    
    .context-item {
        padding: 13px 18px;
    }
}

/* شريط تمرير أنيق لقائمة السياق */
.context-menu-list::-webkit-scrollbar {
    width: 6px;
}

.context-menu-list::-webkit-scrollbar-track {
    background: transparent;
}

.context-menu-list::-webkit-scrollbar-thumb {
    background: var(--surface-color);
    border-radius: 10px;
}

.context-menu-list::-webkit-scrollbar-thumb:hover {
    background: #333;
}

/* ─── ظهور/اختفاء زر حذف الغلاف وزر حذف الكلمات بانيميشن سلس ─── */
#deleteCoverBtn,
#deleteLyricsBtn {
    /* مخفي افتراضياً بدون display:none لكي تعمل الـ transition */
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    pointer-events: none;
    transition:
        max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1),
        opacity    0.22s ease,
        padding    0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

#deleteCoverBtn.visible,
#deleteLyricsBtn.visible {
    max-height: 70px;
    opacity: 1;
    padding-top: 14px;
    padding-bottom: 14px;
    pointer-events: auto;
}

/* تصحيح padding في الشاشات الصغيرة ليتطابق مع .context-item */
@media (max-width: 600px) {
    #deleteCoverBtn.visible,
    #deleteLyricsBtn.visible {
        padding-top: 13px;
        padding-bottom: 13px;
    }
}

/* --- Sleep Timer Elegant Design --- */
.sleep-timer-wrapper {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    padding: 14px 16px;
    margin: 8px 0 4px;
    font-family: 'Tajawal', sans-serif;
    flex-shrink: 0;
}

.timer-header-main {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 12px;
    color: var(--accent-color);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.3px;
}

.timer-options-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.t-chip {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-color-primary);
    padding: 7px 15px;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    font-size: 12px;
    font-family: 'Tajawal', sans-serif;
}

.t-chip:active {
    background: var(--accent-color);
    transform: scale(0.95);
}

@media (hover: hover) { .t-chip:hover {
    background: rgba(255,255,255,0.12);
} }

.custom-t-field {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 5px;
    margin-top: 4px;
}

.custom-t-field input {
    flex: 1;
    min-width: 0;
    background: #000;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 9px;
    padding: 7px 6px;
    color: #fff;
    outline: none;
    text-align: center;
    font-size: 13px;
}

.custom-t-field input:focus {
    border-color: var(--accent-color);
}

.timer-sep {
    color: rgba(255,255,255,0.4);
    font-size: 16px;
    font-weight: 600;
    flex-shrink: 0;
}

.t-chip-start {
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 9px;
    padding: 0 14px;
    height: 34px;
    cursor: pointer;
    font-size: 12px;
    font-family: 'Tajawal', sans-serif;
}

/* حالة العداد النشط */
.timer-countdown-view {
    animation: overlaySlideIn 0.22s ease both;
}

/* صف أفقي: دائرة + نص + زر */
.timer-inline-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.timer-inline-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    flex: 1;
}

/* الدائرة الكبيرة */
.timer-circle-sm {
    width: 96px !important;
    height: 96px !important;
    flex-shrink: 0;
}

.timer-circle-sm .timer-progress-svg {
    width: 96px !important;
    height: 96px !important;
}

/* حاوية دائرة التقدم SVG */
.timer-circle-ui {
    position: relative;
    width: 96px;
    height: 96px;
    margin: 0;
}

.timer-progress-svg {
    width: 96px;
    height: 96px;
    transform: rotate(-90deg);
}

.timer-track-circle {
    fill: none;
    stroke: rgba(255,255,255,0.07);
    stroke-width: 4.5;
}

.timer-arc-circle {
    fill: none;
    stroke: var(--accent-color);
    stroke-width: 4.5;
    stroke-linecap: round;
    stroke-dasharray: 213.63;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.9s linear;
    filter: drop-shadow(0 0 6px var(--accent-color));
}

.timer-center-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

#remainingTime {
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    z-index: 2;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
}

.timer-label-small {
    font-size: 9px;
    color: var(--text-color-secondary);
}

.timer-status-text {
    font-size: 11px;
    color: var(--text-color-secondary);
    line-height: 1.4;
}

.timer-stop-btn {
    background: transparent;
    color: #ff5252;
    border: 1px solid rgba(255,82,82,0.5);
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    font-size: 12px;
    font-family: 'Tajawal', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.timer-stop-btn:active {
    background: rgba(255, 82, 82, 0.15);
    transform: scale(0.96);
}

@media (hover: hover) { .timer-stop-btn:hover {
    background: rgba(255, 82, 82, 0.08);
} }

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
/* =======================================================
   تنسيق شبكة اختيار المؤثرات البصرية
   ======================================================= */
.vis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    padding: 10px 5px 20px 5px;
    overflow-y: auto;
    flex-grow: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--surface-color) transparent;
}

.vis-grid::-webkit-scrollbar { width: 6px; }
.vis-grid::-webkit-scrollbar-thumb { background-color: var(--surface-color); border-radius: 10px; }

/* ── زر إبقاء الشاشة مضيئة ── */
.vis-wakelock-row {
    grid-column: 1 / -1;  /* يمتد عبر كل الأعمدة */
    margin-bottom: 4px;
}

.vis-wakelock-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 13px 16px;
    background: var(--surface-color);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
    font-family: 'Tajawal', sans-serif;
    color: var(--text-color-primary);
    text-align: right;
    direction: rtl;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.vis-wakelock-card:active { transform: scale(0.98); }

.vis-wakelock-card.wl-on {
    background: rgba(233, 180, 30, 0.12);
    border-color: rgba(233, 180, 30, 0.45);
    box-shadow: 0 0 18px rgba(233, 180, 30, 0.15);
}

.vis-wl-icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}

.vis-wl-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.vis-wl-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color-primary);
}

.vis-wl-sub {
    font-size: 11px;
    color: var(--text-color-secondary);
    opacity: 0.75;
}

.wl-on .vis-wl-label { color: #f5c842; }
.wl-on .vis-wl-sub   { color: #f5c842; opacity: 0.7; }

/* مفتاح التبديل (Toggle Switch) */
.vis-wl-toggle {
    width: 44px;
    height: 25px;
    background: rgba(255,255,255,0.12);
    border-radius: 13px;
    position: relative;
    flex-shrink: 0;
    transition: background 0.3s;
}

.vis-wl-toggle.wl-toggle-on {
    background: #f5c842;
}

.vis-wl-knob {
    position: absolute;
    top: 3px;
    right: 3px;            /* RTL: يبدأ من اليمين عند OFF */
    width: 19px;
    height: 19px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.35);
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wl-toggle-on .vis-wl-knob {
    transform: translateX(-19px);  /* ينتقل لليسار عند ON */
}

.vis-option-btn {
    background: var(--surface-color);
    color: var(--text-color-primary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 15px;
    padding: 15px 10px;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

@media (hover: hover) { .vis-option-btn:hover {
    background: #2a2a2a;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.3);
} }

.vis-option-btn.active {
    background: var(--accent-color-light);
    border-color: var(--accent-color);
    color: var(--accent-color);
    font-weight: bold;
    box-shadow: 0 0 15px rgba(233, 30, 99, 0.2);
    transform: scale(1.02);
}

.vis-icon-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--surface-color);
    border: 2px solid currentColor;
    opacity: 0.7;
}
.vis-option-btn.active .vis-icon-indicator {
    background: var(--accent-color);
    opacity: 1;
}
/* ── رأس نافذة معلومات المقطع ── */
.track-info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 16px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
    box-sizing: border-box;
}

.track-info-title {
    color: var(--accent-color);
    font-size: 17px;
    font-weight: 700;
    margin: 0;
    text-align: center;
    flex: 1;
    padding: 0 8px;
}

.track-info-back-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color-primary);
    border-radius: 10px;
    padding: 7px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    font-family: 'Tajawal', sans-serif;
    min-width: 80px;
}
@media (hover: hover) { .track-info-back-btn:hover {
    background: rgba(255, 255, 255, 0.12);
} }
.track-info-back-btn svg {
    flex-shrink: 0;
}

.track-info-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(233, 30, 99, 0.12);
    border: 1px solid rgba(233, 30, 99, 0.25);
    color: var(--accent-color);
    border-radius: 10px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}
@media (hover: hover) { .track-info-close-btn:hover {
    background: rgba(233, 30, 99, 0.25);
} }

/* تنسيقات صندوق معلومات الأغنية */
.details-box {
    background: var(--surface-color);
    padding: 20px;
    border-radius: 15px;
    width: 100%;
    max-width: 400px;
    text-align: right;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px 0;
    font-size: 15px;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-color-secondary);
}

.detail-value {
    color: var(--text-color-primary);
    font-weight: bold;
    max-width: 60%;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    direction: ltr; /* لضمان عرض الأسماء الإنجليزية بشكل صحيح */
}

/* تنسيقات نافذة تأكيد الحذف المخصصة */
.confirm-modal-overlay {
    z-index: 10000; /* أعلى من كل شيء */
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    padding: 20px;
}

.confirm-modal-box {
    background: var(--surface-color);
    padding: 30px 20px;
    border-radius: 20px;
    text-align: center;
    max-width: 350px;
    width: 100%;
    border: 1px solid rgba(244, 67, 54, 0.3);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease;
}

.confirm-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 152, 0, 0.15);
    border: 2px solid rgba(255, 152, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    color: #FF9800;
}

.confirm-modal-box h3 {
    color: white;
    margin-bottom: 25px;
    font-size: 18px;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.confirm-btn {
    flex: 1;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: bold;
    font-size: 15px;
    font-family: 'Tajawal', sans-serif;
    transition: all 0.2s;
}

.danger-btn {
    background: rgba(244, 67, 54, 0.15);
    color: #ff5252;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

@media (hover: hover) { .danger-btn:hover {
    background: #ff5252;
    color: white;
} }

.cancel-btn {
    background: #333;
    color: white;
}

@media (hover: hover) { .cancel-btn:hover {
    background: #444;
} }

/* تنسيقات حقول إدخال وتعديل معلومات الأغنية */
.detail-input {
    flex: 1;
    max-width: 60%;
    background: #121212;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-color-primary);
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    text-align: right;
    direction: auto;
    transition: all 0.3s ease;
}

.detail-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 8px var(--accent-color-light);
    outline: none;
    background: #1a1a1a;
}
/* =======================================================
   ميزة الإيماء على غلاف الأغنية (Swipe Cover Gestures)
   تصميم: تأثيرات GPU فقط (transform + opacity) لأداء مثالي
   ======================================================= */

/* ── مؤشرات الاتجاه (السابق / التالي) ── */
.swipe-dir-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    /* زجاج ناعم خفيف - لا يثقل على الهاتف */
    background: rgba(10, 10, 10, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
    opacity: 0;          /* مخفي افتراضياً */
    pointer-events: none; /* لا يعيق اللمس */
    z-index: 8;
    /* انتقال ناعم جداً لظهور المؤشر */
    transition: opacity 0.08s linear;
    will-change: opacity;
}

.swipe-dir-prev { left: 12px; }
.swipe-dir-next { right: 12px; }

/* ── شريط الضوء الخاطف (يعبر الشاشة عند تأكيد الإيماء) ── */
.swipe-light-beam {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    pointer-events: none;
    z-index: 9;
    /* لا حدود، فقط تدرج ضوء خفيف */
    animation-duration: 0.42s;
    animation-timing-function: ease-out;
    animation-fill-mode: forwards;
    will-change: transform, opacity;
}

/* الشريط يأتي من اليسار (للانتقال للأمام) */
.swipe-beam-fwd {
    left: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0.13), transparent);
    animation-name: beamSweepFwd;
}

/* الشريط يأتي من اليمين (للانتقال للخلف) */
.swipe-beam-back {
    right: 0;
    background: linear-gradient(270deg, rgba(255,255,255,0.13), transparent);
    animation-name: beamSweepBack;
}

@keyframes beamSweepFwd {
    0%   { transform: translateX(-100%); opacity: 0; }
    25%  { opacity: 1; }
    100% { transform: translateX(280%);  opacity: 0; }
}

@keyframes beamSweepBack {
    0%   { transform: translateX(100%);  opacity: 0; }
    25%  { opacity: 1; }
    100% { transform: translateX(-280%); opacity: 0; }
}

/* ── تموج دائري في المركز عند تأكيد الإيماء ── */
.swipe-center-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.18);
    background: transparent;
    pointer-events: none;
    z-index: 7;
    transform: translate(-50%, -50%) scale(0);
    animation: rippleExpand 0.45s ease-out forwards;
    will-change: transform, opacity;
}

@keyframes rippleExpand {
    0%   { transform: translate(-50%, -50%) scale(0.2); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(3.2); opacity: 0;   }
}




/* ════════════════════════════════════════════════════════════
   البرنامج التعليمي — نسخة v3 المحسّنة بالكامل
   جميع الرسوم المتحركة CSS نقي، بدون مكتبات، خفيف على أي جهاز
   ════════════════════════════════════════════════════════════ */

/* ── الطبقة الخلفية ───────────────────────────────────────── */
#tutorialOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 12px;
}
#tutorialOverlay.active { display: flex; }

/* ── البطاقة الرئيسية ─────────────────────────────────────── */
.tut-card {
    background: var(--card-bg, #1a1a2e);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 22px;
    width: 100%;
    max-width: 375px;
    max-height: 92vh;
    overflow-y: auto;
    padding: 26px 18px 20px;
    text-align: center;
    color: #fff;
    position: relative;
    scrollbar-width: none;
}
.tut-card::-webkit-scrollbar { display: none; }

/* ── نقاط التقدم ─────────────────────────────────────────── */
.tut-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 16px; }
.tut-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.15); transition: background .25s, transform .25s; }
.tut-dot.on { background: var(--accent-color, #60a5fa); transform: scale(1.4); }

/* ── الأيقونة الكبيرة ─────────────────────────────────────── */
.tut-icon { font-size: 46px; line-height: 1; margin-bottom: 10px; display: block; }

/* ── العنوان ─────────────────────────────────────────────── */
.tut-title {
    font-size: 1.08rem; font-weight: 700; margin: 0 0 8px;
    color: var(--accent-color, #60a5fa); font-family: 'Tajawal', sans-serif;
}

/* ── النص العادي (الشرائح البسيطة) ──────────────────────── */
.tut-text {
    font-size: 0.87rem; line-height: 1.75; color: rgba(255,255,255,0.72);
    margin: 0 0 18px; font-family: 'Tajawal', sans-serif;
}

/* ── أزرار التنقل ────────────────────────────────────────── */
.tut-nav { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
.tut-btn {
    flex: 1; max-width: 130px; padding: 10px 0; border: none;
    border-radius: 12px; font-size: 0.9rem; font-family: 'Tajawal', sans-serif;
    font-weight: 600; cursor: pointer; background: rgba(255,255,255,0.08); color: #fff;
    transition: background .2s;
}
.tut-btn:active { background: rgba(255,255,255,0.16); }
.tut-btn.primary { background: var(--accent-color, #60a5fa); color: #000; }
.tut-btn.primary:active { opacity: 0.8; }

/* ── زر تخطي ─────────────────────────────────────────────── */
.tut-skip {
    position: absolute; top: 12px; left: 13px;
    background: none; border: none; color: rgba(255,255,255,0.28);
    font-size: 0.75rem; cursor: pointer; font-family: 'Tajawal', sans-serif; padding: 4px 6px;
}
.tut-skip:active { color: rgba(255,255,255,0.6); }


/* ════════════════════════════════════════════════════════════
   مكوّنات خطوات التفعيل (الشريحة 5)
   ════════════════════════════════════════════════════════════ */

/* رسم تخطيطي للواجهة يُظهر موقع الزر بوضوح */
.tut-ui-diagram {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    padding: 10px;
    margin-bottom: 10px;
}
.tut-ui-canvas {
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 7px;
    border: 1px dashed rgba(255,255,255,0.1);
}
.tut-ui-ctrl-row {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-bottom: 6px;
}
.tut-ui-btn { font-size: 1rem; }
.tut-ui-btn-main { font-size: 1.4rem; }
.tut-ui-tools-row {
    display: flex;
    justify-content: center;
    gap: 6px;
    align-items: center;
}
.tut-ui-tool {
    font-size: 0.8rem;
    padding: 2px 5px;
    border-radius: 6px;
    color: rgba(255,255,255,0.5);
}
/* الزر المُضاء = 🌸 */
.tut-ui-tool-active {
    background: var(--accent-color, #60a5fa);
    color: #000;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 7px;
    animation: tutBtnPulse 1.2s ease-in-out infinite;
}
@keyframes tutBtnPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(96,165,250,0.5); }
    50% { box-shadow: 0 0 0 5px rgba(96,165,250,0); }
}
.tut-ui-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 5px;
    gap: 2px;
}
.tut-ui-arrow-line {
    width: 1px; height: 10px;
    background: var(--accent-color, #60a5fa);
}
.tut-ui-arrow-label {
    font-size: 0.72rem; color: var(--accent-color, #60a5fa);
    font-family: 'Tajawal', sans-serif; font-weight: 700;
}

/* قائمة الخطوات المرقّمة */
.tut-vis-steps { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; }
.tut-step-row {
    display: flex; align-items: flex-start; gap: 9px;
    background: rgba(255,255,255,0.04); border-radius: 10px; padding: 8px 10px;
}
.tut-step-row.tut-highlight {
    background: rgba(96,165,250,0.1);
    border: 1px solid rgba(96,165,250,0.2);
}
.tut-step-num {
    flex-shrink: 0; width: 24px; height: 24px;
    background: var(--accent-color, #60a5fa); color: #000;
    font-weight: 900; font-size: 0.78rem; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Tajawal', sans-serif;
}
.tut-step-txt {
    font-size: 0.83rem; line-height: 1.6;
    color: rgba(255,255,255,0.8); font-family: 'Tajawal', sans-serif;
}
.tut-badge {
    display: inline-block; background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 6px; padding: 1px 6px;
    font-size: 0.8rem; vertical-align: middle;
}
.tut-badge-red { background: rgba(255,82,82,0.15); border-color: rgba(255,82,82,0.3); }

/* صندوق تلميح النص في الأسفل */
.tut-tip {
    font-size: 0.78rem; color: rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.04); border-radius: 8px;
    padding: 7px 9px; margin: 8px 0 0; text-align: right;
    font-family: 'Tajawal', sans-serif; line-height: 1.6;
    border-right: 3px solid var(--accent-color, #60a5fa);
}
.tut-tip strong { color: rgba(255,255,255,0.8); }

/* صندوق تلميح الأداء للهواتف الضعيفة */
.tut-perf-box {
    display: flex; align-items: flex-start; gap: 9px;
    background: rgba(255,165,0,0.07); border: 1px solid rgba(255,165,0,0.18);
    border-radius: 10px; padding: 9px 11px; margin-top: 10px; text-align: right;
}
.tut-perf-icon { font-size: 1.2rem; flex-shrink: 0; }
.tut-perf-txt { font-size: 0.8rem; line-height: 1.6; color: rgba(255,255,255,0.72); font-family: 'Tajawal', sans-serif; }
.tut-perf-txt strong { color: #ffa500; }


/* ════════════════════════════════════════════════════════════
   رأس الفئة فوق شبكة المؤثرات
   ════════════════════════════════════════════════════════════ */
.tut-cat-header { margin-bottom: 9px; }
.tut-cat-subtitle {
    font-size: 0.78rem; color: rgba(255,255,255,0.45);
    font-family: 'Tajawal', sans-serif;
}


/* ════════════════════════════════════════════════════════════
   شبكة بطاقات المؤثرات
   ════════════════════════════════════════════════════════════ */
.tut-eff-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-bottom: 8px;
}
/* شبكة 5 أعمدة للشريحة التقنية */
.tut-eff-grid-5 {
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}

.tut-eff-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 9px;
    padding: 7px 4px 5px;
    display: flex; flex-direction: column;
    align-items: center; gap: 3px;
    position: relative;
}
/* شارة 📱 للمؤثرات الخفيفة */
.tut-eff-card.lw::after {
    content: '📱';
    position: absolute; top: 2px; right: 3px;
    font-size: 7px; line-height: 1;
}

.tut-eff-name {
    font-size: 0.68rem; font-weight: 700;
    color: rgba(255,255,255,0.88);
    font-family: 'Tajawal', sans-serif;
    text-align: center; line-height: 1.25;
}
.tut-eff-desc {
    font-size: 0.6rem; color: rgba(255,255,255,0.38);
    font-family: 'Tajawal', sans-serif; text-align: center;
    line-height: 1.3;
}
/* في الشبكة 5-أعمدة، الأوصاف تختفي لتوفير المساحة */
.tut-eff-grid-5 .tut-eff-desc { display: none; }
.tut-eff-grid-5 .tut-eff-name { font-size: 0.6rem; }


/* ════════════════════════════════════════════════════════════
   حاوية المعاينة المصغّرة (mp = mini preview)
   كل بطاقة مؤثر تحتوي على هذا الصندوق الصغير المتحرك
   ════════════════════════════════════════════════════════════ */
.mp {
    width: 100%; height: 30px;
    display: flex; align-items: flex-end; justify-content: center;
    gap: 2px; overflow: hidden; position: relative;
    border-radius: 5px; background: rgba(0,0,0,0.25);
    margin-bottom: 3px;
}
/* في الشبكة 5-أعمدة، المعاينة أصغر قليلاً */
.tut-eff-grid-5 .mp { height: 22px; }


/* ════════════════════════════════════════════════════════════
   [1] معاينة: أعمدة (Bars)
   تُمثّل: أعمدة التردد، انعكاس مرآوي، أعمدة معكوسة،
           معادل 3D، أشعة شمسية، مصفوفة نقاط
   ════════════════════════════════════════════════════════════ */
.mp-bars s {
    flex: 1; border-radius: 2px 2px 0 0;
    background: var(--accent-color, #60a5fa);
    animation: mpBarsUp 0.7s ease-in-out infinite alternate;
    min-height: 3px;
}
/* كل عمود له ارتفاع مختلف وتأخير مختلف → تأثير عضوي */
.mp-bars s:nth-child(1) { --h: 55%; animation-delay: 0.00s; }
.mp-bars s:nth-child(2) { --h: 88%; animation-delay: 0.12s; }
.mp-bars s:nth-child(3) { --h: 65%; animation-delay: 0.06s; }
.mp-bars s:nth-child(4) { --h: 95%; animation-delay: 0.18s; }
.mp-bars s:nth-child(5) { --h: 48%; animation-delay: 0.09s; }
@keyframes mpBarsUp {
    from { height: 12%; }
    to   { height: var(--h, 70%); }
}

/* أعمدة تنمو للأسفل (أعمدة معكوسة) */
.mp-bars-dn { align-items: flex-start; }
.mp-bars-dn s { border-radius: 0 0 2px 2px; }

/* أعمدة تنمو من المنتصف للأعلى والأسفل (انعكاس مرآوي) */
.mp-bars-mirror { align-items: center; }
.mp-bars-mirror s { border-radius: 2px; }

/* تدرّج لوني يوحي بالعمق 3D */
.mp-bars-3d s {
    background: linear-gradient(to top,
        var(--accent-color, #60a5fa),
        rgba(96,165,250,0.35));
}

/* نقاط بدل أعمدة (مصفوفة نقاط) */
.mp-dots { gap: 4px; align-items: center; }
.mp-dots s { border-radius: 50% !important; flex: 0 0 5px !important; }


/* ════════════════════════════════════════════════════════════
   [2] معاينة: موجة (Wave)
   تُمثّل: موجة الصوت، شريط مموج، معدن سائل
   ════════════════════════════════════════════════════════════ */
.mp-wave { align-items: center; gap: 3px; }
.mp-wave s {
    width: 3px; background: var(--accent-color, #60a5fa);
    border-radius: 2px;
    animation: mpWaveScale 0.9s ease-in-out infinite alternate;
}
/* الارتفاعات تشكّل منحنى جيبي مرئي */
.mp-wave s:nth-child(1) { height: 3px;  animation-delay: 0.0s; }
.mp-wave s:nth-child(2) { height: 11px; animation-delay: 0.1s; }
.mp-wave s:nth-child(3) { height: 21px; animation-delay: 0.2s; }
.mp-wave s:nth-child(4) { height: 26px; animation-delay: 0.3s; }
.mp-wave s:nth-child(5) { height: 21px; animation-delay: 0.4s; }
.mp-wave s:nth-child(6) { height: 11px; animation-delay: 0.5s; }
.mp-wave s:nth-child(7) { height: 3px;  animation-delay: 0.6s; }
@keyframes mpWaveScale {
    from { transform: scaleY(0.25); opacity: 0.45; }
    to   { transform: scaleY(1);    opacity: 1; }
}

/* شريط مموج بنفسجي */
.mp-wave-ribbon s { background: linear-gradient(to top, #a78bfa, #60a5fa); }

/* معدن سائل (رمادي لامع) */
.mp-wave-liquid s { background: linear-gradient(to top, #9ca3af, #e5e7eb); }


/* ════════════════════════════════════════════════════════════
   [3] معاينة: دائرة نابضة (Circle)
   تُمثّل: نبض دائري، حلقة الطاقة، كرة متوهجة، نجم نابض،
           تموجات الماء، حلقة قوس قزح، حلقات ديناميكية،
           توهج الحواف، أشعة شمسية، شمس صوتية
   ════════════════════════════════════════════════════════════ */
.mp-circle { align-items: center; justify-content: center; }
.mp-circle::after {
    content: '';
    width: 20px; height: 20px; border-radius: 50%;
    border: 2px solid var(--accent-color, #60a5fa);
    animation: mpCircPulse 0.9s ease-in-out infinite alternate;
}
@keyframes mpCircPulse {
    from { transform: scale(0.45); opacity: 0.3; }
    to   { transform: scale(1);    opacity: 1; box-shadow: 0 0 8px var(--accent-color, #60a5fa); }
}

/* نبض بيضاوي → شكل بيضاوي ينبض */
.mp-oval::after {
    content: '';
    width: 28px; height: 16px; border-radius: 50%;
    border: 2px solid var(--accent-color, #60a5fa);
    animation: mpOvalPulse 0.9s ease-in-out infinite alternate;
}
@keyframes mpOvalPulse {
    from { transform: scale(0.4) scaleX(1.6); opacity: 0.3; }
    to   { transform: scale(1)   scaleX(1.6); opacity: 1; box-shadow: 0 0 8px var(--accent-color, #60a5fa); }
}

/* تموجات الماء → حلقات تتوسع وتختفي */
.mp-ripple::after {
    animation: mpRippleExpand 1s ease-out infinite;
}
@keyframes mpRippleExpand {
    from { transform: scale(0.15); opacity: 0.9; }
    to   { transform: scale(1.6);  opacity: 0; }
}

/* حلقة الطاقة → توهج برتقالي */
.mp-energy::after { border-color: #f59e0b; box-shadow: 0 0 6px #f59e0b; }

/* نجم نابض → توهج أحمر وردي */
.mp-pulsar::after { border-color: #f43f5e; box-shadow: 0 0 6px #f43f5e; }

/* حلقة قوس قزح → دوران بألوان */
.mp-rainbow::after {
    border: none;
    background: conic-gradient(#f43f5e, #fb923c, #facc15, #4ade80, #60a5fa, #a78bfa, #f43f5e);
    animation: mpRainbowSpin 1.5s linear infinite;
}
@keyframes mpRainbowSpin { to { transform: rotate(360deg); } }

/* حلقات ديناميكية → حلقتان بتزامن مختلف */
.mp-dynrings::before, .mp-dynrings::after {
    content: ''; position: absolute; border-radius: 50%;
    border: 1.5px solid var(--accent-color, #60a5fa);
    animation: mpCircPulse 0.8s ease-in-out infinite alternate;
}
.mp-dynrings::before { width: 9px;  height: 9px;  animation-delay: 0s; }
.mp-dynrings::after  { width: 20px; height: 20px; animation-delay: 0.4s; }

/* أشعة شمسية → تدرّج شعاعي ينبض */
.mp-radial::after {
    border: none;
    background: radial-gradient(circle, var(--accent-color,#60a5fa) 25%, transparent 70%);
    animation: mpRadialPulse 0.8s ease-in-out infinite alternate;
}
@keyframes mpRadialPulse {
    from { transform: scale(0.4); opacity: 0.35; }
    to   { transform: scale(1.1); opacity: 1; }
}

/* شمس صوتية → تدرّج شعاعي ذهبي */
.mp-sun::after {
    border: none;
    background: radial-gradient(circle, #fbbf24 30%, rgba(251,191,36,0.15) 70%, transparent);
    animation: mpSunPulse 0.7s ease-in-out infinite alternate;
}
@keyframes mpSunPulse {
    from { transform: scale(0.55); }
    to   { transform: scale(1.15); box-shadow: 0 0 10px rgba(251,191,36,0.6); }
}

/* توهج الحواف → يملأ الحاوية بالكامل */
.mp-edge-glow::after {
    width: 90%; height: 80%; border-radius: 4px;
    background: none; border: none;
    animation: mpEdgePulse 0.9s ease-in-out infinite alternate;
}
@keyframes mpEdgePulse {
    from { box-shadow: 0 0 4px var(--accent-color,#60a5fa), inset 0 0 4px var(--accent-color,#60a5fa); opacity: 0.4; }
    to   { box-shadow: 0 0 12px var(--accent-color,#60a5fa), inset 0 0 10px var(--accent-color,#60a5fa); opacity: 1; }
}

/* كرة متوهجة → كرة مضيئة بالكامل */
.mp-sphere::after {
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.5), var(--accent-color,#60a5fa) 60%, rgba(0,0,200,0.4));
    border: none;
}


/* ════════════════════════════════════════════════════════════
   [4] معاينة: نجوم ومتناثرة (Stars / Particles)
   تُمثّل: حقل النجوم، مجرة، جزيئات متناثرة، مسارات النجوم، قطرات المطر
   ════════════════════════════════════════════════════════════ */
.mp-stars { position: relative; }
.mp-stars s {
    position: absolute; width: 3px; height: 3px;
    border-radius: 50%; background: #fff;
    animation: mpStarTwinkle 1.3s ease-in-out infinite;
}
/* توزيع النجوم عبر الحاوية */
.mp-stars s:nth-child(1) { top: 18%; left: 12%; animation-delay: 0.0s; }
.mp-stars s:nth-child(2) { top: 55%; left: 32%; animation-delay: 0.3s; width: 2px; height: 2px; }
.mp-stars s:nth-child(3) { top: 25%; left: 62%; animation-delay: 0.6s; }
.mp-stars s:nth-child(4) { top: 72%; left: 80%; animation-delay: 0.9s; width: 2px; height: 2px; }
.mp-stars s:nth-child(5) { top: 45%; left: 50%; animation-delay: 0.4s; width: 4px; height: 4px; }
@keyframes mpStarTwinkle {
    0%, 100% { opacity: 0.12; transform: scale(0.4); }
    50%       { opacity: 1;    transform: scale(1.4); }
}

/* مجرة → نجوم بلون التوكيد */
.mp-galaxy s { background: var(--accent-color, #60a5fa); }

/* جزيئات متناثرة → تتطاير للخارج */
.mp-scatter s {
    animation: mpScatterOut 1s ease-out infinite;
    background: var(--accent-color, #60a5fa);
}
.mp-scatter s:nth-child(1) { --sx:  9px; --sy: -9px; animation-delay: 0.0s; }
.mp-scatter s:nth-child(2) { --sx: -9px; --sy: -7px; animation-delay: 0.2s; }
.mp-scatter s:nth-child(3) { --sx:  7px; --sy:  9px; animation-delay: 0.4s; }
.mp-scatter s:nth-child(4) { --sx: -7px; --sy:  7px; animation-delay: 0.6s; }
.mp-scatter s:nth-child(5) { --sx:  1px; --sy:-11px; animation-delay: 0.1s; }
@keyframes mpScatterOut {
    0%   { transform: translate(0,0) scale(1);     opacity: 1; }
    100% { transform: translate(var(--sx),var(--sy)) scale(0); opacity: 0; }
}

/* مسارات النجوم → خطوط مائلة تتلاشى */
.mp-trails { align-items: center; gap: 3px; }
.mp-trails s {
    width: 2px !important; height: 10px !important;
    border-radius: 1px !important;
    transform: rotate(-40deg);
    animation: mpTrailsFade 1s ease-in-out infinite;
}
.mp-trails s:nth-child(1) { animation-delay: 0.0s; background: rgba(255,255,255,0.9); }
.mp-trails s:nth-child(2) { animation-delay: 0.2s; background: rgba(255,255,255,0.65); }
.mp-trails s:nth-child(3) { animation-delay: 0.4s; background: rgba(255,255,255,0.45); }
.mp-trails s:nth-child(4) { animation-delay: 0.6s; background: rgba(255,255,255,0.25); }
.mp-trails s:nth-child(5) { animation-delay: 0.8s; background: rgba(255,255,255,0.1); }
@keyframes mpTrailsFade {
    0%, 100% { opacity: 0.15; }
    50%       { opacity: 1; }
}

/* قطرات المطر → تتساقط من الأعلى للأسفل */
.mp-rain { align-items: flex-start; gap: 5px; }
.mp-rain s {
    width: 2px !important; border-radius: 1px !important;
    height: 8px !important; background: var(--accent-color, #60a5fa);
    animation: mpRainFall 0.7s linear infinite;
}
.mp-rain s:nth-child(1) { animation-delay: 0.00s; }
.mp-rain s:nth-child(2) { animation-delay: 0.14s; }
.mp-rain s:nth-child(3) { animation-delay: 0.28s; }
.mp-rain s:nth-child(4) { animation-delay: 0.42s; }
.mp-rain s:nth-child(5) { animation-delay: 0.56s; }
@keyframes mpRainFall {
    from { transform: translateY(-4px); opacity: 1; }
    to   { transform: translateY(28px); opacity: 0; }
}


/* ════════════════════════════════════════════════════════════
   [5] معاينة: نفق/دوامة (Tunnel)
   تُمثّل: نفق فضائي، دوامة، لولب مزدوج، نفق بلازما
   ════════════════════════════════════════════════════════════ */
.mp-tunnel { align-items: center; justify-content: center; }
/* حلقات تتوسع وتختفي لتعطي إحساس الانطلاق في النفق */
.mp-tunnel::before, .mp-tunnel::after {
    content: ''; position: absolute; border-radius: 50%;
    border: 1px solid var(--accent-color, #60a5fa);
    animation: mpTunnelZoom 1.2s ease-out infinite;
}
.mp-tunnel::before { animation-delay: 0s; }
.mp-tunnel::after  { animation-delay: 0.6s; }
@keyframes mpTunnelZoom {
    from { width: 3px; height: 3px; opacity: 0.9; }
    to   { width: 38px; height: 38px; opacity: 0; }
}

/* نفق سريع → سرعة أعلى */
.mp-tunnel-fast::before, .mp-tunnel-fast::after { animation-duration: 0.65s; }

/* لولب مزدوج → دوران مع توسع */
.mp-helix::before, .mp-helix::after {
    border-color: #a78bfa;
    animation: mpHelixSpin 1.1s ease-out infinite;
}
.mp-helix::after { animation-delay: 0.55s; }
@keyframes mpHelixSpin {
    from { width: 3px; height: 3px; transform: rotate(0deg); opacity: 0.9; }
    to   { width: 36px; height: 36px; transform: rotate(180deg); opacity: 0; }
}

/* نفق بلازما → وردي متوهج */
.mp-plasma::before, .mp-plasma::after {
    border-color: #f472b6;
    box-shadow: 0 0 4px #f472b6;
    animation-duration: 0.9s;
}


/* ════════════════════════════════════════════════════════════
   [6] معاينة: تشويش رقمي (Glitch / Tech)
   تُمثّل: تشويش رقمي، شبكة نيون، شلال رقمي، مربعات متزامنة
   ════════════════════════════════════════════════════════════ */
.mp-glitch { align-items: center; flex-direction: column; gap: 4px; }
.mp-glitch s {
    height: 4px; border-radius: 2px;
    background: var(--accent-color, #60a5fa);
    animation: mpGlitchJump 0.28s step-end infinite;
}
.mp-glitch s:nth-child(1) { width: 72%; animation-delay: 0.00s; }
.mp-glitch s:nth-child(2) { width: 48%; animation-delay: 0.09s; }
.mp-glitch s:nth-child(3) { width: 62%; animation-delay: 0.05s; }
@keyframes mpGlitchJump {
    0%, 100% { transform: translateX(0px);  opacity: 1; }
    33%       { transform: translateX(-4px); opacity: 0.6; }
    66%       { transform: translateX(3px);  opacity: 0.85; }
}

/* شبكة نيون → خطوط خضراء */
.mp-neon s { background: #4ade80; box-shadow: 0 0 4px #4ade80; }

/* شلال رقمي → خطوط سماوية تتحرك عمودياً */
.mp-waterfall { flex-direction: row; align-items: flex-start; gap: 3px; }
.mp-waterfall s {
    width: 5px !important; height: 12px !important;
    border-radius: 2px !important;
    background: #22d3ee; animation: mpWaterfallDrop 0.5s linear infinite;
}
.mp-waterfall s:nth-child(1) { animation-delay: 0.00s; }
.mp-waterfall s:nth-child(2) { animation-delay: 0.17s; }
.mp-waterfall s:nth-child(3) { animation-delay: 0.33s; }
@keyframes mpWaterfallDrop {
    0%   { transform: translateY(-8px); opacity: 0; }
    30%  { opacity: 1; }
    100% { transform: translateY(16px); opacity: 0; }
}

/* مربعات متزامنة → مربعات تنبض معاً */
.mp-squares { flex-direction: row; align-items: center; gap: 4px; }
.mp-squares s {
    width: 8px !important; height: 8px !important;
    border-radius: 2px !important;
    background: var(--accent-color, #60a5fa);
    animation: mpSquarePop 0.6s ease-in-out infinite;
}
.mp-squares s:nth-child(1) { animation-delay: 0.0s; }
.mp-squares s:nth-child(2) { animation-delay: 0.2s; }
.mp-squares s:nth-child(3) { animation-delay: 0.4s; }
@keyframes mpSquarePop {
    0%, 100% { transform: scale(0.4); opacity: 0.3; }
    50%       { transform: scale(1);   opacity: 1; }
}


/* ════════════════════════════════════════════════════════════
   [7] معاينة: شبكة/هندسة (Web / Geometric)
   تُمثّل: شبكة عنكبوتية، خطوط دوارة، أشكال هندسية
   ════════════════════════════════════════════════════════════ */
.mp-web { align-items: center; justify-content: center; }
/* مربع يدور ويتحول إلى دائرة ويعود */
.mp-web::after {
    content: ''; width: 20px; height: 20px;
    border: 1.5px solid var(--accent-color, #60a5fa);
    animation: mpWebMorph 2s ease-in-out infinite;
}
@keyframes mpWebMorph {
    0%  { transform: rotate(0deg);   border-radius: 0; }
    50% { transform: rotate(90deg);  border-radius: 50%; }
    100%{ transform: rotate(180deg); border-radius: 0; }
}

/* خطوط دوارة → خطوط تدور 360 */
.mp-lines::after {
    width: 22px; height: 2px; border-radius: 1px;
    background: var(--accent-color, #60a5fa);
    box-shadow: 0 7px 0 var(--accent-color, #60a5fa), 0 -7px 0 var(--accent-color, #60a5fa);
    border: none; border-radius: 0;
    animation: mpLinesSpin 1s linear infinite;
}
@keyframes mpLinesSpin { to { transform: rotate(360deg); } }

/* أشكال هندسية → تحوّل بطيء بين أشكال */
.mp-geo::after {
    animation: mpGeoMorph 2.5s ease-in-out infinite;
    border-color: #a78bfa;
}
@keyframes mpGeoMorph {
    0%   { transform: rotate(0deg);   border-radius: 0; }
    25%  { transform: rotate(45deg);  border-radius: 25%; }
    50%  { transform: rotate(90deg);  border-radius: 50%; }
    75%  { transform: rotate(135deg); border-radius: 25%; }
    100% { transform: rotate(180deg); border-radius: 0; }
}


/* ════════════════════════════════════════════════════════════
   [8] معاينة: انفجار (Burst / Fireworks)
   تُمثّل: ألعاب نارية، انفجار قصاصات، فقاعات ليزر
   ════════════════════════════════════════════════════════════ */
.mp-burst { align-items: center; justify-content: center; }
.mp-burst s {
    position: absolute; width: 5px; height: 5px;
    border-radius: 50%; background: var(--accent-color, #60a5fa);
    animation: mpBurstOut 1.1s ease-out infinite;
}
.mp-burst s:nth-child(1) { --bx:  11px; --by: -11px; animation-delay: 0.00s; }
.mp-burst s:nth-child(2) { --bx: -11px; --by: -11px; animation-delay: 0.27s; }
.mp-burst s:nth-child(3) { --bx:  11px; --by:  11px; animation-delay: 0.55s; }
.mp-burst s:nth-child(4) { --bx: -11px; --by:  11px; animation-delay: 0.82s; }
@keyframes mpBurstOut {
    0%   { transform: translate(0,0) scale(1.2); opacity: 1; }
    100% { transform: translate(var(--bx), var(--by)) scale(0); opacity: 0; }
}

/* انفجار قصاصات → ألوان احتفالية */
.mp-confetti s:nth-child(1) { background: #f43f5e; }
.mp-confetti s:nth-child(2) { background: #fb923c; }
.mp-confetti s:nth-child(3) { background: #facc15; }
.mp-confetti s:nth-child(4) { background: #4ade80; }
.mp-confetti s { border-radius: 1px; }

/* فقاعات ليزر → دوائر شفافة */
.mp-bubbles s { background: transparent; border: 1.5px solid #a78bfa; }


/* ═══════════════════════════════════════════════════════
   أزرار السرعة والنبرة المنسدلة — داخل لوحة المعادل
   ======================================================= */

.audio-dropdowns-row {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    /* لا نحتاج position:relative هنا بعد الآن */
}

.audio-drop-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;  /* الزر فوق، اللوحة أسفله مباشرةً */
}

/* الزر الرئيسي */
.audio-drop-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px;
    background: rgba(255,255,255,0.05);
    border: 1.5px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    color: var(--text-color, #fff);
    font-family: 'Tajawal', sans-serif;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    white-space: nowrap;
    overflow: hidden;
}

@media (hover: hover) { .audio-drop-btn:hover {
    background: rgba(255,255,255,0.09);
    border-color: rgba(255,255,255,0.2);
} }

.audio-drop-btn.drop-active {
    background: rgba(138,43,226,0.15);
    border-color: rgba(138,43,226,0.5);
    box-shadow: 0 0 0 3px rgba(138,43,226,0.1);
}

/* قيمة السرعة داخل الزر */
.speed-drop-val {
    margin-inline-start: auto;
    font-weight: 800;
    font-size: 13px;
    color: var(--accent-color);
    min-width: 36px;
    text-align: center;
    background: rgba(233,30,99,0.12);
    padding: 2px 8px;
    border-radius: 20px;
}

.drop-chevron {
    opacity: 0.5;
    transition: transform 0.22s;
    flex-shrink: 0;
}

.audio-drop-btn.drop-active .drop-chevron {
    transform: rotate(180deg);
}

/* اللوحة المنسدلة */
.audio-drop-panel {
    background: rgba(20,20,30,0.98);
    border: 1.5px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 14px;
    margin-top: 6px;
    overflow: hidden;
    transform-origin: top center;
    transform: scaleY(0);
    opacity: 0;
    pointer-events: none;
    will-change: transform, opacity;
    transition: transform 0.18s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 0.15s ease;
    visibility: hidden;
}

.audio-drop-panel.speed-panel-open {
    transform: scaleY(1);
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.drop-panel-title {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,0.4);
    margin-bottom: 12px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    text-align: center;
}

/* chips السرعة */
.speed-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.speed-chip {
    background: rgba(255,255,255,0.06);
    border: 1.5px solid rgba(255,255,255,0.1);
    color: var(--text-color-primary);
    padding: 8px 0;
    width: calc(33.33% - 6px);
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    font-family: 'Tajawal', sans-serif;
    font-weight: 600;
    transition: background 0.18s, border-color 0.18s, transform 0.12s;
    text-align: center;
}

.speed-chip:active {
    transform: scale(0.93);
}

@media (hover: hover) { .speed-chip:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
} }

.speed-chip.active {
    background: rgba(233,30,99,0.18);
    border-color: var(--accent-color);
    color: var(--accent-color);
    font-weight: 800;
}


/* =======================================================
   ✨ تحسينات الأداء للأجهزة الضعيفة
   يُطبَّق تلقائياً على الشاشات الصغيرة (≤ 420px) أو الأجهزة التي تفضل تقليل الحركة
   ======================================================= */

/* تقليل التأثيرات عند تفعيل "تقليل الحركة" في إعدادات الجهاز */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .marquee-active {
        animation: none !important;
        transform: none !important;
    }
}

/* الأجهزة الصغيرة (هواتف ≤ 420px): تعطيل التأثيرات المكلفة */
@media screen and (max-width: 420px) {
    /* تعطيل backdrop-filter المكلف جداً على GPU الضعيف */
    .drag-overlay,
    .tutorial-overlay,
    .toast-message {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        /* تعويض بشفافية خلفية بسيطة */
        background-color: rgba(10, 10, 20, 0.92) !important;
    }

    /* الانتقالات مُبسَّطة مسبقاً — لا حاجة لـ override */
    /* #coverArt و #defaultIcon يستخدمان opacity 0.3s فقط في الـ base styles */

    /* تقليل blur في صورة الغلاف عند تشغيل المؤثرات */
    #coverArt.blossom-active {
        filter: blur(4px) brightness(0.7) !important;
    }

    /* تقليل will-change لتوفير ذاكرة GPU */
    .playlist-item,
    .control-btn,
    #progressContainer {
        will-change: auto !important;
    }

    /* تعطيل تأثير الظل المكلف في القائمة */
    .playlist-item:active,
    .control-btn:active {
        box-shadow: none !important;
    }

    /* تقليل مدة الانيميشن لتبدو أسرع */
    .toast-message {
        transition: opacity 0.15s ease !important;
    }
}


/* ═══════════════════════════════════════════════════════════════
   إصلاح شامل: الـ Overlays في وضع Landscape (هاتف أفقي)
   المشكلة: ارتفاع الشاشة ~360px لا يكفي لعرض المحتوى الكامل
   ═══════════════════════════════════════════════════════════════ */
@media (orientation: landscape) and (max-height: 500px) {

    /* ══ جميع الـ overlays: تمرير عمودي وضغط padding ══ */
    .overlay {
        overflow-y: auto;
        overflow-x: hidden;
        padding: 8px 12px 8px 12px;
        overscroll-behavior: contain;
    }

    /* ══ رأس الـ overlay (العنوان + زر الإغلاق) أصغر ══ */
    .overlay h2 {
        font-size: 16px !important;
        margin-bottom: 6px;
        padding-bottom: 5px;
    }

    .playlist-header-row {
        margin-bottom: 4px;
        flex-shrink: 0;
    }

    /* ══════════════════════════════════════════
       EQ Overlay — شبكة عمودين تملأ الشاشة
    ══════════════════════════════════════════ */
    #eqOverlay {
        padding: 6px 10px 6px 10px;
    }

    #eqMode {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto 1fr auto;
        column-gap: 10px;
        row-gap: 6px;
        padding: 0;
        gap: 0;
        overflow: visible;
        flex-shrink: 0;
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    /* ── العمود الأيسر ── */

    /* سرعة التشغيل → صف 1 عمود 1 */
    #eqMode > .audio-dropdowns-row {
        grid-column: 1;
        grid-row: 1;
        margin-bottom: 0;
    }

    /* صدى الصوت → صف 2+3 عمود 1 */
    #eqMode > .echo-card {
        grid-column: 1;
        grid-row: 2 / 4;
        margin-bottom: 0;
        padding: 8px 10px;
        align-self: start;
    }

    /* ── العمود الأيمن ── */

    /* Presets → صف 1 عمود 2 */
    #eqMode > #eqPresetsDropdown {
        grid-column: 2;
        grid-row: 1;
    }

    /* EQ Card → صف 2 عمود 2 */
    #eqMode > .eq-card {
        grid-column: 2;
        grid-row: 2;
    }

    /* زر إعادة الضبط → صف 3 عمود 2 */
    #eqMode > #resetEqBtn {
        grid-column: 2;
        grid-row: 3;
        margin-top: 0;
        padding: 7px 0;
        font-size: 12px;
    }

    /* ── ضغط حاوية الـ EQ ── */
    #eqContainer {
        height: 100px;
        min-height: 90px;
        padding: 8px 6px 6px;
    }

    .eq-ref-labels { height: 100px; }

    .eq-card-header {
        padding: 5px 10px 4px;
    }

    .eq-band {
        min-width: 26px;
        min-height: 90px;
    }

    /* ── ضغط الـ dropdowns ── */
    .audio-drop-btn {
        padding: 7px 10px;
        font-size: 12px;
        border-radius: 10px;
    }

    .speed-drop-val {
        font-size: 11px;
        padding: 1px 6px;
    }

    .dropdown-header {
        padding: 7px 12px;
        font-size: 13px;
        border-radius: 12px;
    }

    /* ── ضغط Echo ── */
    .echo-card-header { margin-bottom: 7px; }
    .echo-card-label  { font-size: 12px; }
    .echo-sliders     { gap: 7px; }
    .echo-row         { gap: 8px; }
    .echo-lbl         { font-size: 10px; width: 30px; }
    .echo-val         { font-size: 10px; width: 32px; }
    .echo-reset-btn   { padding: 4px 10px; font-size: 10px; margin-top: 2px; }

    .echo-slider::-webkit-slider-thumb {
        width: 14px;
        height: 14px;
    }

    /* ══════════════════════════════
       Info / About Overlay
    ══════════════════════════════ */
    /* لا حاجة لـ overflow على الـ overlay نفسه — التمرير يتم عبر #infoScrollArea */
    #infoOverlay { overflow: hidden; }

    #infoScrollArea {
        flex-direction: column;
        padding: 2px 0 6px;
    }

    #infoContent {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 8px;
        padding: 2px 0 6px;
    }

    .info-app-card {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        width: 100%;
    }

    .info-app-icon { width: 40px; height: 40px; border-radius: 10px; }
    .info-app-icon svg { width: 22px; height: 22px; }
    .info-app-title { font-size: 16px; }
    .info-app-version { font-size: 10px; padding: 2px 8px; }
    .info-rows-card { width: 100%; }

    .sleep-timer-wrapper {
        width: 100%;
        padding: 7px 10px;
        margin: 2px 0;
    }

    .timer-header-main { margin-bottom: 5px; }
    #keyboardHintBox   { display: none; }

    /* ══════════════════════════════
       Playlist Overlay
    ══════════════════════════════ */
    #playlistOverlay { overflow-y: hidden; }

    #listMode {
        overflow: hidden;
        flex-grow: 1;
        min-height: 0;
    }

    #playlist-drag-handle { height: 14px; flex-shrink: 0; }

    .playlist-header-unified {
        padding-bottom: 5px;
        margin-bottom: 5px;
    }

    #searchInput {
        padding: 7px 36px 7px 34px;
        font-size: 13px;
    }

    .playlist-header-actions { padding: 2px; }


    /* القائمة تملأ الباقي وتتمرر */
    #playlist {
        flex-grow: 1;
        overflow-y: auto;
        min-height: 0;
    }

    /* تصغير عناصر القائمة قليلاً */
    .playlist-item {
        padding: 7px 10px;
        margin-bottom: 5px;
        border-radius: 10px;
    }

    /* ══════════════════════════════════════════════════
       المشغل المصغر في landscape — يملأ العرض الكامل
       ══════════════════════════════════════════════════ */
    #playlist-mini-player {
        max-width: 100%;
        flex-direction: column;
        align-items: stretch;
        padding: 5px max(16px, env(safe-area-inset-right)) 6px max(16px, env(safe-area-inset-left));
        gap: 4px;
        border-radius: 0;
        border-top: 1px solid rgba(255,255,255,0.1);
        background: rgba(18,18,30,0.96);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        min-height: unset;
        position: relative;
    }

    /* شريط التقدم — صف منفصل أعلى أزرار التحكم */
    #playlist-mini-progress-wrap {
        position: static;
        order: -1;
        width: 100%;
        gap: 6px;
        padding: 0;
        align-items: center;
    }
    #playlist-mini-current,
    #playlist-mini-duration {
        display: inline;
        font-size: 10px;
        opacity: 0.75;
        color: var(--text-color-secondary);
        flex-shrink: 0;
        min-width: 30px;
        font-variant-numeric: tabular-nums;
        letter-spacing: 0.3px;
    }
    #playlist-mini-progress-track {
        flex: 1;
    }
    #playlist-mini-progress-bar {
        height: 3px;
        border-radius: 3px;
        cursor: pointer;
    }

    /* الصف الأفقي الرئيسي */
    #playlist-mini-bottom {
        flex: 1;
        width: 100%;
        gap: 12px;
    }

    /* الأوبار الفنية أكبر قليلاً */
    #playlist-mini-cover {
        width: 36px;
        height: 36px;
        border-radius: 6px;
    }

    /* النصوص أنيقة ومختصرة */
    #playlist-mini-title {
        font-size: 13px;
    }
    #playlist-mini-artist {
        font-size: 11px;
    }

    /* أزرار التحكم */
    #playlist-mini-controls {
        gap: 6px;
    }
    #playlist-mini-controls button {
        width: 34px;
        height: 34px;
    }
}

/* =======================================================
   تحسينات شاشة الكمبيوتر (Desktop)
   ======================================================= */
@media (min-width: 768px) and (hover: hover) {

    /* ── حاوية التحكم الكاملة ── */
    #controls {
        gap: 10px;
        max-width: 600px;
        margin: 0 auto;
        width: 100%;
    }

    /* ── الأزرار الثانوية — صفان منظمان ── */
    #secondaryControls {
        display: grid;
        grid-template-columns: repeat(8, 1fr);
        gap: 4px;
        max-width: 560px;
        width: 100%;
        margin: 0 auto;
        padding: 6px 12px;
        background: rgba(255,255,255,0.03);
        border-radius: 14px;
        border: 1px solid rgba(255,255,255,0.06);
        box-sizing: border-box;
    }

    .secondary-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        padding: 8px 0;
        border-radius: 10px;
        transition: background 0.18s, color 0.18s, transform 0.15s;
    }
    .secondary-btn:hover {
        background: rgba(255,255,255,0.08);
        transform: scale(1.08);
    }
    .secondary-btn svg {
        width: 20px !important;
        height: 20px !important;
    }

    /* ── شريط الصوت على الكمبيوتر ── */
    #volumeContainer {
        display: flex !important;
        align-items: center;
        justify-content: center;
        gap: 4px;
        flex-direction: column;
        padding: 6px 0;
    }
    #volumeContainer span svg {
        width: 18px !important;
        height: 18px !important;
    }
    .volume-slider {
        writing-mode: vertical-lr;
        direction: rtl;
        width: 4px !important;
        height: 40px;
        cursor: pointer;
        appearance: none;
        -webkit-appearance: none;
        background: rgba(255,255,255,0.12);
        border-radius: 4px;
        outline: none;
    }
    .volume-slider::-webkit-slider-thumb {
        -webkit-appearance: none;
        width: 12px;
        height: 12px;
        border-radius: 50%;
        background: var(--accent-color);
        cursor: pointer;
    }

    /* ── الأزرار الرئيسية — مريحة ومنظمة ── */
    #mainControls {
        gap: 28px;
        margin: 4px auto;
        padding: 6px 0;
    }

    .main-ctrl-btn {
        padding: 10px;
        border-radius: 50%;
        transition: background 0.18s, color 0.18s, transform 0.15s;
    }
    .main-ctrl-btn:hover {
        background: rgba(255,255,255,0.07);
        color: var(--accent-color);
        transform: scale(1.12);
    }
    .main-ctrl-btn svg {
        width: 28px !important;
        height: 28px !important;
    }

    /* ── زر التشغيل/الإيقاف — بارز واحترافي ── */
    #playPauseBtn {
        width: 76px !important;
        height: 76px !important;
        box-shadow: 0 4px 20px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.08);
        transition: transform 0.15s, box-shadow 0.15s, background 0.18s;
    }
    #playPauseBtn:hover {
        transform: scale(1.07) !important;
        box-shadow: 0 6px 28px rgba(0,0,0,0.45), 0 0 0 2px rgba(255,255,255,0.12);
    }
    #playPauseBtn svg {
        width: 30px !important;
        height: 30px !important;
    }

    /* ── شريط التقدم أوسع ── */
    #progressContainer {
        max-width: 560px;
        margin: 0 auto;
        width: 100%;
    }
}


/* ═══════════════════════════════════════════════════════════════════
   ✅ إصلاح EQ Overlay — بناءً على بنية HTML الفعلية
   المشاكل: 
   1. playlist-header-row ليس له مكان في grid الـ landscape → يسقط للأسفل
   2. overflow-y: auto على #eqMode يقطع قائمة الـ Presets
   3. أعمدة المعادل صغيرة
   ═══════════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────────────────────────
   1. رأس EQ ثابت (Sticky) — العنوان + زر الإغلاق
   الرأس خارج #eqMode الآن → مباشرةً داخل #eqOverlay
   يستخدم position:sticky ليبقى ثابتاً أثناء تمرير #eqOverlay
   ────────────────────────────────────────────────────────────────── */
#eqOverlay > .playlist-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 4px 12px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 4px;
    /* الثبات عند التمرير */
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(18, 18, 18, 0.98);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

#eqOverlay > .playlist-header-row h2 {
    color: var(--accent-color) !important;
    font-size: 19px !important;
    font-weight: 700 !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* ──────────────────────────────────────────────────────────────────
   2. إصلاح overflow لعرض قائمة Presets كاملة (portrait)
   السبب: overflow-y:auto على #eqMode يقطع الـ dropdown المطلق
   الحل: #eqOverlay هو الحاوية المتمررة — #eqMode overflow:visible
   ────────────────────────────────────────────────────────────────── */
#eqMode {
    overflow: visible !important;
}

/* التمرير على #eqOverlay نفسه — والرأس يبقى ثابتاً بـ sticky */
#eqOverlay {
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* رفع z-index لقائمة Presets لتظهر فوق بطاقة المعادل */
#eqPresetsDropdown .dropdown-list {
    z-index: 9999 !important;
    max-height: min(240px, 40vh) !important;
}

/* ──────────────────────────────────────────────────────────────────
   3. تحسين ارتفاع أعمدة المعادل
   ────────────────────────────────────────────────────────────────── */
#eqContainer {
    height: 200px !important;
    min-height: 180px !important;
}

.eq-ref-labels {
    height: 200px !important;
}

.eq-band {
    min-height: 155px !important;
}

.eq-slider {
    min-height: 115px !important;
}


/* ──────────────────────────────────────────────────────────────────
   4. إصلاح LANDSCAPE: الرأس الآن خارج #eqMode → sticky تلقائياً
   الشبكة تُقلّص لـ 3 صفوف (بدلاً من 4) بعد نقل الرأس للخارج
   ────────────────────────────────────────────────────────────────── */
@media (orientation: landscape) and (max-height: 600px) {

    #eqOverlay {
        padding: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    /* الرأس خارج eqMode: padding مناسب في landscape */
    #eqOverlay > .playlist-header-row {
        padding: 8px 10px 8px !important;
        margin-bottom: 0 !important;
    }

    #eqMode {
        display: grid !important;
        /* 3 صفوف فقط بعد نقل الرأس للخارج */
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto 1fr auto;
        column-gap: 10px;
        row-gap: 5px;
        padding: 0 10px 10px !important;
        overflow: visible !important;
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    /* ── العمود الأيسر ── */
    /* سرعة التشغيل → صف 1 عمود 1 */
    #eqMode > .audio-dropdowns-row {
        grid-column: 1 !important;
        grid-row: 1 !important;
        margin-bottom: 0 !important;
    }

    /* صدى الصوت → صف 2+3 عمود 1 */
    #eqMode > .echo-card {
        grid-column: 1 !important;
        grid-row: 2 / 4 !important;
        margin-bottom: 0 !important;
        padding: 9px 11px !important;
        align-self: start;
    }

    /* ── العمود الأيمن ── */
    /* Presets → صف 1 عمود 2 */
    #eqMode > #eqPresetsDropdown {
        grid-column: 2 !important;
        grid-row: 1 !important;
    }

    /* EQ Card → صف 2 عمود 2 */
    #eqMode > .eq-card {
        grid-column: 2 !important;
        grid-row: 2 !important;
    }

    /* زر إعادة الضبط → صف 3 عمود 2 */
    #eqMode > #resetEqBtn {
        grid-column: 2 !important;
        grid-row: 3 !important;
        margin-top: 0 !important;
        padding: 7px 0 !important;
        font-size: 12px !important;
    }

    /* ── ضغط حاوية EQ في landscape ── */
    #eqContainer {
        height: 115px !important;
        min-height: 100px !important;
        padding: 8px 6px 6px !important;
    }

    .eq-ref-labels {
        height: 115px !important;
    }

    .eq-band {
        min-width: 26px !important;
        min-height: 88px !important;
    }

    .eq-slider {
        min-height: 72px !important;
    }

    /* قائمة Presets: تفتح للأسفل مع حد أقصى مناسب */
    #eqPresetsDropdown .dropdown-list {
        max-height: min(180px, 35vh) !important;
        z-index: 9999 !important;
    }
}

/* ──────────────────────────────────────────────────────────────────
   5. إصلاح landscape max-height: 500px (نفس التعديلات)
   ────────────────────────────────────────────────────────────────── */
@media (orientation: landscape) and (max-height: 500px) {

    /* الرأس خارج eqMode في 500px أيضاً */
    #eqOverlay > .playlist-header-row {
        padding: 6px 10px 6px !important;
        margin-bottom: 0 !important;
    }

    #eqMode {
        grid-template-rows: auto 1fr auto !important;
    }

    #eqMode > .audio-dropdowns-row {
        grid-column: 1 !important;
        grid-row: 1 !important;
    }

    #eqMode > .echo-card {
        grid-column: 1 !important;
        grid-row: 2 / 4 !important;
    }

    #eqMode > #eqPresetsDropdown {
        grid-column: 2 !important;
        grid-row: 1 !important;
    }

    #eqMode > .eq-card {
        grid-column: 2 !important;
        grid-row: 2 !important;
    }

    #eqMode > #resetEqBtn {
        grid-column: 2 !important;
        grid-row: 3 !important;
    }
}


/* ═══════════════════════════════════════════════════════════════
   ✨ تحسين انيميشن زري إعادة الضبط — EQ + Echo
   ═══════════════════════════════════════════════════════════════ */

/* ── Keyframes مشتركة ── */

/* دوران كامل للـ SVG عند الضغط */
@keyframes reset-svg-spin {
    0%   { transform: rotate(0deg)    scale(1);    }
    55%  { transform: rotate(-220deg) scale(1.18); }
    78%  { transform: rotate(-345deg) scale(1.05); }
    100% { transform: rotate(-360deg) scale(1);    }
}

/* توهج خفيف ينبض ثم يختفي */
@keyframes reset-glow-pulse {
    0%   { box-shadow: 0 0 0 0px  rgba(255, 95, 95, 0.00); }
    40%  { box-shadow: 0 0 0 6px  rgba(255, 95, 95, 0.14); }
    100% { box-shadow: 0 0 0 0px  rgba(255, 95, 95, 0.00); }
}

/* وميض خلفية خفيف جداً */
@keyframes reset-bg-flash {
    0%   { background-color: rgba(255, 82, 82, 0.03);  }
    35%  { background-color: rgba(255, 82, 82, 0.13);  }
    100% { background-color: rgba(255, 82, 82, 0.03);  }
}

/* ── EQ Reset Button (تحسين الانيميشن الموجود) ── */

/* الحالة العادية: إخفاء تدريجي للـ SVG */
.eq-reset-btn svg {
    transition: transform 0.48s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.25s ease !important;
    opacity: 0.55;
}

/* Hover: دوران نصف لفة سلس — فقط على أجهزة الماوس */
@media (hover: hover) {
    .eq-reset-btn:hover svg {
        transform: rotate(-180deg) !important;
        opacity: 1 !important;
    }
    .eq-reset-btn:hover {
        background: rgba(255, 82, 82, 0.09) !important;
        border-color: rgba(255, 82, 82, 0.32) !important;
        color: #ff7070 !important;
    }
}

/* Active: لفة كاملة + نبضة توهج + وميض خلفية */
.eq-reset-btn:active {
    transform: scale(0.95) !important;
    animation:
        reset-glow-pulse 0.52s ease forwards,
        reset-bg-flash   0.52s ease forwards;
}

.eq-reset-btn:active svg {
    animation: reset-svg-spin 0.52s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}


/* ── Echo Reset Button (إضافة انيميشن جديد بنفس الأسلوب) ── */

/* الحالة الأساسية */
.echo-reset-btn {
    transition: background 0.22s, color 0.22s,
                border-color 0.22s, transform 0.15s !important;
    position: relative;
}

/* SVG في الحالة العادية */
.echo-reset-btn svg {
    transition: transform 0.44s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.22s ease;
    opacity: 0.45;
    flex-shrink: 0;
}

/* Hover: تأثير خفيف + دوران SVG — فقط على أجهزة الماوس */
@media (hover: hover) {
    .echo-reset-btn:hover {
        background: rgba(255, 255, 255, 0.09) !important;
        color: rgba(255, 255, 255, 0.88) !important;
        border-color: rgba(255, 255, 255, 0.22) !important;
    }
    .echo-reset-btn:hover svg {
        transform: rotate(-180deg) !important;
        opacity: 1 !important;
    }
}

/* Active: لفة + نبضة توهج */
.echo-reset-btn:active {
    transform: scale(0.90) !important;
    animation: reset-glow-pulse 0.46s ease forwards !important;
}

.echo-reset-btn:active svg {
    animation: reset-svg-spin 0.46s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}

/* ════════════════════════════════════════════════════════════
   أنيميشن أزرار السابق والتالي — خفيف ونشيط مع اتجاه RTL
   ════════════════════════════════════════════════════════════ */

/* زر السابق: ينزلق للأمام (يمين في RTL) ثم يرتد */
@keyframes skip-prev-anim {
    0%   { transform: scale(1)    translateX(0);   }
    20%  { transform: scale(0.82) translateX(5px); }
    55%  { transform: scale(1.12) translateX(-3px);}
    80%  { transform: scale(0.97) translateX(1px); }
    100% { transform: scale(1)    translateX(0);   }
}

/* زر التالي: ينزلق للأمام (يسار في RTL) ثم يرتد */
@keyframes skip-next-anim {
    0%   { transform: scale(1)    translateX(0);    }
    20%  { transform: scale(0.82) translateX(-5px); }
    55%  { transform: scale(1.12) translateX(3px);  }
    80%  { transform: scale(0.97) translateX(-1px); }
    100% { transform: scale(1)    translateX(0);    }
}

/* تطبيق الأنيميشن عبر CSS class تُضاف/تُزال بـ JS */
.btn-anim-prev {
    animation: skip-prev-anim 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}

.btn-anim-next {
    animation: skip-next-anim 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}

/* ══ أنيميشن زر تشغيل/إيقاف — خفيف ونشيط ══ */
@keyframes playpause-anim {
    0%   { transform: scale(1);    }
    30%  { transform: scale(0.86); }
    65%  { transform: scale(1.07); }
    100% { transform: scale(1);    }
}
@keyframes playpause-pl-anim {
    0%   { transform: scale(1);    }
    30%  { transform: scale(0.84); }
    65%  { transform: scale(1.06); }
    100% { transform: scale(1);    }
}
.btn-anim-playpause {
    animation: playpause-anim 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}
.btn-anim-pl-play {
    animation: playpause-pl-anim 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}

/* تأثير hover خفيف إضافي للأزرار الرئيسية — فقط على أجهزة الماوس */
@media (hover: hover) {
    #prevBtn:hover svg,
    #nextBtn:hover svg {
        filter: drop-shadow(0 0 4px var(--accent-color));
        transition: filter 0.2s ease;
    }

    /* نفس الـ hover لأزرار mini playlist */
    #playlist-prev-btn:hover svg,
    #playlist-next-btn:hover svg {
        filter: drop-shadow(0 0 3px var(--accent-color));
        transition: filter 0.2s ease;
    }
}

/* ══════════════════════════════════════════════════════════════════
   إصلاح شامل نهائي: منع بقاء hover على جميع الأزرار في أجهزة اللمس
   ملاحظة: نستخدم (pointer: coarse) بدلاً من (hover: none) لأنه أكثر
   موثوقية على Android — ونستثني كلاسات الأنيميشن من transform: none
   لأن !important يتغلب على قيم الـ keyframes ويكسر الحركة.
   ══════════════════════════════════════════════════════════════════ */
@media (pointer: coarse) {
    /* أزرار التحكم الرئيسية — نستثني أزرار تحريك السكيب لئلا نكسر أنيميشنها */
    .main-ctrl-btn:not(.btn-anim-prev):not(.btn-anim-next):hover,
    .main-ctrl-btn:not(.btn-anim-prev):not(.btn-anim-next):focus {
        color: var(--text-color-primary) !important;
        transform: none !important;
        outline: none !important;
    }
    .main-ctrl-btn:hover svg,
    .main-ctrl-btn:focus svg {
        stroke: currentColor !important;
        filter: none !important;
    }

    /* أزرار مشغل القائمة — نسخة طبق الأصل من main-ctrl-btn */
    #playlist-prev-btn:not(.btn-anim-prev):hover,
    #playlist-prev-btn:not(.btn-anim-prev):focus,
    #playlist-next-btn:not(.btn-anim-next):hover,
    #playlist-next-btn:not(.btn-anim-next):focus {
        color: var(--text-color-primary) !important;
        background: none !important;
        transform: none !important;
        outline: none !important;
        filter: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }
    #playlist-prev-btn:hover svg,
    #playlist-next-btn:hover svg {
        filter: none !important;
        stroke: currentColor !important;
    }
    #playlist-play-btn:hover,
    #playlist-play-btn:focus,
    #playlist-play-btn:active {
        background: var(--accent-color-light) !important;
        color: var(--accent-color) !important;
        transform: none !important;
        outline: none !important;
        box-shadow: none !important;
    }

    /* الأزرار الثانوية (EQ، shuffle، loop...) */
    .secondary-btn:not(.active):hover,
    .secondary-btn:not(.active):focus {
        color: var(--text-color-secondary) !important;
        background: transparent !important;
        transform: none !important;
        outline: none !important;
    }
    .secondary-btn.active {
        transform: none !important;
    }
    .secondary-btn:hover svg,
    .secondary-btn:focus svg {
        stroke: currentColor !important;
    }

    /* أزرار الرأس */
    .header-icon-btn:hover,
    .header-icon-btn:focus,
    .header-icon-btn.danger:hover {
        background: transparent !important;
        color: var(--text-color-secondary) !important;
        outline: none !important;
    }
    .icon-btn:hover,
    .icon-btn:focus {
        background: transparent !important;
        outline: none !important;
    }
    .icon-btn:hover svg,
    .icon-btn:focus svg {
        stroke: currentColor !important;
        filter: none !important;
    }

    /* أزرار إعادة الضبط (EQ و Echo) */
    .eq-reset-btn:hover,
    .eq-reset-btn:focus {
        background: transparent !important;
        color: var(--text-color-secondary) !important;
        transform: none !important;
        outline: none !important;
    }
    .eq-reset-btn:hover svg,
    .eq-reset-btn:focus svg {
        color: inherit !important;
        filter: none !important;
    }
    .echo-reset-btn:hover,
    .echo-reset-btn:focus {
        background: transparent !important;
        color: var(--text-color-secondary) !important;
        transform: none !important;
        outline: none !important;
    }

    /* إزالة focus outline من جميع الأزرار */
    button:focus { outline: none !important; }
}

/* ══════════════════════════════════════════════════════════════════
   منع جميع تأثيرات hover العالقة على أجهزة اللمس
   يُفعَّل عبر JS عند أول لمسة: document.documentElement.classList.add('is-touch')
   أعلى أولوية من @media (hover: hover) لأنه يعتمد على touchstart الفعلي
   ══════════════════════════════════════════════════════════════════ */
html.is-touch #playPauseBtn:hover {
    transform: none !important;
    box-shadow: 0 5px 20px rgba(233, 30, 99, 0.4) !important;
    background: var(--accent-color) !important;
}
html.is-touch #playPauseBtn:hover svg {
    stroke: #fff !important;
}
html.is-touch #playPauseBtn::after {
    display: none !important;
}
html.is-touch .main-ctrl-btn:not(.btn-anim-prev):not(.btn-anim-next):not(.btn-anim-playpause):not(#prevBtn):not(#nextBtn):hover {
    transform: none !important;
    color: var(--text-color-secondary) !important;
}
/* prevBtn/nextBtn يعودان للون الأساسي فوراً بعد اللمس (لا يبقيان رماديَّين) */
/* نستثني وجود كلاس الأنيميشن حتى لا يُلغى الـ transform الخاص بالأنيميشن */
html.is-touch #prevBtn:not(.btn-anim-prev):hover,
html.is-touch #nextBtn:not(.btn-anim-next):hover {
    color: var(--text-color-primary) !important;
    transform: none !important;
}
html.is-touch .main-ctrl-btn:not(.btn-anim-prev):not(.btn-anim-next):hover svg {
    filter: none !important;
    stroke: currentColor !important;
}
html.is-touch .icon-btn:hover {
    background: transparent !important;
}
html.is-touch .icon-btn:hover svg {
    stroke: var(--text-color-secondary) !important;
}
html.is-touch .secondary-btn:not(.active):hover {
    color: var(--text-color-secondary) !important;
}
html.is-touch .header-icon-btn:hover {
    background: transparent !important;
    color: var(--text-color-secondary) !important;
}

/* ── is-touch: تُضاف على <html> للأجهزة التي تدعم اللمس ── */
html.is-touch * {
    -webkit-tap-highlight-color: transparent;
}

/* ═══════════════════════════════════════════════
   بطاقة الصوت الأحادي (Mono Audio Card)
   ═══════════════════════════════════════════════ */
.mono-audio-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-color, #1e1e2e);
    border-radius: 14px;
    padding: 12px 16px;
    margin: 10px auto;
    width: 90%;
    max-width: 440px;
    gap: 10px;
    box-sizing: border-box;
}

.mono-audio-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-color, #cdd6f4);
    font-size: 14px;
    flex-wrap: wrap;
}

.mono-hint {
    font-size: 11px;
    color: var(--text-color-secondary, #888);
    width: 100%;
    margin-top: 2px;
    line-height: 1.3;
}

.mono-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--text-color-secondary, #555);
    background: transparent;
    color: var(--text-color-secondary, #888);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.mono-toggle-btn.mono-active {
    background: var(--accent-color, #cba6f7);
    border-color: var(--accent-color, #cba6f7);
    color: #1e1e2e;
}

.mono-toggle-btn.mono-active svg {
    stroke: #1e1e2e;
}

/* ═══════════════════════════════════════════
   بطاقة تنظيف التخزين — تصميم محسّن
═══════════════════════════════════════════ */
.cleanup-storage-card {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 16px;
    padding: 14px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-sizing: border-box;
    position: relative;
}

/* الصف العلوي: العنوان + زر ! */
.cleanup-card-top {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative; /* مرجع لتموضع البالون المطلق */
}

.cleanup-card-title-row {
    display: flex;
    align-items: center;
    gap: 7px;
}

.cleanup-card-title-row > svg {
    flex-shrink: 0;
    color: var(--accent-color);
    stroke: var(--accent-color);
    opacity: 0.85;
}

.cleanup-title-text {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-color-primary);
    flex: 1;
}

/* زر علامة التعجب */
.cleanup-info-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid rgba(var(--accent-rgb, 99,102,241), 0.55);
    background: rgba(var(--accent-rgb, 99,102,241), 0.1);
    color: var(--accent-color);
    font-size: 11px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
    transition: background 0.18s, transform 0.12s;
}

.cleanup-info-btn:active {
    transform: scale(0.88);
    background: rgba(var(--accent-rgb, 99,102,241), 0.25);
}

.cleanup-sub-text {
    font-size: 11.5px;
    color: var(--text-color-secondary);
    opacity: 0.65;
    margin: 0;
    padding-right: 23px; /* محاذاة مع العنوان بعد الأيقونة */
}

/* بالون المعلومات - absolute لمنع تمدد الكارت */
.cleanup-info-balloon {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 30;
    background: rgba(30, 28, 50, 0.97);
    border: 1px solid rgba(var(--accent-rgb, 99,102,241), 0.35);
    border-radius: 12px;
    padding: 10px 13px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    pointer-events: none;
    transition: max-height 0.32s cubic-bezier(0.4,0,0.2,1),
                opacity    0.22s ease,
                padding    0.28s ease;
    padding-top: 0;
    padding-bottom: 0;
}

.cleanup-info-balloon.cleanup-balloon--visible {
    max-height: 200px;
    opacity: 1;
    padding: 10px 13px;
    pointer-events: auto;
}

.cleanup-info-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: var(--text-color-secondary);
    line-height: 1.5;
    direction: rtl;
}

.cleanup-info-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent-color);
    flex-shrink: 0;
    margin-top: 5px;
    opacity: 0.8;
}

/* زر تنظيف التخزين */
.cleanup-storage-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 7px 14px;
    border-radius: 10px;
    border: 1px solid rgba(var(--accent-rgb, 99,102,241), 0.4);
    background: linear-gradient(
        135deg,
        rgba(var(--accent-rgb, 99,102,241), 0.18) 0%,
        rgba(var(--accent-rgb, 99,102,241), 0.08) 100%
    );
    color: var(--accent-color);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.3px;
    transition: background 0.2s, opacity 0.2s, transform 0.12s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(var(--accent-rgb, 99,102,241), 0.07);
}

.cleanup-storage-btn:active {
    transform: scale(0.97);
    box-shadow: none;
}

@media (hover: hover) {
    .cleanup-storage-btn:hover:not(:disabled) {
        background: linear-gradient(
            135deg,
            rgba(var(--accent-rgb, 99,102,241), 0.28) 0%,
            rgba(var(--accent-rgb, 99,102,241), 0.14) 100%
        );
    }
}

.cleanup-storage-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* أيقونة تدور عند التشغيل */
.cleanup-storage-btn.cleanup-btn--running .cleanup-btn-icon-spin {
    animation: cleanupSpin 0.8s linear infinite;
}

@keyframes cleanupSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════
   قائمة المؤثرات البصرية — وضع Landscape
   ═══════════════════════════════════════════════════════ */
@media (orientation: landscape) and (max-height: 600px) {

    /* الـ overlay يصبح flex أفقي */
    #visualizerOverlay {
        flex-direction: row;
        align-items: stretch;
        padding: 8px 12px;
        gap: 10px;
    }

    /* الحاوية تملأ العرض بالكامل */
    #visualizerModeContainer {
        flex-direction: row !important;
        align-items: stretch;
        max-width: 100% !important;
        gap: 10px;
    }

    /* الهيدر يصبح عمودياً على اليمين */
    #visualizerModeContainer .playlist-header-row {
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        writing-mode: vertical-rl;
        width: 36px;
        flex-shrink: 0;
        margin-bottom: 0;
        gap: 8px;
    }

    #visualizerModeContainer .playlist-header-row h2 {
        font-size: 13px !important;
        white-space: nowrap;
        padding: 0;
        margin: 0;
        border: none !important;
    }

    #visualizerModeContainer .playlist-header-row .header-actions {
        flex-direction: column;
        gap: 6px;
    }

    /* الشبكة: 4 أعمدة متساوية بدون فراغ */
    .vis-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        padding: 4px 0;
        overflow-y: auto;
        flex-grow: 1;
    }

    /* زر الشاشة المضيئة يمتد على كل الأعمدة */
    .vis-wakelock-row {
        grid-column: 1 / -1;
        margin-bottom: 2px;
    }

    .vis-wakelock-card {
        padding: 8px 12px;
        border-radius: 12px;
    }

    .vis-wl-label { font-size: 12px; }
    .vis-wl-sub   { font-size: 10px; }

    /* أزرار المؤثرات أصغر في landscape */
    .vis-option-btn {
        padding: 10px 6px;
        font-size: 12px;
        border-radius: 12px;
        gap: 5px;
    }

    .vis-icon-indicator {
        width: 14px;
        height: 14px;
    }
}


/* ═══════════════════════════════════════════════════════════════
   تكيف الشاشات القصيرة — max-height: 620px
   (هواتف صغيرة مثل iPhone SE، Galaxy A series الصغيرة)
   ═══════════════════════════════════════════════════════════════ */
@media (max-height: 620px) and (orientation: portrait) {

    /* تقليل هامش صورة الغلاف */
    #mediaContainer {
        margin: clamp(4px, 1vh, 8px) auto;
    }

    /* معلومات المقطع أصغر وأكثف */
    #trackInfo {
        padding: 4px 0;
    }
    #trackTitle {
        font-size: clamp(13px, 4vw, 16px) !important;
    }
    #artistName, #albumName {
        font-size: clamp(10px, 3vw, 12px) !important;
    }

    /* تقليل padding الشريط السفلي */
    #bottomSection {
        padding-top: clamp(6px, 1.2vh, 10px);
        padding-bottom: max(clamp(6px, 1.2vh, 10px), env(safe-area-inset-bottom));
    }

    /* تقليل gap أزرار التحكم الثانوية */
    #secondaryControls {
        gap: 0;
    }
}

/* ═══════════════════════════════════════════════════════════════
   تكيف الشاشات الضيقة جداً — max-width: 340px
   (هواتف عرضها < 340px مثل iPhone 4, Galaxy Mini)
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 340px) {

    #mainContent {
        padding-left: 8px;
        padding-right: 8px;
    }

    .secondary-btn {
        font-size: 18px;
    }

    #mainControls {
        gap: 10px;
    }

    #playPauseBtn {
        width: 54px;
        height: 54px;
        font-size: 20px;
    }

    /* قائمة حول: أصغر */
    .info-app-icon {
        width: 44px;
        height: 44px;
    }
    .info-app-title {
        font-size: 16px;
    }
    .info-row-item {
        padding: 8px 12px;
    }
    .info-row-label, .info-row-value, .info-row-link {
        font-size: 11px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   قائمة "حول" على الشاشات القصيرة
   ═══════════════════════════════════════════════════════════════ */
@media (max-height: 580px) {

    .info-app-card {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        padding: 0;
    }

    .info-app-icon {
        width: 38px;
        height: 38px;
        border-radius: 10px;
        flex-shrink: 0;
        margin-bottom: 0;
    }

    .info-app-icon svg {
        width: 20px;
        height: 20px;
    }

    .info-app-title {
        font-size: 15px;
    }

    .info-app-version {
        font-size: 10px;
        padding: 2px 7px;
    }

    .info-row-item {
        padding: 8px 14px;
    }

    .info-row-label, .info-row-value, .info-row-link {
        font-size: 12px;
    }

    /* تقليل التباعد داخل قائمة حول */
    #infoContent {
        gap: 8px;
        padding: 4px 0;
    }

    .mono-audio-card {
        padding: 8px 12px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   تكيف الـ Overlays العامة على الشاشات الصغيرة
   ═══════════════════════════════════════════════════════════════ */
@media (max-height: 620px) and (orientation: portrait) {

    /* جميع القوائم المنسدلة تدعم التمرير */
    .overlay {
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    /* رأس القائمة أصغر */
    .overlay h2 {
        font-size: 15px !important;
        padding-bottom: 8px !important;
        margin-bottom: 8px !important;
    }

    /* تصغير padding الـ overlay */
    .overlay-inner,
    .overlay > * {
        padding-top: 8px;
    }
}


/* ═══════════════════════════════════════════════════════════════
   وضع السريع (Lite Mode) — تعطيل كل التأثيرات المكلفة
   يُفعَّل بإضافة class="wardio-lite" على <body>
   ═══════════════════════════════════════════════════════════════ */
body.wardio-lite *,
body.wardio-lite *::before,
body.wardio-lite *::after {
    transition: none !important;
    animation: none !important;
}

body.wardio-lite #coverArt,
body.wardio-lite #defaultIcon {
    transform: none !important;
    filter: none !important;
    will-change: auto !important;
}

body.wardio-lite #mediaContainer {
    box-shadow: 0 2px 8px rgba(0,0,0,0.4) !important;
    will-change: auto !important;
    transition: none !important;
}

body.wardio-lite .overlay,
body.wardio-lite #bottomSection,
body.wardio-lite .toast-message,
body.wardio-lite .tutorial-overlay {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.wardio-lite .overlay {
    background: rgba(15, 14, 26, 0.97) !important;
}

body.wardio-lite #audioCanvas {
    display: none !important;
}

/* في وضع السريع: حاوية النص بدون mask وبدون overflow مخفي (الـ JS يتولى العنصر مباشرة) */
body.wardio-lite .scroll-container {
    mask-image: none !important;
    -webkit-mask-image: none !important;
    text-align: start !important;
    overflow: visible !important;
    width: 95% !important;
}

/* إيقاف أي أنيميشن متبقٍّ على marquee-active (حماية إضافية) */
body.wardio-lite .marquee-active {
    animation: none !important;
    transform: translateX(0) !important;
}

body.wardio-lite .playlist-item,
body.wardio-lite .control-btn,
body.wardio-lite button {
    will-change: auto !important;
}

/* زر وضع الخفة في حالة التفعيل */
.lite-mode-btn.active {
    background: var(--accent-color) !important;
    color: #fff !important;
}

/* ═══════════════════════════════════════════════════════════════
   قائمة الإعدادات السريعة (Quick Settings Dropdown) — نافذة حول
   ═══════════════════════════════════════════════════════════════ */
.quick-settings-btn {
    background: none;
    border: none;
    color: var(--text-color-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}
.quick-settings-btn:active,
.quick-settings-btn.qs-open {
    background: var(--surface-color);
    color: var(--accent-color);
}

/* الحاوية الخارجية للقائمة المنسدلة */
.qs-dropdown-wrap {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: auto;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
    transform-origin: top right;
    transition: opacity 0.18s ease, transform 0.18s ease;
}
.qs-dropdown-wrap.open {
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0) scale(1);
}

.qs-dropdown {
    background: var(--overlay-color, #1a1828);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 6px;
    min-width: 200px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.55);
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.qs-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: none;
    background: none;
    color: var(--text-color-primary);
    font-size: 13.5px;
    font-family: inherit;
    cursor: pointer;
    text-align: right;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease;
    white-space: nowrap;
}
.qs-item:active,
.qs-item:hover {
    background: rgba(255,255,255,0.07);
}
.qs-item svg {
    flex-shrink: 0;
    color: var(--text-color-secondary, #aaa);
}
.qs-item.qs-active svg,
.qs-item.qs-active {
    color: var(--accent-color);
}
.qs-item .qs-badge {
    margin-right: auto;
    font-size: 11px;
    background: var(--accent-color);
    color: #fff;
    border-radius: 6px;
    padding: 1px 6px;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s, transform 0.2s;
}
.qs-item.qs-active .qs-badge {
    opacity: 1;
    transform: scale(1);
}
.qs-divider {
    height: 1px;
    background: rgba(255,255,255,0.07);
    margin: 3px 4px;
}


/* ═══════════════════════════════════════════════════════════
   أنيميشن الغلاف — تم الحذف (لا animation على mediaContainer)
   ═══════════════════════════════════════════════════════════ */

/* body.is-playing #mediaContainer — لا animation */

body.wardio-lite #mediaContainer,
body.wardio-lite.is-playing #mediaContainer {
    animation: none !important;
}
