/* من الجاسوس / برا السالفة — وضع الجوال الواحد */
.qspy-html, .qspy-body {
    margin: 0; padding: 0; min-height: 100%;
}
.qspy-body {
    font-family: 'Tajawal', system-ui, sans-serif;
    background: radial-gradient(circle at 50% 0%, #1f2937 0%, #0b1120 70%);
    color: #f1f5f9;
    -webkit-text-size-adjust: 100%;
}
.qspy {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    position: relative;
}
.qspy * { box-sizing: border-box; }

.qgame-close {
    position: fixed;
    top: 14px; left: 14px;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none;
    font-size: 18px;
    z-index: 20;
    border: 1px solid rgba(255,255,255,.12);
}
.qgame-close:hover { background: rgba(255,255,255,.16); }

.qspy-stage { width: 100%; max-width: 460px; }

.qspy-loader { text-align: center; padding: 60px 0; opacity: .8; }
.qspy-loader__icon { font-size: 48px; }
.qspy-loader__text { margin-top: 10px; color: #94a3b8; }

/* البطاقة */
.qspy-card {
    background: rgba(30,41,59,.72);
    border: 1px solid rgba(148,163,184,.18);
    border-radius: 22px;
    padding: 26px 22px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,.4);
    backdrop-filter: blur(8px);
    animation: qspyIn .25s ease;
}
@keyframes qspyIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.qspy-emoji { font-size: 50px; line-height: 1; margin-bottom: 8px; }
.qspy-title { font-size: 26px; font-weight: 800; margin: 4px 0 8px; }
.qspy-sub { color: #94a3b8; font-size: 14px; line-height: 1.7; margin: 0 0 16px; }

/* الحقول */
.qspy-field { text-align: right; margin: 14px 0; }
.qspy-field > label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 14px; color: #cbd5e1; }
.qspy-select {
    width: 100%; padding: 12px; border-radius: 12px;
    background: #0f172a; color: #f1f5f9;
    border: 1px solid rgba(148,163,184,.25); font-size: 15px; font-family: inherit;
}
.qspy-input {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    background: #0f172a;
    color: #f1f5f9;
    border: 1px solid rgba(148,163,184,.25);
    font-size: 15px;
    font-family: inherit;
    text-align: right;
}

.qspy-stepper { display: flex; align-items: center; justify-content: center; gap: 18px; }
.qspy-step {
    width: 52px; height: 52px; border-radius: 50%;
    background: #334155; color: #fff; border: none;
    font-size: 26px; font-weight: 800; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.qspy-step:active { transform: scale(.94); }
.qspy-step__val { font-size: 34px; font-weight: 800; min-width: 44px; }

.qspy-names { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.qspy-name {
    padding: 10px 12px; border-radius: 10px;
    background: #0f172a; color: #f1f5f9;
    border: 1px solid rgba(148,163,184,.25); font-size: 14px; font-family: inherit;
    text-align: right;
}
.qspy-spyinfo { color: #fbbf24; font-size: 14px; font-weight: 700; margin: 8px 0 16px; }

/* الأزرار */
.qspy-btn {
    width: 100%; padding: 15px; border-radius: 14px;
    font-size: 17px; font-weight: 800; font-family: inherit;
    border: none; cursor: pointer; margin-top: 8px;
    transition: transform .1s, opacity .2s;
}
.qspy-btn:active { transform: scale(.98); }
.qspy-btn:disabled { opacity: .55; cursor: default; }
.qspy-btn--primary { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; }
.qspy-btn--ghost { background: rgba(148,163,184,.15); color: #e2e8f0; }
.qspy-btnrow { display: flex; gap: 10px; margin-top: 8px; }
.qspy-btnrow .qspy-btn { margin-top: 0; }

.qspy-err { color: #f87171; font-size: 14px; margin-top: 10px; min-height: 18px; }

.qspy-ai-card {
    margin: 14px 0;
    padding: 14px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(250, 204, 21, 0.12), rgba(99, 102, 241, 0.12));
    border: 1px solid rgba(250, 204, 21, 0.22);
    text-align: right;
}

.qspy-ai-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: #fff;
    margin-bottom: 6px;
}

.qspy-ai-card__head strong {
    font-size: 15px;
}

.qspy-ai-card__head span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(250, 204, 21, 0.18);
    color: #fde68a;
    font-size: 12px;
    font-weight: 800;
}

.qspy-ai-card__diff {
    margin-top: 8px;
}

.qspy-btn--ai {
    margin-top: 8px;
    background: linear-gradient(135deg, #facc15, #f97316);
    color: #111827;
}

.qspy-ai-card__msg {
    min-height: 18px;
    margin-top: 8px;
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.6;
}

.qspy-ai-card__msg.is-ok {
    color: #86efac;
}

.qspy-ai-card__msg.is-error {
    color: #fca5a5;
}

.qspy-ai-card__msg a {
    color: #fde68a;
    font-weight: 800;
}

/* تمرير الجوال */
.qspy-passname { font-size: 30px; font-weight: 800; color: #a5b4fc; margin: 6px 0 4px; }

/* كشف الدور */
.qspy-role--spy { border-color: rgba(239,68,68,.5); box-shadow: 0 0 0 1px rgba(239,68,68,.3), 0 20px 50px rgba(0,0,0,.4); }
.qspy-role--civ { border-color: rgba(34,197,94,.4); }
.qspy-roletitle { font-size: 24px; font-weight: 800; margin: 4px 0 6px; }
.qspy-role--spy .qspy-roletitle { color: #fca5a5; }
.qspy-word {
    font-size: 34px; font-weight: 900; color: #fff;
    background: rgba(99,102,241,.18); border-radius: 14px;
    padding: 16px; margin: 10px 0;
}
.qspy-hint { color: #cbd5e1; font-size: 15px; margin: 6px 0; }
.qspy-hint--sm { font-size: 13px; color: #94a3b8; }

/* النقاش */
.qspy-order { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 12px 0; }
.qspy-chip { background: rgba(148,163,184,.15); border-radius: 20px; padding: 6px 12px; font-size: 13px; font-weight: 600; }
.qspy-timer { font-size: 40px; font-weight: 800; margin: 12px 0; color: #a5b4fc; }
.qspy-timer--warn { color: #f87171; animation: qspyPulse .6s infinite alternate; }
@keyframes qspyPulse { to { opacity: .55; } }

/* تحكم في الانتقالات */
.qspy-field--toggle { margin: 16px 0 6px; }
.qspy-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; font-size: 14px; color: #e2e8f0; }
.qspy-toggle input[type="checkbox"] { width: 20px; height: 20px; accent-color: #8b5cf6; flex: 0 0 auto; }
.qspy-fieldhint { color: #94a3b8; font-size: 12.5px; line-height: 1.6; margin: 8px 0 0; text-align: right; }
.qspy-subfield { margin: 10px 0 0; padding-right: 14px; border-right: 2px solid rgba(139,92,246,.35); }
.qspy-partner { color: #fbbf24; font-weight: 700; background: rgba(251,191,36,.12); border-radius: 10px; padding: 8px 12px; }
.qspy-directed .qspy-votegrid { margin-top: 4px; }
.qspy-answerlog { margin: 14px 0 6px; }
.qspy-answerlog .qspy-chip { background: rgba(99,102,241,.16); }

/* التصويت */
.qspy-votegrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.qspy-voteopt {
    padding: 16px 10px; border-radius: 14px;
    background: rgba(148,163,184,.12); color: #f1f5f9;
    border: 1px solid rgba(148,163,184,.2);
    font-size: 16px; font-weight: 700; font-family: inherit; cursor: pointer;
}
.qspy-voteopt:active { transform: scale(.97); background: rgba(99,102,241,.25); }

/* النتيجة */
.qspy-guess {
    width: 100%; padding: 14px; border-radius: 12px; text-align: center;
    background: #0f172a; color: #fff; font-size: 18px; font-weight: 700;
    border: 1px solid rgba(148,163,184,.25); font-family: inherit; margin: 8px 0;
}
.qspy-win--civ { color: #4ade80; }
.qspy-win--spy { color: #fca5a5; }
.qspy-roster { margin: 14px 0; text-align: right; }
.qspy-rosteritem {
    display: flex; justify-content: space-between;
    padding: 9px 12px; border-radius: 10px; margin-bottom: 6px;
    background: rgba(148,163,184,.1); font-size: 14px; font-weight: 600;
}
.qspy-rosteritem--spy { background: rgba(239,68,68,.18); color: #fca5a5; }
.qspy-reveal { font-size: 17px; margin: 8px 0 16px; color: #e2e8f0; }

@media (max-width: 380px) {
    .qspy-names, .qspy-votegrid { grid-template-columns: 1fr; }
    .qspy-title { font-size: 22px; }
    .qspy-word { font-size: 28px; }
}
