/* =========================================================
   ملامح جيمناي — Gemini Features
   لعبة استنتاج، واجهة تحقيق داكنة، RTL، متجاوبة للجوال
   ========================================================= */

:root {
    --qfx-bg-1: #0b1020;
    --qfx-bg-2: #0f172a;
    --qfx-bg-3: #111c33;
    --qfx-surface: rgba(255, 255, 255, .045);
    --qfx-surface-2: rgba(255, 255, 255, .07);
    --qfx-border: rgba(148, 163, 184, .18);
    --qfx-border-strong: rgba(148, 163, 184, .35);
    --qfx-text: #e7ecf5;
    --qfx-muted: #94a3b8;
    --qfx-gold: #fbbf24;
    --qfx-sky: #38bdf8;
    --qfx-sky-soft: rgba(56, 189, 248, .14);
    --qfx-green: #22c55e;
    --qfx-red: #f87171;
    --qfx-radius: 16px;
    --qfx-shadow: 0 18px 50px rgba(0, 0, 0, .45);
    --qgame-footer-h: calc(62px + env(safe-area-inset-bottom, 0px));
    font-synthesis: none;
}

* { box-sizing: border-box; }

html, body.qfx-body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background:
        radial-gradient(1200px 600px at 80% -10%, rgba(56, 189, 248, .12), transparent 60%),
        radial-gradient(900px 500px at 10% 0%, rgba(251, 191, 36, .08), transparent 55%),
        linear-gradient(160deg, var(--qfx-bg-1), var(--qfx-bg-2) 55%, var(--qfx-bg-3));
    background-attachment: fixed;
    color: var(--qfx-text);
    font-family: 'Tajawal', system-ui, -apple-system, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}

.qfx {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    padding: max(16px, env(safe-area-inset-top)) 14px 0;
    padding-bottom: calc(var(--qgame-footer-h, 102px) + env(safe-area-inset-bottom, 0px));
}

.qfx-stage-wrap {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 12px;
}

.qfx-stage {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 0 2px;
}

.qfx-progress {
    position: fixed;
    top: max(14px, env(safe-area-inset-top));
    inset-inline-end: 14px;
    z-index: 40;
    font-size: 12px;
    font-weight: 700;
    color: rgba(148, 163, 184, .85);
    background: rgba(15, 23, 42, .65);
    border: 1px solid var(--qfx-border);
    border-radius: 999px;
    padding: 4px 10px;
    backdrop-filter: blur(8px);
}

.qfx-embedded .qfx-progress,
.qfx-embedded #qfx-footer {
    display: none !important;
}

/* ---------- loader & empty ---------- */
.qfx-loader, .qfx-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--qfx-muted);
}
.qfx-loader__icon, .qfx-empty__icon {
    font-size: 46px;
    margin-bottom: 12px;
    animation: qfx-pulse 1.6s ease-in-out infinite;
}
.qfx-empty h2 { color: var(--qfx-text); margin: 8px 0; }
@keyframes qfx-pulse { 0%, 100% { opacity: .55; transform: scale(.96);} 50% { opacity: 1; transform: scale(1);} }

/* ---------- card ---------- */
.qfx-card {
    background: var(--qfx-surface);
    border: 1px solid var(--qfx-border);
    border-radius: var(--qfx-radius);
    box-shadow: var(--qfx-shadow);
    padding: 22px 18px;
    margin: 6px 0 20px;
    backdrop-filter: blur(10px);
    animation: qfx-in .35s ease;
}
@keyframes qfx-in { from { opacity: 0; transform: translateY(10px);} to { opacity: 1; transform: none;} }

.qfx-badge-top {
    display: inline-block;
    background: var(--qfx-sky-soft);
    color: #bae6fd;
    border: 1px solid rgba(56, 189, 248, .3);
    border-radius: 999px;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 700;
}
.qfx-title {
    font-size: 30px;
    font-weight: 800;
    margin: 12px 0 6px;
    letter-spacing: .5px;
}

.qfx-diff {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 999px;
    border: 1px solid var(--qfx-border-strong);
    color: var(--qfx-muted);
}
.qfx-diff.easy { color: #86efac; border-color: rgba(34,197,94,.4); }
.qfx-diff.medium { color: #fde68a; border-color: rgba(251,191,36,.4); }
.qfx-diff.hard { color: #fca5a5; border-color: rgba(248,113,113,.4); }

/* ---------- intro ---------- */
.qfx-card--intro { text-align: center; }
.qfx-story {
    margin: 16px auto;
    max-width: 460px;
    font-size: 16px;
    line-height: 1.85;
    color: #cbd5e1;
    background: var(--qfx-surface-2);
    border: 1px solid var(--qfx-border);
    border-radius: 12px;
    padding: 16px;
}
.qfx-rules {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 420px;
    margin: 0 auto 20px;
    text-align: start;
}
.qfx-rule {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14.5px;
    color: #d7dee9;
    background: var(--qfx-surface);
    border: 1px solid var(--qfx-border);
    border-radius: 10px;
    padding: 10px 14px;
}
.qfx-rule span { font-size: 20px; }
.qfx-rule b { color: var(--qfx-gold); }

/* ---------- statements view ---------- */
.qfx-card--read { text-align: center; }
.qfx-view-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.qfx-view-hint { font-size: 14px; font-weight: 700; color: #bae6fd; }
.qfx-count {
    font-size: 26px;
    font-weight: 900;
    color: var(--qfx-sky);
    min-width: 48px;
    text-align: center;
    background: var(--qfx-sky-soft);
    border-radius: 10px;
    padding: 2px 8px;
}
.qfx-count.danger { color: var(--qfx-red); background: rgba(248,113,113,.16); animation: qfx-blink .7s steps(2) infinite; }
@keyframes qfx-blink { 50% { opacity: .4; } }

.qfx-timebar {
    width: 100%;
    height: 8px;
    background: rgba(148,163,184,.18);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 16px;
}
.qfx-timebar__fill {
    display: block;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--qfx-sky), var(--qfx-gold));
    border-radius: 999px;
}

.qfx-statements {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: start;
    margin-bottom: 16px;
}
.qfx-stmt {
    background: var(--qfx-surface-2);
    border: 1px solid var(--qfx-border);
    border-radius: 12px;
    padding: 14px 16px;
}
.qfx-stmt__witness {
    font-size: 13px;
    font-weight: 800;
    color: var(--qfx-sky);
    margin-bottom: 6px;
}
.qfx-stmt__text {
    font-size: 16px;
    line-height: 1.8;
    color: #e7ecf5;
}

/* ---------- suspects grid ---------- */
.qfx-grid-head { text-align: center; margin-bottom: 16px; }
.qfx-grid-desc { color: var(--qfx-muted); font-size: 14px; margin: 10px 0; }

.qfx-suspects-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
.qfx-suspect {
    appearance: none;
    padding: 0;
    cursor: pointer;
    background: #0b1224;
    border: 2px solid var(--qfx-border-strong);
    border-radius: 14px;
    overflow: hidden;
    transition: border-color .15s ease, transform .12s ease, box-shadow .15s ease;
    font-family: inherit;
    color: var(--qfx-text);
    display: block;
    text-align: center;
}
.qfx-suspect:hover { border-color: var(--qfx-sky); }
.qfx-suspect.selected {
    border-color: var(--qfx-sky);
    box-shadow: 0 0 0 3px rgba(56,189,248,.3);
    transform: translateY(-2px);
}
.qfx-suspect__img {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    background: #0b1224;
}
.qfx-suspect__img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.qfx-suspect-emoji { font-size: 70px; padding: 40px 0; }
.qfx-suspect__label {
    font-size: 13.5px;
    font-weight: 700;
    padding: 9px 6px;
    color: #cbd5e1;
}

/* ---------- result grid states ---------- */
.qfx-suspects-grid--result .qfx-suspect { cursor: default; }
.qfx-suspect--result.correct {
    border-color: var(--qfx-green);
    box-shadow: 0 0 0 3px rgba(34,197,94,.3);
}
.qfx-suspect--result.wrong {
    border-color: var(--qfx-red);
    box-shadow: 0 0 0 3px rgba(248,113,113,.3);
}
.qfx-tag {
    position: absolute;
    inset-inline-start: 8px;
    top: 8px;
    font-size: 12px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 999px;
}
.qfx-tag--ok { background: var(--qfx-green); color: #06281a; }
.qfx-tag--bad { background: var(--qfx-red); color: #2b0a0a; }

.qfx-reason {
    margin-top: 14px;
    background: var(--qfx-surface-2);
    border: 1px solid rgba(251,191,36,.3);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 15px;
    line-height: 1.8;
    color: #fde68a;
    text-align: start;
}
.qfx-reason__icon { font-size: 18px; }

/* ---------- buttons ---------- */
.qfx-btn {
    appearance: none;
    border: none;
    border-radius: 12px;
    padding: 13px 22px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .12s ease, filter .15s ease, opacity .15s ease;
    text-decoration: none;
    display: inline-block;
}
.qfx-btn:active { transform: translateY(1px); }
.qfx-btn:disabled { opacity: .5; cursor: not-allowed; }
.qfx-btn--primary {
    background: linear-gradient(135deg, var(--qfx-sky), #0ea5e9);
    color: #06263b;
    box-shadow: 0 10px 26px rgba(56,189,248,.28);
}
.qfx-btn--primary:hover:not(:disabled) { filter: brightness(1.07); }
.qfx-btn--ghost {
    background: var(--qfx-surface-2);
    color: var(--qfx-text);
    border: 1px solid var(--qfx-border-strong);
}
.qfx-btn--block { display: block; width: 100%; margin-top: 16px; }

.qfx-error { color: var(--qfx-red); font-size: 14px; text-align: center; margin-top: 10px; min-height: 18px; }

/* ---------- result ---------- */
.qfx-result { text-align: center; }
.qfx-result__banner {
    font-size: 22px;
    font-weight: 900;
    padding: 14px;
    border-radius: 12px;
    margin-bottom: 16px;
}
.qfx-result__banner.win { background: rgba(34,197,94,.16); color: #86efac; border: 1px solid rgba(34,197,94,.4); }
.qfx-result__banner.lose { background: rgba(248,113,113,.14); color: #fca5a5; border: 1px solid rgba(248,113,113,.4); }

.qfx-score { margin: 8px 0 16px; }
.qfx-score__num { display: block; font-size: 42px; font-weight: 900; line-height: 1; }
.qfx-score__num.win { color: var(--qfx-green); }
.qfx-score__num.lose { color: var(--qfx-gold); }
.qfx-score__label { display: block; font-size: 14px; color: var(--qfx-muted); margin-top: 6px; }

/* ---------- toast ---------- */
.qfx-toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--qgame-footer-h, 90px) + 16px);
    transform: translate(-50%, 20px);
    background: rgba(15, 23, 42, .96);
    color: #fff;
    border: 1px solid var(--qfx-border-strong);
    border-radius: 12px;
    padding: 11px 18px;
    font-size: 14px;
    font-weight: 600;
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
    max-width: 90vw;
    text-align: center;
}
.qfx-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 480px) {
    .qfx-title { font-size: 26px; }
    .qfx-suspect-emoji { font-size: 54px; padding: 30px 0; }
}
