/**
 * Eduplayify Template: matching
 * يطابق أصناف matching.js فعليًا (match-player-wrap / il-wrap / match-layout / match-col / match-b-card / il-word).
 * ملاحظة: كل سطر px قبل clamp/grid هو fallback مقصود للمتصفحات القديمة
 * التي تتجاهل الدوال الحديثة وتأخذ القيمة الثابتة (نفس أسلوب wheel.css).
 */
.match-player-wrap {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    text-align: center;
}
.match-player-header {
    font-weight: 700;
    margin-bottom: 12px;
    text-align: center;
}
.il-wrap {
    position: relative;
    text-align: center;
}
.il-wrap .ws-feedback {
    min-height: 20px;
    font-size: 0.95rem;
    margin-bottom: 4px;
}
.il-lines-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}
/* الشبكة الحديثة: عمودان متجاوران مع صفوف متزامنة عبر grid-row من JS */
.match-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    row-gap: 6px;
    row-gap: clamp(4px, 0.8vh, 10px);
    column-gap: 30px;
    column-gap: clamp(16px, 5vw, 70px);
    align-items: center;
    justify-items: center;
    padding: 0;
}
/* fallback للمتصفحات بلا grid: عمودان بجانب بعضهما بـ inline-block */
@supports not (display: grid) {
    .match-layout { display: block; }
    .match-col-a, .match-col-b {
        display: inline-block;
        vertical-align: top;
        width: 46%;
    }
}
.match-col { display: contents; }
.match-col-a > * { grid-column: 1; }
.match-col-b > * { grid-column: 2; }
.match-col .il-word {
    font-size: 0.9rem;
    font-size: clamp(0.8rem, 1.5vh, 1.05rem);
    padding: 8px 12px;
    padding: clamp(6px, 1vh, 11px) clamp(8px, 1.2vw, 16px);
    text-align: center;
}
.il-word {
    margin: 0;
    display: inline-flex;
    width: 100%;
    cursor: grab;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background-color: #ffffff;
    text-align: center;
    font-weight: 800;
    padding: 9px 14px;
    padding: clamp(7px, 1.2vh, 12px) clamp(12px, 1.8vw, 18px);
    border: 2px solid #f0e2bc;
    color: #1e2438;
    font-size: 0.95rem;
    font-size: clamp(0.85rem, 1.5vh, 1.1rem);
    box-shadow: 0 2px 0 #e9d9ae, 0 6px 12px -6px rgba(30, 36, 56, 0.15);
}
.il-word .tts-btn { margin-inline-start: 6px; }
.il-word:hover {
    transform: translateY(-2px);
    border-color: #ffb020;
}
.il-word.drop-hover {
    transform: translateY(-2px) scale(1.03);
    border-color: #3d4fe0;
    box-shadow: 0 0 0 4px rgba(61, 79, 224, 0.15), 0 8px 16px -8px rgba(61, 79, 224, 0.3);
}
.il-word-pending {
    background: #eef0fd;
    color: #2e3bb0;
    border: 2px solid #3d4fe0;
}
.il-word-correct {
    background: #1faa6b;
    color: #fff;
    border: 2px solid #188f5a;
    cursor: default;
}
.il-word-incorrect-final {
    background: #e5484d;
    color: #fff;
    border: 2px solid #c0392b;
    cursor: default;
}
.il-line-pending { stroke: #3d4fe0; stroke-width: 3; }
.il-line-dragging { stroke: #3d4fe0; stroke-width: 3; stroke-dasharray: 6 4; }
.il-line-correct { stroke: #1faa6b; stroke-width: 3; }
.il-line-incorrect { stroke: #e5484d; stroke-width: 3; }
.il-line-reveal { stroke: #1faa6b; stroke-width: 2.5; stroke-dasharray: 5 5; }
.match-b-card {
    margin-left: auto;
    margin-right: auto;
    display: flex;
    width: fit-content;
    max-width: 100%;
    cursor: grab;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    border-width: 2px;
    border-style: solid;
    border-color: #e4e7f1;
    background-color: #ffffff;
    text-align: center;
    touch-action: none;
    padding: 8px 12px;
    padding: clamp(6px, 1vh, 12px) clamp(10px, 1.3vw, 16px);
    box-shadow: 0 2px 8px -4px rgba(30, 36, 56, 0.1);
}
.match-b-card:hover { border-color: #aeb9e8; transform: translateY(-2px); box-shadow: 0 10px 20px -8px rgba(30, 36, 56, 0.18); }
.match-b-card:active { cursor: grabbing; }
.match-b-card.drop-hover {
    border-color: #3d4fe0;
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 0 0 4px rgba(61, 79, 224, 0.15), 0 10px 20px -8px rgba(61, 79, 224, 0.3);
}
.match-b-card.connected { border-color: #3d4fe0; background: #eef0fd; transform: scale(1.03); box-shadow: 0 6px 15px rgba(61, 79, 224, 0.15); }
.match-b-card.correct { border-color: #1faa6b; background: #e9f9f0; box-shadow: 0 4px 12px rgba(31, 170, 107, 0.15); }
.match-b-card.incorrect { border-color: #e5484d; background: #fdebec; box-shadow: 0 4px 12px rgba(229, 72, 77, 0.15); }
.match-b-image { max-width: 100%; border-radius: 8px; max-height: 90px; max-height: min(11vh, 90px); box-shadow: 0 2px 6px rgba(0,0,0,0.05); }
.match-b-card > * + * { margin-inline-start: 12px; }
.match-b-word { font-weight: 800; color: #1e2438; font-size: 1rem; font-size: clamp(0.95rem, 1.8vh, 1.15rem); }
.match-b-word .tts-btn { margin-inline-start: 6px; }
/* fallback flex-gap: هوامش للأطفال بدل gap (المتصفحات القديمة تتجاهل gap) */
@supports not (gap: 8px) {
    .match-b-card > * { margin: 0 6px; }
}
/* الشاشات الضيقة: تصغير الحشوات بدل كسر الأعمدة */
@media (max-width: 480px) {
    .match-layout { gap: 8px; }
    .match-col .il-word { font-size: 0.75rem; padding: 7px 8px; }
    .match-b-card { padding: 6px; }
    .match-b-image { max-height: 50px; }
    .match-b-word { font-size: 0.75rem; }
    .il-word { padding: 8px 10px; font-size: 0.8rem; }
}
