/* =========================================================
   الشهود — The Witnesses
   لعبة ذاكرة، واجهة تحقيق، RTL، متجاوبة للجوال
   ========================================================= */

:root {
    --qwt-bg-1: #0b1020;
    --qwt-bg-2: #0f172a;
    --qwt-bg-3: #111c33;
    --qwt-surface: rgba(255, 255, 255, .045);
    --qwt-surface-2: rgba(255, 255, 255, .07);
    --qwt-border: rgba(148, 163, 184, .18);
    --qwt-border-strong: rgba(148, 163, 184, .35);
    --qwt-text: #e7ecf5;
    --qwt-muted: #94a3b8;
    --qwt-gold: #fbbf24;
    --qwt-sky: #38bdf8;
    --qwt-sky-soft: rgba(56, 189, 248, .14);
    --qwt-green: #22c55e;
    --qwt-red: #f87171;
    --qwt-radius: 16px;
    --qwt-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.qwt-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(--qwt-bg-1), var(--qwt-bg-2) 55%, var(--qwt-bg-3));
    background-attachment: fixed;
    color: var(--qwt-text);
    font-family: 'Tajawal', system-ui, -apple-system, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}

.qwt {
    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));
}

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

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

.qwt-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(--qwt-border);
    border-radius: 999px;
    padding: 4px 10px;
    backdrop-filter: blur(8px);
}

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

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

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

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

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

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

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

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

.qwt-suspect {
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--qwt-border-strong);
    margin-bottom: 16px;
    background: #0b1224;
}
.qwt-suspect-img {
    display: block;
    width: 100%;
    max-height: 60vh;
    object-fit: contain;
    margin: 0 auto;
}
.qwt-suspect-emoji { font-size: 120px; padding: 40px 0; }

/* ---------- quiz ---------- */
.qwt-quiz-head { text-align: center; margin-bottom: 16px; }
.qwt-quiz-desc { color: var(--qwt-muted); font-size: 14px; margin: 10px 0; }
.qwt-quiz-prog {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    color: #bae6fd;
    background: var(--qwt-sky-soft);
    border-radius: 999px;
    padding: 4px 14px;
}

.qwt-questions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.qwt-q {
    background: var(--qwt-surface);
    border: 1px solid var(--qwt-border);
    border-radius: 12px;
    padding: 14px;
}
.qwt-q__head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.qwt-q__num {
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--qwt-sky-soft);
    color: var(--qwt-sky);
    font-weight: 800;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.qwt-q__text { font-size: 15.5px; font-weight: 600; line-height: 1.6; }

.qwt-opts { display: grid; gap: 10px; }
.qwt-opts--binary { grid-template-columns: 1fr 1fr; }
.qwt-opts--quad { grid-template-columns: 1fr 1fr; }
.qwt-opt {
    appearance: none;
    border: 1px solid var(--qwt-border-strong);
    background: var(--qwt-surface-2);
    color: var(--qwt-text);
    border-radius: 10px;
    padding: 11px 12px;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
    text-align: center;
}
.qwt-opt:hover { border-color: var(--qwt-sky); background: rgba(56,189,248,.1); }
.qwt-opt.selected {
    border-color: var(--qwt-sky);
    background: var(--qwt-sky);
    color: #06263b;
    font-weight: 800;
}

/* ---------- buttons ---------- */
.qwt-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;
}
.qwt-btn:active { transform: translateY(1px); }
.qwt-btn:disabled { opacity: .5; cursor: not-allowed; }
.qwt-btn--primary {
    background: linear-gradient(135deg, var(--qwt-sky), #0ea5e9);
    color: #06263b;
    box-shadow: 0 10px 26px rgba(56,189,248,.28);
}
.qwt-btn--primary:hover:not(:disabled) { filter: brightness(1.07); }
.qwt-btn--ghost {
    background: var(--qwt-surface-2);
    color: var(--qwt-text);
    border: 1px solid var(--qwt-border-strong);
}
.qwt-btn--block { display: block; width: 100%; margin-top: 16px; }

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

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

.qwt-figure {
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--qwt-border-strong);
    margin: 0 auto 14px;
    max-width: 320px;
    background: #0b1224;
}
.qwt-figure img { display: block; width: 100%; object-fit: contain; }
.qwt-result__char { font-size: 15px; color: #cbd5e1; margin-bottom: 12px; }
.qwt-result__char b { color: var(--qwt-gold); }

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

/* ---------- review ---------- */
.qwt-review { margin-top: 16px; text-align: start; }
.qwt-review summary {
    cursor: pointer;
    font-weight: 700;
    color: #bae6fd;
    padding: 10px 0;
    list-style: none;
}
.qwt-review__list { display: flex; flex-direction: column; gap: 8px; }
.qwt-review__item {
    border-radius: 10px;
    padding: 10px 12px;
    border: 1px solid var(--qwt-border);
    background: var(--qwt-surface);
}
.qwt-review__item.ok { border-color: rgba(34,197,94,.3); }
.qwt-review__item.bad { border-color: rgba(248,113,113,.3); }
.qwt-review__q { font-size: 14.5px; font-weight: 600; margin-bottom: 4px; }
.qwt-review__a { font-size: 13.5px; color: var(--qwt-muted); }
.qwt-review__a b { color: var(--qwt-text); }
.qwt-review__correct { color: #86efac !important; }

/* ---------- toast ---------- */
.qwt-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(--qwt-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;
}
.qwt-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 480px) {
    .qwt-title { font-size: 26px; }
    .qwt-suspect-emoji { font-size: 90px; }
    .qwt-opts--quad { grid-template-columns: 1fr; }
}
