/* =============================================
   قضايا بسيطة — واجهة تيك توك (سوايب عمودي)
   Approach: one slide visible at a time (display toggle)
   ============================================= */

/* ===== قفل الصفحة ===== */
html, body, .qmf-body {
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    height: 100% !important;
    width: 100% !important;
    background: #0a0a0a !important;
    touch-action: none;
    overscroll-behavior: none;
}

/* ===== الحاوية الرئيسية ===== */
.qmf {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
    background: #0a0a0a;
    overflow: hidden;
    direction: rtl;
    font-family: 'Tajawal', 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

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

.qmf-container {
    width: 100%;
    height: 100%;
    position: relative;
}

/* ===== شريحة القضية الواحدة ===== */
.qmf-slide {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: none;               /* مخفية بالافتراض */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px 80px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.qmf-slide.active {
    display: flex;               /* الشريحة الحالية فقط مرئية */
}

/* انتقال الظهور */
.qmf-slide.slide-in-up {
    animation: qmf-slideInUp 0.35s ease forwards;
}
.qmf-slide.slide-in-down {
    animation: qmf-slideInDown 0.35s ease forwards;
}

@keyframes qmf-slideInUp {
    from { transform: translateY(60px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
@keyframes qmf-slideInDown {
    from { transform: translateY(-60px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

.qmf-slide-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 0;
}

/* خلفيات متنوعة */
.qmf-slide[data-theme="0"] .qmf-slide-bg { background: linear-gradient(160deg, #0f172a 0%, #1e1b4b 40%, #312e81 100%); }
.qmf-slide[data-theme="1"] .qmf-slide-bg { background: linear-gradient(160deg, #0c0a09 0%, #292524 40%, #44403c 100%); }
.qmf-slide[data-theme="2"] .qmf-slide-bg { background: linear-gradient(160deg, #0f172a 0%, #0f766e 40%, #134e4a 100%); }
.qmf-slide[data-theme="3"] .qmf-slide-bg { background: linear-gradient(160deg, #18181b 0%, #3f3f46 40%, #27272a 100%); }
.qmf-slide[data-theme="4"] .qmf-slide-bg { background: linear-gradient(160deg, #1a1a2e 0%, #16213e 40%, #0f3460 100%); }
.qmf-slide[data-theme="5"] .qmf-slide-bg { background: linear-gradient(160deg, #0d0d0d 0%, #1a0000 40%, #330000 100%); }
.qmf-slide[data-theme="6"] .qmf-slide-bg { background: linear-gradient(160deg, #0a0a23 0%, #1b1b3a 40%, #2d2d5e 100%); }
.qmf-slide[data-theme="7"] .qmf-slide-bg { background: linear-gradient(160deg, #0f0f0f 0%, #1a1a2e 40%, #0f3443 100%); }

.qmf-slide-bg::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.03) 0%, transparent 60%),
                radial-gradient(circle at 80% 80%, rgba(255,255,255,0.02) 0%, transparent 50%);
}

/* ===== المحتوى ===== */
.qmf-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 500px;
    text-align: center;
}

.qmf-emoji {
    font-size: 48px;
    margin-bottom: 12px;
    animation: qmf-float 3s ease-in-out infinite;
}

@keyframes qmf-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.qmf-type-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.15);
    margin-bottom: 12px;
}

.qmf-title {
    font-size: 19px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 10px;
    line-height: 1.4;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.qmf-text {
    font-size: 15px;
    line-height: 1.7;
    color: rgba(255,255,255,0.85);
    margin-bottom: 24px;
    padding: 0 8px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* ===== الخيارات ===== */
.qmf-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.qmf-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 14px;
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.12);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}

.qmf-option:active { transform: scale(0.97); }

.qmf-option-letter {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.qmf-option-text {
    flex: 1;
    text-align: right;
}

.qmf-option.disabled { pointer-events: none; cursor: default; }

.qmf-option.correct {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
}
.qmf-option.correct .qmf-option-letter {
    background: #10b981;
    color: #fff;
}

.qmf-option.wrong {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}
.qmf-option.wrong .qmf-option-letter {
    background: #ef4444;
    color: #fff;
}

.qmf-option.not-selected { opacity: 0.4; }

/* ===== التعليل ===== */
.qmf-explanation {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    font-size: 13px;
    line-height: 1.7;
    color: rgba(255,255,255,0.75);
    text-align: right;
    display: none;
    animation: qmf-fadeUp 0.4s ease;
}

.qmf-explanation.show { display: block; }

/* ===== عداد الوقت التصاعدي ===== */
.qmf-timer-up {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 50px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    margin-bottom: 12px;
    font-size: 15px;
    color: #4ade80;
    position: relative;
    transition: all 0.3s ease;
}
.qmf-timer-icon {
    font-size: 14px;
}
.qmf-timer-seconds {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 20px;
    text-align: center;
}
.qmf-timer-unit {
    font-size: 12px;
    opacity: 0.7;
}
.qmf-timer-up.warn {
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.3);
    background: rgba(251, 191, 36, 0.08);
}
.qmf-timer-up.danger {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.08);
    animation: qmf-timerPulse 0.8s ease-in-out infinite alternate;
}

/* زر علامة الاستفهام */
.qmf-timer-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.5);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    margin-right: 4px;
    padding: 0;
    line-height: 1;
    transition: all 0.2s;
}
.qmf-timer-help:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-color: rgba(255,255,255,0.4);
}

/* شرح عائم */
.qmf-timer-tooltip {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 15, 35, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 13px;
    line-height: 1.6;
    color: rgba(255,255,255,0.85);
    white-space: normal;
    width: 260px;
    text-align: center;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.qmf-timer-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background: rgba(15, 15, 35, 0.95);
    border-left: 1px solid rgba(255,255,255,0.15);
    border-top: 1px solid rgba(255,255,255,0.15);
}
.qmf-timer-tooltip.show {
    display: block;
    animation: qmf-tooltipIn 0.2s ease-out;
}
.qmf-timer-tooltip strong {
    color: #fbbf24;
}

@keyframes qmf-tooltipIn {
    from { opacity: 0; transform: translateX(-50%) translateY(6px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes qmf-timerPulse {
    from { opacity: 0.7; }
    to   { opacity: 1; }
}

/* ===== زر التالي ===== */
.qmf-next-btn {
    display: none;
    margin: 16px auto 0;
    padding: 12px 36px;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    animation: qmf-fadeUp 0.4s ease;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    font-family: inherit;
}

.qmf-next-btn:active {
    transform: scale(0.95);
}

.qmf-next-btn:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

@keyframes qmf-fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== شريط الأكشنز السفلي ===== */
.qmf-actions {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 100;
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 36px;
    align-items: center;
    padding: 10px 20px;
    padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.3) 60%, transparent 100%);
}

.qmf-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255,255,255,0.7);
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    padding: 4px;
}

.qmf-action-btn:active { transform: scale(0.85); }

.qmf-action-btn svg {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    transition: all 0.2s ease;
}

.qmf-like.active { color: #ef4444; }
.qmf-like.active svg { fill: #ef4444; stroke: #ef4444; }

.qmf-dislike.active { color: #60a5fa; }
.qmf-dislike.active svg { fill: #60a5fa; stroke: #60a5fa; }

.qmf-action-count {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.6);
}

/* ===== عداد التقدم ===== */
.qmf-progress {
    position: fixed;
    top: 12px; right: 12px;
    z-index: 100;
    padding: 5px 12px;
    border-radius: 20px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    font-weight: 600;
}

/* ===== زر الخروج ===== */
.qmf-close {
    position: fixed;
    top: 12px; left: 12px;
    z-index: 100;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== شاشة التحميل ===== */
.qmf-loader {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0a0a0a;
    z-index: 50;
    transition: opacity 0.4s ease;
}

.qmf-loader.hidden {
    opacity: 0;
    pointer-events: none;
    display: none;
}

.qmf-loader-icon {
    font-size: 48px;
    animation: qmf-pulse 1.5s ease-in-out infinite;
}

.qmf-loader-text {
    color: rgba(255,255,255,0.5);
    font-size: 14px;
    margin-top: 12px;
}

@keyframes qmf-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.7; }
}

/* ===== مؤشر السوايب ===== */
.qmf-swipe-hint {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 80;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: rgba(255,255,255,0.35);
    font-size: 11px;
    animation: qmf-hintBounce 2s ease-in-out infinite;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.qmf-swipe-hint.hidden { opacity: 0; }

@keyframes qmf-hintBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-8px); }
}

/* ===== بوب-أب النقاط ===== */
.qmf-points-popup {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 200;
    font-size: 48px;
    font-weight: 800;
    color: #34d399;
    text-shadow: 0 4px 20px rgba(16, 185, 129, 0.5);
    pointer-events: none;
    opacity: 0;
}

.qmf-points-popup.show {
    animation: qmf-pointsIn 1s ease forwards;
}

@keyframes qmf-pointsIn {
    0%   { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    30%  { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
    60%  { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -60%) scale(0.8); opacity: 0; }
}

/* ===== شاشة انتهاء القضايا ===== */
.qmf-end {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #fff;
    padding: 40px;
}

.qmf-end-emoji { font-size: 64px; margin-bottom: 16px; }
.qmf-end-title { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.qmf-end-stats { color: rgba(255,255,255,0.6); font-size: 14px; line-height: 1.8; margin-bottom: 24px; }
.qmf-end-btn {
    padding: 12px 32px;
    border-radius: 30px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    border: none;
    cursor: pointer;
}

/* ===== ريسبونسف ===== */
    .qmf-title { font-size: 22px; }
    .qmf-text { font-size: 16px; }
    .qmf-option { padding: 16px 22px; font-size: 16px; }
    .qmf-actions { gap: 48px; }
}

/* =============================================
   نظام التحفيز (Gamification)
   ============================================= */

/* ===== شريط HUD العلوي ===== */
.qmf-hud {
    position: fixed;
    top: 12px;
    left: 54px;
    right: 54px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 24px;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.08);
    transition: opacity 0.4s ease;
}

.qmf-hud.hidden { opacity: 0; pointer-events: none; }

.qmf-hud-rank {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.qmf-rank-icon { font-size: 18px; }
.qmf-rank-name {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,0.85);
    white-space: nowrap;
}

.qmf-hud-bar {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.1);
    overflow: hidden;
    min-width: 40px;
}

.qmf-hud-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899);
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

.qmf-hud-points {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
    color: #fbbf24;
    text-shadow: 0 1px 4px rgba(251, 191, 36, 0.3);
}

/* ===== عداد السلسلة ===== */
.qmf-streak {
    position: fixed;
    top: 54px;
    right: 12px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 20px;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: rgba(255,255,255,0.5);
    font-size: 14px;
    font-weight: 700;
    transition: all 0.3s ease;
    opacity: 0.5;
}

.qmf-streak.active {
    opacity: 1;
    color: #fb923c;
    background: rgba(251, 146, 60, 0.15);
    border: 1px solid rgba(251, 146, 60, 0.25);
}

.qmf-streak.hot {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.2);
}

.qmf-streak.fire {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.3);
    box-shadow: 0 0 16px rgba(251, 191, 36, 0.25);
    animation: qmf-fireGlow 1s ease-in-out infinite alternate;
}

@keyframes qmf-fireGlow {
    from { box-shadow: 0 0 12px rgba(251, 191, 36, 0.2); }
    to   { box-shadow: 0 0 20px rgba(251, 191, 36, 0.4); }
}

.qmf-streak.bump {
    animation: qmf-streakBump 0.35s ease;
}

@keyframes qmf-streakBump {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.25); }
    100% { transform: scale(1); }
}

.qmf-streak.lost {
    animation: qmf-streakLost 0.6s ease;
    color: #ef4444;
}

@keyframes qmf-streakLost {
    0%   { transform: scale(1); opacity: 1; }
    30%  { transform: scale(1.2) rotate(-5deg); opacity: 1; }
    60%  { transform: scale(0.9) rotate(3deg); opacity: 0.6; }
    100% { transform: scale(1) rotate(0); opacity: 0.5; }
}

.qmf-streak-fire { font-size: 16px; }
.qmf-streak.hidden { opacity: 0; pointer-events: none; }

/* ===== المضاعف ===== */
.qmf-multiplier {
    position: fixed;
    top: 54px;
    left: 12px;
    z-index: 100;
    padding: 5px 12px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
    border: 1px solid rgba(168, 85, 247, 0.3);
    font-size: 15px;
    font-weight: 800;
    color: #c084fc;
    text-shadow: 0 0 8px rgba(192, 132, 252, 0.4);
    transition: all 0.3s ease;
}

.qmf-multiplier.hidden { opacity: 0; pointer-events: none; }

.qmf-multiplier.bump {
    animation: qmf-multiBump 0.4s ease;
}

@keyframes qmf-multiBump {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.35) rotate(-3deg); }
    100% { transform: scale(1); }
}

/* ===== احتفال الترقية ===== */
.qmf-levelup {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0);
    z-index: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 28px 36px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 2px solid rgba(251, 191, 36, 0.4);
    pointer-events: none;
    opacity: 0;
}

.qmf-levelup.hidden { display: none; }

.qmf-levelup.animate {
    display: flex;
    animation: qmf-levelUpIn 2.5s ease forwards;
}

@keyframes qmf-levelUpIn {
    0%   { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    15%  { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
    25%  { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    75%  { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
}

.qmf-levelup-icon { font-size: 44px; }
.qmf-levelup-text {
    font-size: 18px;
    font-weight: 800;
    color: #fbbf24;
    text-shadow: 0 2px 10px rgba(251, 191, 36, 0.5);
}
.qmf-levelup-rank {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

/* ===== شاشة النهاية المحسّنة ===== */
.qmf-end-rank {
    font-size: 18px;
    font-weight: 700;
    color: #fbbf24;
    margin-bottom: 20px;
    text-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
}

.qmf-end-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    max-width: 320px;
    margin-bottom: 16px;
}

.qmf-stat-card {
    padding: 14px 10px;
    border-radius: 14px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    text-align: center;
}

.qmf-stat-value {
    font-size: 26px;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
}

.qmf-stat-label {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    margin-top: 4px;
}

.qmf-end-total {
    font-size: 13px;
    color: rgba(255,255,255,0.45);
    margin-bottom: 20px;
}

/* تكيّف عداد التقدم مع HUD */
.qmf-progress {
    top: auto;
    bottom: 65px;
    right: 12px;
}

/* ===== Admin FAB (زر عائم للأدمن) ===== */
.qmf-admin-fab {
    position: absolute;
    bottom: 90px;
    left: 16px;
    z-index: 100;
    direction: rtl;
}

.qmf-fab-toggle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.85);
    border: 2px solid rgba(255,255,255,0.2);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    transition: transform 0.25s, background 0.25s, box-shadow 0.25s;
    backdrop-filter: blur(8px);
}

.qmf-fab-toggle:hover {
    transform: scale(1.1);
    background: rgba(220, 38, 38, 1);
}

.qmf-admin-fab.open .qmf-fab-toggle {
    transform: rotate(45deg);
    background: rgba(100, 100, 100, 0.85);
}

/* القائمة */
.qmf-fab-menu {
    position: absolute;
    bottom: 56px;
    left: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.9);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}

.qmf-admin-fab.open .qmf-fab-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.qmf-fab-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    background: rgba(20, 20, 30, 0.92);
    color: #fff;
    font-size: 13px;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    white-space: nowrap;
    backdrop-filter: blur(16px);
    transition: background 0.2s, transform 0.15s, border-color 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.qmf-fab-item:hover {
    transform: translateX(-4px);
    background: rgba(30, 30, 50, 0.95);
}

.qmf-fab-item svg {
    flex-shrink: 0;
}

/* ألوان مختلفة لكل زر */
.qmf-fab-edit { border-color: rgba(59, 130, 246, 0.4); }
.qmf-fab-edit:hover { background: rgba(59, 130, 246, 0.2); border-color: rgba(59, 130, 246, 0.6); }
.qmf-fab-edit svg { stroke: #60a5fa; }

.qmf-fab-ai { border-color: rgba(168, 85, 247, 0.4); }
.qmf-fab-ai:hover { background: rgba(168, 85, 247, 0.2); border-color: rgba(168, 85, 247, 0.6); }
.qmf-fab-ai svg { stroke: #c084fc; }

.qmf-fab-unpublish { border-color: rgba(239, 68, 68, 0.4); }
.qmf-fab-unpublish:hover { background: rgba(239, 68, 68, 0.2); border-color: rgba(239, 68, 68, 0.6); }
.qmf-fab-unpublish svg { stroke: #f87171; }

/* حالة التحميل */
.qmf-admin-fab.loading .qmf-fab-toggle {
    animation: qmf-fab-pulse 1s infinite;
}

@keyframes qmf-fab-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.5); }
    50% { box-shadow: 0 0 0 10px rgba(168, 85, 247, 0); }
}

.qmf-fab-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #c084fc;
    border-radius: 50%;
    animation: qmf-spin 0.6s linear infinite;
}

@keyframes qmf-spin {
    to { transform: rotate(360deg); }
}

/* أنيميشن الإزالة */
.qmf-slide-removed {
    animation: qmf-slide-remove 0.4s ease forwards;
}

@keyframes qmf-slide-remove {
    to { transform: translateX(-100%); opacity: 0; }
}

/* التوست */
.qmf-admin-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(20, 20, 30, 0.95);
    color: #fff;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-family: 'Tajawal', sans-serif;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.qmf-admin-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== موبايل ===== */
@media (max-width: 480px) {
    .qmf-admin-fab {
        bottom: 75px;
        left: 10px;
    }
    .qmf-fab-toggle {
        width: 40px;
        height: 40px;
    }
    .qmf-fab-item {
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* ===== مودال تحسين الذكاء الاصطناعي ===== */
.qmf-ai-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s;
    direction: rtl;
    font-family: 'Tajawal', sans-serif;
}

.qmf-ai-modal.show {
    opacity: 1;
}

.qmf-ai-modal-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(6px);
}

.qmf-ai-modal-box {
    position: relative;
    width: 92%;
    max-width: 420px;
    background: linear-gradient(160deg, #1a1a2e 0%, #16213e 100%);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 40px rgba(168, 85, 247, 0.1);
    transform: translateY(20px) scale(0.95);
    transition: transform 0.25s;
}

.qmf-ai-modal.show .qmf-ai-modal-box {
    transform: translateY(0) scale(1);
}

.qmf-ai-modal-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.qmf-ai-modal-icon {
    font-size: 22px;
}

.qmf-ai-modal-title {
    flex: 1;
    font-size: 16px;
    font-weight: 700;
    color: #e2e8f0;
}

.qmf-ai-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.6);
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qmf-ai-modal-close:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.qmf-ai-modal-body {
    padding: 20px;
}

.qmf-ai-modal-label {
    display: block;
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 10px;
}

.qmf-ai-modal-textarea {
    width: 100%;
    min-height: 100px;
    padding: 14px 16px;
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: 14px;
    background: rgba(0,0,0,0.3);
    color: #e2e8f0;
    font-size: 14px;
    font-family: 'Tajawal', sans-serif;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    direction: rtl;
    line-height: 1.7;
}

.qmf-ai-modal-textarea::placeholder {
    color: rgba(255,255,255,0.3);
}

.qmf-ai-modal-textarea:focus {
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.12);
}

.qmf-ai-modal-footer {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    justify-content: flex-start;
}

.qmf-ai-modal-cancel {
    padding: 10px 20px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    background: transparent;
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.qmf-ai-modal-cancel:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.qmf-ai-modal-submit {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
    box-shadow: 0 4px 16px rgba(168, 85, 247, 0.3);
}

.qmf-ai-modal-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.4);
}

.qmf-ai-modal-submit:disabled {
    opacity: 0.7;
    cursor: wait;
    transform: none;
}

@media (max-width: 480px) {
    .qmf-ai-modal-box {
        width: 96%;
        border-radius: 16px;
    }
    .qmf-ai-modal-header {
        padding: 14px 16px;
    }
    .qmf-ai-modal-body {
        padding: 16px;
    }
    .qmf-ai-modal-footer {
        padding: 14px 16px;
    }
}

/* =============================================
   نظام التعليقات — درج تيك توك
   ============================================= */

/* === خلفية معتمة === */
.qmf-comments-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.qmf-comments-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

/* === الدرج === */
.qmf-comments-drawer {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    max-height: 70vh;
    min-height: 300px;
    background: #1a1a2e;
    border-radius: 16px 16px 0 0;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    direction: rtl;
    font-family: 'Tajawal', sans-serif;
}
.qmf-comments-drawer.open {
    transform: translateY(0);
}

/* === رأس الدرج === */
.qmf-comments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.qmf-comments-title {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
}
.qmf-comments-count {
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    margin-right: 6px;
}
.qmf-comments-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.qmf-comments-close:hover {
    color: #fff;
}

/* === قائمة التعليقات === */
.qmf-comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
.qmf-comments-list::-webkit-scrollbar { width: 3px; }
.qmf-comments-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

.qmf-comments-empty {
    text-align: center;
    color: rgba(255,255,255,0.4);
    padding: 40px 20px;
    font-size: 14px;
}

/* === تعليق واحد === */
.qmf-comment {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    animation: qmf-commentIn 0.3s ease;
}
@keyframes qmf-commentIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.qmf-comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.qmf-comment-body {
    flex: 1;
    min-width: 0;
}

.qmf-comment-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}

.qmf-comment-name {
    color: rgba(255,255,255,0.65);
    font-size: 13px;
    font-weight: 600;
}

.qmf-comment-time {
    color: rgba(255,255,255,0.35);
    font-size: 11px;
}

.qmf-comment-text {
    color: #fff;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.qmf-comment-sticker {
    display: block;
    max-width: 100px;
    max-height: 100px;
    margin-top: 4px;
}

.qmf-comment-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 6px;
}

.qmf-comment-like-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.45);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0;
}
.qmf-comment-like-btn:hover,
.qmf-comment-like-btn.liked {
    color: #fe2c55;
}
.qmf-comment-like-btn svg {
    width: 14px;
    height: 14px;
}

.qmf-comment-reply-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.45);
    font-size: 12px;
    cursor: pointer;
    padding: 0;
}
.qmf-comment-reply-btn:hover {
    color: rgba(255,255,255,0.7);
}

.qmf-comment-delete-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.25);
    font-size: 12px;
    cursor: pointer;
    padding: 0;
}
.qmf-comment-delete-btn:hover {
    color: #fe2c55;
}

/* === الردود === */
.qmf-replies {
    margin-top: 10px;
    padding-right: 20px;
    border-right: 2px solid rgba(255,255,255,0.06);
}
.qmf-replies .qmf-comment {
    margin-bottom: 12px;
}
.qmf-replies .qmf-comment-avatar {
    width: 28px;
    height: 28px;
}
.qmf-show-more-replies {
    background: none;
    border: none;
    color: rgba(255,255,255,0.45);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 0;
}
.qmf-show-more-replies:hover {
    color: rgba(255,255,255,0.7);
}

/* === تحميل المزيد === */
.qmf-comments-load-more {
    display: block;
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: none;
    border-radius: 8px;
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    padding: 10px;
    cursor: pointer;
    margin-top: 8px;
    font-family: 'Tajawal', sans-serif;
}
.qmf-comments-load-more:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

/* === صندوق الكتابة === */
.qmf-comments-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: #16162a;
    flex-shrink: 0;
}

.qmf-comments-input {
    flex: 1;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    color: #fff;
    font-size: 14px;
    padding: 9px 16px;
    outline: none;
    font-family: 'Tajawal', sans-serif;
    resize: none;
    max-height: 80px;
    min-height: 38px;
    line-height: 1.4;
}
.qmf-comments-input::placeholder { color: rgba(255,255,255,0.35); }
.qmf-comments-input:focus {
    border-color: rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.12);
}

.qmf-comments-emoji-btn,
.qmf-comments-sticker-btn {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    color: rgba(255,255,255,0.5);
    flex-shrink: 0;
}
.qmf-comments-emoji-btn:hover,
.qmf-comments-sticker-btn:hover {
    color: #fff;
}

.qmf-comments-send-btn {
    background: #fe2c55;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.2s;
}
.qmf-comments-send-btn:disabled {
    opacity: 0.4;
    cursor: default;
}
.qmf-comments-send-btn svg {
    width: 18px;
    height: 18px;
    color: #fff;
    transform: scaleX(-1);
}

/* === الرد على تعليق (بار صغير فوق الإدخال) === */
.qmf-reply-bar {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.04);
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    flex-shrink: 0;
}
.qmf-reply-bar.visible {
    display: flex;
}
.qmf-reply-bar-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    margin-right: auto;
}

/* === لوحة الاستيكرات === */
.qmf-sticker-panel {
    display: none;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px 14px;
    background: #16162a;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.qmf-sticker-panel.visible {
    display: block;
}
.qmf-sticker-pack-title {
    color: rgba(255,255,255,0.5);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    margin-top: 10px;
}
.qmf-sticker-pack-title:first-child {
    margin-top: 0;
}
.qmf-sticker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
}
.qmf-sticker-item {
    cursor: pointer;
    background: rgba(255,255,255,0.06);
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, transform 0.15s;
    aspect-ratio: 1;
}
.qmf-sticker-item:hover {
    border-color: rgba(255,255,255,0.2);
    transform: scale(1.08);
}
.qmf-sticker-item.selected {
    border-color: #fe2c55;
}
.qmf-sticker-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* === لوحة الإيموجي === */
.qmf-emoji-panel {
    display: none;
    max-height: 180px;
    overflow-y: auto;
    padding: 10px 14px;
    background: #16162a;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.qmf-emoji-panel.visible {
    display: block;
}
.qmf-emoji-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.qmf-emoji-item {
    cursor: pointer;
    font-size: 24px;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.15s, transform 0.15s;
    line-height: 1;
}
.qmf-emoji-item:hover {
    background: rgba(255,255,255,0.1);
    transform: scale(1.2);
}

/* === تحميل مؤشر === */
.qmf-comments-spinner {
    text-align: center;
    padding: 20px;
    color: rgba(255,255,255,0.4);
    font-size: 13px;
}

/* === استيكر مرفق === */
.qmf-attached-sticker {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(255,255,255,0.04);
    flex-shrink: 0;
}
.qmf-attached-sticker.visible {
    display: flex;
}
.qmf-attached-sticker img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}
.qmf-attached-sticker-remove {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    font-size: 16px;
}

/* === ريسبونسف === */
    .qmf-comments-drawer.open {
        transform: translateX(-50%) translateY(0);
    }
}

/* ==== وضع الشافل: حيز خاص لأزرار الإعجاب والمشاركة ==== */
.qmf-embedded .qmf-container,
.qcwf-embedded .qcwf-container {
    height: 100vh !important;
    padding-bottom: 0 !important;
}

.qmf-embedded .qmf-hud,
.qmf-embedded .qmf-streak,
.qmf-embedded .qmf-multiplier,
.qmf-embedded .qmf-comment-action {
    display: none !important;
}

.qmf-embedded .qmf-slide,
.qcwf-embedded .qcwf-card {
    padding-bottom: 86px !important;
    scrollbar-width: none;
}
.qmf-embedded .qmf-slide::-webkit-scrollbar,
.qcwf-embedded .qcwf-card::-webkit-scrollbar,
.qcwf-embedded .qcwf-text::-webkit-scrollbar {
    display: none;
}

.qmf-embedded .qmf-actions,
.qcwf-embedded .qcwf-actions {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    height: 68px !important;
    background: #0a0a0a !important;
    border-top: 1px solid rgba(255,255,255,0.08) !important;
    padding: 0 20px !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 40px !important;
    z-index: 9999 !important;
}

.qmf-embedded .qmf-emoji { font-size: clamp(30px, 8vh, 48px) !important; margin-bottom: 8px !important; }
.qmf-embedded .qmf-title { font-size: clamp(16px, 4.4vh, 19px) !important; margin-bottom: 8px !important; }
.qmf-embedded .qmf-text { font-size: clamp(13px, 3.6vh, 15px) !important; line-height: 1.55 !important; margin-bottom: 14px !important; }
.qmf-embedded .qmf-options { gap: 8px !important; }
.qmf-embedded .qmf-option { min-height: 44px !important; padding: 10px 14px !important; font-size: 14px !important; }

@media (max-height: 560px) {
    .qmf-embedded .qmf-actions,
    .qcwf-embedded .qcwf-actions {
        left: auto !important;
        right: 18px !important;
        bottom: auto !important;
        top: 50% !important;
        width: 68px !important;
        height: auto !important;
        min-height: 168px !important;
        transform: translateY(-50%) !important;
        flex-direction: column !important;
        gap: 10px !important;
        padding: 10px 6px !important;
        border-top: 1px solid rgba(255,255,255,0.08) !important;
        border-radius: 28px !important;
        background: rgba(8,8,8,0.76) !important;
        backdrop-filter: blur(10px) !important;
    }
    .qmf-embedded .qmf-slide,
    .qcwf-embedded .qcwf-card {
        padding: 26px clamp(92px, 15vw, 132px) 22px !important;
    }
    .qmf-embedded .qmf-action-btn,
    .qcwf-embedded .qcwf-action-btn { min-width: 52px !important; min-height: 44px !important; }
}

@media (max-width: 380px) {
    .qmf-embedded .qmf-actions,
    .qcwf-embedded .qcwf-actions {
        padding: 0 10px !important;
        gap: 20px !important;
    }
}
