/* =========================================================
   المجرم المتخفّي
   ========================================================= */

:root {
    --qhidden-bg-1: #07111c;
    --qhidden-bg-2: #101826;
    --qhidden-bg-3: #17131d;
    --qhidden-surface: rgba(255, 255, 255, .055);
    --qhidden-surface-2: rgba(255, 255, 255, .085);
    --qhidden-border: rgba(203, 213, 225, .18);
    --qhidden-border-strong: rgba(203, 213, 225, .34);
    --qhidden-text: #edf3fb;
    --qhidden-muted: #aab7c8;
    --qhidden-gold: #fbbf24;
    --qhidden-teal: #2dd4bf;
    --qhidden-red: #fb7185;
    --qhidden-green: #34d399;
    --qhidden-radius: 16px;
    --qhidden-shadow: 0 22px 60px rgba(0, 0, 0, .46);
    --qgame-footer-h: calc(62px + env(safe-area-inset-bottom, 0px));
    font-synthesis: none;
}

* { box-sizing: border-box; }

html,
body.qhidden-body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(900px 520px at 78% 0%, rgba(45, 212, 191, .12), transparent 58%),
        radial-gradient(760px 420px at 10% 5%, rgba(251, 191, 36, .09), transparent 60%),
        linear-gradient(155deg, var(--qhidden-bg-1), var(--qhidden-bg-2) 52%, var(--qhidden-bg-3));
    background-attachment: fixed;
    color: var(--qhidden-text);
    font-family: 'Tajawal', system-ui, -apple-system, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}

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

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

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

.qhidden-progress {
    position: fixed;
    top: max(14px, env(safe-area-inset-top));
    inset-inline-end: 14px;
    z-index: 40;
    font-size: 12px;
    font-weight: 800;
    color: rgba(203, 213, 225, .88);
    background: rgba(7, 17, 28, .72);
    border: 1px solid var(--qhidden-border);
    border-radius: 999px;
    padding: 4px 10px;
    backdrop-filter: blur(8px);
}

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

.qhidden-loader,
.qhidden-empty {
    text-align: center;
    padding: 64px 20px;
    color: var(--qhidden-muted);
}

.qhidden-loader__icon,
.qhidden-empty__icon {
    font-size: 48px;
    margin-bottom: 12px;
    animation: qhidden-pulse 1.5s ease-in-out infinite;
}

.qhidden-empty h2 {
    margin: 8px 0;
    color: var(--qhidden-text);
}

.qhidden-empty__actions { margin-top: 20px; }

@keyframes qhidden-pulse {
    0%, 100% { opacity: .56; transform: scale(.96); }
    50% { opacity: 1; transform: scale(1); }
}

.qhidden-card {
    background: var(--qhidden-surface);
    border: 1px solid var(--qhidden-border);
    border-radius: var(--qhidden-radius);
    box-shadow: var(--qhidden-shadow);
    padding: 22px 18px;
    margin: 8px 0 22px;
    backdrop-filter: blur(11px);
    animation: qhidden-in .32s ease;
}

@keyframes qhidden-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

.qhidden-badge-row,
.qhidden-search-head,
.qhidden-result-head,
.qhidden-score,
.qhidden-actionbar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qhidden-badge-row,
.qhidden-search-head {
    justify-content: space-between;
}

.qhidden-chip,
.qhidden-diff,
.qhidden-tries {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.qhidden-chip {
    color: #ccfbf1;
    background: rgba(45, 212, 191, .14);
    border: 1px solid rgba(45, 212, 191, .3);
}

.qhidden-diff,
.qhidden-tries {
    color: var(--qhidden-muted);
    border: 1px solid var(--qhidden-border-strong);
    background: rgba(15, 23, 42, .34);
}

.qhidden-diff.easy { color: #bbf7d0; border-color: rgba(52, 211, 153, .45); }
.qhidden-diff.medium { color: #fde68a; border-color: rgba(251, 191, 36, .45); }
.qhidden-diff.hard { color: #fecdd3; border-color: rgba(251, 113, 133, .45); }

.qhidden-title {
    margin: 14px 0 8px;
    font-size: clamp(25px, 4vw, 34px);
    line-height: 1.25;
    font-weight: 900;
    letter-spacing: 0;
}

.qhidden-scene {
    margin: 0 0 16px;
    color: #cbd5e1;
    line-height: 1.75;
}

.qhidden-dialogue {
    list-style: none;
    padding: 0;
    margin: 18px 0;
    display: grid;
    gap: 12px;
}

.qhidden-dialogue__line {
    display: grid;
    gap: 5px;
    background: var(--qhidden-surface-2);
    border: 1px solid var(--qhidden-border);
    border-radius: 12px;
    padding: 13px 14px;
}

.qhidden-dialogue__line b {
    color: var(--qhidden-gold);
    font-size: 13px;
}

.qhidden-dialogue__line span {
    color: #e2e8f0;
    line-height: 1.85;
}

.qhidden-rules {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0;
}

.qhidden-rules span {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--qhidden-border);
    border-radius: 10px;
    background: rgba(15, 23, 42, .32);
    color: #dbeafe;
    font-weight: 800;
}

.qhidden-btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 12px;
    min-height: 44px;
    padding: 10px 16px;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
    transition: transform .16s ease, opacity .16s ease, background .16s ease, border-color .16s ease;
}

.qhidden-btn:hover { transform: translateY(-1px); }
.qhidden-btn:disabled { opacity: .48; cursor: not-allowed; transform: none; }

.qhidden-btn--primary {
    color: #082f2e;
    background: linear-gradient(135deg, var(--qhidden-teal), #facc15);
    border-color: rgba(255, 255, 255, .18);
    box-shadow: 0 12px 30px rgba(45, 212, 191, .16);
}

.qhidden-btn--ghost {
    color: #e2e8f0;
    background: rgba(15, 23, 42, .38);
    border-color: var(--qhidden-border);
}

.qhidden-search-head {
    margin-bottom: 14px;
}

.qhidden-search-head h2 {
    margin: 9px 0 0;
    font-size: clamp(20px, 3.4vw, 26px);
    line-height: 1.35;
    letter-spacing: 0;
}

.qhidden-feedback {
    margin-bottom: 12px;
    color: #fecdd3;
    background: rgba(251, 113, 133, .12);
    border: 1px solid rgba(251, 113, 133, .32);
    border-radius: 12px;
    padding: 10px 12px;
    font-weight: 800;
}

.qhidden-image-box {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid rgba(203, 213, 225, .2);
    background: #050a10;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .03);
}

.qhidden-image-box img {
    display: block;
    width: 100%;
    height: auto;
    min-height: 240px;
    object-fit: contain;
    user-select: none;
}

.qhidden-marker {
    position: absolute;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border-radius: 999px;
    border: 3px solid #fff;
    background: rgba(251, 191, 36, .82);
    box-shadow: 0 0 0 8px rgba(251, 191, 36, .18), 0 0 28px rgba(251, 191, 36, .5);
    pointer-events: none;
}

.qhidden-actionbar {
    justify-content: space-between;
    margin-top: 14px;
    flex-wrap: wrap;
}

.qhidden-actionbar .qhidden-btn {
    flex: 1 1 180px;
}

.qhidden-hints {
    list-style: none;
    padding: 0;
    margin: 14px 0 0;
    display: grid;
    gap: 9px;
}

.qhidden-hints li {
    display: grid;
    gap: 4px;
    color: #dbeafe;
    background: rgba(45, 212, 191, .09);
    border: 1px solid rgba(45, 212, 191, .22);
    border-radius: 10px;
    padding: 10px 12px;
}

.qhidden-hints b {
    color: #99f6e4;
    font-size: 13px;
}

.qhidden-card--result.is-correct {
    border-color: rgba(52, 211, 153, .4);
}

.qhidden-card--result.is-wrong {
    border-color: rgba(251, 113, 133, .38);
}

.qhidden-result-head {
    align-items: flex-start;
    margin-bottom: 14px;
}

.qhidden-result-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 900;
    flex: 0 0 auto;
}

.is-correct .qhidden-result-icon {
    color: #052e1a;
    background: var(--qhidden-green);
}

.is-wrong .qhidden-result-icon {
    color: #450a0a;
    background: var(--qhidden-red);
}

.qhidden-result-head h2 {
    margin: 0 0 4px;
    font-size: 28px;
    letter-spacing: 0;
}

.qhidden-result-head p {
    margin: 0;
    color: var(--qhidden-muted);
}

.qhidden-image-box--reveal {
    margin: 8px 0 14px;
}

.qhidden-hotspot {
    position: absolute;
    border: 3px solid var(--qhidden-green);
    border-radius: 14px;
    background: rgba(52, 211, 153, .16);
    box-shadow: 0 0 0 9999px rgba(2, 6, 23, .42), 0 0 28px rgba(52, 211, 153, .42);
    pointer-events: none;
}

.qhidden-answer {
    background: var(--qhidden-surface-2);
    border: 1px solid var(--qhidden-border);
    border-radius: 12px;
    padding: 14px;
}

.qhidden-answer b {
    display: block;
    color: #fde68a;
    margin-bottom: 6px;
    font-size: 17px;
}

.qhidden-answer p {
    margin: 0;
    color: #e2e8f0;
    line-height: 1.85;
}

.qhidden-score {
    margin-top: 14px;
    flex-wrap: wrap;
}

.qhidden-score span {
    flex: 1 1 120px;
    text-align: center;
    color: #cbd5e1;
    background: rgba(15, 23, 42, .38);
    border: 1px solid var(--qhidden-border);
    border-radius: 10px;
    padding: 9px 10px;
    font-weight: 800;
}

.qhidden-score b {
    color: var(--qhidden-gold);
    font-size: 22px;
}

.qhidden-actionbar--result {
    margin-top: 14px;
}

.qhidden-toast {
    position: fixed;
    left: 50%;
    bottom: calc(90px + env(safe-area-inset-bottom, 0px));
    z-index: 9999;
    transform: translateX(-50%) translateY(12px);
    max-width: min(92vw, 460px);
    padding: 12px 16px;
    border-radius: 999px;
    color: #f8fafc;
    background: rgba(15, 23, 42, .94);
    border: 1px solid rgba(203, 213, 225, .18);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}

.qhidden-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 620px) {
    .qhidden {
        padding-inline: 10px;
    }

    .qhidden-card {
        border-radius: 14px;
        padding: 18px 13px;
    }

    .qhidden-badge-row,
    .qhidden-search-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .qhidden-rules {
        grid-template-columns: 1fr;
    }

    .qhidden-image-box img {
        min-height: 210px;
    }
}
