/* quiz.css */
.question-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding-bottom: 8px;
    min-height: 0;
}

.question-number {
    font-size: 12px;
    color: var(--primary-color);
    font-weight: 500;
    margin-bottom: 6px;
    opacity: 0.8;
    white-space: nowrap;
}

#question-text {
    font-size: clamp(16px, 4.5vw, 20px);
    font-weight: 500;
    margin-bottom: 12px;
    line-height: 1.4;
    color: var(--text-color);
    flex-shrink: 0;
    word-break: break-word;
    overflow-wrap: break-word;
}

.options-container {
    display: grid;
    gap: 8px;
    flex: 1;
    overflow-y: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    min-height: 0;
}

.option-btn {
    background: var(--card-bg);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    padding: 12px;
    text-align: left;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    min-height: 50px;
    word-break: break-word;
    -webkit-touch-callout: none;
    touch-action: manipulation;
    overflow: hidden;
}

.option-btn:active {
    transform: scale(0.98);
}

.option-number {
    font-weight: 700;
    margin-right: 8px;
    color: var(--primary-color);
    min-width: 20px;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.option-btn.correct {
    background: rgba(76, 175, 80, 0.15);
    border-color: #4CAF50;
    color: #2E7D32;
}

.option-btn.incorrect {
    background: rgba(244, 67, 54, 0.1);
    border-color: #F44336;
    color: #C62828;
}

.option-btn.correct .option-number,
.option-btn.incorrect .option-number {
    color: inherit;
}

.explanation-container {
    background: rgba(108, 92, 231, 0.05);
    border-radius: 10px;
    padding: 12px;
    margin: 0 12px 12px;
    font-size: 14px;
    line-height: 1.4;
    border-left: 3px solid var(--primary-color);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    flex-shrink: 0;
    word-break: break-word;
}

.explanation-container.show {
    opacity: 1;
    max-height: 200px;
    margin-bottom: 8px;
}

#other-games-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fff;
    z-index: 1000;
    overflow: hidden;
    padding: 16px;
    box-sizing: border-box;
    padding-top: calc(16px + var(--safe-area-inset-top));
    padding-bottom: calc(16px + var(--safe-area-inset-bottom));
}

.other-games-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.other-games-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    padding-bottom: 16px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    min-height: 0;
}

.other-game-btn {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #f9f9f9;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 15px;
    word-break: break-word;
    touch-action: manipulation;
    min-width: 0;
}

.other-game-btn:active {
    background-color: #eee;
}

.game-title {
    font-size: inherit;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
}

.back-btn {
    padding: 8px 12px;
    background-color: #f0f0f0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 12px;
    font-size: 14px;
    align-self: flex-start;
    touch-action: manipulation;
    min-width: 80px;
}

/* Адаптация для мобильных */
@media (max-width: 480px) {
    .question-container {
        padding-bottom: 4px;
    }
    
    #question-text {
        font-size: clamp(15px, 5vw, 18px);
        margin-bottom: 10px;
    }
    
    .option-btn {
        padding: 10px;
        font-size: 14px;
        min-height: 45px;
    }
    
    .explanation-container {
        font-size: 13px;
        padding: 10px;
        margin: 0 8px 8px;
    }
    
    .other-game-btn {
        padding: 10px;
        font-size: 14px;
    }
}

/* Альбомная ориентация для мобильных */
@media (orientation: landscape) and (max-width: 900px) {
    .question-container {
        padding-bottom: 0;
    }
    
    #question-text {
        margin-bottom: 8px;
        font-size: 16px;
    }
    
    .options-container {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }
    
    .option-btn {
        min-height: 60px;
        padding: 8px;
    }
    
    @media (max-height: 500px) {
        #question-text {
            font-size: 14px;
            margin-bottom: 6px;
        }
        
        .option-btn {
            min-height: 50px;
            font-size: 12px;
        }
        
        .explanation-container {
            font-size: 12px;
            max-height: 120px;
        }
    }
}

/* Адаптация для очень маленьких экранов */
@media (max-width: 768px) {
    .question-scrollable {
        padding: 6px !important;
    }
    
    .question-number {
        font-size: 9px !important;
        margin-bottom: 3px !important;
    }
    
    #question-text {
        font-size: clamp(12px, 4vw, 16px) !important;
        margin-bottom: 6px !important;
    }
    
    .option-btn {
        padding: 6px !important;
        min-height: 30px !important;
        font-size: 12px !important;
    }
    
    .option-number {
        font-size: 10px !important;
        min-width: 15px !important;
    }
    
    .explanation-container {
        padding: 6px !important;
        font-size: 11px !important;
        margin: 0 6px 6px !important;
    }
    
    .btn {
        padding: 6px 12px !important;
        font-size: 12px !important;
    }
}

@media (max-width: 320px) {
    .option-btn {
        padding: 4px !important;
        font-size: 10px !important;
    }
    
    .explanation-container {
        font-size: 10px !important;
    }
}

/* PC адаптация при изменении масштаба */
@media (min-width: 769px) {
    .question-container {
        min-height: 300px;
    }
    
    .options-container {
        min-height: 200px;
    }
    
    @media (max-height: 700px) {
        .question-container {
            min-height: 250px;
        }
        
        .options-container {
            min-height: 150px;
        }
    }
    
    @media (max-height: 600px) {
        .question-container {
            min-height: 200px;
        }
        
        .options-container {
            min-height: 120px;
        }
        
        .option-btn {
            min-height: 40px;
            padding: 8px;
            font-size: 14px;
        }
    }
    
    @media (max-width: 900px) and (max-height: 500px) {
        #question-text {
            font-size: 16px;
        }
        
        .option-btn {
            font-size: 13px;
        }
    }
}