/* ==========================================================================
   Sophicly Matching Pairs v2.2.0
   Two-column matching exercise.
   ========================================================================== */

.scm-widget {
    --scm-font: 'Proxima Soft', system-ui, -apple-system, sans-serif;
    --scm-text: #f0f0f2;
    --scm-text-muted: rgba(255,255,255,0.55);
    --scm-bg: #1C1D1F;
    --scm-card-bg: #2a2b2e;
    --scm-card-border: rgba(255,255,255,0.08);
    --scm-success: #1CD991;
    --scm-error: #E74C3C;
    --scm-accent: #51dacf;
    --scm-purple: #5333ed;

    font-family: var(--scm-font); max-width: 720px; margin: 24px auto;
    color: var(--scm-text); -webkit-font-smoothing: antialiased;
    animation: scmFadeIn 0.4s ease both;
}
.scm-widget *, .scm-widget *::before, .scm-widget *::after { box-sizing: border-box; }
@keyframes scmFadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

.scm-title { font-size: 20px; font-weight: 600; margin-bottom: 16px; text-align: center; }

/* ── Results Banner ───────────────────────────────────────────────────── */

.scm-results-banner {
    text-align: center; padding: 14px 20px; border-radius: 10px;
    margin-bottom: 16px; font-size: 16px; font-weight: 600;
    background: rgba(231,76,60,0.1); border: 1px solid var(--scm-error);
    color: var(--scm-text);
    animation: scmFadeIn 0.3s ease both;
}
.scm-results-banner--perfect {
    background: rgba(28,217,145,0.1); border-color: var(--scm-success);
}
.scm-results-fraction { font-size: 18px; font-weight: 700; }
.scm-results-pct { font-size: 14px; color: var(--scm-text-muted); font-weight: 500; }

/* ── Board (two columns) ─────────────────────────────────────────────── */

.scm-board {
    display: flex; gap: 24px; margin-bottom: 16px;
}
.scm-col {
    flex: 1; display: flex; flex-direction: column; gap: 8px;
}
.scm-col-header {
    font-size: 13px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--scm-text-muted); text-align: center;
    margin-bottom: 4px;
}

/* ── Item Cards ───────────────────────────────────────────────────────── */

.scm-item {
    padding: 12px 16px; border-radius: 10px;
    border: 2px solid var(--scm-card-border);
    background: var(--scm-card-bg);
    cursor: pointer; user-select: none;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    display: flex; align-items: center; gap: 10px;
    min-height: 48px;
}
.scm-item:hover {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.15);
}
.scm-item:active { transform: scale(0.98); }

/* Selected (waiting for pair) */
.scm-item--selected {
    border-color: var(--scm-purple);
    box-shadow: 0 0 0 3px rgba(83,51,237,0.25);
    background: rgba(83,51,237,0.06);
}

/* Paired (matched with a partner) */
.scm-item--paired {
    border-color: var(--scm-pair-color, var(--scm-accent));
    background: rgba(81,218,207,0.06);
}

/* Feedback states */
.scm-item--correct {
    border-color: var(--scm-success) !important;
    background: rgba(28,217,145,0.08) !important;
    cursor: default;
}
.scm-item--wrong {
    border-color: var(--scm-error) !important;
    background: rgba(231,76,60,0.08) !important;
    cursor: default;
}

/* Item content */
.scm-item-label {
    flex: 1; font-size: 14px; font-weight: 600; line-height: 1.4;
}

/* Pair badge */
.scm-pair-badge {
    width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: #fff;
    background: var(--scm-pair-color, var(--scm-accent));
}

/* ── Action Buttons ───────────────────────────────────────────────────── */

.scm-actions {
    display: flex; align-items: center; justify-content: center;
    gap: 10px; flex-wrap: wrap;
}

.scm-btn {
    padding: 8px 20px; border: none; border-radius: 24px;
    font-family: var(--scm-font); font-size: 14px; font-weight: 600;
    cursor: pointer; transition: background 0.2s ease, transform 0.15s ease;
}
.scm-btn:active { transform: scale(0.97); }
.scm-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.scm-btn--check { background: var(--scm-purple); color: #fff; }
.scm-btn--check:hover:not(:disabled) { background: #6b4fff; }
.scm-btn--checked { background: var(--scm-success); color: #1C1D1F; }
.scm-btn--checked:hover { background: #2ee8a6; }
.scm-btn--primary { background: var(--scm-accent); color: #1C1D1F; }
.scm-btn--primary:hover:not(:disabled) { background: #7DF9E9; }
.scm-btn--secondary { background: transparent; border: 1px solid var(--scm-card-border); color: var(--scm-text); }
.scm-btn--secondary:hover { background: rgba(255,255,255,0.05); }

.scm-status { font-size: 13px; font-weight: 500; }
.scm-status--saved { color: var(--scm-success); }
.scm-status--error { color: var(--scm-error); }

/* ── Light Theme ──────────────────────────────────────────────────────── */

html[data-theme="light"] .scm-widget, html.light .scm-widget {
    --scm-text: #1a1a1e;
    --scm-text-muted: rgba(0,0,0,0.5);
    --scm-bg: #f5f5f7;
    --scm-card-bg: #fff;
    --scm-card-border: rgba(0,0,0,0.1);
}
html[data-theme="light"] .scm-btn--primary, html.light .scm-btn--primary { background: #5333ed; color: #fff; }
html[data-theme="light"] .scm-btn--primary:hover, html.light .scm-btn--primary:hover { background: #6b4fff; }

/* ── Focus Mode ───────────────────────────────────────────────────────── */

.sophicly-focus-mode .scm-widget { max-width: none; margin: 24px 0; }

/* ── Responsive ───────────────────────────────────────────────────────── */

@media (max-width: 540px) {
    .scm-board { flex-direction: column; gap: 16px; }
    .scm-widget { margin: 16px 8px; }
    .scm-item { padding: 10px 12px; }
    .scm-item-label { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
    .scm-widget *, .scm-widget *::before, .scm-widget *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
