/* =====================================================
   QUIZ SCREEN - STABLE LAYOUT (NO JUMPING)
   ===================================================== */

#quiz-screen.active {
    display: flex !important;
    flex-direction: column;
    /* גובה מלא של המכשיר - מונע שינויי גובה */
    height: 100vh;
    height: 100dvh; 
    overflow: hidden; /* חוסם גלילה של המסך הראשי */
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    font-family: 'Heebo', sans-serif;
    z-index: 9999;
}

/* === 1. Header (למעלה - קבוע) === */
#quiz-screen .quiz-header {
    flex-shrink: 0;
    order: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    height: 55px;
    background: rgba(15, 23, 42, 0.98);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    z-index: 20;
}

/* === 2. Progress Bar (קבוע) === */
#quiz-screen .quiz-progress-bar {
    flex-shrink: 0;
    order: 2;
    height: 4px;
    background: rgba(255,255,255,0.1);
}

/* === 3. Content (האזור היחיד שמשתנה) === */
#quiz-screen .quiz-content {
    /* flex: 1 מכריח את האזור הזה לתפוס את כל המקום הפנוי */
    /* זה מה שדוחף את הכפתורים למטה ומונע קפיצות */
    flex: 1; 
    
    order: 3;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 15px;
    
    /* תוכן ארוך יגלול בתוך האזור הזה, בלי להזיז את הכפתורים */
    overflow-y: auto; 
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* === 4. Footer Buttons (קבוע למטה) === */
#quiz-screen .quiz-footer {
    flex-shrink: 0; /* לא מתכווץ */
    order: 10 !important; 
    position: relative !important;
    padding: 10px 15px;
    background: #0f172a;
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex;
    gap: 12px;
    z-index: 100;
    margin-bottom: 0;
}

#quiz-screen .quiz-footer .btn {
    height: 48px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    flex: 1;
    display: flex; align-items: center; justify-content: center;
}

/* === 5. Ad Container (קבוע בתחתית של התחתית) === */
#sticky-ad-container {
    flex-shrink: 0;
    order: 20 !important;
    position: relative !important;
    width: 100% !important;
    
    /* מידות קבועות למניעת קפיצות בטעינה */
    height: 60px;       
    min-height: 60px;   
    
    background: #000;   
    display: flex !important;
    justify-content: center;
    align-items: center;
    z-index: 200;
    border-top: 1px solid rgba(255,255,255,0.1);
    
    /* מרווח בטיחות לאייפון */
    padding-bottom: env(safe-area-inset-bottom, 0); 
    
    /* ביטול דחיפות מיותרות */
    margin-top: 0; 
}

#sticky-ad-container ins.adsbygoogle {
    display: block !important;
    width: 100%;
    height: 100%;
}

/* =========================================
   עיצוב פנימי (שאלות ותשובות)
   ========================================= */

#quiz-screen .question-card { 
    text-align: center;
    padding: 0 5px;
    /* במצב יציב, השאלה יכולה להיות למעלה או במרכז */
    margin-top: 0; 
}

#quiz-screen .question-text {
    font-size: clamp(1.1rem, 2.5vh, 1.4rem); 
    font-weight: 700;
    line-height: 1.35;
    color: #fff;
    margin: 0;
}

#quiz-screen .question-image-wrap {
    display: none;
    width: 100%;
    border-radius: 12px;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.05);
    position: relative;
    overflow: hidden;
}

#quiz-screen .question-image-wrap.visible {
    display: flex;
    flex: 0 1 auto; 
    min-height: 120px;
    max-height: 35vh;
    margin: 5px 0;
    justify-content: center;
    align-items: center;
}

#quiz-screen .question-image-wrap img {
    object-fit: contain;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
}

#quiz-screen .answers-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    /* משאיר את התשובות צמודות לשאלה */
    margin-bottom: 20px; 
}

#quiz-screen .answer-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    min-height: 50px;
    transition: background 0.2s;
}

#quiz-screen .answer-btn:active { background: rgba(255,255,255,0.1); transform: scale(0.98); }

#quiz-screen .answer-letter {
    width: 28px; height: 28px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem;
    color: var(--primary-light); flex-shrink: 0;
}

#quiz-screen .answer-text {
    flex: 1;
    font-size: 1rem;
    color: #e2e8f0;
    line-height: 1.25;
}

#quiz-screen .answer-btn.correct { border-color: #10b981; background: rgba(16,185,129,0.15); }
#quiz-screen .answer-btn.correct .answer-letter { background: #10b981; color: white; }
#quiz-screen .answer-btn.wrong { border-color: #ef4444; background: rgba(239,68,68,0.15); }
#quiz-screen .answer-btn.wrong .answer-letter { background: #ef4444; color: white; }

#quiz-screen .btn-zoom {
    position: absolute; bottom: 8px; left: 8px; width: 34px; height: 34px;
    background: rgba(0,0,0,0.6); border-radius: 50%; border: 1px solid rgba(255,255,255,0.3);
    color: #fff; display: flex; align-items: center; justify-content: center; z-index: 10;
}

@media (max-height: 650px) {
    #quiz-screen .question-text { font-size: 1rem; }
    #quiz-screen .answer-btn { min-height: 42px; padding: 8px 12px; }
    #quiz-screen .quiz-footer { padding: 8px 15px; }
    #quiz-screen .question-image-wrap.visible { max-height: 28vh; }
}