/* --- CSS Custom Variables --- */
:root {
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #dbeafe 100%);
    --viewport-bg: rgba(255, 255, 255, 0.55);
    --glass-card: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(30, 58, 138, 0.15);
    --glass-hover: rgba(255, 255, 255, 0.95);
    --primary: #1e3a8a;
    --primary-hover: #1e40af;
    --primary-glow: rgba(30, 58, 138, 0.25);
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --accent-yellow: #eab308;
    --accent-cyan: #38bdf8;
    --accent-purple: #8b5cf6;
    --accent-pink: #ec4899;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --nav-bg: rgba(255, 255, 255, 0.92);
    --nav-border: rgba(30, 58, 138, 0.18);
    --input-bg: rgba(255, 255, 255, 0.9);
    --reader-bg: rgba(255, 255, 255, 0.98);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 12px;

    --card-stories-bg: linear-gradient(135deg, rgba(219, 234, 254, 0.85), rgba(245, 158, 11, 0.1));
    --card-stories-border: rgba(245, 158, 11, 0.35);
    --card-quran-bg: linear-gradient(135deg, rgba(209, 250, 229, 0.85), rgba(56, 189, 248, 0.12));
    --card-quran-border: rgba(16, 185, 129, 0.35);
    --card-adventures-bg: linear-gradient(135deg, rgba(254, 243, 199, 0.85), rgba(251, 191, 36, 0.25));
    --card-adventures-border: rgba(245, 158, 11, 0.5);
    --card-wheel-bg: linear-gradient(135deg, rgba(253, 230, 138, 0.4), rgba(244, 114, 182, 0.18));
    --card-wheel-border: rgba(245, 158, 11, 0.5);

    --m-btn-1-bg: rgba(30, 58, 138, 0.07); --m-btn-1-border: rgba(30, 58, 138, 0.25);
    --m-btn-2-bg: rgba(245, 158, 11, 0.08); --m-btn-2-border: rgba(245, 158, 11, 0.3);
    --m-btn-3-bg: rgba(56, 189, 248, 0.1); --m-btn-3-border: rgba(56, 189, 248, 0.35);
    --m-btn-4-bg: rgba(16, 185, 129, 0.08); --m-btn-4-border: rgba(16, 185, 129, 0.3);
}

/* --- ثيمات التطبيق الملكية --- */
body.theme-gold {
    --bg-gradient: linear-gradient(135deg, #451a03 0%, #78350f 50%, #b45309 100%);
    --viewport-bg: rgba(69, 26, 3, 0.5);
    --glass-card: rgba(254, 243, 199, 0.12);
    --glass-border: rgba(245, 158, 11, 0.4);
    --primary: #fbbf24;
    --primary-glow: rgba(251, 191, 36, 0.4);
    --text-main: #fffbeb;
    --text-muted: #fde68a;
    --nav-bg: rgba(120, 53, 15, 0.95);
    --input-bg: rgba(254, 243, 199, 0.15);
    --reader-bg: rgba(254, 243, 199, 0.95);
}

body.theme-purple {
    --bg-gradient: linear-gradient(135deg, #2e1065 0%, #581c87 50%, #6b21a8 100%);
    --viewport-bg: rgba(46, 16, 101, 0.5);
    --glass-card: rgba(237, 233, 254, 0.12);
    --glass-border: rgba(167, 139, 250, 0.4);
    --primary: #c084fc;
    --primary-glow: rgba(192, 132, 252, 0.4);
    --text-main: #faf5ff;
    --text-muted: #ddd6fe;
    --nav-bg: rgba(88, 28, 135, 0.95);
    --input-bg: rgba(237, 233, 254, 0.15);
    --reader-bg: rgba(237, 233, 254, 0.95);
}

body.theme-emerald {
    --bg-gradient: linear-gradient(135deg, #064e3b 0%, #065f46 50%, #047857 100%);
    --viewport-bg: rgba(6, 78, 59, 0.5);
    --glass-card: rgba(209, 250, 229, 0.12);
    --glass-border: rgba(52, 211, 153, 0.4);
    --primary: #34d399;
    --primary-glow: rgba(52, 211, 153, 0.4);
    --text-main: #ecfdf5;
    --text-muted: #a7f3d0;
    --nav-bg: rgba(6, 95, 70, 0.95);
    --input-bg: rgba(209, 250, 229, 0.15);
    --reader-bg: rgba(209, 250, 229, 0.95);
}

body.theme-cyberpunk {
    --bg-gradient: linear-gradient(135deg, #030712 0%, #111827 50%, #1f2937 100%);
    --viewport-bg: rgba(3, 7, 18, 0.7);
    --glass-card: rgba(31, 41, 55, 0.5);
    --glass-border: rgba(236, 72, 153, 0.5);
    --primary: #f43f5e;
    --primary-glow: rgba(244, 63, 94, 0.6);
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --nav-bg: rgba(17, 24, 39, 0.95);
    --input-bg: rgba(255, 255, 255, 0.1);
    --reader-bg: rgba(31, 41, 55, 0.95);
}

body.theme-royal-night {
    --bg-gradient: linear-gradient(135deg, #020617 0%, #0f172a 50%, #1e1b4b 100%);
    --viewport-bg: rgba(2, 6, 23, 0.6);
    --glass-card: rgba(30, 27, 75, 0.35);
    --glass-border: rgba(99, 102, 241, 0.4);
    --primary: #818cf8;
    --primary-glow: rgba(129, 140, 248, 0.5);
    --text-main: #e0e7ff;
    --text-muted: #a5b4fc;
    --nav-bg: rgba(15, 23, 42, 0.95);
    --input-bg: rgba(255, 255, 255, 0.1);
    --reader-bg: rgba(30, 27, 75, 0.95);
}

body.dark-mode {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #1e3a8a 100%);
    --viewport-bg: rgba(15, 23, 42, 0.45);
    --glass-card: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-hover: rgba(255, 255, 255, 0.12);
    --primary: #60a5fa;
    --primary-glow: rgba(96, 165, 250, 0.35);
    --accent-green: #34d399;
    --accent-orange: #fbbf24;
    --accent-yellow: #facc15;
    --accent-cyan: #38bdf8;
    --accent-purple: #a78bfa;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --nav-bg: rgba(15, 23, 42, 0.92);
    --nav-border: rgba(255, 255, 255, 0.15);
    --input-bg: rgba(255, 255, 255, 0.07);
    --reader-bg: rgba(255, 255, 255, 0.98);

    --card-stories-bg: rgba(251, 191, 36, 0.08);
    --card-stories-border: rgba(251, 191, 36, 0.35);
    --card-quran-bg: rgba(52, 211, 153, 0.08);
    --card-quran-border: rgba(52, 211, 153, 0.35);
    --card-adventures-bg: rgba(245, 158, 11, 0.12);
    --card-adventures-border: rgba(245, 158, 11, 0.4);
    --card-wheel-bg: rgba(245, 158, 11, 0.12);
    --card-wheel-border: rgba(245, 158, 11, 0.45);

    --m-btn-1-bg: rgba(96, 165, 250, 0.1); --m-btn-1-border: rgba(96, 165, 250, 0.35);
    --m-btn-2-bg: rgba(251, 191, 36, 0.1); --m-btn-2-border: rgba(251, 191, 36, 0.35);
    --m-btn-3-bg: rgba(56, 189, 248, 0.1); --m-btn-3-border: rgba(56, 189, 248, 0.35);
    --m-btn-4-bg: rgba(52, 211, 153, 0.1); --m-btn-4-border: rgba(52, 211, 153, 0.35);
}

* {
    box-sizing: border-box;
    margin: 0; padding: 0;
    font-family: 'Tajawal', sans-serif;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

html, body {
    touch-action: pan-x pan-y;
    background: var(--bg-gradient);
    min-height: 100vh; width: 100%;
    color: var(--text-main);
    overflow-x: hidden; position: relative;
}

/* مسافة علوية مريحة من التطبيق لعدم ملامسة الحافة وشريط الحالة */
.app-viewport {
    width: 100%; min-height: 100vh;
    background: var(--viewport-bg);
    backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
    position: relative; display: flex; flex-direction: column;
    padding-top: calc(16px + env(safe-area-inset-top));
}

.screen {
    display: none; flex-direction: column;
    width: 100%; max-width: 1280px; margin: 0 auto;
    padding: 24px 24px 140px 24px;
    opacity: 0; transform: translateY(14px) scale(0.99);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.screen.active { display: flex; opacity: 1; transform: translateY(0) scale(1); }

.app-header { text-align: center; margin-bottom: 20px; }
h1.app-title {
    font-size: 2.2rem; font-weight: 900;
    background: linear-gradient(135deg, var(--primary), var(--accent-orange));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    margin-bottom: 6px;
}
p.subtitle { font-size: 0.95rem; color: var(--text-muted); font-weight: 500; }

/* ==========================================================================
   === كارت هوية الطفل (User Bar) مع شريط التقدم وزر الصوت ===
   ========================================================================== */
.user-bar {
    background: var(--glass-card); backdrop-filter: blur(15px);
    border: 1.5px solid var(--glass-border); color: var(--text-main);
    padding: 16px 18px; border-radius: var(--radius-lg); margin-bottom: 14px;
    display: flex; flex-direction: column; gap: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.05); width: 100%;
}

.user-bar-top-row {
    display: flex; justify-content: space-between; align-items: center;
    width: 100%; flex-wrap: nowrap; gap: 10px;
}

.user-info-group { display: flex; flex-direction: column; gap: 4px; }
.user-name { font-weight: 900; font-size: 1.25rem; display: flex; align-items: center; gap: 6px; }

.user-level-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-rank { 
    font-size: 0.8rem; color: var(--primary); background: var(--primary-glow); 
    padding: 2px 10px; border-radius: 10px; font-weight: 800; border: 1px solid var(--glass-border);
}
.level-progress-txt { font-size: 0.78rem; font-weight: 800; color: var(--text-muted); }

.user-bar-quick-actions { display: flex; align-items: center; gap: 8px; }

.level-progress-container {
    width: 100%; height: 8px; background: rgba(0, 0, 0, 0.08);
    border-radius: 10px; overflow: hidden; position: relative; border: 1px solid var(--glass-border);
}
body.dark-mode .level-progress-container { background: rgba(255, 255, 255, 0.1); }
.level-progress-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--accent-orange), var(--accent-yellow), var(--accent-green));
    border-radius: 10px; transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.sound-btn {
    background: rgba(30, 58, 138, 0.08); border: 1px solid var(--glass-border);
    cursor: pointer; font-size: 1.1rem; padding: 6px 10px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease;
}
.sound-btn:active { transform: scale(0.9); }
.sound-btn:hover { background: rgba(30, 58, 138, 0.15); }

.stats-badges { display: flex; gap: 8px; align-items: center; width: 100%; justify-content: flex-start; flex-wrap: wrap; }
.badge-capsule {
    padding: 5px 12px; border-radius: 20px; font-weight: 800; font-size: 0.82rem;
    display: flex; align-items: center; gap: 5px; backdrop-filter: blur(10px);
}
.badge-streak { background: rgba(245, 158, 11, 0.15); border: 1px solid rgba(245, 158, 11, 0.3); color: var(--accent-orange); }
.badge-points { background: rgba(56, 189, 248, 0.15); border: 1px solid rgba(56, 189, 248, 0.3); color: var(--primary); }
.badge-gems { background: rgba(139, 92, 246, 0.18); border: 1px solid rgba(139, 92, 246, 0.4); color: var(--accent-purple); }

#home-notification-btn { transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease; }
#home-notification-btn:hover { transform: scale(1.08); box-shadow: 0 0 12px var(--primary-glow); }
#home-notification-btn:active { transform: scale(0.95); }

/* ==========================================================================
   === إشراقة اليوم المدمجة (Compact Quote Bar) ===
   ========================================================================== */
.compact-quote-bar {
    background: rgba(234, 179, 8, 0.12); border: 1px solid rgba(234, 179, 8, 0.35);
    backdrop-filter: blur(10px); border-radius: 14px; padding: 8px 14px; margin-bottom: 18px;
    display: flex; align-items: center; gap: 8px; overflow: hidden; width: 100%; white-space: nowrap;
}
.quote-pill-tag { font-size: 0.8rem; font-weight: 900; color: var(--accent-orange); flex-shrink: 0; }
.quote-text-inline { font-size: 0.88rem; font-weight: 800; color: var(--text-main); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.quote-source-inline { font-size: 0.75rem; color: var(--text-muted); font-weight: 700; flex-shrink: 0; }

/* ==========================================================================
   === شبكة البوابات التفاعلية للأطفال ===
   ========================================================================== */
.gateway-container-compact { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; width: 100%; }
.gateway-card-compact {
    background: var(--glass-card); backdrop-filter: blur(15px); border-radius: var(--radius-lg);
    padding: 18px 14px; display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; gap: 6px; border: 2px solid var(--glass-border); cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.04); transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, border-color 0.25s ease;
    min-height: 125px; position: relative; user-select: none;
}
.gateway-card-compact:hover { transform: translateY(-4px); box-shadow: 0 12px 25px rgba(0,0,0,0.09); }
.gateway-card-compact:active { transform: scale(0.95); }

.gateway-card-compact.stories-theme { background: var(--card-stories-bg); border-color: var(--card-stories-border); }
.gateway-card-compact.quran-theme { background: var(--card-quran-bg); border-color: var(--card-quran-border); }
.gateway-card-compact.challenges-theme { background: linear-gradient(135deg, rgba(254, 240, 138, 0.4), rgba(245, 158, 11, 0.15)); border-color: rgba(234, 179, 8, 0.45); }
.gateway-card-compact.adventures-theme { background: var(--card-adventures-bg); border-color: var(--card-adventures-border); }
.gateway-card-compact.wheel-theme { background: var(--card-wheel-bg); border-color: var(--card-wheel-border); box-shadow: 0 8px 20px rgba(245, 158, 11, 0.12); }
.gateway-card-compact.coming-soon-theme { background: var(--glass-card); border-color: var(--glass-border); opacity: 0.85; }

.gateway-icon-compact { font-size: 2.3rem; line-height: 1; margin-bottom: 2px; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.08)); }
.gateway-title-compact { font-weight: 900; font-size: 1.05rem; color: var(--text-main); }
.gateway-desc-compact { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }

/* ==========================================================================
   === منصة التتويج الأولمبية (Podium Showcase) للمراكز الثلاثة الأولى ===
   ========================================================================== */
.podium-showcase-container {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 12px;
    width: 100%;
    margin: 20px 0 25px 0;
    padding: 20px 8px 0 8px;
    user-select: none;
}

.podium-spot {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    max-width: 150px;
    position: relative;
    transition: transform 0.3s ease;
}

.podium-crown-float {
    font-size: 2rem;
    position: absolute;
    top: -24px;
    z-index: 5;
    animation: crownFloat 1.8s infinite alternate ease-in-out;
    filter: drop-shadow(0 4px 8px rgba(245, 158, 11, 0.5));
}

@keyframes crownFloat {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-8px) scale(1.1); }
}

.podium-character-wrap {
    width: 100%;
    height: 180px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    position: relative;
    z-index: 2;
    margin-bottom: -4px;
}

.spot-rank-1 .podium-character-wrap {
    height: 220px;
}

.podium-character-img {
    width: 100%;
    max-width: 100px;
    height: 100%;
    object-fit: contain;
    object-position: bottom center;
    filter: drop-shadow(0 8px 14px rgba(0,0,0,0.3));
    transition: transform 0.3s ease;
}

.spot-rank-1 .podium-character-img {
    max-width: 120px;
    transform: scale(1.05);
}

.podium-pillar {
    width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 6px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-bottom: none;
    position: relative;
    z-index: 1;
}

/* ارتفاعات وألوان عتبات منصات التتويج مع إصلاح بروز اسم المركز الثالث */
.pillar-1 {
    height: 140px;
    background: linear-gradient(180deg, #f59e0b 0%, #b45309 100%);
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.4);
    border-color: #fde68a;
}

.pillar-2 {
    height: 105px;
    background: linear-gradient(180deg, #94a3b8 0%, #475569 100%);
    box-shadow: 0 0 18px rgba(148, 163, 184, 0.3);
    border-color: #cbd5e1;
}

.pillar-3 {
    min-height: 98px;
    height: auto;
    background: linear-gradient(180deg, #d97706 0%, #78350f 100%);
    box-shadow: 0 0 15px rgba(217, 119, 6, 0.3);
    border-color: #fed7aa;
    overflow: visible !important;
    padding-bottom: 12px;
}

.podium-rank-badge {
    font-size: 0.95rem;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.4);
    margin-bottom: 4px;
}

.podium-student-name {
    font-size: 0.85rem;
    font-weight: 800;
    color: #ffffff;
    text-align: center;
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
    width: 95%;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.podium-student-points {
    font-size: 0.75rem;
    font-weight: 900;
    background: rgba(0, 0, 0, 0.25);
    color: #fef08a;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   === نافذة شبكة اختيار الشخصيات (Avatar Selection Grid) ===
   ========================================================================== */
.avatar-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 14px;
    width: 100%;
    max-height: 60vh;
    overflow-y: auto;
    padding: 8px 4px;
}

.avatar-card-item {
    background: var(--glass-card);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}

.avatar-card-item:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.avatar-card-item.selected-by-me {
    border-color: var(--accent-green) !important;
    background: rgba(16, 185, 129, 0.12) !important;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.35) !important;
}

.avatar-card-item.locked-by-other {
    cursor: not-allowed;
    filter: grayscale(80%);
    opacity: 0.65;
    background: rgba(0, 0, 0, 0.05);
}

.avatar-card-img-wrap {
    width: 100%;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    overflow: hidden;
}

.avatar-card-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: transform 0.2s ease;
}

.avatar-card-item:hover .avatar-card-img {
    transform: scale(1.08);
}

.avatar-card-name {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--text-main);
}

.avatar-card-status {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 8px;
    width: 100%;
    text-align: center;
}

.status-available {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
}

.status-locked {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid #ef4444;
}

.status-mine {
    background: var(--accent-green);
    color: #ffffff;
    font-weight: 900;
}

/* ==========================================================================
   === تنسيقات شاشة ومحرك عجلة الحظ (Lucky Wheel) ===
   ========================================================================== */
.wheel-stage-container { user-select: none; }
.wheel-pointer-arrow {
    transform-origin: top center;
    animation: pointerFloat 1.2s infinite alternate ease-in-out;
}

@keyframes pointerFloat {
    0% { transform: translateY(0); }
    100% { transform: translateY(6px); }
}

.wheel-outer-frame { transition: transform 0.3s ease, box-shadow 0.3s ease; }

#wheel-center-spin-btn {
    outline: none;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}
#wheel-center-spin-btn:hover {
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.6);
}
#wheel-center-spin-btn:active { transform: translate(-50%, -50%) scale(0.92); }
#wheel-center-spin-btn:disabled { cursor: not-allowed; filter: grayscale(60%); opacity: 0.8; }

#ad-media-render-box video, 
#ad-media-render-box iframe { width: 100%; height: 100%; border: none; display: block; }
#ad-media-render-box img { max-width: 100%; max-height: 340px; object-fit: contain; display: block; }

/* --- الإطارات المتقدمة --- */
.frame-gold { border: 2.5px solid #f59e0b !important; box-shadow: 0 0 16px rgba(245, 158, 11, 0.6); background: rgba(245, 158, 11, 0.08); }
.frame-fire { border: 2.5px solid #ef4444 !important; box-shadow: 0 0 16px rgba(239, 68, 68, 0.7); animation: fireGlow 1.5s infinite alternate; }
.frame-emerald { border: 2.5px solid #10b981 !important; box-shadow: 0 0 16px rgba(16, 185, 129, 0.6); }
.frame-cosmic { border: 2.5px solid #8b5cf6 !important; box-shadow: 0 0 18px rgba(139, 92, 246, 0.8); }
.frame-diamond-crown { border: 3px double #e0e7ff !important; box-shadow: 0 0 22px rgba(224, 231, 255, 0.9); }
.frame-aura { border: 3px solid #ec4899 !important; box-shadow: 0 0 25px rgba(236, 72, 153, 0.85); animation: auraPulse 2s infinite alternate; }
.frame-neon-pink { border: 2.5px solid #f43f5e !important; box-shadow: 0 0 20px rgba(244, 63, 94, 0.9); }

@keyframes fireGlow {
    from { box-shadow: 0 0 8px rgba(239, 68, 68, 0.5); }
    to { box-shadow: 0 0 20px rgba(245, 158, 11, 1); }
}

@keyframes auraPulse {
    from { box-shadow: 0 0 10px rgba(236, 72, 153, 0.4); }
    to { box-shadow: 0 0 30px rgba(139, 92, 246, 1); }
}

/* --- ألوان النصوص العالية التوهج --- */
.name-gold { color: #f59e0b !important; text-shadow: 0 0 10px rgba(245, 158, 11, 0.6); }
.name-neon { color: #38bdf8 !important; text-shadow: 0 0 12px rgba(56, 189, 248, 0.8); }
.name-pink { color: #ec4899 !important; text-shadow: 0 0 10px rgba(236, 72, 153, 0.6); }
.name-emerald { color: #34d399 !important; text-shadow: 0 0 12px rgba(52, 211, 153, 0.7); }
.name-purple { color: #c084fc !important; text-shadow: 0 0 12px rgba(192, 132, 252, 0.8); }

/* --- ألوان وخلفيات البوكسات الحصرية --- */
.box-gold-royal { background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(120, 53, 15, 0.35)) !important; border: 1.5px solid rgba(245, 158, 11, 0.6) !important; }
.box-glass-neon { background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(30, 58, 138, 0.35)) !important; border: 1.5px solid rgba(56, 189, 248, 0.6) !important; }
.box-cosmic-nebula { background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(236, 72, 153, 0.25)) !important; border: 1.5px solid rgba(236, 72, 153, 0.6) !important; }

/* بار التبويبات مرفوع بمسافة مدروسة ومريحة للمستخدمين */
.bottom-nav {
    position: fixed !important; bottom: 26px !important; left: 50% !important;
    transform: translateX(-50%) !important; width: calc(100% - 32px); max-width: 900px;
    height: 70px; background: var(--nav-bg);
    backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
    display: none; justify-content: space-around; align-items: center;
    border: 1px solid var(--nav-border); border-radius: 26px; padding: 0 14px;
    z-index: 99999; box-shadow: 0 15px 35px rgba(0, 0, 0, 0.14);
}

.nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: transparent !important; border: none; color: var(--text-muted);
    font-size: 0.8rem; font-weight: 700; cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); flex: 1; padding: 8px 0; position: relative;
}

.nav-item .nav-icon { font-size: 1.45rem; transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease; }
.nav-item.active { color: var(--primary); }
.nav-item.active .nav-icon { transform: translateY(-4px) scale(1.2); filter: drop-shadow(0 0 10px var(--primary-glow)); }

.nav-item.active::after {
    content: ''; position: absolute; bottom: 4px; width: 18px; height: 4px;
    background: var(--primary); border-radius: 10px; box-shadow: 0 0 10px var(--primary-glow);
}

.input-group { width: 100%; margin-bottom: 14px; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
    width: 100%; padding: 14px 18px; background: var(--input-bg);
    border: 1px solid var(--glass-border); border-radius: var(--radius-md);
    font-size: 1rem; outline: none; color: var(--text-main); backdrop-filter: blur(10px);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 15px var(--primary-glow); }

button.main-btn {
    width: 100%; padding: 16px; background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white; border: none; border-radius: var(--radius-md); font-size: 1.05rem; font-weight: 700;
    cursor: pointer; box-shadow: 0 8px 20px var(--primary-glow);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); margin-top: 10px;
}
button.main-btn:active { transform: scale(0.96); }

.admin-nav-bar {
    display: flex; gap: 8px; background: var(--glass-card);
    padding: 8px; border-radius: var(--radius-lg); border: 1px solid var(--glass-border);
    margin-bottom: 24px; flex-wrap: wrap;
}
.admin-nav-btn {
    flex: 1; min-width: 120px; padding: 12px 14px; background: transparent;
    border: none; color: var(--text-muted); font-weight: 700; font-size: 0.92rem;
    border-radius: var(--radius-md); cursor: pointer;
}
.admin-nav-btn.active { background: var(--primary); color: white; box-shadow: 0 6px 16px var(--primary-glow); }

.admin-card {
    background: var(--glass-card); backdrop-filter: blur(15px);
    border-radius: var(--radius-lg); border: 1px solid var(--glass-border);
    padding: 22px; margin-bottom: 20px; width: 100%;
}
.admin-card h3, .admin-card h4 { color: var(--primary); font-size: 1.15rem; font-weight: 800; margin-bottom: 14px; }

.grid-responsive-layout { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; width: 100%; }

.gateway-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; width: 100%; }
.gateway-card {
    backdrop-filter: blur(15px); border-radius: var(--radius-lg); padding: 22px;
    display: flex; align-items: center; gap: 18px; border: 1.5px solid var(--glass-border);
    cursor: pointer; transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}
.gateway-card:hover { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(0,0,0,0.12); }
.gateway-card:active { transform: scale(0.97); }

.gateway-icon { font-size: 2.8rem; }
.gateway-info { text-align: right; }
.gateway-title { font-weight: 800; font-size: 1.2rem; color: var(--text-main); }
.gateway-desc { font-size: 0.88rem; color: var(--text-muted); margin-top: 3px; }

.buttons-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; padding-bottom: 20px; width: 100%; }
.masoom-btn {
    backdrop-filter: blur(12px); border-radius: var(--radius-lg); padding: 20px 12px;
    font-size: 1rem; font-weight: 800; color: var(--text-main);
    display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer;
    border: 1.5px solid var(--glass-border); transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}
.masoom-btn:nth-child(4n+1) { background: var(--m-btn-1-bg); border-color: var(--m-btn-1-border); box-shadow: 0 0 12px rgba(30, 58, 138, 0.08); }
.masoom-btn:nth-child(4n+2) { background: var(--m-btn-2-bg); border-color: var(--m-btn-2-border); box-shadow: 0 0 12px rgba(245, 158, 11, 0.08); }
.masoom-btn:nth-child(4n+3) { background: var(--m-btn-3-bg); border-color: var(--m-btn-3-border); box-shadow: 0 0 12px rgba(56, 189, 248, 0.08); }
.masoom-btn:nth-child(4n+4) { background: var(--m-btn-4-bg); border-color: var(--m-btn-4-border); box-shadow: 0 0 12px rgba(16, 185, 129, 0.08); }
.masoom-btn:hover { transform: translateY(-4px); }
.masoom-btn:active { transform: scale(0.95); }

.story-container {
    width: 100%; height: 60vh; min-height: 400px; 
    overflow: auto !important; background: var(--reader-bg); 
    border-radius: var(--radius-lg); border: 2px solid var(--glass-border); 
    margin-bottom: 18px; padding: 15px; position: relative;
    display: block; text-align: center;
}
.story-container img { 
    max-width: 100%; height: auto; object-fit: contain; 
    transition: transform 0.15s ease-out; margin: 0 auto;
    display: inline-block; transform-origin: top center; 
}

#book-screen { padding: 24px; padding-bottom: 30px; }
.book-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.back-btn { background: var(--glass-card); color: var(--text-main); border: 1px solid var(--glass-border); padding: 10px 18px; border-radius: 12px; font-weight: 700; cursor: pointer; }

.book-controls { display: flex; gap: 12px; width: 100%; }
.nav-btn { flex: 1; padding: 15px; font-weight: 700; border: none; border-radius: var(--radius-md); color: white; cursor: pointer; }
#prev-btn { background-color: var(--text-muted); } 
#next-btn { background-color: var(--primary); }
.quiz-trigger-btn { background-color: var(--accent-green); }

.quiz-container { background: var(--glass-card); backdrop-filter: blur(15px); padding: 22px; border-radius: var(--radius-lg); border: 1px solid var(--glass-border); margin-bottom: 16px; width: 100%; }
.option-btn { width: 100%; padding: 15px; background: var(--input-bg); color: var(--text-main); border: 1px solid var(--glass-border); border-radius: var(--radius-md); text-align: right; margin-bottom: 10px; font-size: 1rem; font-weight: 700; cursor: pointer; }
.option-btn.selected { background: rgba(16, 185, 129, 0.18); border-color: var(--accent-green); }

.shop-item, .admin-user-card, .log-item, .challenge-card, .order-card, .admin-item-card, .leaderboard-card {
    background: var(--glass-card); backdrop-filter: blur(12px); padding: 16px; border-radius: var(--radius-md); margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--glass-border); width: 100%;
}
.shop-item-clickable { cursor: pointer; transition: transform 0.2s ease, border-color 0.2s ease; }
.shop-item-clickable:hover { transform: translateY(-2px); border-color: var(--primary); }

.challenge-card { background: var(--glass-card); border-color: rgba(30, 58, 138, 0.25); box-shadow: 0 0 15px rgba(30, 58, 138, 0.08); }
.leaderboard-card.top-1 { border-color: rgba(245, 158, 11, 0.6); background: rgba(245, 158, 11, 0.12); }

#toast-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 999999; display: flex; flex-direction: column; gap: 10px; width: 90%; max-width: 420px; pointer-events: none; }
.toast { 
    pointer-events: auto; background: var(--glass-card); backdrop-filter: blur(25px);
    border-radius: var(--radius-lg); padding: 15px 18px; box-shadow: 0 15px 35px rgba(0,0,0,0.18); 
    display: flex; align-items: center; gap: 12px; border: 1px solid var(--glass-border);
    border-right: 5px solid var(--primary); color: var(--text-main);
    animation: toastSlideIn 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.toast.hiding { animation: toastSlideOut 0.35s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards; }

@keyframes toastSlideIn { from { opacity: 0; transform: translateY(-35px) scale(0.88); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastSlideOut { from { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 0; transform: translateY(-25px) scale(0.9); } }

/* طبقات النوافذ المنبثقة: تم جعل confirm-overlay في أعلى قمة النوافذ (z-index: 10000005) */
#streak-modal-overlay, #broadcast-popup-overlay, #product-detail-overlay, #edit-product-overlay, #notifications-history-overlay, #avatar-select-overlay {
    position: fixed; top:0; left:0; right:0; bottom:0; background: rgba(15, 23, 42, 0.6); 
    backdrop-filter: blur(10px); z-index: 999999; display: none; justify-content: center; align-items: center; padding: 18px;
}
#ad-viewer-overlay {
    position: fixed; top:0; left:0; right:0; bottom:0; background: rgba(15, 23, 42, 0.95); 
    backdrop-filter: blur(10px); z-index: 9999999; display: none; justify-content: center; align-items: center; padding: 18px;
}
#confirm-overlay {
    position: fixed; top:0; left:0; right:0; bottom:0; background: rgba(15, 23, 42, 0.8); 
    backdrop-filter: blur(12px); z-index: 10000005 !important; display: none; justify-content: center; align-items: center; padding: 18px;
}

#confirm-overlay.visible, #streak-modal-overlay.visible, #broadcast-popup-overlay.visible, #product-detail-overlay.visible, #edit-product-overlay.visible, #notifications-history-overlay.visible, #ad-viewer-overlay.visible, #avatar-select-overlay.visible { display: flex; }

.modal-box {
    background: var(--glass-card); backdrop-filter: blur(25px); border-radius: var(--radius-lg); 
    border: 1px solid var(--glass-border); padding: 26px; max-width: 420px; width: 100%; 
    text-align: center; box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2); color: var(--text-main);
    max-height: 90vh; overflow-y: auto;
}

/* --- سجل الإعلانات والإشعارات --- */
.notification-feed-card {
    background: var(--input-bg); border: 1px solid var(--glass-border);
    border-radius: var(--radius-md); padding: 12px; text-align: right;
    display: flex; flex-direction: column; gap: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}
.notification-feed-card.unread { border-right: 4px solid var(--primary); background: rgba(30, 58, 138, 0.08); }
.notification-feed-title { font-weight: 800; font-size: 1.05rem; color: var(--primary); display: flex; align-items: center; justify-content: space-between; }
.notification-feed-date { font-size: 0.75rem; color: var(--text-muted); }
.notification-feed-body { font-size: 0.92rem; color: var(--text-main); line-height: 1.6; }
.notification-feed-media { width: 100%; border-radius: var(--radius-md); overflow: hidden; margin-top: 6px; border: 1px solid var(--glass-border); }
.notification-feed-media img { width: 100%; max-height: 200px; object-fit: cover; display: block; }
.notification-feed-media iframe, .notification-feed-media video { width: 100%; aspect-ratio: 16 / 9; border: none; display: block; }

.product-img-thumb { width: 55px; height: 55px; object-fit: cover; border-radius: var(--radius-md); border: 1px solid var(--glass-border); flex-shrink: 0; background: rgba(0,0,0,0.05); }
.product-img-large { width: 100%; max-height: 220px; object-fit: contain; border-radius: var(--radius-md); margin-bottom: 14px; background: rgba(255,255,255,0.05); border: 1px solid var(--glass-border); }
.credits { text-align: center; font-size: 0.85rem; color: var(--text-muted); margin-top: auto; padding: 20px 0; font-weight: 700; }
.quran-text-box { font-size: 1.4rem; line-height: 2.3; text-align: center; color: #0f172a; font-family: 'Tajawal', sans-serif; padding: 15px; }
.ayah-number { color: #10b981; font-weight: 700; margin: 0 4px; }
.theme-toggle-box { display: flex; align-items: center; justify-content: space-between; background: var(--input-bg); padding: 12px 14px; border-radius: var(--radius-md); border: 1px solid var(--glass-border); margin-bottom: 12px; }

.shop-subnav { display: flex; gap: 8px; margin-bottom: 16px; }
.shop-subnav-btn { flex: 1; padding: 10px; border-radius: var(--radius-md); border: 1px solid var(--glass-border); background: var(--input-bg); font-weight: 800; cursor: pointer; color: var(--text-muted); }
.shop-subnav-btn.active { background: var(--accent-purple); color: white; border-color: var(--accent-purple); }

/* --- إصلاح التباين مع الثيمات --- */
body[class*="theme-"] { color: var(--text-main) !important; }
body[class*="theme-"] .shop-subnav-btn { background: rgba(255, 255, 255, 0.12) !important; color: var(--text-main) !important; border-color: rgba(255, 255, 255, 0.25) !important; }
body[class*="theme-"] .shop-subnav-btn.active { background: var(--accent-purple) !important; color: #ffffff !important; border-color: var(--accent-purple) !important; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4) !important; }
body[class*="theme-"] .subtitle, body[class*="theme-"] .gateway-desc, body[class*="theme-"] small { color: var(--text-muted) !important; opacity: 0.9; }
body[class*="theme-"] input, body[class*="theme-"] select, body[class*="theme-"] textarea, body[class*="theme-"] .theme-toggle-box { background: rgba(255, 255, 255, 0.15) !important; color: #ffffff !important; border-color: rgba(255, 255, 255, 0.25) !important; }
body[class*="theme-"] input::placeholder, body[class*="theme-"] textarea::placeholder { color: rgba(255, 255, 255, 0.65) !important; }
body[class*="theme-"] .back-btn { background: rgba(255, 255, 255, 0.15) !important; color: var(--text-main) !important; border-color: rgba(255, 255, 255, 0.2) !important; }
body[class*="theme-"] .shop-item, body[class*="theme-"] .challenge-card, body[class*="theme-"] .admin-user-card, body[class*="theme-"] .order-card { background: var(--glass-card) !important; border-color: var(--glass-border) !important; }

#popup-notification-body { background: rgba(255, 255, 255, 0.15) !important; color: #ffffff !important; border: 1px solid rgba(255, 255, 255, 0.25) !important; font-weight: 700 !important; }
#popup-notification-title { color: var(--primary) !important; }
body[class*="theme-"] #popup-notification-title { color: #ffffff !important; text-shadow: 0 0 8px rgba(255, 255, 255, 0.4); }

/* --- نظام الخصومات في المتجر --- */
.shop-discount-banner {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.18), rgba(245, 158, 11, 0.25));
    border: 2px solid #ef4444; border-radius: var(--radius-lg); padding: 14px 18px; margin-bottom: 18px;
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.18); animation: discountPulse 2.2s infinite ease-in-out;
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
}
@keyframes discountPulse {
    0% { transform: scale(1); box-shadow: 0 8px 25px rgba(239, 68, 68, 0.18); }
    50% { transform: scale(1.015); box-shadow: 0 12px 30px rgba(239, 68, 68, 0.35); }
    100% { transform: scale(1); box-shadow: 0 8px 25px rgba(239, 68, 68, 0.18); }
}
.discount-banner-icon { font-size: 2.2rem; flex-shrink: 0; }
.discount-banner-content { flex: 1; text-align: right; }
.discount-banner-title { font-size: 1.15rem; font-weight: 900; color: #ef4444; display: flex; align-items: center; gap: 6px; }
.discount-banner-sub { font-size: 0.88rem; color: var(--text-main); font-weight: 700; margin-top: 3px; }
.discount-banner-timer { background: #ef4444; color: #ffffff; padding: 5px 12px; border-radius: 20px; font-size: 0.82rem; font-weight: 800; white-space: nowrap; }

.price-old-striked { text-decoration: line-through; color: #ef4444 !important; opacity: 0.8; margin-left: 6px; font-weight: 700; }
.price-new-discounted { color: var(--accent-green) !important; font-weight: 900 !important; font-size: 1.05rem; }
.badge-discount-tag { background: linear-gradient(135deg, #ef4444, #dc2626) !important; color: #ffffff !important; border: none !important; font-size: 0.72rem !important; padding: 2px 7px !important; border-radius: 6px !important; font-weight: 900 !important; }

/* --- كروت ولعبة البازل --- */
.puzzle-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; width: 100%; }
.puzzle-card-item {
    background: var(--glass-card); border: 2px solid var(--glass-border); border-radius: var(--radius-lg);
    overflow: hidden; box-shadow: 0 8px 20px rgba(0,0,0,0.06); display: flex; flex-direction: column;
    cursor: pointer; transition: transform 0.2s ease, border-color 0.2s ease; position: relative;
}
.puzzle-card-item:hover { transform: translateY(-4px); border-color: var(--accent-orange); }
.puzzle-card-thumb-wrapper { position: relative; width: 100%; aspect-ratio: 1 / 1; background: #cbd5e1; overflow: hidden; }
.puzzle-card-thumb { width: 100%; height: 100%; object-fit: cover; display: block; transition: filter 0.3s ease; }
.puzzle-card-thumb.blurred { filter: blur(14px) grayscale(40%); transform: scale(1.08); }
.puzzle-card-badge { position: absolute; top: 10px; right: 10px; background: rgba(15, 23, 42, 0.75); color: #fff; padding: 4px 10px; border-radius: 12px; font-size: 0.8rem; font-weight: 800; }
.puzzle-card-status-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.25); font-size: 2.2rem; color: #fff; }
.puzzle-card-content { padding: 12px; text-align: right; display: flex; flex-direction: column; gap: 4px; }

.yousef-banner {
    background: var(--glass-card); border: 2px solid #f59e0b; border-radius: 16px;
    padding: 12px 18px; margin-bottom: 14px; text-align: center; width: 100%; max-width: 800px;
}
.yousef-banner h3 { color: #b45309; margin-bottom: 4px; font-size: 1.15rem; font-weight: 900; }

.puzzle-game-area { display: flex; flex-direction: column; gap: 14px; align-items: center; width: 100%; max-width: 900px; margin: 0 auto; }
#puzzle-board {
    width: 100%; max-width: 440px; aspect-ratio: 1 / 1;
    display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(5, 1fr);
    background: var(--reader-bg); border: 3px dashed var(--accent-orange);
    border-radius: 12px; overflow: hidden; position: relative; padding: 0; gap: 0;
}
.puzzle-slot { outline: 1px dashed rgba(0, 0, 0, 0.15); outline-offset: -1px; width: 100%; height: 100%; display: flex; position: relative; }
.puzzle-slot.drag-over { background-color: rgba(56, 189, 248, 0.35); outline: 2px solid var(--accent-cyan); }

#puzzle-pieces-pool {
    display: flex !important; flex-direction: row !important; flex-wrap: wrap !important; gap: 8px !important;
    background: var(--glass-card); border: 2px solid var(--glass-border); border-radius: 14px;
    padding: 10px; width: 100%; max-width: 460px; min-height: 120px; max-height: 210px;
    overflow-y: auto; justify-content: center; align-content: flex-start;
}
.puzzle-piece { cursor: grab; touch-action: none; background-repeat: no-repeat; background-size: 500% 500% !important; box-sizing: border-box; }
.puzzle-piece:active { cursor: grabbing; }
#puzzle-pieces-pool .puzzle-piece { width: 56px !important; height: 56px !important; flex: 0 0 56px !important; border: 1.5px solid #64748b !important; border-radius: 6px !important; }
.puzzle-slot .puzzle-piece { width: 100% !important; height: 100% !important; border: none !important; border-radius: 0 !important; }
.puzzle-piece.dragging { opacity: 0.85; position: fixed !important; z-index: 9999999 !important; pointer-events: none !important; transform: translate(-50%, -50%) scale(1.05) !important; border: 2px solid var(--accent-orange) !important; border-radius: 8px !important; }
.puzzle-piece.selected-mobile { outline: 3px solid #ef4444; transform: scale(1.08); }
#puzzle-win-card { display: none; margin-top: 14px; background: linear-gradient(135deg, #10b981, #047857); color: #fff; padding: 14px 20px; border-radius: 16px; font-size: 1.2rem; font-weight: 900; text-align: center; }

/* العدادات ومقاسات شاشات الجوال */
.challenge-timer-inputs { display: flex; gap: 8px; align-items: center; }
.challenge-timer-inputs input { flex: 1; min-width: 0; }
.challenge-timer-inputs select { flex: 1.4; min-width: 0; }
.challenge-remaining-time, .challenge-closed-time { margin-top: 6px; font-size: 0.82rem; font-weight: 800; }
.challenge-remaining-time { color: var(--accent-orange); }
.challenge-closed-time { color: #ef4444; }

/* ==========================================================================
   === ميديا كويري مخصصة ومريحة للجوال والأطفال ===
   ========================================================================== */
@media (max-width: 768px) {
    .screen { padding: 18px 12px 130px; max-width: 100%; }
    .user-bar { padding: 14px; gap: 10px; }
    .user-name { font-size: 1.15rem; }
    .stats-badges { gap: 6px; }
    .badge-capsule { padding: 4px 10px; font-size: 0.78rem; }
    
    .gateway-container-compact { gap: 10px; }
    .gateway-card-compact { padding: 14px 10px; min-height: 115px; }
    .gateway-icon-compact { font-size: 2.1rem; }
    .gateway-title-compact { font-size: 0.95rem; }
    .gateway-desc-compact { font-size: 0.72rem; }

    .podium-showcase-container { gap: 8px; margin: 15px 0 20px 0; }
    .podium-character-wrap { height: 145px; }
    .spot-rank-1 .podium-character-wrap { height: 180px; }
    .pillar-1 { height: 120px; }
    .pillar-2 { height: 90px; }
    .pillar-3 { min-height: 85px; }
    .podium-student-name { font-size: 0.78rem; }

    .wheel-outer-frame { width: 290px !important; height: 290px !important; }
    #lucky-wheel-canvas { width: 270px !important; height: 270px !important; }
    #wheel-center-spin-btn { width: 60px !important; height: 60px !important; font-size: 0.95rem !important; }

    .bottom-nav { width: calc(100% - 20px) !important; bottom: 20px !important; padding: 0 6px; }
    .nav-item { font-size: 0.68rem; padding: 6px 2px; }
    .nav-item .nav-icon { font-size: 1.25rem; }

    .shop-discount-banner { flex-direction: column; align-items: flex-start; gap: 10px; }
}

@media (max-width: 480px) {
    .screen { padding: 14px 10px 125px; }
    .compact-quote-bar { padding: 6px 10px; }
    .quote-text-inline { font-size: 0.8rem; }
    .gateway-card-compact { min-height: 108px; }
    
    .podium-character-wrap { height: 125px; }
    .spot-rank-1 .podium-character-wrap { height: 155px; }
    .pillar-1 { height: 105px; }
    .pillar-2 { height: 80px; }
    .pillar-3 { min-height: 75px; }
    .podium-rank-badge { font-size: 0.82rem; }
    .podium-student-name { font-size: 0.72rem; }
    .podium-student-points { font-size: 0.68rem; padding: 2px 6px; }

    .avatar-selection-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .avatar-card-img-wrap { height: 110px; }

    .wheel-outer-frame { width: 260px !important; height: 260px !important; }
    #lucky-wheel-canvas { width: 240px !important; height: 240px !important; }
    #wheel-center-spin-btn { width: 54px !important; height: 54px !important; font-size: 0.85rem !important; }

    #puzzle-board { max-width: 320px; }
    #puzzle-pieces-pool { max-width: 340px; }
    #puzzle-pieces-pool .puzzle-piece { width: 48px !important; height: 48px !important; flex: 0 0 48px !important; }
}

/* ==========================================================================
   === إشعارات رسائل الأدمن وتبويبات تنبيهات الطالب ===
   ========================================================================== */

/* زر جرس الأدمن في رأس الصفحة */
#admin-messages-bell-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
    user-select: none;
}

#admin-messages-bell-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 0 12px var(--primary-glow);
}

#admin-messages-bell-btn:active {
    transform: scale(0.95);
}

/* بطاقات رسائل الطلاب الواردة للأدمن */
.admin-msg-item {
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.admin-msg-item:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    background: rgba(30, 58, 138, 0.08);
}

.admin-msg-item.unread {
    border-right: 4px solid #ef4444;
    background: rgba(239, 68, 68, 0.06);
}

.admin-msg-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.admin-msg-name {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--primary);
}

.admin-msg-text {
    font-size: 0.85rem;
    color: var(--text-main);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.admin-msg-date {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* تبويبات التنبيهات في نافذة الطالب */
.notifications-tabs-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.notif-tab-btn {
    background: var(--input-bg);
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
    font-family: inherit;
    font-size: 0.88rem;
    transition: all 0.25s ease;
}

.notif-tab-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.notif-tab-btn:hover:not(.active) {
    background: var(--glass-hover);
    color: var(--text-main);
}

/* كرت ردود القائد المباشرة للطالب */
.reply-feed-card {
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-right: 4px solid var(--accent-green);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.reply-feed-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-green);
}

.reply-feed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--accent-green);
}

.reply-feed-msg {
    font-size: 0.9rem;
    color: var(--text-main);
    line-height: 1.5;
}

.reply-feed-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    align-self: flex-start;
}

/* التوافق مع الوضع الليلي والثيمات */
body.dark-mode .notif-tab-btn.active {
    background: var(--primary);
    color: #ffffff;
}

body[class*="theme-"] .notif-tab-btn {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-main);
}

body[class*="theme-"] .notif-tab-btn.active {
    background: var(--primary);
    color: #ffffff;
}
