/**
 * Eduplayify Game Template CSS: odd_one_out (اكتشف العنصر الدخيل)
 * تصميم مبهج وجذاب للأطفال بألوان حيوية، بطاقات لمسية ثلاثية الأبعاد، وحركات تفاعلية سلسة
 */

.ooo-wrap {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: clamp(0.75rem, 2.5vw, 1.75rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    font-family: inherit;
    user-select: none;
    -webkit-user-select: none;
}

/* رأس النشاط والشارات */
.ooo-header-box {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
    text-align: center;
}

.ooo-prompt-bar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #ffffff;
    border: 2px solid #e0e7ff;
    padding: clamp(8px, 1.5vw, 12px) clamp(14px, 3vw, 24px);
    border-radius: 9999px;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.08);
}

.ooo-prompt-icon {
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.12));
}

.ooo-prompt-text {
    font-size: clamp(1.05rem, 2vw, 1.35rem);
    font-weight: 800;
    color: #1e1b4b;
    margin: 0;
}

.ooo-category-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1.5px solid #bfdbfe;
    padding: 4px 14px;
    border-radius: 9999px;
    font-size: clamp(0.82rem, 1.5vw, 0.95rem);
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.08);
}

/* شبكة البطاقات التفاعلية */
.ooo-grid {
    width: 100%;
    display: grid;
    gap: clamp(12px, 2vw, 20px);
    justify-content: center;
    margin-bottom: clamp(1rem, 2vw, 1.5rem);
}

/* توزيع الأعمدة الذكي حسب عدد العناصر */
.ooo-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ooo-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ooo-grid-5 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ooo-grid-6 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 768px) {
    .ooo-grid-3,
    .ooo-grid-4,
    .ooo-grid-5,
    .ooo-grid-6 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .ooo-grid-3 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
}

/* تصميم بطاقة العنصر ثلاثية الأبعاد */
.ooo-card {
    position: relative;
    background: #ffffff;
    border: 3px solid #e2e8f0;
    border-radius: clamp(14px, 2vw, 22px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06), 0 4px 0 #cbd5e1;
    padding: clamp(12px, 2vw, 18px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: clamp(140px, 20vw, 200px);
    cursor: pointer;
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
    outline: none;
    touch-action: manipulation;
}

.ooo-card:hover:not(.is-disabled) {
    transform: translateY(-5px);
    border-color: #6366f1;
    box-shadow: 0 14px 26px rgba(99, 102, 241, 0.15), 0 6px 0 #4f46e5;
}

.ooo-card:active:not(.is-disabled) {
    transform: translateY(2px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08), 0 1px 0 #cbd5e1;
}

.ooo-card:focus-visible {
    border-color: #4f46e5;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.35);
}

/* شارة رقم العنصر الكرتونية */
.ooo-card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #cbd5e1;
}

[dir="rtl"] .ooo-card-badge {
    right: auto;
    left: 8px;
}

/* صورة العنصر */
.ooo-card-img-wrap {
    width: 100%;
    max-height: clamp(80px, 12vw, 120px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 12px;
}

.ooo-card-img {
    max-width: 100%;
    max-height: clamp(80px, 12vw, 120px);
    object-fit: contain;
    border-radius: 10px;
    transition: transform 0.2s ease;
}

.ooo-card:hover .ooo-card-img {
    transform: scale(1.04);
}

/* نص العنصر */
.ooo-card-label {
    font-size: clamp(1rem, 1.8vw, 1.3rem);
    font-weight: 800;
    color: #1e293b;
    text-align: center;
    word-break: break-word;
    line-height: 1.35;
    margin: 0;
}

/* صف الصوت داخل البطاقة */
.ooo-card-audio {
    margin-top: 2px;
}

/* حالة البطاقة الصحيحة (العنصر الدخيل المكتشف) */
.ooo-card.is-solved-odd {
    background: #f0fdf4 !important;
    border-color: #22c55e !important;
    box-shadow: 0 12px 28px rgba(34, 197, 94, 0.25), 0 5px 0 #16a34a !important;
    transform: translateY(-4px) scale(1.03);
    animation: ooo-tada 0.7s ease-in-out;
}

.ooo-card.is-solved-odd .ooo-card-label {
    color: #14532d !important;
}

.ooo-card.is-solved-odd .ooo-card-badge {
    background: #22c55e;
    color: #ffffff;
    border-color: #16a34a;
}

/* حالة بقية العناصر المنتمية للمجموعة بعد الحل */
.ooo-card.is-solved-common {
    background: #f8fafc !important;
    border-color: #94a3b8 !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04), 0 2px 0 #cbd5e1 !important;
    opacity: 0.85;
}

/* حالة الاختيار الخاطئ */
.ooo-card.is-wrong-pick {
    background: #fef2f2 !important;
    border-color: #ef4444 !important;
    box-shadow: 0 8px 18px rgba(239, 68, 68, 0.2), 0 4px 0 #dc2626 !important;
    animation: ooo-wobble 0.5s ease-in-out;
}

.ooo-card.is-disabled {
    cursor: default;
    pointer-events: none;
}

.ooo-card.is-eliminated {
    opacity: 0.45;
    filter: grayscale(0.5);
    border-style: dashed;
}

/* بطاقة كشف التفسير التعليمي المبهجة */
.ooo-reveal-card {
    width: 100%;
    max-width: 640px;
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
    border: 2.5px solid #86efac;
    border-radius: 18px;
    padding: clamp(14px, 2.5vw, 22px);
    box-shadow: 0 10px 25px rgba(34, 197, 94, 0.15);
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
    margin-top: 8px;
    animation: ooo-pop-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ooo-reveal-title {
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    font-weight: 800;
    color: #15803d;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ooo-reveal-reason {
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    font-weight: 700;
    color: #166534;
    line-height: 1.5;
    margin: 0;
}

/* انفجار لطيف كرتوني للعنصر الدخيل */
.ooo-card.is-popping-cute {
    animation: ooo-cute-pop 0.65s cubic-bezier(0.25, 1.25, 0.5, 1) forwards !important;
    z-index: 10;
}

@keyframes ooo-cute-pop {
    0% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.18) rotate(-4deg);
        box-shadow: 0 0 25px rgba(251, 191, 36, 0.6), 0 0 50px rgba(244, 63, 94, 0.4);
    }
    55% {
        transform: scale(1.24) rotate(4deg);
        border-color: #f59e0b;
    }
    75% {
        transform: scale(0.94) rotate(-1deg);
    }
    100% {
        transform: scale(1.06) rotate(0deg);
        box-shadow: 0 0 35px rgba(34, 197, 94, 0.5), 0 10px 25px rgba(0, 0, 0, 0.12);
        border-color: #22c55e;
        background: #f0fdf4 !important;
    }
}

/* شظايا نجوم ومفرقعات كرتونية لطيفة تنبثق حول العنصر الدخيل */
.ooo-sparkle-burst {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
    z-index: 20;
}

.ooo-sparkle-item {
    position: absolute;
    top: 50%;
    left: 50%;
    font-size: 1.5rem;
    line-height: 1;
    transform: translate(-50%, -50%);
    animation: ooo-sparkle-fly 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes ooo-sparkle-fly {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.3) rotate(0deg);
    }
    80% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx, 0), var(--ty, 0)) scale(1.3) rotate(var(--rot, 360deg));
    }
}

/* النافذة المنبثقة الأنيقة للتلميح والتفسير العلمي */
.ooo-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 3vw, 24px);
    animation: ooo-fade-in 0.25s ease-out;
}

.ooo-modal-dialog {
    background: #ffffff;
    width: 100%;
    max-width: 480px;
    border-radius: clamp(20px, 3.5vw, 28px);
    border: 3.5px solid #818cf8;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.35), 0 0 35px rgba(99, 102, 241, 0.25);
    padding: clamp(20px, 3.5vw, 28px);
    text-align: center;
    position: relative;
    overflow: hidden;
    animation: ooo-modal-bounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-sizing: border-box;
}

.ooo-modal-icon-wrap {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fef08a 0%, #facc15 100%);
    border: 3px solid #eab308;
    box-shadow: 0 8px 20px rgba(234, 179, 8, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    animation: ooo-tada 1s infinite alternate;
}

.ooo-modal-title {
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    font-weight: 900;
    color: #1e1b4b;
    margin: 0 0 10px;
}

.ooo-modal-odd-target {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fef2f2;
    color: #dc2626;
    border: 1.5px solid #fecaca;
    padding: 6px 14px;
    border-radius: 9999px;
    font-weight: 800;
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.ooo-modal-reason-box {
    background: linear-gradient(135deg, #f8fafc 0%, #fdf4ff 100%);
    border: 2px dashed #c084fc;
    border-radius: 18px;
    padding: clamp(14px, 2.5vw, 18px);
    margin: 12px 0 18px;
    position: relative;
    text-align: center;
}

.ooo-modal-reason-label {
    font-size: 0.82rem;
    font-weight: 800;
    color: #9333ea;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.ooo-modal-reason-text {
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    font-weight: 800;
    color: #4a044e;
    line-height: 1.55;
    margin: 0;
}

.ooo-modal-common-cat {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1d4ed8;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 4px 10px;
    margin-top: 8px;
    display: inline-block;
}

.ooo-modal-btn {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #ffffff;
    border: none;
    border-radius: 9999px;
    padding: clamp(12px, 2vw, 15px) clamp(28px, 4vw, 42px);
    font-size: clamp(1.05rem, 2vw, 1.2rem);
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35), 0 3px 0 #3730a3;
    transition: transform 0.15s, box-shadow 0.15s;
    outline: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ooo-modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(99, 102, 241, 0.45), 0 4px 0 #3730a3;
}

.ooo-modal-btn:active {
    transform: translateY(2px);
    box-shadow: 0 3px 8px rgba(99, 102, 241, 0.25), 0 1px 0 #3730a3;
}

@keyframes ooo-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes ooo-modal-bounce {
    0% { opacity: 0; transform: scale(0.7) translateY(30px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* حركات كرتونية لطيفة (Keyframes) */
@keyframes ooo-wobble {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-8px) rotate(-3deg); }
    30% { transform: translateX(7px) rotate(2deg); }
    45% { transform: translateX(-5px) rotate(-2deg); }
    60% { transform: translateX(4px) rotate(1deg); }
    75% { transform: translateX(-2px); }
}

@keyframes ooo-tada {
    0% { transform: scale(1); }
    10%, 20% { transform: scale(0.93) rotate(-3deg); }
    30%, 50%, 70%, 90% { transform: scale(1.08) rotate(3deg); }
    40%, 60%, 80% { transform: scale(1.08) rotate(-3deg); }
    100% { transform: scale(1.03) rotate(0); }
}

@keyframes ooo-pop-in {
    0% { opacity: 0; transform: translateY(18px) scale(0.92); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
