/**
 * Eduplayify Game Engine: Common Styles
 * التنسيقات المشتركة لمحرك الألعاب (الهيكل، المؤقتات، التنقل، النتائج، الأزرار)
 */

/* إطار وحاوية اللعب */
.play-container {
    max-width: 1060px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}
.play-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}
#gpCard {
    background: #fff;
    border-radius: var(--radius-lg, 16px);
    border: 1px solid var(--border-color, #e2e8f0);
    box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1));
    overflow: hidden;
    min-height: 520px;
    position: relative;
}
#gamePlayArea {
    position: relative;
    width: 100%;
    min-height: 520px;
    display: flex;
    flex-direction: column;
}

/* وضع ملء الشاشة */
.gpa-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    background: #f8fafc !important;
    margin: 0 !important;
    padding: 1rem !important;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* لوحة المؤقتات والإيقاف */
.timers-panel {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.game-timer-badge {
    background: #eef2ff;
    color: #4338ca;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.92rem;
    font-weight: 700;
    border: 1px solid #c7d2fe;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.game-pause-btn {
    background: #fff;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-sm, 6px);
    padding: 4px 10px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}
.game-pause-btn:hover {
    background: #f1f5f9;
}

/* مضيف شريط تقدم الأسئلة */
.q-progress-host {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}
.qp-pill {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--primary, #4f46e5);
    white-space: nowrap;
}
.qp-track {
    flex-grow: 1;
    height: 8px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}
.qp-track > i {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, #06b6d4);
    border-radius: 10px;
    transition: width 0.35s ease;
}

/* أسهم التنقل */
.qnav-host {
    position: absolute;
    bottom: 16px;
    inset-inline-start: 20px;
    display: flex;
    gap: 8px;
    z-index: 25;
}
.qnav-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1.5px solid var(--border-color, #cbd5e1);
    background: #fff;
    color: var(--dark, #334155);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}
.qnav-btn svg {
    width: 14px !important;
    height: 14px !important;
    max-width: 14px !important;
    max-height: 14px !important;
    min-width: 14px !important;
    min-height: 14px !important;
    display: block;
    stroke: currentColor;
}
.qnav-btn:hover:not(:disabled) {
    background: var(--primary, #4f46e5);
    color: #fff;
    border-color: var(--primary, #4f46e5);
    transform: scale(1.06);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}
.qnav-btn:active:not(:disabled) {
    transform: scale(0.96);
}
.qnav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: #f8fafc;
    box-shadow: none;
}

/* الحاوية العامة للأسئلة */
.gp-qwrap {
    padding: clamp(0.75rem, 2vw, 1.75rem);
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 420px;
}
.gp-qarea {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}
.gpa-fullscreen .gp-qarea {
    max-width: 1120px;
}

/* شاشة اختيار نمط اللعب */
.mode-select-wrap {
    text-align: center;
    padding: 2.5rem 1rem;
}
.mode-select-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--dark, #1e293b);
}
.mode-select-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* صورة السؤال المشتركة */
.ws-image {
    max-height: 220px;
    max-width: 90%;
    display: block;
    margin: 0 auto 20px;
    border-radius: 14px;
    object-fit: contain;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    background: #ffffff;
    padding: 4px;
}

/* التغذية الراجعة المشتركة */
.ws-feedback {
    margin: 16px auto 0;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 1.05rem;
    text-align: center;
    max-width: 480px;
    animation: wsFeedbackIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes wsFeedbackIn {
    from { opacity: 0; transform: translateY(6px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.ws-feedback.correct,
.ws-feedback.is-correct {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    color: #065f46;
    border: 1.5px solid #a7f3d0;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.12);
}
.ws-feedback.incorrect,
.ws-feedback.is-incorrect {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #991b1b;
    border: 1.5px solid #fecaca;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.12);
}

/* شاشة نهاية اللعبة والنتائج */
.ws-final-score {
    font-size: 1.5rem;
    font-weight: 800;
    color: #4f46e5;
    margin: 12px 0;
}
.ws-details-panel {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px;
    text-align: right;
    max-height: 300px;
    overflow-y: auto;
}
.ws-detail-row {
    padding: 8px 10px;
    margin-bottom: 6px;
    border-radius: 6px;
    border-right: 4px solid #cbd5e1;
    background: #fff;
}
.ws-detail-correct { border-right-color: #10b981; }
.ws-detail-partial { border-right-color: #f59e0b; }
.ws-detail-incorrect { border-right-color: #ef4444; }

/* زر نطق الصوت TTS */
.tts-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    margin: 0 4px;
    vertical-align: middle;
    opacity: 0.75;
    transition: opacity 0.2s;
}
.tts-btn:hover { opacity: 1; transform: scale(1.1); }

/* تحسين السحب والإفلات على شاشات اللمس والمتصفحات */
.cls-card,
.ord-slot,
.ord-item-btn,
.il-point,
.il-word,
.match-b-card,
[data-draggable="true"] {
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}