@import url('https://fonts.googleapis.com/css2?family=Baloo+Bhaijaan+2:wght@500;600;700;800&family=Tajawal:wght@400;500;700&display=swap');

:root {
    --bg: #0c1524;
    --bg-alt: #16233a;
    --card: #ffffff;
    --card-tint: #f4f8fd;

    /* Accent palette — matched to spelling-challenge-game */
    --coral: #ff6b6b;
    --coral-soft: #ff9a9e;
    --teal: #4ecdc4;
    --sky: #6ecbf5;
    --violet: #a18afd;
    --sun: #ffe66d;
    --sun-deep: #ffd166;

    --team-a: #4ecdc4;
    --team-b: #ff9a55;

    --text: #eef3fb;
    --text-dim: #93a1c2;
    --ink: #1f2740;
    --ink-dim: #5c6584;
    /* نغمة ذهبية داكنة مقروءة فوق الخلفية الفاتحة (بديل --sun على الخلفيات الفاتحة) */
    --amber-ink: #8a6a00;

    --radius: 22px;
    --radius-sm: 14px;

    /* روابط صور الخلفية — قيمة افتراضية تضمن ظهور الخلفية فورًا من أول تحميل
       للصفحة، حتى لو تأخر أو فشل طلب assets/js/brand.js. يعيد brand.js كتابة
       هذا المتغيّر ديناميكيًا (مع رقم إصدار asset_version) بعد أي رفع جديد من
       لوحة التحكم حتى تظهر فورًا دون انتظار انتهاء صلاحية الكاش على الملفين */
    --bg-image-portrait: url('../img/bg.jpg');
    --bg-image-portrait-portrait: url('../img/bg-portrait.jpg');
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background:
       
        var(--bg-image-portrait) center center / cover no-repeat fixed;
    color: var(--text);
    font-family: 'Tajawal', sans-serif;
    direction: rtl;
}

/* على الشاشات الطولية (جوال) نستخدم نسخة الخلفية المصممة للوضع الطولي */
@media (max-width: 700px) {
    html, body {
        background:
          var(--bg-image-portrait-portrait) center center / cover no-repeat fixed;
    }
}

h1, h2, h3, .display {
    font-family: 'Baloo Bhaijaan 2', 'Tajawal', sans-serif;
    font-weight: 800;
    margin: 0;
}

a { color: inherit; }

.stage {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px 60px;
}

.eyebrow {
    display: inline-block;
    color: var(--amber-ink);
    letter-spacing: .08em;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 10px;
    background: rgba(255, 230, 109, .55);
    border: 1px solid rgba(138, 106, 0, .35);
    padding: 5px 16px;
    border-radius: 999px;
}

/* ===== شعار وهج ===== */
.brand-logo {
    display: block;
    width: 100%;
    max-width: 190px;
    height: auto;
    margin: 0 auto 18px;
    filter: drop-shadow(0 8px 20px rgba(0,0,0,.35));
}
.brand-logo.sm {
    max-width: 120px;
    margin: 0;
}

.title-xl {
    font-family: 'Baloo Bhaijaan 2', sans-serif;
    font-size: clamp(32px, 6vw, 56px);
    text-align: center;
    background: linear-gradient(to left, var(--coral), var(--sky), var(--teal));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 6px 30px rgba(78, 205, 196, .25);
    padding-bottom: 6px;
}

.stage, .site-footer {
    color: var(--ink);
}

.subtitle {
    color: var(--ink-dim);
    margin-top: 6px;
    text-align: center;
    font-size: 16px;
    max-width: 560px;
    line-height: 1.7;
}

/* ===== بطاقات الاختيار (وضع اللعب) ===== */
.mode-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    max-width: 760px;
    width: 100%;
    margin-top: 48px;
}
@media (max-width: 640px) { .mode-grid { grid-template-columns: 1fr; } }

.mode-card {
    background: linear-gradient(160deg, var(--card), var(--card-tint));
    border: 2px solid transparent;
    border-radius: var(--radius);
    padding: 32px 24px;
    cursor: pointer;
    text-align: center;
    color: var(--ink);
    box-shadow: 0 14px 34px rgba(6, 14, 30, .35);
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.mode-card:hover, .mode-card:focus-visible {
    transform: translateY(-6px) scale(1.02);
    border-color: var(--teal);
    box-shadow: 0 18px 40px rgba(78, 205, 196, .3);
    outline: none;
}
.mode-card .icon { font-size: 44px; margin-bottom: 14px; }
.mode-card p { color: var(--ink-dim); font-size: 14px; margin-top: 8px; }

/* ===== نماذج الإعداد ===== */
.panel {
    background: linear-gradient(165deg, var(--card), var(--card-tint));
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: var(--radius);
    padding: 30px;
    max-width: 640px;
    width: 100%;
    margin-top: 32px;
    color: var(--ink);
    box-shadow: 0 20px 50px rgba(6, 14, 30, .4);
}
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 14px; color: var(--ink-dim); font-weight: 700; margin-bottom: 8px; }
.field input, .field select {
    width: 100%;
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    border: 2px solid #e3e9f5;
    background: #fff;
    color: var(--ink);
    font-family: 'Tajawal', sans-serif;
    font-size: 15px;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.field input:focus, .field select:focus {
    outline: none;
    border-color: var(--sky);
    box-shadow: 0 0 0 4px rgba(110, 203, 245, .25);
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .two-col { grid-template-columns: 1fr; } }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px,1fr)); gap: 12px; margin-top: 8px; }
.cat-chip {
    background: #eef3fb;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    padding: 16px 10px;
    text-align: center;
    cursor: pointer;
    font-weight: 700;
    color: var(--ink);
    transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.cat-chip:hover { transform: translateY(-3px); }
.cat-chip.selected { border-color: var(--teal); color: #1a8a80; background: rgba(78, 205, 196, .14); }
.cat-chip .icon { font-size: 26px; display: block; margin-bottom: 6px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: linear-gradient(to left, var(--teal), var(--sky));
    color: #fff;
    border: none;
    border-radius: 60px;
    padding: 15px 30px;
    font-family: 'Baloo Bhaijaan 2', sans-serif;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(78, 205, 196, .3);
    transition: transform .2s ease, box-shadow .2s ease, filter .15s ease;
}
.btn:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(78, 205, 196, .4); filter: brightness(1.03); }
.btn:active { transform: translateY(-1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.ghost { background: rgba(255,255,255,.55); border: 2px solid rgba(52, 90, 151, .35); color: #2b4a80; box-shadow: none; }
.btn.ghost:hover { border-color: var(--sun); box-shadow: 0 10px 20px rgba(255,230,109,.15); }
.btn.danger { background: linear-gradient(to left, var(--coral), var(--coral-soft)); box-shadow: 0 10px 25px rgba(255, 107, 107, .35); }
.btn.block { width: 100%; }

/* ===== شاشة اللعب ===== */
.scoreboard {
    width: 100%;
    max-width: 900px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
}
.team-score {
    border-radius: var(--radius);
    padding: 18px 22px;
    text-align: center;
    background: linear-gradient(165deg, var(--card), var(--card-tint));
    color: var(--ink);
    box-shadow: 0 12px 30px rgba(6, 14, 30, .3);
    border: 2px solid transparent;
    transition: transform .2s ease, box-shadow .2s ease;
}
.team-score.a { border-color: var(--team-a); }
.team-score.b { border-color: var(--team-b); }
.team-score .name { font-family: 'Baloo Bhaijaan 2', sans-serif; font-weight: 700; font-size: 15px; color: var(--ink-dim); }
.team-score .points { font-family: 'Baloo Bhaijaan 2', sans-serif; font-weight: 800; font-size: 38px; }
.team-score.a .points { color: var(--team-a); }
.team-score.b .points { color: var(--team-b); }
.turn-indicator { font-size: 12px; color: var(--amber-ink); margin-top: 4px; opacity: 0; font-weight: 700; }
.team-score.active .turn-indicator { opacity: 1; }
.team-score.active { transform: translateY(-4px); box-shadow: 0 0 0 3px var(--sun), 0 16px 34px rgba(255,230,109,.25); }

.room-code { font-family: 'Baloo Bhaijaan 2', sans-serif; color: var(--ink-dim); font-size: 13px; text-align: center; margin-bottom: 20px; }
.room-code b { color: var(--amber-ink); letter-spacing: .12em; }

.question-grid {
    width: 100%;
    max-width: 900px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 14px;
}
.q-tile {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    background: linear-gradient(160deg, var(--card), var(--card-tint));
    border: 2px solid transparent;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Baloo Bhaijaan 2', sans-serif;
    font-size: 26px;
    font-weight: 800;
    color: var(--teal);
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 10px 22px rgba(6, 14, 30, .3);
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.q-tile:hover { transform: scale(1.07) translateY(-3px); border-color: var(--sun); box-shadow: 0 14px 28px rgba(255,230,109,.28); }
.q-tile.taken { color: var(--ink-dim); opacity: .35; cursor: not-allowed; pointer-events: none; }
.q-tile.taken:hover { transform: none; }
.q-tile.readonly { cursor: default; }
.q-tile.readonly:hover { transform: none; border-color: transparent; box-shadow: 0 10px 22px rgba(6, 14, 30, .3); }

/* ===== نافذة السؤال ===== */
.overlay {
    position: fixed; inset: 0; background: rgba(8,12,24,.82);
    backdrop-filter: blur(3px);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 50;
}
.q-modal {
    background: linear-gradient(165deg, var(--card), var(--card-tint));
    border: 1px solid rgba(255,255,255,.6);
    border-radius: 30px;
    max-width: 640px;
    width: 100%;
    padding: 34px;
    text-align: center;
    color: var(--ink);
    box-shadow: 0 30px 70px rgba(0,0,0,.45);
    animation: popIn .3s ease;
    margin: auto 0;      /* يبقيها في المنتصف عندما يسمح الارتفاع، ويتيح التمرير عندما لا يسمح (سفاري) */
}
@keyframes popIn {
    from { transform: scale(.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.timer-ring-wrap { position: relative; width: 130px; height: 130px; margin: 0 auto 20px; }
.timer-ring-wrap svg { transform: rotate(-90deg); width: 130px; height: 130px; }
.timer-ring-bg { fill: none; stroke: #e9eef8; stroke-width: 8; }
.timer-ring-fg { fill: none; stroke: var(--coral); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke .3s ease; }
.timer-num {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-family: 'Baloo Bhaijaan 2', sans-serif; font-size: 34px; font-weight: 800; color: var(--ink);
}
.q-turn { color: var(--amber-ink); font-weight: 700; margin-bottom: 6px; font-size: 14px; }
.q-text { font-size: 21px; font-weight: 700; margin: 10px 0 22px; line-height: 1.6; color: var(--ink); }

.q-media-wrap { margin: 0 0 22px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.q-media-gallery { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.q-media-gallery img { max-width: 220px; max-height: 220px; border-radius: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.18); object-fit: cover; }
.q-media-gallery.multi img { max-width: 140px; max-height: 140px; }
.q-media-video { width: 100%; max-width: 480px; aspect-ratio: 16/9; border: 0; border-radius: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.q-media-note { font-size: 13px; color: var(--ink-dim); font-weight: 600; }
.q-media-fallback {
    width: 100%; max-width: 480px; padding: 16px 18px; border-radius: 12px;
    background: rgba(255, 107, 107, .10); border: 1px solid rgba(255, 107, 107, .35);
    color: #a33; font-size: 14px; font-weight: 700; line-height: 1.7; text-align: center;
}
.q-media-fallback span { display: block; font-weight: 400; font-size: 12px; color: var(--ink-dim); margin-top: 4px; }
.q-media-fallback a { display: inline-block; margin-top: 8px; color: #2b4a80; font-size: 13px; }
.q-audio-only { display:flex; flex-direction:column; align-items:center; gap:8px; }
.q-audio-toggle { background: var(--accent, #6c8bff); color:#fff; border:0; border-radius: 30px; padding: 10px 22px; font-size: 15px; font-weight:700; cursor:pointer; }
.q-audio-toggle:hover { filter: brightness(1.08); }
.q-audio-hidden-frame { position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; border:0; }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }
.opt {
    background: #eef3fb; border: 2px solid transparent; border-radius: var(--radius-sm);
    padding: 14px; font-size: 15px; text-align: right; color: var(--ink);
    transition: border-color .15s ease;
}
.opt b { color: var(--teal); margin-left: 8px; }

.mod-controls { border-top: 2px dashed #e3e9f5; padding-top: 20px; margin-top: 8px; }
.mod-label { font-size: 13px; color: var(--ink-dim); margin-bottom: 12px; font-weight: 700; }
.mod-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.mod-actions .btn { flex: 1 1 auto; min-height: 50px; min-width: 140px; }

.call-badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(255, 107, 107, .12); color: var(--coral);
    border: 1px solid rgba(255, 107, 107, .35);
    padding: 6px 16px; border-radius: 999px; font-size: 13px; font-weight: 700;
    margin-bottom: 18px;
}
.call-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

/* شارة المكالمة الدائمة أعلى الصفحة — تظهر طوال الجلسة وليس فقط داخل نافذة السؤال */
.call-badge.persistent { margin: 0 0 14px; }

/* بطاقة الإجابة الصحيحة الظاهرة للجميع (لاعبين ومشاهدين ومشرف) */
.public-reveal {
    background: linear-gradient(to left, rgba(78,205,196,.18), rgba(161,138,253,.14));
    border: 1px solid rgba(78,205,196,.4);
    color: var(--ink);
    font-weight: 700;
    font-size: 16px;
    text-align: center;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    margin: 0 0 16px;
}

.hidden { display: none !important; }

/* ===== شاشة البداية: اختيار الدور (مشرف / لاعب) ===== */
.role-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    max-width: 760px;
    width: 100%;
    margin-top: 40px;
}
@media (max-width: 640px) { .role-grid { grid-template-columns: 1fr; } }
.role-grid-3 { grid-template-columns: repeat(3, 1fr); max-width: 1040px; }
@media (max-width: 900px) { .role-grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .role-grid-3 { grid-template-columns: 1fr; } }
.role-card {
    background: linear-gradient(160deg, var(--card), var(--card-tint));
    border: 2px solid transparent;
    border-radius: var(--radius);
    padding: 30px 22px;
    cursor: pointer;
    text-align: center;
    color: var(--ink);
    box-shadow: 0 14px 34px rgba(6, 14, 30, .35);
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.role-card:hover { transform: translateY(-6px) scale(1.02); box-shadow: 0 18px 40px rgba(78, 205, 196, .28); }
.role-card.selected { border-color: var(--teal); box-shadow: 0 18px 40px rgba(78, 205, 196, .35); }
.role-card .icon { font-size: 42px; margin-bottom: 12px; }
.role-card h3 { font-size: 18px; }
.role-card p { color: var(--ink-dim); font-size: 13px; margin-top: 8px; line-height: 1.6; }

/* ===== حالات الأخطاء والانتظار ===== */
.error-text { color: var(--coral); font-size: 14px; font-weight: 700; }
.waiting-spinner {
    width: 46px; height: 46px; margin: 8px auto 0;
    border: 5px solid #e9eef8;
    border-top-color: var(--sky);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== شارة الدور داخل الاستديو ===== */
.role-badge {
    display: inline-block;
    background: rgba(255, 230, 109, .55);
    color: var(--amber-ink);
    border: 1px solid rgba(138, 106, 0, .35);
    border-radius: 999px;
    padding: 3px 12px;
    font-size: 11px;
    font-weight: 700;
    margin-inline-start: 6px;
}

/* ===== لوحة طلبات الانضمام (المشرف فقط) ===== */
.pending-panel { padding: 20px 24px; margin-top: 0; margin-bottom: 24px; }
.pending-item {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: #eef3fb; border-radius: var(--radius-sm); padding: 12px 16px; margin-top: 10px;
}
.pending-item .who { font-weight: 700; font-size: 14px; color: var(--ink); }
.pending-item .who .team-tag { color: var(--ink-dim); font-weight: 400; font-size: 12px; margin-inline-start: 6px; }
.pending-item .actions { display: flex; gap: 8px; }
.pending-item .actions button {
    border: none; border-radius: 999px; padding: 8px 16px; font-weight: 700; cursor: pointer; font-size: 13px;
    transition: transform .15s ease;
}
.pending-item .actions button:hover { transform: translateY(-2px); }
.pending-item .actions .accept { background: linear-gradient(to left, var(--teal), var(--sky)); color: #fff; }
.pending-item .actions .decline { background: rgba(255, 107, 107, .14); color: var(--coral); }

.waiting-note { font-size: 13px; color: var(--ink-dim); margin-top: 14px; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .panel, .q-modal { padding: 24px 20px; }
    .team-score .points { font-size: 30px; }
}

/* ===== شريط علوي داخل الاستديو ===== */
.top-bar {
    width: 100%;
    max-width: 900px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}
.btn.sm { padding: 9px 18px; font-size: 13px; box-shadow: none; }

/* زر الإجابة الخاطئة — أوضح وأثقل بصريًا حتى لا يُخلط بينه وبين بقية الأزرار */
.btn.danger {
    background: linear-gradient(to left, #ff3b3b, var(--coral));
    box-shadow: 0 12px 28px rgba(255, 59, 59, .45);
    border: 2px solid rgba(255,255,255,.5);
    font-size: 17px;
}
.btn.danger:hover { box-shadow: 0 16px 32px rgba(255, 59, 59, .55); }

/* ===== زر "الانضمام كلاعب" في أعلى الصفحة الرئيسية ===== */
.join-cta {
    display: flex;
    align-items: center;
    gap: 18px;
    background: linear-gradient(to left, var(--teal), var(--sky));
    border-radius: var(--radius);
    padding: 22px 26px;
    max-width: 640px;
    width: 100%;
    margin-top: 36px;
    cursor: pointer;
    box-shadow: 0 16px 36px rgba(78, 205, 196, .35);
    transition: transform .2s ease, box-shadow .2s ease;
}
.join-cta:hover, .join-cta:focus-visible { transform: translateY(-4px); box-shadow: 0 20px 42px rgba(78, 205, 196, .45); outline: none; }
.join-cta .icon { font-size: 38px; }
.join-cta-text { flex: 1; text-align: right; color: #fff; }
.join-cta-text h3 { font-size: 19px; }
.join-cta-text p { font-size: 13px; opacity: .92; margin-top: 4px; line-height: 1.6; }
.join-cta-arrow { font-size: 20px; color: #fff; opacity: .85; }
.divider-label { color: var(--ink-dim); font-size: 13px; margin: 30px 0 -6px; text-align: center; }

/* ===== اختيار الافاتار ===== */
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px,1fr)); gap: 10px; margin-top: 8px; }
.avatar-chip {
    background: #eef3fb;
    border: 2px solid transparent;
    border-radius: 50%;
    text-align: center;
    padding: 6px;
    cursor: pointer;
    transition: transform .15s ease, border-color .15s ease;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.avatar-chip img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; display: block; }
.avatar-chip:hover { transform: translateY(-2px); }
.avatar-chip.selected { border-color: var(--teal); background: rgba(78, 205, 196, .16); }

.avatar-badge { width: 34px; height: 34px; margin-bottom: 2px; }
.avatar-badge img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; display: block; }
.avatar-badge.hidden { display: none; }

.avatar-mini { width: 20px; height: 20px; object-fit: contain; border-radius: 50%; vertical-align: middle; margin-inline-end: 4px; }

.join-actions { display: flex; flex-direction: column; gap: 10px; }

/* ===== أشرطة التصنيفات داخل الاستديو ===== */
.cat-tabs {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 18px;
}
.cat-tab {
    display: flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,.62);
    border: 2px solid rgba(31, 39, 64, .10);
    color: var(--ink);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.cat-tab:hover { background: rgba(255,255,255,.85); }
.cat-tab.active { border-color: var(--teal); background: rgba(78, 205, 196, .22); color: #14706a; }
.cat-tab.readonly { cursor: default; }
.cat-tab .icon { font-size: 16px; }

/* ===== تاج الفريق المتقدم ===== */
.crown { font-size: 20px; opacity: 0; transform: translateY(6px) scale(.7); transition: all .3s ease; margin-bottom: 2px; }
.team-score.leading .crown { opacity: 1; transform: translateY(0) scale(1); animation: bounce 1.4s infinite; }
.team-score.leading { box-shadow: 0 0 0 3px var(--sun), 0 16px 34px rgba(255,230,109,.3); }
@keyframes bounce { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-4px) scale(1.08); } }

/* ===== رسالة التأكيد بعد الحسم ===== */
.feedback-toast {
    margin-top: 14px;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
}
.feedback-toast.good { background: rgba(78, 205, 196, .16); color: #1a8a80; }
.feedback-toast.bad { background: rgba(255, 59, 59, .12); color: #d43333; }
.feedback-toast.neutral { background: rgba(161, 138, 253, .14); color: #6a4fd6; }

.reveal-answer {
    width: 100%;
    background: rgba(78, 205, 196, .14);
    color: #1a8a80;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
}

/* ===== نافذة النتائج النهائية ===== */
.confetti-wrap { position: relative; overflow: hidden; }
.confetti-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti-piece {
    position: absolute; top: -12px; width: 8px; height: 14px; opacity: .9;
    animation-name: confetti-fall; animation-timing-function: ease-in; animation-fill-mode: forwards;
}
@keyframes confetti-fall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(420px) rotate(540deg); opacity: 0; }
}
.results-row {
    display: flex; align-items: center; gap: 14px;
    background: #eef3fb; border-radius: var(--radius-sm);
    padding: 14px 18px; margin-top: 12px;
    position: relative; z-index: 1;
}
.results-row.first { background: linear-gradient(to left, rgba(255,230,109,.35), rgba(255,230,109,.1)); border: 2px solid var(--sun-deep); }
.results-row .medal { font-size: 28px; }
.results-row .results-name { flex: 1; text-align: right; font-weight: 700; color: var(--ink); }
.results-row .results-score { font-weight: 800; color: var(--teal); font-family: 'Baloo Bhaijaan 2', sans-serif; }

/* ===== تنبيه انتهاء الوقت ===== */
.q-modal.time-up { animation: timeUpPulse 1s ease-in-out infinite; }
@keyframes timeUpPulse {
    0%, 100% { box-shadow: 0 30px 70px rgba(0,0,0,.45), 0 0 0 0 rgba(255,59,59,.55); }
    50% { box-shadow: 0 30px 70px rgba(0,0,0,.45), 0 0 0 14px rgba(255,59,59,0); }
}
.time-up-banner {
    background: linear-gradient(to left, #ff3b3b, var(--coral));
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    margin-bottom: 14px;
    animation: timeUpBlink 1s ease-in-out infinite;
}
@keyframes timeUpBlink { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

.time-up-decision {
    width: 100%;
    background: linear-gradient(165deg, #fff, #fff5e8);
    border: 2px solid var(--sun-deep);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-bottom: 18px;
    animation: timeUpDecisionPop .35s ease;
}
@keyframes timeUpDecisionPop {
    0% { transform: scale(.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
.time-up-decision-title { font-weight: 800; color: var(--ink); font-size: 16px; margin-bottom: 14px; }
.time-up-decision-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.time-up-decision-actions .btn { flex: 1 1 auto; min-height: 50px; min-width: 160px; }

.hint-text { color: var(--ink-dim); font-size: 13px; text-align: center; margin: -6px 0 16px; }

/* ===== تذييل وسائل التواصل ===== */
.site-footer {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 22px 16px 28px;
    margin-top: 20px;
}
.footer-label { color: var(--ink-dim); font-size: 12px; font-weight: 700; }
.footer-link {
    color: var(--ink);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    opacity: .92;
    transition: opacity .15s ease, transform .15s ease;
}
.footer-link:hover { opacity: 1; transform: translateY(-2px); }

/* صور الإيموجي المخصَّصة من لوحة الأدمن (تحل محل رمز الإيموجي النصي تلقائيًا) */
.emoji-icon {
    display: inline-block;
    height: 1.15em;
    width: 1.15em;
    object-fit: contain;
    vertical-align: -0.2em;
}