/* من الجاسوس أونلاين */
.qspyo-html, .qspyo-body { margin: 0; padding: 0; min-height: 100%; }
.qspyo-body {
    font-family: 'Tajawal', system-ui, sans-serif;
    background: radial-gradient(circle at 50% 0%, #1f2937 0%, #0b1120 70%);
    color: #f1f5f9;
}
.qspyo {
    min-height: 100vh; min-height: 100dvh;
    display: flex; align-items: flex-start; justify-content: center;
    padding: 16px; box-sizing: border-box; position: relative;
}
.qspyo * { box-sizing: border-box; }
.qspyo-stage { width: 100%; max-width: 480px; margin-top: 40px; }

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

.qspyo-panel, .qspyo-game {
    background: rgba(30,41,59,.72);
    border: 1px solid rgba(148,163,184,.18);
    border-radius: 20px;
    padding: 22px 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,.4);
    animation: qspyoIn .25s ease;
}
@keyframes qspyoIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.qspyo-panel h2 { margin: 0 0 8px; font-size: 24px; text-align: center; }
.qspyo-panel__icon { font-size: 46px; text-align: center; }
.qspyo-desc { color: #94a3b8; font-size: 14px; line-height: 1.7; text-align: center; margin: 0 0 16px; }
.qspyo-mini-title { font-size: 15px; font-weight: 800; margin: 16px 0 8px; color: #cbd5e1; }
.qspyo-muted { color: #94a3b8; font-size: 13px; }
.qspyo-ok { color: #4ade80; font-weight: 700; font-size: 14px; }
.qspyo-code { text-align: center; font-size: 16px; }
.qspyo-code b { color: #a5b4fc; letter-spacing: 2px; }

.qspyo-field { margin: 10px 0; }
.qspyo-field label { display: block; font-weight: 700; margin-bottom: 5px; font-size: 14px; color: #cbd5e1; }
.qonline-input {
    width: 100%; padding: 11px 12px; border-radius: 11px;
    background: #0f172a; color: #f1f5f9;
    border: 1px solid rgba(148,163,184,.25); font-size: 15px; font-family: inherit;
}
select.qonline-input { cursor: pointer; }
.qspyo-row { display: flex; gap: 8px; margin: 8px 0; align-items: stretch; }
.qspyo-row .qonline-input { flex: 1 1 auto; min-width: 0; }
.qspyo-row .qonline-btn { flex: 0 0 auto; width: auto; white-space: nowrap; padding: 11px 16px; }

.qspyo-create, .qspyo-join, .qspyo-host-tools { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(148,163,184,.12); }
.qspyo-host-tools .qonline-btn { margin: 6px 0; width: 100%; }
/* صفّ الدعوة: حقل كامل العرض ثم زر تحته لتفادي ضيق المساحة */
.qspyo-invite-row { margin-top: 10px; flex-direction: column; gap: 8px; }
.qspyo-invite-row .qonline-input { width: 100%; }
.qspyo-invite-row .qonline-btn { width: 100%; margin: 0; }

.qspyo-players { list-style: none; padding: 0; margin: 12px 0; }
.qspyo-players li {
    padding: 10px 14px; border-radius: 10px; margin-bottom: 6px;
    background: rgba(148,163,184,.1); font-weight: 600;
}
.qspyo-tag { font-size: 11px; background: #6366f1; color: #fff; border-radius: 8px; padding: 2px 7px; margin-right: 4px; }

/* أزرار */
.qonline-btn {
    display: inline-block; padding: 13px 18px; border-radius: 12px;
    font-size: 16px; font-weight: 800; font-family: inherit;
    border: none; cursor: pointer; text-decoration: none; text-align: center;
    background: rgba(148,163,184,.15); color: #e2e8f0;
    transition: transform .1s, opacity .2s;
}
.qonline-btn:active { transform: scale(.98); }
.qonline-btn:disabled { opacity: .5; cursor: default; }
.qonline-btn--primary { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; }
.qonline-btn--ghost { background: rgba(148,163,184,.12); }

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

/* شريط الدور */
.qspyo-rolebar { border-radius: 14px; padding: 14px; margin-bottom: 12px; text-align: center; }
.qspyo-rolebar--civ { background: rgba(34,197,94,.15); border: 1px solid rgba(34,197,94,.35); }
.qspyo-rolebar--spy { background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.4); }
.qspyo-rolebar__title { font-size: 18px; font-weight: 800; color: #fca5a5; }
.qspyo-rolebar__word { font-size: 28px; font-weight: 900; color: #fff; margin-top: 4px; }
.qspyo-rolebar__sub { font-size: 14px; color: #cbd5e1; }
.qspyo-rolebar__hint { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.qspyo-rolebar__partner { font-size: 13px; font-weight: 700; color: #fbbf24; margin-top: 6px; }

/* المؤقّت */
.qspyo-timer { text-align: center; font-size: 22px; font-weight: 800; color: #a5b4fc; margin: 8px 0; }
.qspyo-timer.is-urgent { color: #f87171; }

.qspyo-section { margin: 10px 0; }
.qspyo-section__hint { color: #cbd5e1; font-size: 14px; text-align: center; }
.qspyo-turninfo { text-align: center; margin: 10px 0; font-size: 15px; }
.qspyo-turn--you { color: #4ade80; }
.qspyo-turn--other { color: #94a3b8; }

.qspyo-clues { list-style: none; padding: 0; margin: 10px 0; }
.qspyo-clues li { padding: 8px 12px; border-radius: 9px; margin-bottom: 5px; background: rgba(148,163,184,.1); font-size: 14px; }
.qspyo-clue__name { font-weight: 800; color: #a5b4fc; }

.qspyo-vote-title { text-align: center; font-size: 20px; margin: 4px 0 10px; }
.qspyo-votegrid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 8px; }
.qspyo-voteopt {
    padding: 14px 10px; border-radius: 12px;
    background: rgba(148,163,184,.12); color: #f1f5f9;
    border: 1px solid rgba(148,163,184,.2);
    font-size: 15px; font-weight: 700; font-family: inherit; cursor: pointer;
}
.qspyo-voteopt:active { background: rgba(99,102,241,.3); transform: scale(.97); }

.qspyo-spinner {
    width: 34px; height: 34px; margin: 16px auto;
    border: 4px solid rgba(148,163,184,.2); border-top-color: #8b5cf6;
    border-radius: 50%; animation: qspyoSpin .8s linear infinite;
}
@keyframes qspyoSpin { to { transform: rotate(360deg); } }

/* تحكم في الانتقالات */
.qspyo-field--toggle { margin: 12px 0 6px; }
.qspyo-toggle { display: flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 700; font-size: 14px; color: #e2e8f0; }
.qspyo-toggle input[type="checkbox"] { width: 19px; height: 19px; accent-color: #8b5cf6; flex: 0 0 auto; }
.qspyo-fieldhint { color: #94a3b8; font-size: 12px; line-height: 1.6; margin: 7px 0 0; }
.qspyo-subtoggle { margin-top: 10px; padding-right: 12px; border-right: 2px solid rgba(139,92,246,.35); }
.qspyo-toggle input[type="checkbox"]:disabled { opacity: .5; cursor: not-allowed; }
.qspyo-directed .qspyo-pickopt { background: rgba(99,102,241,.16); border-color: rgba(99,102,241,.35); }
.qspyo-directed .qspyo-pickopt:active { background: rgba(99,102,241,.35); }
.qspyo-callvote { width: 100%; margin-top: 12px; }

/* النتيجة */
.qspyo-result { text-align: center; }
.qspyo-result h3 { font-size: 24px; margin: 6px 0; }
.qspyo-result.win h3 { color: #4ade80; }
.qspyo-result.lose h3 { color: #fca5a5; }
.qspyo-result.tie h3 { color: #fbbf24; }
.qspyo-reveal-word { font-size: 18px; margin: 10px 0; }
.qspyo-reveal-word b { color: #a5b4fc; }
.qspyo-roster { list-style: none; padding: 0; margin: 14px 0; text-align: right; }
.qspyo-roster li {
    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;
}
.qspyo-roster li.is-spy { background: rgba(239,68,68,.18); color: #fca5a5; }

.qspyo-log { margin-top: 14px; padding-top: 10px; border-top: 1px solid rgba(148,163,184,.12); }
.qspyo-log__line { color: #94a3b8; font-size: 12px; padding: 3px 0; }

.qspyo-toast {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: #1e293b; color: #fff; padding: 12px 20px; border-radius: 12px;
    font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none;
    transition: opacity .25s, transform .25s; z-index: 50;
    border: 1px solid rgba(148,163,184,.2); max-width: 90vw; text-align: center;
}
.qspyo-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 380px) {
    .qspyo-votegrid { grid-template-columns: 1fr; }
    .qspyo-rolebar__word { font-size: 24px; }
}

/* رمز QR للانضمام (الأصدقاء بجوارك) */
.qspyo-qr-wrap {
    display: flex; justify-content: center; margin: 14px auto 6px;
    background: #fff; width: max-content; padding: 10px; border-radius: 14px;
}
.qspyo-qr-wrap canvas, .qspyo-qr-wrap img { display: block; }
.qspyo-qr-hint { color: var(--qonline-muted); font-size: .85rem; margin: 4px 0 12px; text-align: center; }
